Commit eb54d43707c69340581940e1fcaecb4d7d17b814
Committed by
Trond Myklebust
1 parent
f448badd34
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
NFS: Fix security flavor negotiation with legacy binary mounts
Darrick J. Wong <darrick.wong@oracle.com> reports: > I have a kvm-based testing setup that netboots VMs over NFS, the > client end of which seems to have broken somehow in 3.10-rc1. The > server's exports file looks like this: > > /storage/mtr/x64 192.168.122.0/24(ro,sync,no_root_squash,no_subtree_check) > > On the client end (inside the VM), the initrd runs the following > command to try to mount the rootfs over NFS: > > # mount -o nolock -o ro -o retrans=10 192.168.122.1:/storage/mtr/x64/ /root > > (Note: This is the busybox mount command.) > > The mount fails with -EINVAL. Commit 4580a92d44 "NFS: Use server-recommended security flavor by default (NFSv3)" introduced a behavior regression for NFS mounts done via a legacy binary mount(2) call. Ensure that a default security flavor is specified for legacy binary mount requests, since they do not invoke nfs_select_flavor() in the kernel. Busybox uses klibc's nfsmount command, which performs NFS mounts using the legacy binary mount data format. /sbin/mount.nfs is not affected by this regression. Reported-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: Darrick J. Wong <darrick.wong@oracle.com> Acked-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff
fs/nfs/super.c
... | ... | @@ -1942,6 +1942,7 @@ |
1942 | 1942 | args->namlen = data->namlen; |
1943 | 1943 | args->bsize = data->bsize; |
1944 | 1944 | |
1945 | + args->auth_flavors[0] = RPC_AUTH_UNIX; | |
1945 | 1946 | if (data->flags & NFS_MOUNT_SECFLAVOUR) |
1946 | 1947 | args->auth_flavors[0] = data->pseudoflavor; |
1947 | 1948 | if (!args->nfs_server.hostname) |
... | ... | @@ -2637,6 +2638,7 @@ |
2637 | 2638 | goto out_no_address; |
2638 | 2639 | args->nfs_server.port = ntohs(((struct sockaddr_in *)sap)->sin_port); |
2639 | 2640 | |
2641 | + args->auth_flavors[0] = RPC_AUTH_UNIX; | |
2640 | 2642 | if (data->auth_flavourlen) { |
2641 | 2643 | if (data->auth_flavourlen > 1) |
2642 | 2644 | goto out_inval_auth; |