Skip to content

Commit

Permalink
NFS: Remove the nfs4_label argument from decode_getattr_*() functions
Browse files Browse the repository at this point in the history
Wa can check if the fattr has an allocated label when needed

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
  • Loading branch information
Anna Schumaker authored and Trond Myklebust committed Nov 5, 2021
1 parent dd225cb commit 1e2f67d
Showing 1 changed file with 17 additions and 26 deletions.
43 changes: 17 additions & 26 deletions fs/nfs/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4585,8 +4585,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;
Expand Down Expand Up @@ -4701,8 +4700,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;
Expand All @@ -4715,7 +4714,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,
Expand All @@ -4734,8 +4733,7 @@ static int decode_getfattr_generic(struct xdr_stream *xdr, struct nfs_fattr *fat
if (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;

Expand All @@ -4745,16 +4743,10 @@ static int decode_getfattr_generic(struct xdr_stream *xdr, struct nfs_fattr *fat
return 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);
}

/*
Expand Down Expand Up @@ -6171,7 +6163,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;
}
Expand Down Expand Up @@ -6201,7 +6193,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;
}
Expand All @@ -6228,8 +6220,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;
}
Expand Down Expand Up @@ -6323,7 +6314,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;
}
Expand Down Expand Up @@ -6353,7 +6344,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;
}
Expand Down Expand Up @@ -6386,7 +6377,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;
}
Expand Down Expand Up @@ -6524,7 +6515,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:
Expand Down Expand Up @@ -6608,7 +6599,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;
}
Expand Down Expand Up @@ -7023,7 +7014,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)
Expand All @@ -7036,7 +7027,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;
Expand Down Expand Up @@ -7467,7 +7458,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;
Expand Down

0 comments on commit 1e2f67d

Please sign in to comment.