Skip to content

Commit

Permalink
NFS: Remove the f_label from the nfs4_opendata and nfs_openres
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Schumaker <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
amschuma-ntap authored and Trond Myklebust committed Nov 5, 2021
1 parent ba4bc8d commit 76baa2b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 27 deletions.
1 change: 0 additions & 1 deletion fs/nfs/nfs4_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
35 changes: 11 additions & 24 deletions fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -1434,7 +1433,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:
Expand All @@ -1456,7 +1455,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);
Expand Down Expand Up @@ -2009,7 +2008,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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 */
Expand All @@ -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];
}
Expand All @@ -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) &&
Expand All @@ -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;
}
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion fs/nfs/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6524,7 +6524,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:
Expand Down
1 change: 0 additions & 1 deletion include/linux/nfs_xdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 76baa2b

Please sign in to comment.