NFS: Clean up nfs4_label allocation
Subsystems (2)
v2 cover NFS: Clean up nfs4_label allocation
From: Anna Schumaker <[email protected]>
In the functions where we want a label we also tend to allocate a struct fattr, which happens to have a field for labels that goes unused in most cases. Let's just allocate the label at the same time as the fattr if we know we'll want one. This lets us pass fattrs around by themselves, and also remove the struct nfs4_label argument from functions like nfs3_proc_getattr().
Changes in v2:
- Rebased on v5.15-rc6
Thoughts?
Anna
Anna Schumaker (14):
NFS: Create a new nfs_alloc_fattr_with_label() function
NFS: Remove the nfs4_label from the nfs_entry struct
NFS: Remove the nfs4_label from the nfs4_create_res struct
NFS: Remove the nfs4_label from the nfs4_link_res struct
NFS: Remove the label from the nfs4_lookup_res struct
NFS: Remove the nfs4_label from the nfs4_lookupp_res struct
NFS: Remove the f_label from the nfs4_opendata and nfs_openres
NFS: Remove the nfs4_label from the nfs4_getattr_res
NFS: Remove the nfs4_label from the nfs_setattrres
NFS: Remove the nfs4_label argument from nfs_instantiate()
NFS: Remove the nfs4_label argument from nfs_add_or_obtain()
NFS: Remove the nfs4_label argument from nfs_fhget()
NFS: Remove the nfs4_label argument from nfs_setsecurity
NFS: Remove the nfs4_label argument from decode_getattr_*() functions
fs/nfs/client.c | 2 +- fs/nfs/dir.c | 66 ++++++---------- fs/nfs/export.c | 44 +++-------- fs/nfs/getroot.c | 21 ++--- fs/nfs/inode.c | 59 +++++++------- fs/nfs/internal.h | 9 --- fs/nfs/namespace.c | 3 +- fs/nfs/nfs3proc.c | 10 +-- fs/nfs/nfs4_fs.h | 4 +- fs/nfs/nfs4file.c | 5 +- fs/nfs/nfs4proc.c | 165 +++++++++++++--------------------------- fs/nfs/nfs4xdr.c | 43 +++++------ fs/nfs/proc.c | 14 ++-- include/linux/nfs_fs.h | 23 ++++-- include/linux/nfs_xdr.h | 16 +--- 15 files changed, 180 insertions(+), 304 deletions(-)
Signature · 1 line
2.33.1
PATCH v2 1/14 NFS: Create a new nfs_alloc_fattr_with_label() function
From: Anna Schumaker <[email protected]>
For creating fattrs with the label field already allocated for us. I also update nfs_free_fattr() to free the label in the end.
--- fs/nfs/getroot.c | 17 ++++++----------- fs/nfs/inode.c | 17 +++++++++++++++++ fs/nfs/internal.h | 9 --------- include/linux/nfs_fs.h | 13 +++++++++++++ 4 files changed, 36 insertions(+), 20 deletions(-)
fs/nfs/getroot.c +6 -11
@@ -80,18 +80,15 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) goto out;/* get the actual root for this mount */ - fsinfo.fattr =nfs_alloc_fattr (); + fsinfo.fattr =nfs_alloc_fattr_with_label (server);if (fsinfo.fattr ==NULL ) goto out_name; - fsinfo.fattr->label =nfs4_label_alloc (server,GFP_KERNEL ); -if (IS_ERR (fsinfo.fattr->label)) - goto out_fattr; error = server->nfs_client->rpc_ops->getroot (server, ctx->mntfh, &fsinfo);if (error <0 ) {dprintk ("nfs_get_root: getattr error = %d\n" , -error);nfs_errorf (fc,"NFS: Couldn't getattr on root" ); - goto out_label; + goto out_fattr; } inode =nfs_fhget (s, ctx->mntfh, fsinfo.fattr,NULL );
@@ -99,12 +96,12 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc)dprintk ("nfs_get_root: get root inode failed\n" ); error =PTR_ERR (inode);nfs_errorf (fc,"NFS: Couldn't get root inode" ); - goto out_label; + goto out_fattr; } error =nfs_superblock_set_dummy_root (s, inode);if (error !=0 ) - goto out_label; + goto out_fattr;/* root dentries normally start off anonymous and get spliced in later * if the dentry tree reaches them; however if the dentry already
@@ -115,7 +112,7 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc)dprintk ("nfs_get_root: get root dentry failed\n" ); error =PTR_ERR (root);nfs_errorf (fc,"NFS: Couldn't get root dentry" ); - goto out_label; + goto out_fattr; }security_d_instantiate (root, inode);
@@ -154,8 +151,6 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc)nfs_setsecurity (inode, fsinfo.fattr, fsinfo.fattr->label); error =0 ; -out_label: -nfs4_label_free (fsinfo.fattr->label); out_fattr:nfs_free_fattr (fsinfo.fattr); out_name:
@@ -165,5 +160,5 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) error_splat_root:dput (fc->root); fc->root =NULL ; - goto out_label; + goto out_fattr; }
fs/nfs/inode.c +17 -0
@@ -1586,6 +1586,23 @@ struct nfs_fattr *nfs_alloc_fattr(void) }EXPORT_SYMBOL_GPL (nfs_alloc_fattr); +struct nfs_fattr *nfs_alloc_fattr_with_label (struct nfs_server *server) +{ +struct nfs_fattr *fattr =nfs_alloc_fattr (); + +if (!fattr) +return NULL ; + + fattr->label =nfs4_label_alloc (server,GFP_NOFS ); +if (IS_ERR (fattr->label)) { +kfree (fattr); +return NULL ; + } + +return fattr; +} +EXPORT_SYMBOL_GPL (nfs_alloc_fattr_with_label); +struct nfs_fh *nfs_alloc_fhandle (void ) {struct nfs_fh *fh;
fs/nfs/internal.h +0 -9
@@ -341,14 +341,6 @@ nfs4_label_copy(struct nfs4_label *dst, struct nfs4_label *src)return dst; } -static inline void nfs4_label_free (struct nfs4_label *label) -{ -if (label) { -kfree (label->label); -kfree (label); - } -return ; -}static inline void nfs_zap_label_cache_locked (struct nfs_inode *nfsi) {
@@ -357,7 +349,6 @@ static inline void nfs_zap_label_cache_locked(struct nfs_inode *nfsi) }#else static inline struct nfs4_label *nfs4_label_alloc (struct nfs_server *server,gfp_t flags) {return NULL ; } -static inline void nfs4_label_free (void *label) {}static inline void nfs_zap_label_cache_locked (struct nfs_inode *nfsi) { }
include/linux/nfs_fs.h +13 -0
@@ -421,9 +421,22 @@ extern void nfs_fattr_set_barrier(struct nfs_fattr *fattr);extern unsigned long nfs_inc_attr_generation_counter (void );extern struct nfs_fattr *nfs_alloc_fattr (void ); +extern struct nfs_fattr *nfs_alloc_fattr_with_label (struct nfs_server *server); + +static inline void nfs4_label_free (struct nfs4_label *label) +{ +#ifdef CONFIG_NFS_V4_SECURITY_LABEL +if (label) { +kfree (label->label); +kfree (label); + } +#endif +}static inline void nfs_free_fattr (const struct nfs_fattr *fattr) { +if (fattr) +nfs4_label_free (fattr->label);kfree (fattr); }
Signature · 1 line
2.33.1
PATCH v2 2/14 NFS: Remove the nfs4_label from the nfs_entry struct
In reply to [email protected]From: Anna Schumaker <[email protected]>
And instead allocate the fattr using nfs_alloc_fattr_with_label()
--- fs/nfs/dir.c | 21 +++++++-------------- fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 3 files changed, 8 insertions(+), 16 deletions(-)
fs/nfs/dir.c +7 -14
@@ -680,7 +680,8 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry,nfs_set_verifier (dentry, dir_verifier); status =nfs_refresh_inode (d_inode (dentry), entry->fattr);if (!status) -nfs_setsecurity (d_inode (dentry), entry->fattr, entry->label); +nfs_setsecurity (d_inode (dentry), entry->fattr, + entry->fattr->label); goto out; }else {d_invalidate (dentry);
@@ -694,7 +695,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry, goto out; } - inode =nfs_fhget (dentry->d_sb, entry->fh, entry->fattr, entry->label); + inode =nfs_fhget (dentry->d_sb, entry->fh, entry->fattr, entry->fattr->label); alias =d_splice_alias (inode, dentry);d_lookup_done (dentry);if (alias) {
@@ -730,8 +731,8 @@ static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc,xdr_set_scratch_page (&stream, scratch); do { - if (entry->label) - entry->label->len = NFS4_MAXLABELLEN; + if (entry->fattr->label) + entry->fattr->label->len = NFS4_MAXLABELLEN; status = xdr_decode(desc, entry, &stream); if (status != 0)
@@ -836,21 +837,15 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,return -ENOMEM ; entry->cookie =nfs_readdir_page_last_cookie (page); entry->fh =nfs_alloc_fhandle (); - entry->fattr =nfs_alloc_fattr (); + entry->fattr =nfs_alloc_fattr_with_label (NFS_SERVER (inode)); entry->server =NFS_SERVER (inode);if (entry->fh ==NULL || entry->fattr ==NULL ) goto out; - entry->label =nfs4_label_alloc (NFS_SERVER (inode),GFP_NOWAIT ); -if (IS_ERR (entry->label)) { - status =PTR_ERR (entry->label); - goto out; - } - array_size = (dtsize +PAGE_SIZE -1 ) >>PAGE_SHIFT ; pages =nfs_readdir_alloc_pages (array_size);if (!pages) - goto out_release_label; + goto out; do { unsigned int pglen;
@@ -873,8 +868,6 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc, }while (!status &&nfs_readdir_page_needs_filling (page));nfs_readdir_free_pages (pages, array_size); -out_release_label: -nfs4_label_free (entry->label); out:nfs_free_fattr (entry->fattr);nfs_free_fhandle (entry->fh);
fs/nfs/nfs4xdr.c +1 -1
@@ -7475,7 +7475,7 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,return -EAGAIN ;if (decode_getfattr_attrs (xdr, bitmap, entry->fattr, entry->fh, -NULL , entry->label, entry->server) <0 ) +NULL , entry->fattr->label, entry->server) <0 )return -EAGAIN ;if (entry->fattr->valid &NFS_ATTR_FATTR_MOUNTED_ON_FILEID ) entry->ino = entry->fattr->mounted_on_fileid;
include/linux/nfs_xdr.h +0 -1
@@ -753,7 +753,6 @@ struct nfs_entry {int eof;struct nfs_fh * fh;struct nfs_fattr * fattr; -struct nfs4_label *label;unsigned char d_type;struct nfs_server * server; };
Signature · 1 line
2.33.1
PATCH v2 3/14 NFS: Remove the nfs4_label from the nfs4_create_res struct
In reply to [email protected]From: Anna Schumaker <[email protected]>
Instead, use the label embedded in the attached fattr.
--- fs/nfs/nfs4proc.c | 12 +++++------- fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 3 files changed, 6 insertions(+), 9 deletions(-)
fs/nfs/nfs4proc.c +5 -7
@@ -4851,7 +4851,6 @@ struct nfs4_createdata {struct nfs4_create_res res;struct nfs_fh fh;struct nfs_fattr fattr; -struct nfs4_label *label; }; static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir,
@@ -4863,8 +4862,8 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir,if (data !=NULL ) {struct nfs_server *server =NFS_SERVER (dir); - data->label =nfs4_label_alloc (server,GFP_KERNEL ); -if (IS_ERR (data->label)) + data->fattr.label =nfs4_label_alloc (server,GFP_KERNEL ); +if (IS_ERR (data->fattr.label)) goto out_free; data->msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CREATE ];
@@ -4875,12 +4874,11 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir, data->arg.name = name; data->arg.attrs = sattr; data->arg.ftype = ftype; - data->arg.bitmask =nfs4_bitmask (server, data->label); + data->arg.bitmask =nfs4_bitmask (server, data->fattr.label); data->arg.umask =current_umask (); data->res.server = server; data->res.fh = &data->fh; data->res.fattr = &data->fattr; - data->res.label = data->label;nfs_fattr_init (data->res.fattr); }return data;
@@ -4902,14 +4900,14 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_ data->res.fattr->time_start, NFS_INO_INVALID_DATA);spin_unlock (&dir->i_lock); - status =nfs_instantiate (dentry, data->res.fh, data->res.fattr, data->res.label); + status =nfs_instantiate (dentry, data->res.fh, data->res.fattr, data->res.fattr->label); }return status; }static void nfs4_free_createdata (struct nfs4_createdata *data) { -nfs4_label_free (data->label); +nfs4_label_free (data->fattr.label);kfree (data); }
fs/nfs/nfs4xdr.c +1 -1
@@ -6361,7 +6361,7 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_getfh (xdr, res->fh);if (status) goto out; -decode_getfattr_label (xdr, res->fattr, res->label, res->server); +decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); out:return status; }
include/linux/nfs_xdr.h +0 -1
@@ -1040,7 +1040,6 @@ struct nfs4_create_res {const struct nfs_server * server;struct nfs_fh * fh;struct nfs_fattr * fattr; -struct nfs4_label *label;struct nfs4_change_info dir_cinfo; };
Signature · 1 line
2.33.1
PATCH v2 4/14 NFS: Remove the nfs4_label from the nfs4_link_res struct
In reply to [email protected]From: Anna Schumaker <[email protected]>
Again, use the fattr's label field instead.
--- fs/nfs/nfs4proc.c | 16 +++------------- fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 3 files changed, 4 insertions(+), 15 deletions(-)
fs/nfs/nfs4proc.c +3 -13
@@ -4791,7 +4791,6 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct };struct nfs4_link_res res = { .server = server, - .label =NULL , };struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LINK ],
@@ -4800,18 +4799,12 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct };int status = -ENOMEM ; - res.fattr =nfs_alloc_fattr (); + res.fattr =nfs_alloc_fattr_with_label (server);if (res.fattr ==NULL ) goto out; - res.label =nfs4_label_alloc (server,GFP_KERNEL ); -if (IS_ERR (res.label)) { - status =PTR_ERR (res.label); - goto out; - } -nfs4_inode_make_writeable (inode); -nfs4_bitmap_copy_adjust (bitmask,nfs4_bitmask (server, res.label), inode, +nfs4_bitmap_copy_adjust (bitmask,nfs4_bitmask (server, res.fattr->label), inode,NFS_INO_INVALID_CHANGE ); status =nfs4_call_sync (server->client, server, &msg, &arg.seq_args, &res.seq_res,1 );if (!status) {
@@ -4820,12 +4813,9 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const structnfs4_inc_nlink (inode); status =nfs_post_op_update_inode (inode, res.fattr);if (!status) -nfs_setsecurity (inode, res.fattr, res.label); +nfs_setsecurity (inode, res.fattr, res.fattr->label); } - -nfs4_label_free (res.label); - out:nfs_free_fattr (res.fattr);return status;
fs/nfs/nfs4xdr.c +1 -1
@@ -6331,7 +6331,7 @@ static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_restorefh (xdr);if (status) goto out; -decode_getfattr_label (xdr, res->fattr, res->label, res->server); +decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); out:return status; }
include/linux/nfs_xdr.h +0 -1
@@ -1079,7 +1079,6 @@ struct nfs4_link_res {struct nfs4_sequence_res seq_res;const struct nfs_server * server;struct nfs_fattr * fattr; -struct nfs4_label *label;struct nfs4_change_info cinfo;struct nfs_fattr * dir_attr; };
Signature · 1 line
2.33.1
PATCH v2 5/14 NFS: Remove the label from the nfs4_lookup_res struct
In reply to [email protected]From: Anna Schumaker <[email protected]>
And usethe fattr's label field instead. I also adjust function calls to remove labels along the way.
--- fs/nfs/dir.c | 34 ++++++++++++---------------------- fs/nfs/namespace.c | 3 +-- fs/nfs/nfs3proc.c | 3 +-- fs/nfs/nfs4proc.c | 16 +++++++--------- fs/nfs/nfs4xdr.c | 4 ++-- fs/nfs/proc.c | 3 +-- include/linux/nfs_xdr.h | 4 +--- 7 files changed, 25 insertions(+), 42 deletions(-)
fs/nfs/dir.c +12 -22
@@ -1488,19 +1488,17 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, {struct nfs_fh *fhandle;struct nfs_fattr *fattr; -struct nfs4_label *label;unsigned long dir_verifier;int ret; ret = -ENOMEM ; fhandle =nfs_alloc_fhandle (); - fattr =nfs_alloc_fattr (); - label =nfs4_label_alloc (NFS_SERVER (inode),GFP_KERNEL ); -if (fhandle ==NULL || fattr ==NULL ||IS_ERR (label)) + fattr =nfs_alloc_fattr_with_label (NFS_SERVER (inode)); +if (fhandle ==NULL || fattr ==NULL ) goto out; dir_verifier =nfs_save_change_attribute (dir); - ret =NFS_PROTO (dir)->lookup (dir, dentry, fhandle, fattr, label); + ret =NFS_PROTO (dir)->lookup (dir, dentry, fhandle, fattr);if (ret <0 ) {switch (ret) {case -ESTALE :
@@ -1519,7 +1517,7 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry,if (nfs_refresh_inode (inode, fattr) <0 ) goto out; -nfs_setsecurity (inode, fattr, label); +nfs_setsecurity (inode, fattr, fattr->label);nfs_set_verifier (dentry, dir_verifier);/* set a readdirplus hint that we had a cache miss */
@@ -1528,7 +1526,6 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, out:nfs_free_fattr (fattr);nfs_free_fhandle (fhandle); -nfs4_label_free (label);/* * If the lookup failed despite the dentry change attribute being
@@ -1752,7 +1749,6 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned instruct inode *inode =NULL ;struct nfs_fh *fhandle =NULL ;struct nfs_fattr *fattr =NULL ; -struct nfs4_label *label =NULL ;unsigned long dir_verifier;int error;
@@ -1771,27 +1767,23 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in res =ERR_PTR (-ENOMEM ); fhandle =nfs_alloc_fhandle (); - fattr =nfs_alloc_fattr (); + fattr =nfs_alloc_fattr_with_label (NFS_SERVER (dir));if (fhandle ==NULL || fattr ==NULL ) goto out; - label =nfs4_label_alloc (NFS_SERVER (dir),GFP_NOWAIT ); -if (IS_ERR (label)) - goto out; - dir_verifier =nfs_save_change_attribute (dir);trace_nfs_lookup_enter (dir, dentry, flags); - error =NFS_PROTO (dir)->lookup (dir, dentry, fhandle, fattr, label); + error =NFS_PROTO (dir)->lookup (dir, dentry, fhandle, fattr);if (error == -ENOENT ) goto no_entry;if (error <0 ) { res =ERR_PTR (error); - goto out_label; + goto out; } - inode =nfs_fhget (dentry->d_sb, fhandle, fattr, label); + inode =nfs_fhget (dentry->d_sb, fhandle, fattr, fattr->label); res =ERR_CAST (inode);if (IS_ERR (res)) - goto out_label; + goto out;/* Notify readdir to use READDIRPLUS */ nfs_force_use_readdirplus (dir);
@@ -1800,14 +1792,12 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in res =d_splice_alias (inode, dentry);if (res !=NULL ) {if (IS_ERR (res)) - goto out_label; + goto out; dentry = res; }nfs_set_verifier (dentry, dir_verifier); -out_label: +out:trace_nfs_lookup_exit (dir, dentry, flags, error); -nfs4_label_free (label); -out:nfs_free_fattr (fattr);nfs_free_fhandle (fhandle);return res;
@@ -2056,7 +2046,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle,d_drop (dentry);if (fhandle->size ==0 ) { - error =NFS_PROTO (dir)->lookup (dir, dentry, fhandle, fattr,NULL ); + error =NFS_PROTO (dir)->lookup (dir, dentry, fhandle, fattr);if (error) goto out_error; }
fs/nfs/namespace.c +1 -2
@@ -308,8 +308,7 @@ int nfs_submount(struct fs_context *fc, struct nfs_server *server)/* Look it up again to get its attributes */ err = server->nfs_client->rpc_ops->lookup (d_inode (parent), dentry, - ctx->mntfh, ctx->clone_data.fattr, -NULL ); + ctx->mntfh, ctx->clone_data.fattr);dput (parent);if (err !=0 )return err;
fs/nfs/nfs3proc.c +1 -2
@@ -193,8 +193,7 @@ __nfs3_proc_lookup(struct inode *dir, const char *name, size_t len,static int nfs3_proc_lookup (struct inode *dir,struct dentry *dentry, -struct nfs_fh *fhandle,struct nfs_fattr *fattr, -struct nfs4_label *label) +struct nfs_fh *fhandle,struct nfs_fattr *fattr) {unsigned short task_flags =0 ;
fs/nfs/nfs4proc.c +7 -9
@@ -4295,7 +4295,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,static int _nfs4_proc_lookup (struct rpc_clnt *clnt,struct inode *dir,struct dentry *dentry,struct nfs_fh *fhandle, -struct nfs_fattr *fattr,struct nfs4_label *label) +struct nfs_fattr *fattr) {struct nfs_server *server =NFS_SERVER (dir);int status;
@@ -4307,7 +4307,6 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,struct nfs4_lookup_res res = { .server = server, .fattr = fattr, - .label = label, .fh = fhandle, };struct rpc_message msg = {
@@ -4324,7 +4323,7 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,if (nfs_lookup_is_soft_revalidate (dentry)) task_flags |=RPC_TASK_TIMEOUT ; - args.bitmask =nfs4_bitmask (server, label); + args.bitmask =nfs4_bitmask (server, fattr->label);nfs_fattr_init (fattr);
@@ -4346,7 +4345,7 @@ static void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr)static int nfs4_proc_lookup_common (struct rpc_clnt **clnt,struct inode *dir,struct dentry *dentry,struct nfs_fh *fhandle, -struct nfs_fattr *fattr,struct nfs4_label *label) +struct nfs_fattr *fattr) {struct nfs4_exception exception = { .interruptible = true,
@@ -4355,7 +4354,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir,const struct qstr *name = &dentry->d_name;int err; do { - err = _nfs4_proc_lookup(client, dir, dentry, fhandle, fattr, label); + err = _nfs4_proc_lookup(client, dir, dentry, fhandle, fattr); trace_nfs4_lookup(dir, name, err); switch (err) { case -NFS4ERR_BADNAME:
@@ -4391,13 +4390,12 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, }static int nfs4_proc_lookup (struct inode *dir,struct dentry *dentry, -struct nfs_fh *fhandle,struct nfs_fattr *fattr, -struct nfs4_label *label) +struct nfs_fh *fhandle,struct nfs_fattr *fattr) {int status;struct rpc_clnt *client =NFS_CLIENT (dir); - status =nfs4_proc_lookup_common (&client, dir, dentry, fhandle, fattr, label); + status =nfs4_proc_lookup_common (&client, dir, dentry, fhandle, fattr);if (client !=NFS_CLIENT (dir)) {rpc_shutdown_client (client);nfs_fixup_secinfo_attributes (fattr);
@@ -4412,7 +4410,7 @@ nfs4_proc_lookup_mountpoint(struct inode *dir, struct dentry *dentry,struct rpc_clnt *client =NFS_CLIENT (dir);int status; - status =nfs4_proc_lookup_common (&client, dir, dentry, fhandle, fattr,NULL ); + status =nfs4_proc_lookup_common (&client, dir, dentry, fhandle, fattr);if (status <0 )return ERR_PTR (status);return (client ==NFS_CLIENT (dir)) ?rpc_clone_client (client) : client;
fs/nfs/nfs4xdr.c +2 -2
@@ -6179,7 +6179,7 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_getfh (xdr, res->fh);if (status) goto out; - status =decode_getfattr_label (xdr, res->fattr, res->label, res->server); + status =decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); out:return status; }
@@ -6237,7 +6237,7 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, status =decode_getfh (xdr, res->fh);if (status ==0 ) status =decode_getfattr_label (xdr, res->fattr, - res->label, res->server); + res->fattr->label, res->server); out:return status; }
fs/nfs/proc.c +1 -2
@@ -154,8 +154,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,static int nfs_proc_lookup (struct inode *dir,struct dentry *dentry, -struct nfs_fh *fhandle,struct nfs_fattr *fattr, -struct nfs4_label *label) +struct nfs_fh *fhandle,struct nfs_fattr *fattr) {struct nfs_diropargs arg = { .fh =NFS_FH (dir),
include/linux/nfs_xdr.h +1 -3
@@ -1095,7 +1095,6 @@ struct nfs4_lookup_res {const struct nfs_server * server;struct nfs_fattr * fattr;struct nfs_fh * fh; -struct nfs4_label *label; };struct nfs4_lookupp_arg {
@@ -1740,8 +1739,7 @@ struct nfs_rpc_ops {int (*setattr) (struct dentry *,struct nfs_fattr *,struct iattr *);int (*lookup) (struct inode *,struct dentry *, -struct nfs_fh *,struct nfs_fattr *, -struct nfs4_label *); +struct nfs_fh *,struct nfs_fattr *);int (*lookupp) (struct inode *,struct nfs_fh *,struct nfs_fattr *,struct nfs4_label *);int (*access) (struct inode *,struct nfs_access_entry *);
Signature · 1 line
2.33.1
kernel test robot
build botRe: [PATCH v2 05/14] NFS: Remove the label from the nfs4_lookup_res struct
I love your patch! Perhaps something to improve:
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on trondmy-nfs/linux-next]
[also build test WARNING on v5.15]
[cannot apply to next-20211106]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/schumaker-anna-gmail-com/NFS-Clean-up-nfs4_label-allocation/20211024-104605 base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next config: x86_64-randconfig-r034-20211025 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project a461fa64bb37cffd73f683c74f6b0780379fc2ca)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/ca3c213e9f927361803d5558b63140f228d83303
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review schumaker-anna-gmail-com/NFS-Clean-up-nfs4_label-allocation/20211024-104605 git checkout ca3c213e9f927361803d5558b63140f228d83303
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> fs/nfs/dir.c:1773:6: warning: variable 'error' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (fhandle == NULL || fattr == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/nfs/dir.c:1802:44: note: uninitialized use occurs here
trace_nfs_lookup_exit(dir, dentry, flags, error);
^~~~~
fs/nfs/dir.c:1773:2: note: remove the 'if' if its condition is always false
if (fhandle == NULL || fattr == NULL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/nfs/dir.c:1773:6: warning: variable 'error' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
if (fhandle == NULL || fattr == NULL)
^~~~~~~~~~~~~~~
fs/nfs/dir.c:1802:44: note: uninitialized use occurs here
trace_nfs_lookup_exit(dir, dentry, flags, error);
^~~~~
fs/nfs/dir.c:1773:6: note: remove the '||' if its condition is always false
if (fhandle == NULL || fattr == NULL)
^~~~~~~~~~~~~~~~~~
fs/nfs/dir.c:1755:11: note: initialize the variable 'error' to silence this warning
int error;
^
= 02 warnings generated.
vim +1773 fs/nfs/dir.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 1747
597d92891b8859 Bryan Schumaker 2012-07-16 1748 struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1749 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1750 struct dentry *res;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1751 struct inode *inode = NULL;
e1fb4d05d5a326 Trond Myklebust 2010-04-16 1752 struct nfs_fh *fhandle = NULL;
e1fb4d05d5a326 Trond Myklebust 2010-04-16 1753 struct nfs_fattr *fattr = NULL;
a1147b8281bda9 Trond Myklebust 2020-02-05 1754 unsigned long dir_verifier;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1755 int error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1756
6de1472f1a4a3b Al Viro 2013-09-16 1757 dfprintk(VFS, "NFS: lookup(%pd2)\n", dentry);
91d5b47023b608 Chuck Lever 2006-03-20 1758 nfs_inc_stats(dir, NFSIOS_VFSLOOKUP);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1759
130f9ab75dc3af Al Viro 2016-03-07 1760 if (unlikely(dentry->d_name.len > NFS_SERVER(dir)->namelen))
130f9ab75dc3af Al Viro 2016-03-07 1761 return ERR_PTR(-ENAMETOOLONG);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1762
fd6840714d9cf6 Trond Myklebust 2006-09-05 1763 /*
fd6840714d9cf6 Trond Myklebust 2006-09-05 1764 * If we're doing an exclusive create, optimize away the lookup
fd6840714d9cf6 Trond Myklebust 2006-09-05 1765 * but don't hash the dentry.
fd6840714d9cf6 Trond Myklebust 2006-09-05 1766 */
9f6d44d418b1f4 Trond Myklebust 2018-05-10 1767 if (nfs_is_exclusive_create(dir, flags) || flags & LOOKUP_RENAME_TARGET)
130f9ab75dc3af Al Viro 2016-03-07 1768 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1769
e1fb4d05d5a326 Trond Myklebust 2010-04-16 1770 res = ERR_PTR(-ENOMEM);
e1fb4d05d5a326 Trond Myklebust 2010-04-16 1771 fhandle = nfs_alloc_fhandle();
ca3c213e9f9273 Anna Schumaker 2021-10-22 1772 fattr = nfs_alloc_fattr_with_label(NFS_SERVER(dir));
e1fb4d05d5a326 Trond Myklebust 2010-04-16 @1773 if (fhandle == NULL || fattr == NULL)
e1fb4d05d5a326 Trond Myklebust 2010-04-16 1774 goto out;
e1fb4d05d5a326 Trond Myklebust 2010-04-16 1775
a1147b8281bda9 Trond Myklebust 2020-02-05 1776 dir_verifier = nfs_save_change_attribute(dir);
6e0d0be715fe04 Trond Myklebust 2013-08-20 1777 trace_nfs_lookup_enter(dir, dentry, flags);
ca3c213e9f9273 Anna Schumaker 2021-10-22 1778 error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1779 if (error == -ENOENT)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1780 goto no_entry;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1781 if (error < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1782 res = ERR_PTR(error);
ca3c213e9f9273 Anna Schumaker 2021-10-22 1783 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1784 }
ca3c213e9f9273 Anna Schumaker 2021-10-22 1785 inode = nfs_fhget(dentry->d_sb, fhandle, fattr, fattr->label);
bf0c84f1614bff Namhyung Kim 2010-12-28 1786 res = ERR_CAST(inode);
03f28e3a2059fc Trond Myklebust 2006-03-20 1787 if (IS_ERR(res))
ca3c213e9f9273 Anna Schumaker 2021-10-22 1788 goto out;
54ceac45159860 David Howells 2006-08-22 1789
63519fbc67d0d9 Trond Myklebust 2016-11-19 1790 /* Notify readdir to use READDIRPLUS */
63519fbc67d0d9 Trond Myklebust 2016-11-19 1791 nfs_force_use_readdirplus(dir);
d69ee9b85541a6 Trond Myklebust 2012-05-01 1792
^1da177e4c3f41 Linus Torvalds 2005-04-16 1793 no_entry:
41d28bca2da4bd Al Viro 2014-10-12 1794 res = d_splice_alias(inode, dentry);
9eaef27b36a6b7 Trond Myklebust 2006-10-21 1795 if (res != NULL) {
9eaef27b36a6b7 Trond Myklebust 2006-10-21 1796 if (IS_ERR(res))
ca3c213e9f9273 Anna Schumaker 2021-10-22 1797 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1798 dentry = res;
9eaef27b36a6b7 Trond Myklebust 2006-10-21 1799 }
a1147b8281bda9 Trond Myklebust 2020-02-05 1800 nfs_set_verifier(dentry, dir_verifier);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1801 out:
ca3c213e9f9273 Anna Schumaker 2021-10-22 1802 trace_nfs_lookup_exit(dir, dentry, flags, error);
e1fb4d05d5a326 Trond Myklebust 2010-04-16 1803 nfs_free_fattr(fattr);
e1fb4d05d5a326 Trond Myklebust 2010-04-16 1804 nfs_free_fhandle(fhandle);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1805 return res;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1806 }
ddda8e0aa8b955 Bryan Schumaker 2012-07-30 1807 EXPORT_SYMBOL_GPL(nfs_lookup);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1808 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH v2 6/14 NFS: Remove the nfs4_label from the nfs4_lookupp_res struct
In reply to [email protected]From: Anna Schumaker <[email protected]>
--- fs/nfs/export.c | 26 +++++++------------------- fs/nfs/nfs3proc.c | 2 +- fs/nfs/nfs4proc.c | 10 ++++------ fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 3 +-- 5 files changed, 14 insertions(+), 29 deletions(-)
fs/nfs/export.c +7 -19
@@ -131,7 +131,6 @@ nfs_get_parent(struct dentry *dentry)struct super_block *sb = inode->i_sb;struct nfs_server *server =NFS_SB (sb);struct nfs_fattr *fattr =NULL ; -struct nfs4_label *label =NULL ;struct dentry *parent;struct nfs_rpc_ops const *ops = server->nfs_client->rpc_ops;struct nfs_fh fh;
@@ -139,31 +138,20 @@ nfs_get_parent(struct dentry *dentry)if (!ops->lookupp)return ERR_PTR (-EACCES ); - fattr =nfs_alloc_fattr (); -if (fattr ==NULL ) { - parent =ERR_PTR (-ENOMEM ); - goto out; - } + fattr =nfs_alloc_fattr_with_label (server); +if (fattr ==NULL ) +return ERR_PTR (-ENOMEM ); - label =nfs4_label_alloc (server,GFP_KERNEL ); -if (IS_ERR (label)) { - parent =ERR_CAST (label); - goto out_free_fattr; - } - - ret = ops->lookupp (inode, &fh, fattr, label); + ret = ops->lookupp (inode, &fh, fattr);if (ret) { parent =ERR_PTR (ret); - goto out_free_label; + goto out; } - pinode =nfs_fhget (sb, &fh, fattr, label); + pinode =nfs_fhget (sb, &fh, fattr, fattr->label); parent =d_obtain_alias (pinode); -out_free_label: -nfs4_label_free (label); -out_free_fattr: -nfs_free_fattr (fattr); out: +nfs_free_fattr (fattr);return parent; }
fs/nfs/nfs3proc.c +1 -1
@@ -208,7 +208,7 @@ nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, }static int nfs3_proc_lookupp (struct inode *inode,struct nfs_fh *fhandle, -struct nfs_fattr *fattr,struct nfs4_label *label) +struct nfs_fattr *fattr) {const char dotdot[] =".." ;const size_t len =strlen (dotdot);
fs/nfs/nfs4proc.c +4 -6
@@ -4417,8 +4417,7 @@ nfs4_proc_lookup_mountpoint(struct inode *dir, struct dentry *dentry, }static int _nfs4_proc_lookupp (struct inode *inode, -struct nfs_fh *fhandle,struct nfs_fattr *fattr, -struct nfs4_label *label) +struct nfs_fh *fhandle,struct nfs_fattr *fattr) {struct rpc_clnt *clnt =NFS_CLIENT (inode);struct nfs_server *server =NFS_SERVER (inode);
@@ -4430,7 +4429,6 @@ static int _nfs4_proc_lookupp(struct inode *inode,struct nfs4_lookupp_res res = { .server = server, .fattr = fattr, - .label = label, .fh = fhandle, };struct rpc_message msg = {
@@ -4443,7 +4441,7 @@ static int _nfs4_proc_lookupp(struct inode *inode,if (NFS_SERVER (inode)->flags &NFS_MOUNT_SOFTREVAL ) task_flags |=RPC_TASK_TIMEOUT ; - args.bitmask =nfs4_bitmask (server, label); + args.bitmask =nfs4_bitmask (server, fattr->label);nfs_fattr_init (fattr);
@@ -4455,14 +4453,14 @@ static int _nfs4_proc_lookupp(struct inode *inode, }static int nfs4_proc_lookupp (struct inode *inode,struct nfs_fh *fhandle, -struct nfs_fattr *fattr,struct nfs4_label *label) +struct nfs_fattr *fattr) {struct nfs4_exception exception = { .interruptible = true, };int err; do { - err = _nfs4_proc_lookupp(inode, fhandle, fattr, label); + err = _nfs4_proc_lookupp(inode, fhandle, fattr); trace_nfs4_lookupp(inode, err); err = nfs4_handle_exception(NFS_SERVER(inode), err, &exception);
fs/nfs/nfs4xdr.c +1 -1
@@ -6209,7 +6209,7 @@ static int nfs4_xdr_dec_lookupp(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_getfh (xdr, res->fh);if (status) goto out; - status =decode_getfattr_label (xdr, res->fattr, res->label, res->server); + status =decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); out:return status; }
include/linux/nfs_xdr.h +1 -2
@@ -1108,7 +1108,6 @@ struct nfs4_lookupp_res {const struct nfs_server *server;struct nfs_fattr *fattr;struct nfs_fh *fh; -struct nfs4_label *label; };struct nfs4_lookup_root_arg {
@@ -1741,7 +1740,7 @@ struct nfs_rpc_ops {int (*lookup) (struct inode *,struct dentry *,struct nfs_fh *,struct nfs_fattr *);int (*lookupp) (struct inode *,struct nfs_fh *, -struct nfs_fattr *,struct nfs4_label *); +struct nfs_fattr *);int (*access) (struct inode *,struct nfs_access_entry *);int (*readlink)(struct inode *,struct page *,unsigned int ,unsigned int );
Signature · 1 line
2.33.1
PATCH v2 7/14 NFS: Remove the f_label from the nfs4_opendata and nfs_openres
In reply to [email protected]From: Anna Schumaker <[email protected]>
--- fs/nfs/nfs4_fs.h | 1 - fs/nfs/nfs4proc.c | 35 +++++++++++------------------------ fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 4 files changed, 12 insertions(+), 27 deletions(-)
fs/nfs/nfs4_fs.h +0 -1
@@ -234,7 +234,6 @@ struct nfs4_opendata {struct nfs4_string group_name;struct nfs4_label *a_label;struct nfs_fattr f_attr; -struct nfs4_label *f_label;struct dentry *dir;struct dentry *dentry;struct nfs4_state_owner *owner;
fs/nfs/nfs4proc.c +11 -24
@@ -1329,7 +1329,6 @@ nfs4_map_atomic_open_claim(struct nfs_server *server,static void nfs4_init_opendata_res (struct nfs4_opendata *p) { p->o_res.f_attr = &p->f_attr; - p->o_res.f_label = p->f_label; p->o_res.seqid = p->o_arg.seqid; p->c_res.seqid = p->c_arg.seqid; p->o_res.server = p->o_arg.server;
@@ -1355,8 +1354,8 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,if (p ==NULL ) goto err; - p->f_label =nfs4_label_alloc (server, gfp_mask); -if (IS_ERR (p->f_label)) + p->f_attr.label =nfs4_label_alloc (server, gfp_mask); +if (IS_ERR (p->f_attr.label)) goto err_free_p; p->a_label =nfs4_label_alloc (server, gfp_mask);
@@ -1439,7 +1438,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, err_free_label:nfs4_label_free (p->a_label); err_free_f: -nfs4_label_free (p->f_label); +nfs4_label_free (p->f_attr.label); err_free_p:kfree (p); err:
@@ -1461,7 +1460,7 @@ static void nfs4_opendata_free(struct kref *kref)nfs4_put_state_owner (p->owner);nfs4_label_free (p->a_label); -nfs4_label_free (p->f_label); +nfs4_label_free (p->f_attr.label);dput (p->dir);dput (p->dentry);
@@ -2013,7 +2012,7 @@ nfs4_opendata_get_inode(struct nfs4_opendata *data)if (!(data->f_attr.valid &NFS_ATTR_FATTR ))return ERR_PTR (-EAGAIN ); inode =nfs_fhget (data->dir->d_sb, &data->o_res.fh, - &data->f_attr, data->f_label); + &data->f_attr, data->f_attr.label);break ;default : inode =d_inode (data->dentry);
@@ -2709,7 +2708,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data,if (!(o_res->f_attr->valid &NFS_ATTR_FATTR )) {nfs4_sequence_free_slot (&o_res->seq_res);nfs4_proc_getattr (server, &o_res->fh, o_res->f_attr, - o_res->f_label,NULL ); + o_res->f_attr->label,NULL ); }return 0 ; }
@@ -3125,7 +3124,6 @@ static int _nfs4_do_open(struct inode *dir,enum open_claim_type4 claim =NFS4_OPEN_CLAIM_NULL ;struct iattr *sattr = c->sattr;struct nfs4_label *label = c->label; -struct nfs4_label *olabel =NULL ;int status;/* Protect against reboot recovery conflicts */
@@ -3148,19 +3146,11 @@ static int _nfs4_do_open(struct inode *dir,if (opendata ==NULL ) goto err_put_state_owner; -if (label) { - olabel =nfs4_label_alloc (server,GFP_KERNEL ); -if (IS_ERR (olabel)) { - status =PTR_ERR (olabel); - goto err_opendata_put; - } - } -if (server->attr_bitmask[2 ] &FATTR4_WORD2_MDSTHRESHOLD ) {if (!opendata->f_attr.mdsthreshold) { opendata->f_attr.mdsthreshold =pnfs_mdsthreshold_alloc ();if (!opendata->f_attr.mdsthreshold) - goto err_free_label; + goto err_opendata_put; } opendata->o_arg.open_bitmap = &nfs4_pnfs_open_bitmap[0 ]; }
@@ -3169,7 +3159,7 @@ static int _nfs4_do_open(struct inode *dir, status =_nfs4_open_and_get_state (opendata, flags, ctx);if (status !=0 ) - goto err_free_label; + goto err_opendata_put; state = ctx->state; if ((opendata->o_arg.open_flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) &&
@@ -3186,11 +3176,12 @@ static int _nfs4_do_open(struct inode *dir,nfs_fattr_init (opendata->o_res.f_attr); status =nfs4_do_setattr (state->inode, cred, opendata->o_res.f_attr, sattr, - ctx, label, olabel); + ctx, label, opendata->o_res.f_attr->label);if (status ==0 ) {nfs_setattr_update_inode (state->inode, sattr, opendata->o_res.f_attr); -nfs_setsecurity (state->inode, opendata->o_res.f_attr, olabel); +nfs_setsecurity (state->inode, opendata->o_res.f_attr, + opendata->o_res.f_attr->label); } sattr->ia_valid = ia_old; }
@@ -3203,13 +3194,9 @@ static int _nfs4_do_open(struct inode *dir, opendata->f_attr.mdsthreshold =NULL ; } -nfs4_label_free (olabel); -nfs4_opendata_put (opendata);nfs4_put_state_owner (sp);return 0 ; -err_free_label: -nfs4_label_free (olabel); err_opendata_put:nfs4_opendata_put (opendata); err_put_state_owner:
fs/nfs/nfs4xdr.c +1 -1
@@ -6532,7 +6532,7 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr, goto out;if (res->access_request)decode_access (xdr, &res->access_supported, &res->access_result); -decode_getfattr_label (xdr, res->f_attr, res->f_label, res->server); +decode_getfattr_label (xdr, res->f_attr, res->f_attr->label, res->server);if (res->lg_res)decode_layoutget (xdr, rqstp, res->lg_res); out:
include/linux/nfs_xdr.h +0 -1
@@ -488,7 +488,6 @@ struct nfs_openres {struct nfs4_change_info cinfo;__u32 rflags;struct nfs_fattr * f_attr; -struct nfs4_label *f_label;struct nfs_seqid * seqid;const struct nfs_server *server;fmode_t delegation_type;
Signature · 1 line
2.33.1
PATCH v2 8/14 NFS: Remove the nfs4_label from the nfs4_getattr_res
In reply to [email protected]From: Anna Schumaker <[email protected]>
--- fs/nfs/client.c | 2 +- fs/nfs/dir.c | 2 +- fs/nfs/export.c | 18 ++++-------------- fs/nfs/inode.c | 20 +++++--------------- fs/nfs/nfs3proc.c | 3 +-- fs/nfs/nfs4_fs.h | 3 +-- fs/nfs/nfs4file.c | 2 +- fs/nfs/nfs4proc.c | 25 +++++++++++-------------- fs/nfs/nfs4xdr.c | 2 +- fs/nfs/proc.c | 3 +-- include/linux/nfs_xdr.h | 4 +--- 11 files changed, 28 insertions(+), 56 deletions(-)
fs/nfs/client.c +1 -1
@@ -1025,7 +1025,7 @@ struct nfs_server *nfs_create_server(struct fs_context *fc)if (!(fattr->valid &NFS_ATTR_FATTR )) { error = ctx->nfs_mod->rpc_ops->getattr (server, ctx->mntfh, - fattr,NULL ,NULL ); + fattr,NULL );if (error <0 ) {dprintk ("nfs_create_server: getattr error = %d\n" , -error); goto error;
fs/nfs/dir.c +1 -1
@@ -2054,7 +2054,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle,if (!(fattr->valid &NFS_ATTR_FATTR )) {struct nfs_server *server =NFS_SB (dentry->d_sb); error = server->nfs_client->rpc_ops->getattr (server, fhandle, - fattr,NULL ,NULL ); + fattr,NULL );if (error <0 ) goto out_error; }
fs/nfs/export.c +4 -14
@@ -64,7 +64,6 @@ static struct dentry * nfs_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { - struct nfs4_label *label = NULL; struct nfs_fattr *fattr = NULL;struct nfs_fh *server_fh =nfs_exp_embedfh (fid->raw);size_t fh_size = offsetof(struct nfs_fh , data) + server_fh->size;
@@ -79,7 +78,7 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid,if (fh_len < len || fh_type != len)return NULL ; - fattr =nfs_alloc_fattr (); + fattr =nfs_alloc_fattr_with_label (NFS_SB (sb));if (fattr ==NULL ) { dentry =ERR_PTR (-ENOMEM ); goto out;
@@ -95,28 +94,19 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid,if (inode) goto out_found; - label =nfs4_label_alloc (NFS_SB (sb),GFP_KERNEL ); -if (IS_ERR (label)) { - dentry =ERR_CAST (label); - goto out_free_fattr; - } - rpc_ops =NFS_SB (sb)->nfs_client->rpc_ops; - ret = rpc_ops->getattr (NFS_SB (sb), server_fh, fattr, label,NULL ); + ret = rpc_ops->getattr (NFS_SB (sb), server_fh, fattr,NULL );if (ret) {dprintk ("%s: getattr failed %d\n" , __func__, ret);trace_nfs_fh_to_dentry (sb, server_fh, fattr->fileid, ret); dentry =ERR_PTR (ret); - goto out_free_label; + goto out_free_fattr; } - inode =nfs_fhget (sb, server_fh, fattr, label); + inode =nfs_fhget (sb, server_fh, fattr, fattr->label); out_found: dentry =d_obtain_alias (inode); - -out_free_label: -nfs4_label_free (label); out_free_fattr:nfs_free_fattr (fattr); out:
fs/nfs/inode.c +5 -15
@@ -1175,7 +1175,6 @@ int __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) { int status = -ESTALE; -struct nfs4_label *label =NULL ;struct nfs_fattr *fattr =NULL ;struct nfs_inode *nfsi =NFS_I (inode);
@@ -1197,20 +1196,13 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) } status = -ENOMEM ; - fattr =nfs_alloc_fattr (); + fattr =nfs_alloc_fattr_with_label (NFS_SERVER (inode));if (fattr ==NULL ) goto out;nfs_inc_stats (inode,NFSIOS_INODEREVALIDATE ); - label =nfs4_label_alloc (NFS_SERVER (inode),GFP_KERNEL ); -if (IS_ERR (label)) { - status =PTR_ERR (label); - goto out; - } - - status =NFS_PROTO (inode)->getattr (server,NFS_FH (inode), fattr, - label, inode); + status =NFS_PROTO (inode)->getattr (server,NFS_FH (inode), fattr, inode);if (status !=0 ) { dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) getattr failed, error=%d\n", inode->i_sb->s_id,
@@ -1227,7 +1219,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)else nfs_zap_caches (inode); } - goto err_out; + goto out; } status =nfs_refresh_inode (inode, fattr);
@@ -1235,20 +1227,18 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)dfprintk (PAGECACHE ,"nfs_revalidate_inode: (%s/%Lu) refresh failed, error=%d\n" , inode->i_sb->s_id, (unsigned long long )NFS_FILEID (inode), status); - goto err_out; + goto out; }if (nfsi->cache_validity &NFS_INO_INVALID_ACL )nfs_zap_acl_cache (inode); -nfs_setsecurity (inode, fattr, label); +nfs_setsecurity (inode, fattr, fattr->label);dfprintk (PAGECACHE ,"NFS: (%s/%Lu) revalidation complete\n" , inode->i_sb->s_id, (unsigned long long )NFS_FILEID (inode)); -err_out: -nfs4_label_free (label); out:nfs_free_fattr (fattr);trace_nfs_revalidate_inode_exit (inode, status);
fs/nfs/nfs3proc.c +1 -2
@@ -100,8 +100,7 @@ nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,*/ static int nfs3_proc_getattr (struct nfs_server *server,struct nfs_fh *fhandle, -struct nfs_fattr *fattr,struct nfs4_label *label, -struct inode *inode) +struct nfs_fattr *fattr,struct inode *inode) {struct rpc_message msg = { .rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR ],
fs/nfs/nfs4_fs.h +1 -2
@@ -316,8 +316,7 @@ extern int nfs4_set_rw_stateid(nfs4_stateid *stateid,const struct nfs_lock_context *l_ctx, fmode_t fmode);extern int nfs4_proc_getattr (struct nfs_server *server,struct nfs_fh *fhandle, -struct nfs_fattr *fattr,struct nfs4_label *label, -struct inode *inode); +struct nfs_fattr *fattr,struct inode *inode); extern int update_open_stateid(struct nfs4_state *state, const nfs4_stateid *open_stateid, const nfs4_stateid *deleg_stateid,
fs/nfs/nfs4file.c +1 -1
@@ -330,7 +330,7 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt,nfs_fattr_init (&fattr); - status =nfs4_proc_getattr (server, src_fh, &fattr,NULL ,NULL ); + status =nfs4_proc_getattr (server, src_fh, &fattr,NULL );if (status <0 ) { res =ERR_PTR (status); goto out;
fs/nfs/nfs4proc.c +11 -14
@@ -93,7 +93,8 @@ struct nfs4_opendata;static int _nfs4_recover_proc_open (struct nfs4_opendata *data);static int nfs4_do_fsinfo (struct nfs_server *,struct nfs_fh *,struct nfs_fsinfo *);static void nfs_fixup_referral_attributes (struct nfs_fattr *fattr); -static int _nfs4_proc_getattr (struct nfs_server *server,struct nfs_fh *fhandle,struct nfs_fattr *fattr,struct nfs4_label *label,struct inode *inode); +static int _nfs4_proc_getattr (struct nfs_server *server,struct nfs_fh *fhandle, +struct nfs_fattr *fattr,struct inode *inode); static int nfs4_do_setattr(struct inode *inode, const struct cred *cred, struct nfs_fattr *fattr, struct iattr *sattr, struct nfs_open_context *ctx, struct nfs4_label *ilabel,
@@ -2707,8 +2708,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data, }if (!(o_res->f_attr->valid &NFS_ATTR_FATTR )) {nfs4_sequence_free_slot (&o_res->seq_res); -nfs4_proc_getattr (server, &o_res->fh, o_res->f_attr, - o_res->f_attr->label,NULL ); +nfs4_proc_getattr (server, &o_res->fh, o_res->f_attr,NULL ); }return 0 ; }
@@ -4091,7 +4091,6 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *mntfh, {int error;struct nfs_fattr *fattr = info->fattr; -struct nfs4_label *label = fattr->label; error =nfs4_server_capabilities (server, mntfh);if (error <0 ) {
@@ -4099,7 +4098,7 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *mntfh,return error; } - error =nfs4_proc_getattr (server, mntfh, fattr, label,NULL ); + error =nfs4_proc_getattr (server, mntfh, fattr,NULL );if (error <0 ) {dprintk ("nfs4_get_root: getattr error = %d\n" , -error); goto out;
@@ -4162,8 +4161,7 @@ static int nfs4_get_referral(struct rpc_clnt *client, struct inode *dir, }static int _nfs4_proc_getattr (struct nfs_server *server,struct nfs_fh *fhandle, -struct nfs_fattr *fattr,struct nfs4_label *label, -struct inode *inode) +struct nfs_fattr *fattr,struct inode *inode) {__u32 bitmask[NFS4_BITMASK_SZ ];struct nfs4_getattr_arg args = {
@@ -4172,7 +4170,6 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, };struct nfs4_getattr_res res = { .fattr = fattr, - .label = label, .server = server, };struct rpc_message msg = {
@@ -4189,7 +4186,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,if (inode && (server->flags &NFS_MOUNT_SOFTREVAL )) task_flags |=RPC_TASK_TIMEOUT ; -nfs4_bitmap_copy_adjust (bitmask,nfs4_bitmask (server, label), inode,0 ); +nfs4_bitmap_copy_adjust (bitmask,nfs4_bitmask (server, fattr->label), inode,0 );nfs_fattr_init (fattr);nfs4_init_sequence (&args.seq_args, &res.seq_res,0 ,0 ); return nfs4_do_call_sync(server->client, server, &msg,
@@ -4197,15 +4194,14 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, }int nfs4_proc_getattr (struct nfs_server *server,struct nfs_fh *fhandle, -struct nfs_fattr *fattr,struct nfs4_label *label, -struct inode *inode) +struct nfs_fattr *fattr,struct inode *inode) {struct nfs4_exception exception = { .interruptible = true, };int err; do { - err = _nfs4_proc_getattr(server, fhandle, fattr, label, inode); + err = _nfs4_proc_getattr(server, fhandle, fattr, inode); trace_nfs4_getattr(server, fhandle, fattr, err); err = nfs4_handle_exception(server, err, &exception);
@@ -5975,17 +5971,18 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, size_t buflen) {struct nfs_server *server =NFS_SERVER (inode); -struct nfs_fattr fattr;struct nfs4_label label = {0 ,0 , buflen, buf};u32 bitmask[3 ] = {0 ,0 ,FATTR4_WORD2_SECURITY_LABEL }; +struct nfs_fattr fattr = { + .label = &label, + };struct nfs4_getattr_arg arg = { .fh =NFS_FH (inode), .bitmask = bitmask, };struct nfs4_getattr_res res = { .fattr = &fattr, - .label = &label, .server = server, };struct rpc_message msg = {
fs/nfs/nfs4xdr.c +1 -1
@@ -6394,7 +6394,7 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_putfh (xdr);if (status) goto out; - status =decode_getfattr_label (xdr, res->fattr, res->label, res->server); + status =decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); out:return status; }
fs/nfs/proc.c +1 -2
@@ -100,8 +100,7 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,*/ static int nfs_proc_getattr (struct nfs_server *server,struct nfs_fh *fhandle, -struct nfs_fattr *fattr,struct nfs4_label *label, -struct inode *inode) +struct nfs_fattr *fattr,struct inode *inode) {struct rpc_message msg = { .rpc_proc = &nfs_procedures[NFSPROC_GETATTR ],
include/linux/nfs_xdr.h +1 -3
@@ -1063,7 +1063,6 @@ struct nfs4_getattr_res {struct nfs4_sequence_res seq_res;const struct nfs_server * server;struct nfs_fattr * fattr; -struct nfs4_label *label; };struct nfs4_link_arg {
@@ -1732,8 +1731,7 @@ struct nfs_rpc_ops {int (*submount) (struct fs_context *,struct nfs_server *);int (*try_get_tree) (struct fs_context *);int (*getattr) (struct nfs_server *,struct nfs_fh *, -struct nfs_fattr *,struct nfs4_label *, -struct inode *); +struct nfs_fattr *,struct inode *);int (*setattr) (struct dentry *,struct nfs_fattr *,struct iattr *); int (*lookup) (struct inode *, struct dentry *,
Signature · 1 line
2.33.1
PATCH v2 9/14 NFS: Remove the nfs4_label from the nfs_setattrres
In reply to [email protected]From: Anna Schumaker <[email protected]>
--- fs/nfs/inode.c | 2 +- fs/nfs/nfs4proc.c | 56 ++++++++++++----------------------------- fs/nfs/nfs4xdr.c | 2 +- include/linux/nfs_xdr.h | 1 - 4 files changed, 18 insertions(+), 43 deletions(-)
fs/nfs/inode.c +1 -1
@@ -632,7 +632,7 @@ nfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,if (S_ISREG (inode->i_mode))nfs_sync_inode (inode); - fattr =nfs_alloc_fattr (); + fattr =nfs_alloc_fattr_with_label (NFS_SERVER (inode));if (fattr ==NULL ) { error = -ENOMEM ; goto out;
fs/nfs/nfs4proc.c +16 -40
142 lines not on this page · raw message
fs/nfs/nfs4xdr.c +1 -1
@@ -6616,7 +6616,7 @@ static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, status =decode_setattr (xdr);if (status) goto out; -decode_getfattr_label (xdr, res->fattr, res->label, res->server); +decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); out:return status; }
include/linux/nfs_xdr.h +0 -1
@@ -832,7 +832,6 @@ struct nfs_getaclres {struct nfs_setattrres {struct nfs4_sequence_res seq_res;struct nfs_fattr * fattr; -struct nfs4_label *label;const struct nfs_server * server; };
Signature · 1 line
2.33.1
PATCH v2 10/14 NFS: Remove the nfs4_label argument from nfs_instantiate()
In reply to [email protected]From: Anna Schumaker <[email protected]>
Pull the label from the fattr instead.
--- fs/nfs/dir.c | 5 ++--- fs/nfs/nfs4proc.c | 2 +- fs/nfs/proc.c | 8 ++++---- include/linux/nfs_fs.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-)
fs/nfs/dir.c +2 -3
@@ -2073,12 +2073,11 @@ EXPORT_SYMBOL_GPL(nfs_add_or_obtain);* Code common to create, mkdir, and mknod. */ int nfs_instantiate (struct dentry *dentry,struct nfs_fh *fhandle, -struct nfs_fattr *fattr, -struct nfs4_label *label) +struct nfs_fattr *fattr) {struct dentry *d; - d =nfs_add_or_obtain (dentry, fhandle, fattr, label); + d =nfs_add_or_obtain (dentry, fhandle, fattr, fattr->label);if (IS_ERR (d))return PTR_ERR (d);
fs/nfs/nfs4proc.c +1 -1
@@ -4860,7 +4860,7 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_ data->res.fattr->time_start, NFS_INO_INVALID_DATA);spin_unlock (&dir->i_lock); - status =nfs_instantiate (dentry, data->res.fh, data->res.fattr, data->res.fattr->label); + status =nfs_instantiate (dentry, data->res.fh, data->res.fattr); }return status; }
fs/nfs/proc.c +4 -4
@@ -255,7 +255,7 @@ nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, status =rpc_call_sync (NFS_CLIENT (dir), &msg,0 );nfs_mark_for_revalidate (dir);if (status ==0 ) - status =nfs_instantiate (dentry, data->res.fh, data->res.fattr,NULL ); + status =nfs_instantiate (dentry, data->res.fh, data->res.fattr);nfs_free_createdata (data); out:dprintk ("NFS reply create: %d\n" , status);
@@ -302,7 +302,7 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, status =rpc_call_sync (NFS_CLIENT (dir), &msg,0 ); }if (status ==0 ) - status =nfs_instantiate (dentry, data->res.fh, data->res.fattr,NULL ); + status =nfs_instantiate (dentry, data->res.fh, data->res.fattr);nfs_free_createdata (data); out:dprintk ("NFS reply mknod: %d\n" , status);
@@ -434,7 +434,7 @@ nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,* should fill in the data with a LOOKUP call on the wire. */ if (status ==0 ) - status =nfs_instantiate (dentry, fh, fattr,NULL ); + status =nfs_instantiate (dentry, fh, fattr); out_free:nfs_free_fattr (fattr);
@@ -463,7 +463,7 @@ nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) status =rpc_call_sync (NFS_CLIENT (dir), &msg,0 );nfs_mark_for_revalidate (dir);if (status ==0 ) - status =nfs_instantiate (dentry, data->res.fh, data->res.fattr,NULL ); + status =nfs_instantiate (dentry, data->res.fh, data->res.fattr);nfs_free_createdata (data); out:dprintk ("NFS reply mkdir: %d\n" , status);
include/linux/nfs_fs.h +1 -1
@@ -527,7 +527,7 @@ extern struct dentry *nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr, struct nfs4_label *label);extern int nfs_instantiate (struct dentry *dentry,struct nfs_fh *fh, -struct nfs_fattr *fattr,struct nfs4_label *label); +struct nfs_fattr *fattr);extern int nfs_may_open (struct inode *inode,const struct cred *cred,int openflags);extern void nfs_access_zap_cache (struct inode *inode); extern int nfs_access_get_cached(struct inode *inode, const struct cred *cred, struct nfs_access_entry *res,
Signature · 1 line
2.33.1
PATCH v2 11/14 NFS: Remove the nfs4_label argument from nfs_add_or_obtain()
In reply to [email protected]From: Anna Schumaker <[email protected]>
--- fs/nfs/dir.c | 7 +++---- fs/nfs/nfs3proc.c | 2 +- include/linux/nfs_fs.h | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-)
fs/nfs/dir.c +3 -4
@@ -2034,8 +2034,7 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags)struct dentry *nfs_add_or_obtain (struct dentry *dentry,struct nfs_fh *fhandle, -struct nfs_fattr *fattr, -struct nfs4_label *label) +struct nfs_fattr *fattr) {struct dentry *parent =dget_parent (dentry);struct inode *dir =d_inode (parent);
@@ -2058,7 +2057,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle,if (error <0 ) goto out_error; } - inode =nfs_fhget (dentry->d_sb, fhandle, fattr, label); + inode =nfs_fhget (dentry->d_sb, fhandle, fattr, fattr->label); d =d_splice_alias (inode, dentry); out:dput (parent);
@@ -2077,7 +2076,7 @@ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle, {struct dentry *d; - d =nfs_add_or_obtain (dentry, fhandle, fattr, fattr->label); + d =nfs_add_or_obtain (dentry, fhandle, fattr);if (IS_ERR (d))return PTR_ERR (d);
fs/nfs/nfs3proc.c +1 -1
@@ -321,7 +321,7 @@ nfs3_do_create(struct inode *dir, struct dentry *dentry, struct nfs3_createdataif (status !=0 )return ERR_PTR (status); -return nfs_add_or_obtain (dentry, data->res.fh, data->res.fattr,NULL ); +return nfs_add_or_obtain (dentry, data->res.fh, data->res.fattr); }static void nfs3_free_createdata (struct nfs3_createdata *data)
include/linux/nfs_fs.h +1 -2
@@ -524,8 +524,7 @@ extern void nfs_set_verifier(struct dentry * dentry, unsigned long verf);extern void nfs_clear_verifier_delegated (struct inode *inode);#endif /* IS_ENABLED(CONFIG_NFS_V4) */ extern struct dentry *nfs_add_or_obtain (struct dentry *dentry, -struct nfs_fh *fh,struct nfs_fattr *fattr, -struct nfs4_label *label); +struct nfs_fh *fh,struct nfs_fattr *fattr);extern int nfs_instantiate (struct dentry *dentry,struct nfs_fh *fh,struct nfs_fattr *fattr);extern int nfs_may_open (struct inode *inode,const struct cred *cred,int openflags);
Signature · 1 line
2.33.1
PATCH v2 12/14 NFS: Remove the nfs4_label argument from nfs_fhget()
In reply to [email protected]From: Anna Schumaker <[email protected]>
--- fs/nfs/dir.c | 6 +++--- fs/nfs/export.c | 4 ++-- fs/nfs/getroot.c | 2 +- fs/nfs/inode.c | 4 ++-- fs/nfs/nfs4file.c | 3 +-- fs/nfs/nfs4proc.c | 2 +- include/linux/nfs_fs.h | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-)
fs/nfs/dir.c +3 -3
@@ -695,7 +695,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry, goto out; } - inode =nfs_fhget (dentry->d_sb, entry->fh, entry->fattr, entry->fattr->label); + inode =nfs_fhget (dentry->d_sb, entry->fh, entry->fattr); alias =d_splice_alias (inode, dentry);d_lookup_done (dentry);if (alias) {
@@ -1780,7 +1780,7 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in res =ERR_PTR (error); goto out; } - inode =nfs_fhget (dentry->d_sb, fhandle, fattr, fattr->label); + inode =nfs_fhget (dentry->d_sb, fhandle, fattr); res =ERR_CAST (inode);if (IS_ERR (res)) goto out;
@@ -2057,7 +2057,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle,if (error <0 ) goto out_error; } - inode =nfs_fhget (dentry->d_sb, fhandle, fattr, fattr->label); + inode =nfs_fhget (dentry->d_sb, fhandle, fattr); d =d_splice_alias (inode, dentry); out:dput (parent);
fs/nfs/export.c +2 -2
@@ -103,7 +103,7 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid, goto out_free_fattr; } - inode =nfs_fhget (sb, server_fh, fattr, fattr->label); + inode =nfs_fhget (sb, server_fh, fattr); out_found: dentry =d_obtain_alias (inode);
@@ -138,7 +138,7 @@ nfs_get_parent(struct dentry *dentry) goto out; } - pinode =nfs_fhget (sb, &fh, fattr, fattr->label); + pinode =nfs_fhget (sb, &fh, fattr); parent =d_obtain_alias (pinode); out:nfs_free_fattr (fattr);
fs/nfs/getroot.c +1 -1
@@ -91,7 +91,7 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) goto out_fattr; } - inode =nfs_fhget (s, ctx->mntfh, fsinfo.fattr,NULL ); + inode =nfs_fhget (s, ctx->mntfh, fsinfo.fattr);if (IS_ERR (inode)) {dprintk ("nfs_get_root: get root inode failed\n" ); error =PTR_ERR (inode);
fs/nfs/inode.c +2 -2
@@ -431,7 +431,7 @@ nfs_ilookup(struct super_block *sb, struct nfs_fattr *fattr, struct nfs_fh *fh)* instead of inode number. */ struct inode * -nfs_fhget (struct super_block *sb,struct nfs_fh *fh,struct nfs_fattr *fattr,struct nfs4_label *label) +nfs_fhget (struct super_block *sb,struct nfs_fh *fh,struct nfs_fattr *fattr) {struct nfs_find_desc desc = { .fh = fh,
@@ -563,7 +563,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st fattr->size != 0)nfs_set_cache_invalid (inode,NFS_INO_INVALID_BLOCKS ); -nfs_setsecurity (inode, fattr, label); +nfs_setsecurity (inode, fattr, fattr->label); nfsi->attrtimeo =NFS_MINATTRTIMEO (inode); nfsi->attrtimeo_timestamp = now;
fs/nfs/nfs4file.c +1 -2
@@ -343,8 +343,7 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt, goto out;snprintf (read_name, len,SSC_READ_NAME_BODY , read_name_gen++); - r_ino =nfs_fhget (ss_mnt->mnt_root->d_inode->i_sb, src_fh, &fattr, -NULL ); + r_ino =nfs_fhget (ss_mnt->mnt_root->d_inode->i_sb, src_fh, &fattr);if (IS_ERR (r_ino)) { res =ERR_CAST (r_ino); goto out_free_name;
fs/nfs/nfs4proc.c +1 -1
@@ -2012,7 +2012,7 @@ nfs4_opendata_get_inode(struct nfs4_opendata *data)if (!(data->f_attr.valid &NFS_ATTR_FATTR ))return ERR_PTR (-EAGAIN ); inode =nfs_fhget (data->dir->d_sb, &data->o_res.fh, - &data->f_attr, data->f_attr.label); + &data->f_attr);break ;default : inode =d_inode (data->dentry);
include/linux/nfs_fs.h +1 -1
@@ -383,7 +383,7 @@ extern void nfs_zap_caches(struct inode *);extern void nfs_set_inode_stale (struct inode *inode);extern void nfs_invalidate_atime (struct inode *);extern struct inode *nfs_fhget (struct super_block *,struct nfs_fh *, -struct nfs_fattr *,struct nfs4_label *); +struct nfs_fattr *);struct inode *nfs_ilookup (struct super_block *sb,struct nfs_fattr *,struct nfs_fh *);extern int nfs_refresh_inode (struct inode *,struct nfs_fattr *);extern int nfs_post_op_update_inode (struct inode *inode,struct nfs_fattr *fattr);
Signature · 1 line
2.33.1
PATCH v2 13/14 NFS: Remove the nfs4_label argument from nfs_setsecurity
In reply to [email protected]From: Anna Schumaker <[email protected]>
--- fs/nfs/dir.c | 5 ++--- fs/nfs/getroot.c | 2 +- fs/nfs/inode.c | 20 +++++++++----------- fs/nfs/nfs4proc.c | 9 ++++----- include/linux/nfs_fs.h | 3 +-- 5 files changed, 17 insertions(+), 22 deletions(-)
fs/nfs/dir.c +2 -3
@@ -680,8 +680,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry,nfs_set_verifier (dentry, dir_verifier); status =nfs_refresh_inode (d_inode (dentry), entry->fattr);if (!status) -nfs_setsecurity (d_inode (dentry), entry->fattr, - entry->fattr->label); +nfs_setsecurity (d_inode (dentry), entry->fattr); goto out; }else {d_invalidate (dentry);
@@ -1517,7 +1516,7 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry,if (nfs_refresh_inode (inode, fattr) <0 ) goto out; -nfs_setsecurity (inode, fattr, fattr->label); +nfs_setsecurity (inode, fattr);nfs_set_verifier (dentry, dir_verifier);/* set a readdirplus hint that we had a cache miss */
fs/nfs/getroot.c +1 -1
@@ -148,7 +148,7 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc) !(kflags_out & SECURITY_LSM_NATIVE_LABELS)) server->caps &= ~NFS_CAP_SECURITY_LABEL; -nfs_setsecurity (inode, fsinfo.fattr, fsinfo.fattr->label); +nfs_setsecurity (inode, fsinfo.fattr); error =0 ; out_fattr:
fs/nfs/inode.c +9 -11
@@ -350,23 +350,22 @@ static void nfs_clear_label_invalid(struct inode *inode)spin_unlock (&inode->i_lock); } -void nfs_setsecurity (struct inode *inode,struct nfs_fattr *fattr, -struct nfs4_label *label) +void nfs_setsecurity (struct inode *inode,struct nfs_fattr *fattr) {int error; -if (label ==NULL ) +if (fattr->label ==NULL )return ;if ((fattr->valid &NFS_ATTR_FATTR_V4_SECURITY_LABEL ) && inode->i_security) { - error =security_inode_notifysecctx (inode, label->label, - label->len); + error =security_inode_notifysecctx (inode, fattr->label->label, + fattr->label->len);if (error)printk (KERN_ERR "%s() %s %d " "security_inode_notifysecctx() %d\n" , __func__, - (char *)label->label, - label->len, error); + (char *)fattr->label->label, + fattr->label->len, error);nfs_clear_label_invalid (inode); } }
@@ -397,8 +396,7 @@ struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) }EXPORT_SYMBOL_GPL (nfs4_label_alloc);#else -void nfs_setsecurity (struct inode *inode,struct nfs_fattr *fattr, -struct nfs4_label *label) +void nfs_setsecurity (struct inode *inode,struct nfs_fattr *fattr) { }#endif
@@ -563,7 +561,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) fattr->size != 0)nfs_set_cache_invalid (inode,NFS_INO_INVALID_BLOCKS ); -nfs_setsecurity (inode, fattr, fattr->label); +nfs_setsecurity (inode, fattr); nfsi->attrtimeo =NFS_MINATTRTIMEO (inode); nfsi->attrtimeo_timestamp = now;
@@ -1233,7 +1231,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)if (nfsi->cache_validity &NFS_INO_INVALID_ACL )nfs_zap_acl_cache (inode); -nfs_setsecurity (inode, fattr, fattr->label); +nfs_setsecurity (inode, fattr); dfprintk(PAGECACHE, "NFS: (%s/%Lu) revalidation complete\n", inode->i_sb->s_id,
fs/nfs/nfs4proc.c +4 -5
@@ -3179,8 +3179,7 @@ static int _nfs4_do_open(struct inode *dir,if (status ==0 ) {nfs_setattr_update_inode (state->inode, sattr, opendata->o_res.f_attr); -nfs_setsecurity (state->inode, opendata->o_res.f_attr, - opendata->o_res.f_attr->label); +nfs_setsecurity (state->inode, opendata->o_res.f_attr); } sattr->ia_valid = ia_old; }
@@ -4262,7 +4261,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, status =nfs4_do_setattr (inode, cred, fattr, sattr, ctx,NULL );if (status ==0 ) {nfs_setattr_update_inode (inode, sattr, fattr); -nfs_setsecurity (inode, fattr, fattr->label); +nfs_setsecurity (inode, fattr); }return status; }
@@ -4783,7 +4782,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const structnfs4_inc_nlink (inode); status =nfs_post_op_update_inode (inode, res.fattr);if (!status) -nfs_setsecurity (inode, res.fattr, res.fattr->label); +nfs_setsecurity (inode, res.fattr); } out:
@@ -6080,7 +6079,7 @@ nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen) status =nfs4_do_set_security_label (inode, &ilabel, fattr);if (status ==0 ) -nfs_setsecurity (inode, fattr, fattr->label); +nfs_setsecurity (inode, fattr);return status; }
include/linux/nfs_fs.h +1 -2
@@ -404,8 +404,7 @@ extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapextern int nfs_revalidate_mapping_rcu (struct inode *inode);extern int nfs_setattr (struct user_namespace *,struct dentry *,struct iattr *);extern void nfs_setattr_update_inode (struct inode *inode,struct iattr *attr,struct nfs_fattr *); -extern void nfs_setsecurity (struct inode *inode,struct nfs_fattr *fattr, -struct nfs4_label *label); +extern void nfs_setsecurity (struct inode *inode,struct nfs_fattr *fattr);extern struct nfs_open_context *get_nfs_open_context (struct nfs_open_context *ctx);extern void put_nfs_open_context (struct nfs_open_context *ctx);extern struct nfs_open_context *nfs_find_open_context (struct inode *inode,const struct cred *cred,fmode_t mode);
Signature · 1 line
2.33.1
PATCH v2 14/14 NFS: Remove the nfs4_label argument from decode_getattr_*() functions
In reply to [email protected]From: Anna Schumaker <[email protected]>
Wa can check if the fattr has an allocated label when needed
--- fs/nfs/nfs4xdr.c | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-)
fs/nfs/nfs4xdr.c +17 -26
@@ -4582,8 +4582,7 @@ static int decode_attr_mdsthreshold(struct xdr_stream *xdr,static int decode_getfattr_attrs (struct xdr_stream *xdr,uint32_t *bitmap,struct nfs_fattr *fattr,struct nfs_fh *fh, -struct nfs4_fs_locations *fs_loc,struct nfs4_label *label, -const struct nfs_server *server) +struct nfs4_fs_locations *fs_loc,const struct nfs_server *server) {int status;umode_t fmode =0 ;
@@ -4698,8 +4697,8 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap,if (status <0 ) goto xdr_error; -if (label) { - status =decode_attr_security_label (xdr, bitmap, label); +if (fattr->label) { + status =decode_attr_security_label (xdr, bitmap, fattr->label);if (status <0 ) goto xdr_error; fattr->valid |= status;
@@ -4712,7 +4711,7 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap,static int decode_getfattr_generic (struct xdr_stream *xdr,struct nfs_fattr *fattr,struct nfs_fh *fh,struct nfs4_fs_locations *fs_loc, -struct nfs4_label *label,const struct nfs_server *server) +const struct nfs_server *server) {unsigned int savep; uint32_t attrlen,
@@ -4731,8 +4730,7 @@ static int decode_getfattr_generic(struct xdr_stream *xdr, struct nfs_fattr *fatif (status <0 ) goto xdr_error; - status =decode_getfattr_attrs (xdr, bitmap, fattr, fh, fs_loc, - label, server); + status =decode_getfattr_attrs (xdr, bitmap, fattr, fh, fs_loc, server);if (status <0 ) goto xdr_error;
@@ -4742,16 +4740,10 @@ static int decode_getfattr_generic(struct xdr_stream *xdr, struct nfs_fattr *fatreturn status; } -static int decode_getfattr_label (struct xdr_stream *xdr,struct nfs_fattr *fattr, -struct nfs4_label *label,const struct nfs_server *server) -{ -return decode_getfattr_generic (xdr, fattr,NULL ,NULL , label, server); -} -static int decode_getfattr (struct xdr_stream *xdr,struct nfs_fattr *fattr,const struct nfs_server *server) { -return decode_getfattr_generic (xdr, fattr,NULL ,NULL ,NULL , server); +return decode_getfattr_generic (xdr, fattr,NULL ,NULL , server); }/*
@@ -6179,7 +6171,7 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_getfh (xdr, res->fh);if (status) goto out; - status =decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); + status =decode_getfattr (xdr, res->fattr, res->server); out:return status; }
@@ -6209,7 +6201,7 @@ static int nfs4_xdr_dec_lookupp(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_getfh (xdr, res->fh);if (status) goto out; - status =decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); + status =decode_getfattr (xdr, res->fattr, res->server); out:return status; }
@@ -6236,8 +6228,7 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, goto out; status =decode_getfh (xdr, res->fh);if (status ==0 ) - status =decode_getfattr_label (xdr, res->fattr, - res->fattr->label, res->server); + status =decode_getfattr (xdr, res->fattr, res->server); out:return status; }
@@ -6331,7 +6322,7 @@ static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_restorefh (xdr);if (status) goto out; -decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); +decode_getfattr (xdr, res->fattr, res->server); out:return status; }
@@ -6361,7 +6352,7 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_getfh (xdr, res->fh);if (status) goto out; -decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); +decode_getfattr (xdr, res->fattr, res->server); out:return status; }
@@ -6394,7 +6385,7 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, struct xdr_stream *xdr, status =decode_putfh (xdr);if (status) goto out; - status =decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); + status =decode_getfattr (xdr, res->fattr, res->server); out:return status; }
@@ -6532,7 +6523,7 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr, goto out;if (res->access_request)decode_access (xdr, &res->access_supported, &res->access_result); -decode_getfattr_label (xdr, res->f_attr, res->f_attr->label, res->server); +decode_getfattr (xdr, res->f_attr, res->server);if (res->lg_res)decode_layoutget (xdr, rqstp, res->lg_res); out:
@@ -6616,7 +6607,7 @@ static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, status =decode_setattr (xdr);if (status) goto out; -decode_getfattr_label (xdr, res->fattr, res->fattr->label, res->server); +decode_getfattr (xdr, res->fattr, res->server); out:return status; }
@@ -7031,7 +7022,7 @@ static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, status =decode_getfattr_generic (xdr, &res->fs_locations->fattr,NULL , res->fs_locations, -NULL , res->fs_locations->server); + res->fs_locations->server);if (status) goto out;if (res->renew)
@@ -7044,7 +7035,7 @@ static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, status =decode_getfattr_generic (xdr, &res->fs_locations->fattr,NULL , res->fs_locations, -NULL , res->fs_locations->server); + res->fs_locations->server); } out:return status;
@@ -7475,7 +7466,7 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,return -EAGAIN ;if (decode_getfattr_attrs (xdr, bitmap, entry->fattr, entry->fh, -NULL , entry->fattr->label, entry->server) <0 ) +NULL , entry->server) <0 )return -EAGAIN ;if (entry->fattr->valid &NFS_ATTR_FATTR_MOUNTED_ON_FILEID ) entry->ino = entry->fattr->mounted_on_fileid;
Signature · 1 line
2.33.1