From: Andy Adamson Date: Fri, 18 May 2007 16:52:47 -0400 NFSv4: Add security flavor to struct nfs_fattr Set fattr->flavor upon successful nfs4_proc_lookup retry in WRONGSEC error processing. This will ignored in all nfs4_proc_lookup returns except in nfs_follow_mount where the fattr->flavor is passed through to nfs_clone_server via the nfs_mount_data->fattr field. Signed-off-by: Andy Adamson Signed-off-by: Trond Myklebust --- fs/nfs/client.c | 7 ++++++- fs/nfs/nfs4proc.c | 3 +++ include/linux/nfs_fs.h | 1 + include/linux/nfs_xdr.h | 1 + 4 files changed, 11 insertions(+), 1 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 1c68c28..140ed2f 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1213,6 +1213,7 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, { struct nfs_server *server; struct nfs_fattr fattr_fsinfo; + rpc_authflavor_t flavor; int error; dprintk("--> nfs_clone_server(,%llx:%llx,)\n", @@ -1230,7 +1231,11 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, server->fsid = fattr->fsid; - error = nfs_init_server_rpcclient(server, source->client->cl_auth->au_flavor); + flavor = source->client->cl_auth->au_flavor; + if (fattr->flavor != RPC_AUTH_MAXFLAVOR) + flavor = fattr->flavor; + + error = nfs_init_server_rpcclient(server, flavor); if (error < 0) goto out_free_server; if (!IS_ERR(source->client_acl)) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index afeb5bf..8e46e3e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1616,6 +1616,9 @@ static int _nfs4_proc_lookup(struct inode *dir, struct qstr *name, exc->ex_info.fh = NFS_FH(dir); exc->ex_info.name = name; } + if (!status && exc->ex_clnt) + fattr->flavor = exc->ex_clnt->cl_auth->au_flavor; + dprintk("NFS reply lookup: %d\n", status); return status; } diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 0543439..6f07ad6 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -318,6 +318,7 @@ static inline void nfs_fattr_init(struct nfs_fattr *fattr) { fattr->valid = 0; fattr->time_start = jiffies; + fattr->flavor = RPC_AUTH_MAXFLAVOR; } /* diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index c1ec5ec..f8c55e5 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -56,6 +56,7 @@ struct nfs_fattr { __u64 change_attr; /* NFSv4 change attribute */ __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ unsigned long time_start; + rpc_authflavor_t flavor; /* wrongsec handling */ }; #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */