Commit 9558a007 authored by Anna Schumaker's avatar Anna Schumaker Committed by Trond Myklebust

NFS: Remove the label from the nfs4_lookup_res struct

And usethe fattr's label field instead. I also adjust function calls to
remove labels along the way.
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent aa7ca3b2
...@@ -1494,19 +1494,17 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, ...@@ -1494,19 +1494,17 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry,
{ {
struct nfs_fh *fhandle; struct nfs_fh *fhandle;
struct nfs_fattr *fattr; struct nfs_fattr *fattr;
struct nfs4_label *label;
unsigned long dir_verifier; unsigned long dir_verifier;
int ret; int ret;
ret = -ENOMEM; ret = -ENOMEM;
fhandle = nfs_alloc_fhandle(); fhandle = nfs_alloc_fhandle();
fattr = nfs_alloc_fattr(); fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode));
label = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL); if (fhandle == NULL || fattr == NULL)
if (fhandle == NULL || fattr == NULL || IS_ERR(label))
goto out; goto out;
dir_verifier = nfs_save_change_attribute(dir); 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) { if (ret < 0) {
switch (ret) { switch (ret) {
case -ESTALE: case -ESTALE:
...@@ -1525,7 +1523,7 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, ...@@ -1525,7 +1523,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, label); nfs_setsecurity(inode, fattr, fattr->label);
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 */
...@@ -1534,7 +1532,6 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry, ...@@ -1534,7 +1532,6 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry,
out: out:
nfs_free_fattr(fattr); nfs_free_fattr(fattr);
nfs_free_fhandle(fhandle); nfs_free_fhandle(fhandle);
nfs4_label_free(label);
/* /*
* If the lookup failed despite the dentry change attribute being * If the lookup failed despite the dentry change attribute being
...@@ -1754,7 +1751,6 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in ...@@ -1754,7 +1751,6 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in
struct inode *inode = NULL; struct inode *inode = NULL;
struct nfs_fh *fhandle = NULL; struct nfs_fh *fhandle = NULL;
struct nfs_fattr *fattr = NULL; struct nfs_fattr *fattr = NULL;
struct nfs4_label *label = NULL;
unsigned long dir_verifier; unsigned long dir_verifier;
int error; int error;
...@@ -1773,27 +1769,23 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in ...@@ -1773,27 +1769,23 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in
res = ERR_PTR(-ENOMEM); res = ERR_PTR(-ENOMEM);
fhandle = nfs_alloc_fhandle(); fhandle = nfs_alloc_fhandle();
fattr = nfs_alloc_fattr(); fattr = nfs_alloc_fattr_with_label(NFS_SERVER(dir));
if (fhandle == NULL || fattr == NULL) if (fhandle == NULL || fattr == NULL)
goto out; goto out;
label = nfs4_label_alloc(NFS_SERVER(dir), GFP_NOWAIT);
if (IS_ERR(label))
goto out;
dir_verifier = nfs_save_change_attribute(dir); dir_verifier = nfs_save_change_attribute(dir);
trace_nfs_lookup_enter(dir, dentry, flags); 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) if (error == -ENOENT)
goto no_entry; goto no_entry;
if (error < 0) { if (error < 0) {
res = ERR_PTR(error); 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); res = ERR_CAST(inode);
if (IS_ERR(res)) if (IS_ERR(res))
goto out_label; goto out;
/* Notify readdir to use READDIRPLUS */ /* Notify readdir to use READDIRPLUS */
nfs_force_use_readdirplus(dir); nfs_force_use_readdirplus(dir);
...@@ -1802,14 +1794,12 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in ...@@ -1802,14 +1794,12 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in
res = d_splice_alias(inode, dentry); res = d_splice_alias(inode, dentry);
if (res != NULL) { if (res != NULL) {
if (IS_ERR(res)) if (IS_ERR(res))
goto out_label; goto out;
dentry = res; dentry = res;
} }
nfs_set_verifier(dentry, dir_verifier); nfs_set_verifier(dentry, dir_verifier);
out_label:
trace_nfs_lookup_exit(dir, dentry, flags, PTR_ERR_OR_ZERO(res));
nfs4_label_free(label);
out: out:
trace_nfs_lookup_exit(dir, dentry, flags, PTR_ERR_OR_ZERO(res));
nfs_free_fattr(fattr); nfs_free_fattr(fattr);
nfs_free_fhandle(fhandle); nfs_free_fhandle(fhandle);
return res; return res;
...@@ -2058,7 +2048,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle, ...@@ -2058,7 +2048,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle,
d_drop(dentry); d_drop(dentry);
if (fhandle->size == 0) { 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) if (error)
goto out_error; goto out_error;
} }
......
...@@ -308,8 +308,7 @@ int nfs_submount(struct fs_context *fc, struct nfs_server *server) ...@@ -308,8 +308,7 @@ int nfs_submount(struct fs_context *fc, struct nfs_server *server)
/* Look it up again to get its attributes */ /* Look it up again to get its attributes */
err = server->nfs_client->rpc_ops->lookup(d_inode(parent), dentry, err = server->nfs_client->rpc_ops->lookup(d_inode(parent), dentry,
ctx->mntfh, ctx->clone_data.fattr, ctx->mntfh, ctx->clone_data.fattr);
NULL);
dput(parent); dput(parent);
if (err != 0) if (err != 0)
return err; return err;
......
...@@ -193,8 +193,7 @@ __nfs3_proc_lookup(struct inode *dir, const char *name, size_t len, ...@@ -193,8 +193,7 @@ __nfs3_proc_lookup(struct inode *dir, const char *name, size_t len,
static int static int
nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, nfs3_proc_lookup(struct inode *dir, struct dentry *dentry,
struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
struct nfs4_label *label)
{ {
unsigned short task_flags = 0; unsigned short task_flags = 0;
......
...@@ -4294,7 +4294,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, ...@@ -4294,7 +4294,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
struct dentry *dentry, struct nfs_fh *fhandle, 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); struct nfs_server *server = NFS_SERVER(dir);
int status; int status;
...@@ -4306,7 +4306,6 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, ...@@ -4306,7 +4306,6 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
struct nfs4_lookup_res res = { struct nfs4_lookup_res res = {
.server = server, .server = server,
.fattr = fattr, .fattr = fattr,
.label = label,
.fh = fhandle, .fh = fhandle,
}; };
struct rpc_message msg = { struct rpc_message msg = {
...@@ -4323,7 +4322,7 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, ...@@ -4323,7 +4322,7 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
if (nfs_lookup_is_soft_revalidate(dentry)) if (nfs_lookup_is_soft_revalidate(dentry))
task_flags |= RPC_TASK_TIMEOUT; task_flags |= RPC_TASK_TIMEOUT;
args.bitmask = nfs4_bitmask(server, label); args.bitmask = nfs4_bitmask(server, fattr->label);
nfs_fattr_init(fattr); nfs_fattr_init(fattr);
...@@ -4345,7 +4344,7 @@ static void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr) ...@@ -4345,7 +4344,7 @@ static void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr)
static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir,
struct dentry *dentry, struct nfs_fh *fhandle, struct dentry *dentry, struct nfs_fh *fhandle,
struct nfs_fattr *fattr, struct nfs4_label *label) struct nfs_fattr *fattr)
{ {
struct nfs4_exception exception = { struct nfs4_exception exception = {
.interruptible = true, .interruptible = true,
...@@ -4354,7 +4353,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, ...@@ -4354,7 +4353,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir,
const struct qstr *name = &dentry->d_name; const struct qstr *name = &dentry->d_name;
int err; int err;
do { 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); trace_nfs4_lookup(dir, name, err);
switch (err) { switch (err) {
case -NFS4ERR_BADNAME: case -NFS4ERR_BADNAME:
...@@ -4390,13 +4389,12 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, ...@@ -4390,13 +4389,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, static int nfs4_proc_lookup(struct inode *dir, struct dentry *dentry,
struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
struct nfs4_label *label)
{ {
int status; int status;
struct rpc_clnt *client = NFS_CLIENT(dir); 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)) { if (client != NFS_CLIENT(dir)) {
rpc_shutdown_client(client); rpc_shutdown_client(client);
nfs_fixup_secinfo_attributes(fattr); nfs_fixup_secinfo_attributes(fattr);
...@@ -4411,7 +4409,7 @@ nfs4_proc_lookup_mountpoint(struct inode *dir, struct dentry *dentry, ...@@ -4411,7 +4409,7 @@ nfs4_proc_lookup_mountpoint(struct inode *dir, struct dentry *dentry,
struct rpc_clnt *client = NFS_CLIENT(dir); struct rpc_clnt *client = NFS_CLIENT(dir);
int status; 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) if (status < 0)
return ERR_PTR(status); return ERR_PTR(status);
return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client; return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client;
......
...@@ -6171,7 +6171,7 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr, ...@@ -6171,7 +6171,7 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
status = decode_getfh(xdr, res->fh); status = decode_getfh(xdr, res->fh);
if (status) if (status)
goto out; 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: out:
return status; return status;
} }
...@@ -6229,7 +6229,7 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, ...@@ -6229,7 +6229,7 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp,
status = decode_getfh(xdr, res->fh); status = decode_getfh(xdr, res->fh);
if (status == 0) if (status == 0)
status = decode_getfattr_label(xdr, res->fattr, status = decode_getfattr_label(xdr, res->fattr,
res->label, res->server); res->fattr->label, res->server);
out: out:
return status; return status;
} }
......
...@@ -154,8 +154,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, ...@@ -154,8 +154,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
static int static int
nfs_proc_lookup(struct inode *dir, struct dentry *dentry, nfs_proc_lookup(struct inode *dir, struct dentry *dentry,
struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
struct nfs4_label *label)
{ {
struct nfs_diropargs arg = { struct nfs_diropargs arg = {
.fh = NFS_FH(dir), .fh = NFS_FH(dir),
......
...@@ -1095,7 +1095,6 @@ struct nfs4_lookup_res { ...@@ -1095,7 +1095,6 @@ struct nfs4_lookup_res {
const struct nfs_server * server; const struct nfs_server * server;
struct nfs_fattr * fattr; struct nfs_fattr * fattr;
struct nfs_fh * fh; struct nfs_fh * fh;
struct nfs4_label *label;
}; };
struct nfs4_lookupp_arg { struct nfs4_lookupp_arg {
...@@ -1740,8 +1739,7 @@ struct nfs_rpc_ops { ...@@ -1740,8 +1739,7 @@ struct nfs_rpc_ops {
int (*setattr) (struct dentry *, struct nfs_fattr *, int (*setattr) (struct dentry *, struct nfs_fattr *,
struct iattr *); struct iattr *);
int (*lookup) (struct inode *, struct dentry *, int (*lookup) (struct inode *, struct dentry *,
struct nfs_fh *, struct nfs_fattr *, struct nfs_fh *, struct nfs_fattr *);
struct nfs4_label *);
int (*lookupp) (struct inode *, struct nfs_fh *, int (*lookupp) (struct inode *, struct nfs_fh *,
struct nfs_fattr *, struct nfs4_label *); struct nfs_fattr *, struct nfs4_label *);
int (*access) (struct inode *, struct nfs_access_entry *); int (*access) (struct inode *, struct nfs_access_entry *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment