Fix SECINFO procedure
Subsystems (2)
v3 cover Fix SECINFO procedure
From: Bryan Schumaker <[email protected]>
My initial SECINFO implementation was merged in 2.6.39, but accidentally got disabled in 3.0. These patches re-enable SECINFO as part of LOOKUP and push it down to the v4 layer, instead of existing as an rpc_op (I create a "submount" rpc_op instead, see patch 5).
I also noticed that SECINFO_NO_NAME was never run with the current xdr decoding logic. Patch 6 fixes this problem.
Changes in version 3:
- Don't define decode_secinfo_no_name() if CONFIG_NFS_V4_1 isn't set
- Move around function declerations in header files
Changes in version 2:
- Reorder the patches so I'm not doing cleanup in the beginning
- Don't pre-clone an rpc_clnt for nfs_clone_server, instead fix passing an rpc_authflavor_t through the nfs_clone_mount data.
Comments are appreciated!
- Bryan
Bryan Schumaker (8):
NFS: Fix SECINFO_NO_NAME
NFS: Handle exceptions coming out of nfs4_proc_fs_locations()
NFS: Do secinfo as part of lookup
NFS: Remove secinfo knowledge out of the generic client
NFS: Create a submount rpc_op
NFS: Fix following referral mount points with different security
NFS: Honor the authflavor set in the clone mount data
NFS: Remove extra rpc_clnt argument to proc_lookup
fs/nfs/client.c | 5 +- fs/nfs/dir.c | 6 +- fs/nfs/internal.h | 22 ++------ fs/nfs/namespace.c | 140 ++++++----------------------------------------- fs/nfs/nfs3proc.c | 3 +- fs/nfs/nfs4_fs.h | 13 ++++- fs/nfs/nfs4namespace.c | 107 +++++++++++++++++++++++++++++++++++- fs/nfs/nfs4proc.c | 111 +++++++++++++++++++++++++++++-------- fs/nfs/nfs4xdr.c | 26 ++++++--- fs/nfs/proc.c | 3 +- fs/nfs/super.c | 4 +- include/linux/nfs_xdr.h | 5 +- 12 files changed, 261 insertions(+), 184 deletions(-)
Signature · 1 line
1.7.10
PATCH v3 1/8 NFS: Fix SECINFO_NO_NAME
From: Bryan Schumaker <[email protected]>
I was using the same decoder function for SECINFO and SECINFO_NO_NAME, so it was returning an error when it tried to decode an OP_SECINFO_NO_NAME header as OP_SECINFO.
--- fs/nfs/nfs4xdr.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
fs/nfs/nfs4xdr.c +19 -5
@@ -5090,16 +5090,13 @@ out_err:return -EINVAL ; } -static int decode_secinfo (struct xdr_stream *xdr,struct nfs4_secinfo_res *res) +static int decode_secinfo_common (struct xdr_stream *xdr,struct nfs4_secinfo_res *res) {struct nfs4_secinfo_flavor *sec_flavor;int status;__be32 *p;int i, num_flavors; - status =decode_op_hdr (xdr,OP_SECINFO ); -if (status) - goto out; p =xdr_inline_decode (xdr,4 );if (unlikely (!p)) goto out_overflow;
@@ -5125,6 +5122,7 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) res->flavors->num_flavors++; } + status =0 ; out:return status; out_overflow:
@@ -5132,7 +5130,23 @@ out_overflow:return -EIO ; } +static int decode_secinfo (struct xdr_stream *xdr,struct nfs4_secinfo_res *res) +{ +int status =decode_op_hdr (xdr,OP_SECINFO ); +if (status) +return status; +return decode_secinfo_common (xdr, res); +} +#if defined(CONFIG_NFS_V4_1 ) +static int decode_secinfo_no_name (struct xdr_stream *xdr,struct nfs4_secinfo_res *res) +{ +int status =decode_op_hdr (xdr,OP_SECINFO_NO_NAME ); +if (status) +return status; +return decode_secinfo_common (xdr, res); +} +static int decode_exchange_id (struct xdr_stream *xdr,struct nfs41_exchange_id_res *res) {
@@ -6817,7 +6831,7 @@ static int nfs4_xdr_dec_secinfo_no_name(struct rpc_rqst *rqstp, status =decode_putrootfh (xdr);if (status) goto out; - status =decode_secinfo (xdr, res); + status =decode_secinfo_no_name (xdr, res); out:return status; }
Signature · 1 line
1.7.10
PATCH v3 2/8 NFS: Handle exceptions coming out of nfs4_proc_fs_locations()
In reply to [email protected]From: Bryan Schumaker <[email protected]>
We don't want to return -NFS4ERR_WRONGSEC to the VFS because it could cause the kernel to oops.
--- fs/nfs/nfs4proc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
fs/nfs/nfs4proc.c +14 -1
@@ -4919,7 +4919,7 @@ static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr) fattr->nlink =2 ; } -int nfs4_proc_fs_locations (struct inode *dir,const struct qstr *name, +static int _nfs4_proc_fs_locations (struct inode *dir,const struct qstr *name,struct nfs4_fs_locations *fs_locations,struct page *page) {struct nfs_server *server =NFS_SERVER (dir);
@@ -4959,6 +4959,19 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,return status; } +int nfs4_proc_fs_locations (struct inode *dir,const struct qstr *name, +struct nfs4_fs_locations *fs_locations,struct page *page) +{ +struct nfs4_exception exception = { }; +int err; +do { + err =nfs4_handle_exception (NFS_SERVER (dir), +_nfs4_proc_fs_locations (dir, name, fs_locations, page), + &exception); + }while (exception.retry); +return err; +} +static int _nfs4_proc_secinfo (struct inode *dir,const struct qstr *name,struct nfs4_secinfo_flavors *flavors) {int status;
Signature · 1 line
1.7.10
PATCH v3 3/8 NFS: Do secinfo as part of lookup
In reply to [email protected]From: Bryan Schumaker <[email protected]>
Whenever lookup sees wrongsec do a secinfo and retry the lookup to find attributes of the file or directory, such as "is this a referral mountpoint?". This also allows me to remove handling -NFS4ERR_WRONSEC as part of getattr xdr decoding.
--- fs/nfs/internal.h | 1 - fs/nfs/nfs4_fs.h | 4 +++ fs/nfs/nfs4namespace.c | 52 +++++++++++++++++++++++++++++++++++++++ fs/nfs/nfs4proc.c | 64 +++++++++++++++++++++++++++++++++++------------- fs/nfs/nfs4xdr.c | 2 -- 5 files changed, 103 insertions(+), 20 deletions(-)
fs/nfs/internal.h +0 -1
@@ -234,7 +234,6 @@ extern const u32 nfs41_maxwrite_overhead;/* nfs4proc.c */ #ifdef CONFIG_NFS_V4 extern struct rpc_procinfo nfs4_procedures[]; -void nfs_fixup_secinfo_attributes (struct nfs_fattr *,struct nfs_fh *);#endif extern int nfs4_init_ds_session (struct nfs_client *clp);
fs/nfs/nfs4_fs.h +4 -0
@@ -205,6 +205,9 @@ struct nfs4_state_maintenance_ops {extern const struct dentry_operations nfs4_dentry_operations;extern const struct inode_operations nfs4_dir_inode_operations; +/* nfs4namespace.c */ +struct rpc_clnt *nfs4_create_sec_client (struct rpc_clnt *,struct inode *,struct qstr *); +/* nfs4proc.c */ extern int nfs4_proc_setclientid (struct nfs_client *,u32 ,unsigned short ,struct rpc_cred *,struct nfs4_setclientid_res *);extern int nfs4_proc_setclientid_confirm (struct nfs_client *,struct nfs4_setclientid_res *arg,struct rpc_cred *);
@@ -215,6 +218,7 @@ extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, booextern int nfs4_server_capabilities (struct nfs_server *server,struct nfs_fh *fhandle);extern int nfs4_proc_fs_locations (struct inode *dir,const struct qstr *name,struct nfs4_fs_locations *fs_locations,struct page *page); +extern int nfs4_proc_secinfo (struct inode *,const struct qstr *,struct nfs4_secinfo_flavors *);extern int nfs4_release_lockowner (struct nfs4_lock_state *);extern const struct xattr_handler *nfs4_xattr_handlers[];
fs/nfs/nfs4namespace.c +52 -0
58 lines not on this page · raw message
fs/nfs/nfs4proc.c +47 -17
94 lines not on this page · raw message
fs/nfs/nfs4xdr.c +0 -2
@@ -4258,8 +4258,6 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, status =decode_attr_error (xdr, bitmap, &err);if (status <0 ) goto xdr_error; -if (err == -NFS4ERR_WRONGSEC ) -nfs_fixup_secinfo_attributes (fattr, fh); status =decode_attr_filehandle (xdr, bitmap, fh);if (status <0 )
Signature · 1 line
1.7.10
PATCH v3 4/8 NFS: Remove secinfo knowledge out of the generic client
In reply to [email protected]From: Bryan Schumaker <[email protected]>
And also remove the unneeded rpc_op.
--- fs/nfs/internal.h | 3 -- fs/nfs/namespace.c | 95 ----------------------------------------------- fs/nfs/nfs4_fs.h | 1 + fs/nfs/nfs4namespace.c | 29 +++++++++++++++ fs/nfs/nfs4proc.c | 1 - include/linux/nfs_xdr.h | 1 - 6 files changed, 30 insertions(+), 100 deletions(-)
fs/nfs/internal.h +0 -3
@@ -279,9 +279,6 @@ extern void nfs_sb_deactive(struct super_block *sb);extern char *nfs_path (char **p,struct dentry *dentry,char *buffer,ssize_t buflen);extern struct vfsmount *nfs_d_automount (struct path *path); -#ifdef CONFIG_NFS_V4 -rpc_authflavor_t nfs_find_best_sec (struct nfs4_secinfo_flavors *); -#endif /* getroot.c */ extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *,
fs/nfs/namespace.c +0 -95
107 lines not on this page · raw message
fs/nfs/nfs4_fs.h +1 -0
@@ -206,6 +206,7 @@ extern const struct dentry_operations nfs4_dentry_operations;extern const struct inode_operations nfs4_dir_inode_operations;/* nfs4namespace.c */ +rpc_authflavor_t nfs_find_best_sec (struct nfs4_secinfo_flavors *);struct rpc_clnt *nfs4_create_sec_client (struct rpc_clnt *,struct inode *,struct qstr *);/* nfs4proc.c */
fs/nfs/nfs4namespace.c +29 -0
@@ -108,6 +108,35 @@ static size_t nfs_parse_server_name(char *string, size_t len,return ret; } +rpc_authflavor_t nfs_find_best_sec (struct nfs4_secinfo_flavors *flavors) +{ +struct gss_api_mech *mech; +struct xdr_netobj oid; +int i; +rpc_authflavor_t pseudoflavor =RPC_AUTH_UNIX ; + +for (i =0 ; i < flavors->num_flavors; i++) { +struct nfs4_secinfo_flavor *flavor; + flavor = &flavors->flavors[i]; + +if (flavor->flavor ==RPC_AUTH_NULL || flavor->flavor ==RPC_AUTH_UNIX ) { + pseudoflavor = flavor->flavor; +break ; + }else if (flavor->flavor ==RPC_AUTH_GSS ) { + oid.len = flavor->gss.sec_oid4.len; + oid.data = flavor->gss.sec_oid4.data; + mech =gss_mech_get_by_OID (&oid); +if (!mech) +continue ; + pseudoflavor =gss_svc_to_pseudoflavor (mech, flavor->gss.service); +gss_mech_put (mech); +break ; + } + } + +return pseudoflavor; +} +static rpc_authflavor_t nfs4_negotiate_security (struct inode *inode,struct qstr *name) {struct page *page;
fs/nfs/nfs4proc.c +0 -1
@@ -6575,7 +6575,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = { .close_context = nfs4_close_context, .open_context = nfs4_atomic_open, .init_client = nfs4_init_client, - .secinfo = nfs4_proc_secinfo, };static const struct xattr_handler nfs4_xattr_nfs4_acl_handler = {
include/linux/nfs_xdr.h +0 -1
@@ -1289,7 +1289,6 @@ struct nfs_rpc_ops { struct iattr *iattr);int (*init_client) (struct nfs_client *,const struct rpc_timeout *,const char *,rpc_authflavor_t ,int ); -int (*secinfo)(struct inode *,const struct qstr *,struct nfs4_secinfo_flavors *); };/*
Signature · 1 line
1.7.10
PATCH v3 5/8 NFS: Create a submount rpc_op
In reply to [email protected]From: Bryan Schumaker <[email protected]>
This simplifies the code for v2 and v3 and gives v4 a chance to decide on referrals without needing to modify the generic client.
--- fs/nfs/internal.h | 15 ++++----------- fs/nfs/namespace.c | 46 +++++++++++++++++++--------------------------- fs/nfs/nfs3proc.c | 1 + fs/nfs/nfs4_fs.h | 2 ++ fs/nfs/nfs4namespace.c | 20 +++++++++++++++++++- fs/nfs/nfs4proc.c | 1 + fs/nfs/proc.c | 1 + include/linux/nfs_xdr.h | 2 ++ 8 files changed, 49 insertions(+), 39 deletions(-)
fs/nfs/internal.h +4 -11
@@ -184,17 +184,6 @@ static inline void nfs_fs_proc_exit(void) }#endif -/* nfs4namespace.c */ -#ifdef CONFIG_NFS_V4 -extern struct vfsmount *nfs_do_refmount (struct dentry *dentry); -#else -static inline -struct vfsmount *nfs_do_refmount (struct dentry *dentry) -{ -return ERR_PTR (-ENOENT ); -} -#endif -/* callback_xdr.c */ extern struct svc_version nfs4_callback_version1;extern struct svc_version nfs4_callback_version4;
@@ -279,6 +268,10 @@ extern void nfs_sb_deactive(struct super_block *sb);extern char *nfs_path (char **p,struct dentry *dentry,char *buffer,ssize_t buflen);extern struct vfsmount *nfs_d_automount (struct path *path); +struct vfsmount *nfs_submount (struct nfs_server *,struct dentry *, +struct nfs_fh *,struct nfs_fattr *); +struct vfsmount *nfs_do_submount (struct dentry *,struct nfs_fh *, +struct nfs_fattr *,rpc_authflavor_t );/* getroot.c */ extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *,
fs/nfs/namespace.c +19 -27
75 lines not on this page · raw message
fs/nfs/nfs3proc.c +1 -0
@@ -876,6 +876,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = { .file_inode_ops = &nfs3_file_inode_operations, .file_ops = &nfs_file_operations, .getroot = nfs3_proc_get_root, + .submount = nfs_submount, .getattr = nfs3_proc_getattr, .setattr = nfs3_proc_setattr, .lookup = nfs3_proc_lookup,
fs/nfs/nfs4_fs.h +2 -0
@@ -208,6 +208,8 @@ extern const struct inode_operations nfs4_dir_inode_operations;/* nfs4namespace.c */ rpc_authflavor_t nfs_find_best_sec (struct nfs4_secinfo_flavors *);struct rpc_clnt *nfs4_create_sec_client (struct rpc_clnt *,struct inode *,struct qstr *); +struct vfsmount *nfs4_submount (struct nfs_server *,struct dentry *, +struct nfs_fh *,struct nfs_fattr *);/* nfs4proc.c */ extern int nfs4_proc_setclientid (struct nfs_client *,u32 ,unsigned short ,struct rpc_cred *,struct nfs4_setclientid_res *);
fs/nfs/nfs4namespace.c +19 -1
@@ -305,7 +305,7 @@ out:* @dentry - dentry of referral * */ -struct vfsmount *nfs_do_refmount (struct dentry *dentry) +static struct vfsmount *nfs_do_refmount (struct dentry *dentry) {struct vfsmount *mnt =ERR_PTR (-ENOMEM );struct dentry *parent;
@@ -346,3 +346,21 @@ out:dprintk ("%s: done\n" , __func__);return mnt; } + +struct vfsmount *nfs4_submount (struct nfs_server *server,struct dentry *dentry, +struct nfs_fh *fh,struct nfs_fattr *fattr) +{ +int err; +struct dentry *parent =dget_parent (dentry); + +/* Look it up again to get its attributes */ + err = server->nfs_client->rpc_ops->lookup (server->client, parent->d_inode, + &dentry->d_name, fh, fattr); +dput (parent); +if (err !=0 ) +return ERR_PTR (err); + +if (fattr->valid &NFS_ATTR_FATTR_V4_REFERRAL ) +return nfs_do_refmount (dentry); +return nfs_do_submount (dentry, fh, fattr, server->client->cl_auth->au_flavor); +}
fs/nfs/nfs4proc.c +1 -0
@@ -6537,6 +6537,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { .file_inode_ops = &nfs4_file_inode_operations, .file_ops = &nfs4_file_operations, .getroot = nfs4_proc_get_root, + .submount = nfs4_submount, .getattr = nfs4_proc_getattr, .setattr = nfs4_proc_setattr, .lookup = nfs4_proc_lookup,
fs/nfs/proc.c +1 -0
@@ -733,6 +733,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = { .file_inode_ops = &nfs_file_inode_operations, .file_ops = &nfs_file_operations, .getroot = nfs_proc_get_root, + .submount = nfs_submount, .getattr = nfs_proc_getattr, .setattr = nfs_proc_setattr, .lookup = nfs_proc_lookup,
include/linux/nfs_xdr.h +2 -0
@@ -1234,6 +1234,8 @@ struct nfs_rpc_ops {int (*getroot) (struct nfs_server *,struct nfs_fh *,struct nfs_fsinfo *); +struct vfsmount *(*submount) (struct nfs_server *,struct dentry *, +struct nfs_fh *,struct nfs_fattr *);int (*getattr) (struct nfs_server *,struct nfs_fh *,struct nfs_fattr *); int (*setattr) (struct dentry *, struct nfs_fattr *,
Signature · 1 line
1.7.10
PATCH v3 6/8 NFS: Fix following referral mount points with different security
In reply to [email protected]From: Bryan Schumaker <[email protected]>
I create a new proc_lookup_mountpoint() to use when submounting an NFS v4 share. This function returns an rpc_clnt to use for performing an fs_locations() call on a referral's mountpoint.
--- fs/nfs/nfs4_fs.h | 6 ++++-- fs/nfs/nfs4namespace.c | 24 ++++++++++++++---------- fs/nfs/nfs4proc.c | 40 ++++++++++++++++++++++++++++++---------- 3 files changed, 48 insertions(+), 22 deletions(-)
fs/nfs/nfs4_fs.h +4 -2
@@ -219,8 +219,10 @@ extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *);extern int nfs41_init_clientid (struct nfs_client *,struct rpc_cred *);extern int nfs4_do_close (struct nfs4_state *state,gfp_t gfp_mask,int wait,bool roc);extern int nfs4_server_capabilities (struct nfs_server *server,struct nfs_fh *fhandle); -extern int nfs4_proc_fs_locations (struct inode *dir,const struct qstr *name, -struct nfs4_fs_locations *fs_locations,struct page *page); +extern int nfs4_proc_fs_locations (struct rpc_clnt *,struct inode *,const struct qstr *, +struct nfs4_fs_locations *,struct page *); +extern struct rpc_clnt *nfs4_proc_lookup_mountpoint (struct inode *,struct qstr *, +struct nfs_fh *,struct nfs_fattr *);extern int nfs4_proc_secinfo (struct inode *,const struct qstr *,struct nfs4_secinfo_flavors *);extern int nfs4_release_lockowner (struct nfs4_lock_state *);extern const struct xattr_handler *nfs4_xattr_handlers[];
fs/nfs/nfs4namespace.c +14 -10
@@ -305,7 +305,7 @@ out:* @dentry - dentry of referral * */ -static struct vfsmount *nfs_do_refmount (struct dentry *dentry) +static struct vfsmount *nfs_do_refmount (struct rpc_clnt *client,struct dentry *dentry) {struct vfsmount *mnt =ERR_PTR (-ENOMEM );struct dentry *parent;
@@ -331,7 +331,7 @@ static struct vfsmount *nfs_do_refmount(struct dentry *dentry)dprintk ("%s: getting locations for %s/%s\n" , __func__, parent->d_name.name, dentry->d_name.name); - err =nfs4_proc_fs_locations (parent->d_inode, &dentry->d_name, fs_locations, page); + err =nfs4_proc_fs_locations (client, parent->d_inode, &dentry->d_name, fs_locations, page);dput (parent); if (err != 0 || fs_locations->nlocations <= 0 ||
@@ -350,17 +350,21 @@ out:struct vfsmount *nfs4_submount (struct nfs_server *server,struct dentry *dentry,struct nfs_fh *fh,struct nfs_fattr *fattr) { -int err;struct dentry *parent =dget_parent (dentry); +struct rpc_clnt *client; +struct vfsmount *mnt; -/* Look it up again to get its attributes */ - err = server->nfs_client->rpc_ops->lookup (server->client, parent->d_inode, - &dentry->d_name, fh, fattr); +/* Look it up again to get its attributes and sec flavor*/ + client =nfs4_proc_lookup_mountpoint (parent->d_inode, &dentry->d_name, fh, fattr);dput (parent); -if (err !=0 ) -return ERR_PTR (err); +if (IS_ERR (client)) +return ERR_CAST (client);if (fattr->valid &NFS_ATTR_FATTR_V4_REFERRAL ) -return nfs_do_refmount (dentry); -return nfs_do_submount (dentry, fh, fattr, server->client->cl_auth->au_flavor); + mnt =nfs_do_refmount (client, dentry); +else + mnt =nfs_do_submount (dentry, fh, fattr, client->cl_auth->au_flavor); + +rpc_shutdown_client (client); +return mnt; }
fs/nfs/nfs4proc.c +30 -10
@@ -2377,8 +2377,9 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,* Note that we'll actually follow the referral later when * we detect fsid mismatch in inode revalidation */ -static int nfs4_get_referral (struct inode *dir,const struct qstr *name, -struct nfs_fattr *fattr,struct nfs_fh *fhandle) +static int nfs4_get_referral (struct rpc_clnt *client,struct inode *dir, +const struct qstr *name,struct nfs_fattr *fattr, +struct nfs_fh *fhandle) {int status = -ENOMEM ;struct page *page =NULL ;
@@ -2391,7 +2392,7 @@ static int nfs4_get_referral(struct inode *dir, const struct qstr *name,if (locations ==NULL ) goto out; - status =nfs4_proc_fs_locations (dir, name, locations, page); + status =nfs4_proc_fs_locations (client, dir, name, locations, page);if (status !=0 ) goto out;/* Make sure server returned a different fsid for the referral */
@@ -2550,7 +2551,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, err = -ENOENT ; goto out;case -NFS4ERR_MOVED : - err =nfs4_get_referral (dir, name, fattr, fhandle); + err =nfs4_get_referral (client, dir, name, fattr, fhandle); goto out;case -NFS4ERR_WRONGSEC : err = -EPERM ;
@@ -2591,6 +2592,21 @@ static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstreturn status; } +struct rpc_clnt * +nfs4_proc_lookup_mountpoint (struct inode *dir,struct qstr *name, +struct nfs_fh *fhandle,struct nfs_fattr *fattr) +{ +int status; +struct rpc_clnt *client =rpc_clone_client (NFS_CLIENT (dir)); + + status =nfs4_proc_lookup_common (&client, dir, name, fhandle, fattr); +if (status <0 ) { +rpc_shutdown_client (client); +return ERR_PTR (status); + } +return client; +} +static int _nfs4_proc_access (struct inode *inode,struct nfs_access_entry *entry) {struct nfs_server *server =NFS_SERVER (inode);
@@ -4949,8 +4965,10 @@ static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr) fattr->nlink =2 ; } -static int _nfs4_proc_fs_locations (struct inode *dir,const struct qstr *name, -struct nfs4_fs_locations *fs_locations,struct page *page) +static int _nfs4_proc_fs_locations (struct rpc_clnt *client,struct inode *dir, +const struct qstr *name, +struct nfs4_fs_locations *fs_locations, +struct page *page) {struct nfs_server *server =NFS_SERVER (dir);u32 bitmask[2 ] = {
@@ -4984,19 +5002,21 @@ static int _nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,nfs_fattr_init (&fs_locations->fattr); fs_locations->server = server; fs_locations->nlocations =0 ; - status =nfs4_call_sync (server->client, server, &msg, &args.seq_args, &res.seq_res,0 ); + status =nfs4_call_sync (client, server, &msg, &args.seq_args, &res.seq_res,0 );dprintk ("%s: returned status = %d\n" , __func__, status);return status; } -int nfs4_proc_fs_locations (struct inode *dir,const struct qstr *name, -struct nfs4_fs_locations *fs_locations,struct page *page) +int nfs4_proc_fs_locations (struct rpc_clnt *client,struct inode *dir, +const struct qstr *name, +struct nfs4_fs_locations *fs_locations, +struct page *page) {struct nfs4_exception exception = { };int err;do { err =nfs4_handle_exception (NFS_SERVER (dir), -_nfs4_proc_fs_locations (dir, name, fs_locations, page), +_nfs4_proc_fs_locations (client, dir, name, fs_locations, page), &exception); }while (exception.retry);return err;
Signature · 1 line
1.7.10
PATCH v3 7/8 NFS: Honor the authflavor set in the clone mount data
In reply to [email protected]From: Bryan Schumaker <[email protected]>
The authflavor is set in an nfs_clone_mount structure and passed to the xdev_mount() functions where it was promptly ignored. Instead, use it to initialize an rpc_clnt for the cloned server.
--- fs/nfs/client.c | 5 +++-- fs/nfs/internal.h | 3 ++- fs/nfs/super.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-)
fs/nfs/client.c +3 -2
@@ -1729,7 +1729,8 @@ error:*/ struct nfs_server *nfs_clone_server (struct nfs_server *source,struct nfs_fh *fh, -struct nfs_fattr *fattr) +struct nfs_fattr *fattr, +rpc_authflavor_t flavor) {struct nfs_server *server;struct nfs_fattr *fattr_fsinfo;
@@ -1758,7 +1759,7 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, error =nfs_init_server_rpcclient (server, source->client->cl_timeout, - source->client->cl_auth->au_flavor); + flavor);if (error <0 ) goto out_free_server;if (!IS_ERR (source->client_acl))
fs/nfs/internal.h +2 -1
@@ -165,7 +165,8 @@ extern struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *,extern void nfs_free_server (struct nfs_server *server);extern struct nfs_server *nfs_clone_server (struct nfs_server *,struct nfs_fh *, -struct nfs_fattr *); +struct nfs_fattr *, +rpc_authflavor_t );extern void nfs_mark_client_ready (struct nfs_client *clp,int state);extern int nfs4_check_client_ready (struct nfs_client *clp); extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
fs/nfs/super.c +2 -2
@@ -2428,7 +2428,7 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags,dprintk ("--> nfs_xdev_mount()\n" );/* create a new volume representation */ - server =nfs_clone_server (NFS_SB (data->sb), data->fh, data->fattr); + server =nfs_clone_server (NFS_SB (data->sb), data->fh, data->fattr, data->authflavor);if (IS_ERR (server)) { error =PTR_ERR (server); goto out_err_noserver;
@@ -2955,7 +2955,7 @@ nfs4_xdev_mount(struct file_system_type *fs_type, int flags,dprintk ("--> nfs4_xdev_mount()\n" );/* create a new volume representation */ - server =nfs_clone_server (NFS_SB (data->sb), data->fh, data->fattr); + server =nfs_clone_server (NFS_SB (data->sb), data->fh, data->fattr, data->authflavor);if (IS_ERR (server)) { error =PTR_ERR (server); goto out_err_noserver;
Signature · 1 line
1.7.10
PATCH v3 8/8 NFS: Remove extra rpc_clnt argument to proc_lookup
In reply to [email protected]From: Bryan Schumaker <[email protected]>
Now that I'm doing secinfo automatically in the v4 code this extra argument isn't needed.
--- fs/nfs/dir.c | 6 +++--- fs/nfs/namespace.c | 3 +-- fs/nfs/nfs3proc.c | 2 +- fs/nfs/nfs4proc.c | 2 +- fs/nfs/proc.c | 2 +- include/linux/nfs_xdr.h | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-)
fs/nfs/dir.c +3 -3
@@ -1143,7 +1143,7 @@ static int nfs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)if (fhandle ==NULL || fattr ==NULL ) goto out_error; - error =NFS_PROTO (dir)->lookup (NFS_SERVER (dir)->client, dir, &dentry->d_name, fhandle, fattr); + error =NFS_PROTO (dir)->lookup (dir, &dentry->d_name, fhandle, fattr);if (error) goto out_bad;if (nfs_compare_fh (NFS_FH (inode), fhandle))
@@ -1299,7 +1299,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru parent = dentry->d_parent;/* Protect against concurrent sillydeletes */ nfs_block_sillyrename (parent); - error =NFS_PROTO (dir)->lookup (NFS_SERVER (dir)->client, dir, &dentry->d_name, fhandle, fattr); + error =NFS_PROTO (dir)->lookup (dir, &dentry->d_name, fhandle, fattr);if (error == -ENOENT ) goto no_entry;if (error <0 ) {
@@ -1646,7 +1646,7 @@ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,if (dentry->d_inode) goto out;if (fhandle->size ==0 ) { - error =NFS_PROTO (dir)->lookup (NFS_SERVER (dir)->client, dir, &dentry->d_name, fhandle, fattr); + error =NFS_PROTO (dir)->lookup (dir, &dentry->d_name, fhandle, fattr);if (error) goto out_error; }
fs/nfs/namespace.c +1 -2
@@ -261,8 +261,7 @@ struct vfsmount *nfs_submount(struct nfs_server *server, struct dentry *dentry,struct dentry *parent =dget_parent (dentry);/* Look it up again to get its attributes */ - err = server->nfs_client->rpc_ops->lookup (server->client, parent->d_inode, - &dentry->d_name, fh, fattr); + err = server->nfs_client->rpc_ops->lookup (parent->d_inode, &dentry->d_name, fh, fattr);dput (parent);if (err !=0 )return ERR_PTR (err);
fs/nfs/nfs3proc.c +1 -1
@@ -142,7 +142,7 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, }static int -nfs3_proc_lookup (struct rpc_clnt *clnt,struct inode *dir,struct qstr *name, +nfs3_proc_lookup (struct inode *dir,struct qstr *name,struct nfs_fh *fhandle,struct nfs_fattr *fattr) {struct nfs3_diropargs arg = {
fs/nfs/nfs4proc.c +1 -1
@@ -2578,7 +2578,7 @@ out:return err; } -static int nfs4_proc_lookup (struct rpc_clnt *clnt,struct inode *dir,struct qstr *name, +static int nfs4_proc_lookup (struct inode *dir,struct qstr *name,struct nfs_fh *fhandle,struct nfs_fattr *fattr) {int status;
fs/nfs/proc.c +1 -1
@@ -178,7 +178,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, }static int -nfs_proc_lookup (struct rpc_clnt *clnt,struct inode *dir,struct qstr *name, +nfs_proc_lookup (struct inode *dir,struct qstr *name,struct nfs_fh *fhandle,struct nfs_fattr *fattr) {struct nfs_diropargs arg = {
include/linux/nfs_xdr.h +1 -1
@@ -1240,7 +1240,7 @@ struct nfs_rpc_ops { struct nfs_fattr *);int (*setattr) (struct dentry *,struct nfs_fattr *,struct iattr *); -int (*lookup) (struct rpc_clnt *clnt,struct inode *,struct qstr *, +int (*lookup) (struct inode *,struct qstr *,struct nfs_fh *,struct nfs_fattr *);int (*access) (struct inode *,struct nfs_access_entry *); int (*readlink)(struct inode *, struct page *, unsigned int,
Signature · 1 line
1.7.10