NFS: Remove the nfs4_label argument from nfs_setsecurity

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Anna Schumaker 2021-10-22 13:11:12 -04:00 committed by Trond Myklebust
parent cf7ab00aab
commit dd225cb3b0
5 changed files with 17 additions and 22 deletions

View File

@ -682,8 +682,7 @@ again:
nfs_set_verifier(dentry, dir_verifier); nfs_set_verifier(dentry, dir_verifier);
status = nfs_refresh_inode(d_inode(dentry), entry->fattr); status = nfs_refresh_inode(d_inode(dentry), entry->fattr);
if (!status) if (!status)
nfs_setsecurity(d_inode(dentry), entry->fattr, nfs_setsecurity(d_inode(dentry), entry->fattr);
entry->fattr->label);
goto out; goto out;
} else { } else {
d_invalidate(dentry); d_invalidate(dentry);
@ -1523,7 +1522,7 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry,
if (nfs_refresh_inode(inode, fattr) < 0) if (nfs_refresh_inode(inode, fattr) < 0)
goto out; goto out;
nfs_setsecurity(inode, fattr, fattr->label); nfs_setsecurity(inode, fattr);
nfs_set_verifier(dentry, dir_verifier); nfs_set_verifier(dentry, dir_verifier);
/* set a readdirplus hint that we had a cache miss */ /* set a readdirplus hint that we had a cache miss */

View File

@ -148,7 +148,7 @@ int nfs_get_root(struct super_block *s, struct fs_context *fc)
!(kflags_out & SECURITY_LSM_NATIVE_LABELS)) !(kflags_out & SECURITY_LSM_NATIVE_LABELS))
server->caps &= ~NFS_CAP_SECURITY_LABEL; server->caps &= ~NFS_CAP_SECURITY_LABEL;
nfs_setsecurity(inode, fsinfo.fattr, fsinfo.fattr->label); nfs_setsecurity(inode, fsinfo.fattr);
error = 0; error = 0;
out_fattr: out_fattr:

View File

@ -355,23 +355,22 @@ static void nfs_clear_label_invalid(struct inode *inode)
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
} }
void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr)
struct nfs4_label *label)
{ {
int error; int error;
if (label == NULL) if (fattr->label == NULL)
return; return;
if ((fattr->valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL) && inode->i_security) { if ((fattr->valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL) && inode->i_security) {
error = security_inode_notifysecctx(inode, label->label, error = security_inode_notifysecctx(inode, fattr->label->label,
label->len); fattr->label->len);
if (error) if (error)
printk(KERN_ERR "%s() %s %d " printk(KERN_ERR "%s() %s %d "
"security_inode_notifysecctx() %d\n", "security_inode_notifysecctx() %d\n",
__func__, __func__,
(char *)label->label, (char *)fattr->label->label,
label->len, error); fattr->label->len, error);
nfs_clear_label_invalid(inode); nfs_clear_label_invalid(inode);
} }
} }
@ -398,8 +397,7 @@ struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags)
} }
EXPORT_SYMBOL_GPL(nfs4_label_alloc); EXPORT_SYMBOL_GPL(nfs4_label_alloc);
#else #else
void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr)
struct nfs4_label *label)
{ {
} }
#endif #endif
@ -581,7 +579,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
fattr->size != 0) fattr->size != 0)
nfs_set_cache_invalid(inode, NFS_INO_INVALID_BLOCKS); 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 = NFS_MINATTRTIMEO(inode);
nfsi->attrtimeo_timestamp = now; nfsi->attrtimeo_timestamp = now;
@ -1252,7 +1250,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
if (nfsi->cache_validity & NFS_INO_INVALID_ACL) if (nfsi->cache_validity & NFS_INO_INVALID_ACL)
nfs_zap_acl_cache(inode); nfs_zap_acl_cache(inode);
nfs_setsecurity(inode, fattr, fattr->label); nfs_setsecurity(inode, fattr);
dfprintk(PAGECACHE, "NFS: (%s/%Lu) revalidation complete\n", dfprintk(PAGECACHE, "NFS: (%s/%Lu) revalidation complete\n",
inode->i_sb->s_id, inode->i_sb->s_id,

View File

@ -3179,8 +3179,7 @@ static int _nfs4_do_open(struct inode *dir,
if (status == 0) { if (status == 0) {
nfs_setattr_update_inode(state->inode, sattr, nfs_setattr_update_inode(state->inode, sattr,
opendata->o_res.f_attr); opendata->o_res.f_attr);
nfs_setsecurity(state->inode, opendata->o_res.f_attr, nfs_setsecurity(state->inode, opendata->o_res.f_attr);
opendata->o_res.f_attr->label);
} }
sattr->ia_valid = ia_old; sattr->ia_valid = ia_old;
} }
@ -4261,7 +4260,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
status = nfs4_do_setattr(inode, cred, fattr, sattr, ctx, NULL); status = nfs4_do_setattr(inode, cred, fattr, sattr, ctx, NULL);
if (status == 0) { if (status == 0) {
nfs_setattr_update_inode(inode, sattr, fattr); nfs_setattr_update_inode(inode, sattr, fattr);
nfs_setsecurity(inode, fattr, fattr->label); nfs_setsecurity(inode, fattr);
} }
return status; return status;
} }
@ -4782,7 +4781,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct
nfs4_inc_nlink(inode); nfs4_inc_nlink(inode);
status = nfs_post_op_update_inode(inode, res.fattr); status = nfs_post_op_update_inode(inode, res.fattr);
if (!status) if (!status)
nfs_setsecurity(inode, res.fattr, res.fattr->label); nfs_setsecurity(inode, res.fattr);
} }
out: out:
@ -6077,7 +6076,7 @@ nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen)
status = nfs4_do_set_security_label(inode, &ilabel, fattr); status = nfs4_do_set_security_label(inode, &ilabel, fattr);
if (status == 0) if (status == 0)
nfs_setsecurity(inode, fattr, fattr->label); nfs_setsecurity(inode, fattr);
return status; return status;
} }

View File

@ -409,8 +409,7 @@ extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *map
extern int nfs_revalidate_mapping_rcu(struct inode *inode); extern int nfs_revalidate_mapping_rcu(struct inode *inode);
extern int nfs_setattr(struct user_namespace *, struct dentry *, struct iattr *); 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_setattr_update_inode(struct inode *inode, struct iattr *attr, struct nfs_fattr *);
extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr);
struct nfs4_label *label);
extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 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 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); extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, const struct cred *cred, fmode_t mode);