Skip to content

Commit 9558a00

Browse files
amschuma-ntapTrond Myklebust
authored andcommitted
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: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent aa7ca3b commit 9558a00

File tree

7 files changed

+25
-42
lines changed

7 files changed

+25
-42
lines changed

fs/nfs/dir.c

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,19 +1494,17 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry,
14941494
{
14951495
struct nfs_fh *fhandle;
14961496
struct nfs_fattr *fattr;
1497-
struct nfs4_label *label;
14981497
unsigned long dir_verifier;
14991498
int ret;
15001499

15011500
ret = -ENOMEM;
15021501
fhandle = nfs_alloc_fhandle();
1503-
fattr = nfs_alloc_fattr();
1504-
label = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL);
1505-
if (fhandle == NULL || fattr == NULL || IS_ERR(label))
1502+
fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode));
1503+
if (fhandle == NULL || fattr == NULL)
15061504
goto out;
15071505

15081506
dir_verifier = nfs_save_change_attribute(dir);
1509-
ret = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr, label);
1507+
ret = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr);
15101508
if (ret < 0) {
15111509
switch (ret) {
15121510
case -ESTALE:
@@ -1525,7 +1523,7 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry,
15251523
if (nfs_refresh_inode(inode, fattr) < 0)
15261524
goto out;
15271525

1528-
nfs_setsecurity(inode, fattr, label);
1526+
nfs_setsecurity(inode, fattr, fattr->label);
15291527
nfs_set_verifier(dentry, dir_verifier);
15301528

15311529
/* set a readdirplus hint that we had a cache miss */
@@ -1534,7 +1532,6 @@ nfs_lookup_revalidate_dentry(struct inode *dir, struct dentry *dentry,
15341532
out:
15351533
nfs_free_fattr(fattr);
15361534
nfs_free_fhandle(fhandle);
1537-
nfs4_label_free(label);
15381535

15391536
/*
15401537
* 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
17541751
struct inode *inode = NULL;
17551752
struct nfs_fh *fhandle = NULL;
17561753
struct nfs_fattr *fattr = NULL;
1757-
struct nfs4_label *label = NULL;
17581754
unsigned long dir_verifier;
17591755
int error;
17601756

@@ -1773,27 +1769,23 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in
17731769

17741770
res = ERR_PTR(-ENOMEM);
17751771
fhandle = nfs_alloc_fhandle();
1776-
fattr = nfs_alloc_fattr();
1772+
fattr = nfs_alloc_fattr_with_label(NFS_SERVER(dir));
17771773
if (fhandle == NULL || fattr == NULL)
17781774
goto out;
17791775

1780-
label = nfs4_label_alloc(NFS_SERVER(dir), GFP_NOWAIT);
1781-
if (IS_ERR(label))
1782-
goto out;
1783-
17841776
dir_verifier = nfs_save_change_attribute(dir);
17851777
trace_nfs_lookup_enter(dir, dentry, flags);
1786-
error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr, label);
1778+
error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr);
17871779
if (error == -ENOENT)
17881780
goto no_entry;
17891781
if (error < 0) {
17901782
res = ERR_PTR(error);
1791-
goto out_label;
1783+
goto out;
17921784
}
1793-
inode = nfs_fhget(dentry->d_sb, fhandle, fattr, label);
1785+
inode = nfs_fhget(dentry->d_sb, fhandle, fattr, fattr->label);
17941786
res = ERR_CAST(inode);
17951787
if (IS_ERR(res))
1796-
goto out_label;
1788+
goto out;
17971789

17981790
/* Notify readdir to use READDIRPLUS */
17991791
nfs_force_use_readdirplus(dir);
@@ -1802,14 +1794,12 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in
18021794
res = d_splice_alias(inode, dentry);
18031795
if (res != NULL) {
18041796
if (IS_ERR(res))
1805-
goto out_label;
1797+
goto out;
18061798
dentry = res;
18071799
}
18081800
nfs_set_verifier(dentry, dir_verifier);
1809-
out_label:
1810-
trace_nfs_lookup_exit(dir, dentry, flags, PTR_ERR_OR_ZERO(res));
1811-
nfs4_label_free(label);
18121801
out:
1802+
trace_nfs_lookup_exit(dir, dentry, flags, PTR_ERR_OR_ZERO(res));
18131803
nfs_free_fattr(fattr);
18141804
nfs_free_fhandle(fhandle);
18151805
return res;
@@ -2058,7 +2048,7 @@ nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle,
20582048
d_drop(dentry);
20592049

20602050
if (fhandle->size == 0) {
2061-
error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr, NULL);
2051+
error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr);
20622052
if (error)
20632053
goto out_error;
20642054
}

fs/nfs/namespace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,7 @@ int nfs_submount(struct fs_context *fc, struct nfs_server *server)
308308

309309
/* Look it up again to get its attributes */
310310
err = server->nfs_client->rpc_ops->lookup(d_inode(parent), dentry,
311-
ctx->mntfh, ctx->clone_data.fattr,
312-
NULL);
311+
ctx->mntfh, ctx->clone_data.fattr);
313312
dput(parent);
314313
if (err != 0)
315314
return err;

fs/nfs/nfs3proc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ __nfs3_proc_lookup(struct inode *dir, const char *name, size_t len,
193193

194194
static int
195195
nfs3_proc_lookup(struct inode *dir, struct dentry *dentry,
196-
struct nfs_fh *fhandle, struct nfs_fattr *fattr,
197-
struct nfs4_label *label)
196+
struct nfs_fh *fhandle, struct nfs_fattr *fattr)
198197
{
199198
unsigned short task_flags = 0;
200199

fs/nfs/nfs4proc.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4294,7 +4294,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
42944294

42954295
static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
42964296
struct dentry *dentry, struct nfs_fh *fhandle,
4297-
struct nfs_fattr *fattr, struct nfs4_label *label)
4297+
struct nfs_fattr *fattr)
42984298
{
42994299
struct nfs_server *server = NFS_SERVER(dir);
43004300
int status;
@@ -4306,7 +4306,6 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
43064306
struct nfs4_lookup_res res = {
43074307
.server = server,
43084308
.fattr = fattr,
4309-
.label = label,
43104309
.fh = fhandle,
43114310
};
43124311
struct rpc_message msg = {
@@ -4323,7 +4322,7 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
43234322
if (nfs_lookup_is_soft_revalidate(dentry))
43244323
task_flags |= RPC_TASK_TIMEOUT;
43254324

4326-
args.bitmask = nfs4_bitmask(server, label);
4325+
args.bitmask = nfs4_bitmask(server, fattr->label);
43274326

43284327
nfs_fattr_init(fattr);
43294328

@@ -4345,7 +4344,7 @@ static void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr)
43454344

43464345
static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir,
43474346
struct dentry *dentry, struct nfs_fh *fhandle,
4348-
struct nfs_fattr *fattr, struct nfs4_label *label)
4347+
struct nfs_fattr *fattr)
43494348
{
43504349
struct nfs4_exception exception = {
43514350
.interruptible = true,
@@ -4354,7 +4353,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir,
43544353
const struct qstr *name = &dentry->d_name;
43554354
int err;
43564355
do {
4357-
err = _nfs4_proc_lookup(client, dir, dentry, fhandle, fattr, label);
4356+
err = _nfs4_proc_lookup(client, dir, dentry, fhandle, fattr);
43584357
trace_nfs4_lookup(dir, name, err);
43594358
switch (err) {
43604359
case -NFS4ERR_BADNAME:
@@ -4390,13 +4389,12 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir,
43904389
}
43914390

43924391
static int nfs4_proc_lookup(struct inode *dir, struct dentry *dentry,
4393-
struct nfs_fh *fhandle, struct nfs_fattr *fattr,
4394-
struct nfs4_label *label)
4392+
struct nfs_fh *fhandle, struct nfs_fattr *fattr)
43954393
{
43964394
int status;
43974395
struct rpc_clnt *client = NFS_CLIENT(dir);
43984396

4399-
status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr, label);
4397+
status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr);
44004398
if (client != NFS_CLIENT(dir)) {
44014399
rpc_shutdown_client(client);
44024400
nfs_fixup_secinfo_attributes(fattr);
@@ -4411,7 +4409,7 @@ nfs4_proc_lookup_mountpoint(struct inode *dir, struct dentry *dentry,
44114409
struct rpc_clnt *client = NFS_CLIENT(dir);
44124410
int status;
44134411

4414-
status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr, NULL);
4412+
status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr);
44154413
if (status < 0)
44164414
return ERR_PTR(status);
44174415
return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client;

fs/nfs/nfs4xdr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6171,7 +6171,7 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
61716171
status = decode_getfh(xdr, res->fh);
61726172
if (status)
61736173
goto out;
6174-
status = decode_getfattr_label(xdr, res->fattr, res->label, res->server);
6174+
status = decode_getfattr_label(xdr, res->fattr, res->fattr->label, res->server);
61756175
out:
61766176
return status;
61776177
}
@@ -6229,7 +6229,7 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp,
62296229
status = decode_getfh(xdr, res->fh);
62306230
if (status == 0)
62316231
status = decode_getfattr_label(xdr, res->fattr,
6232-
res->label, res->server);
6232+
res->fattr->label, res->server);
62336233
out:
62346234
return status;
62356235
}

fs/nfs/proc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
154154

155155
static int
156156
nfs_proc_lookup(struct inode *dir, struct dentry *dentry,
157-
struct nfs_fh *fhandle, struct nfs_fattr *fattr,
158-
struct nfs4_label *label)
157+
struct nfs_fh *fhandle, struct nfs_fattr *fattr)
159158
{
160159
struct nfs_diropargs arg = {
161160
.fh = NFS_FH(dir),

include/linux/nfs_xdr.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,6 @@ struct nfs4_lookup_res {
10951095
const struct nfs_server * server;
10961096
struct nfs_fattr * fattr;
10971097
struct nfs_fh * fh;
1098-
struct nfs4_label *label;
10991098
};
11001099

11011100
struct nfs4_lookupp_arg {
@@ -1740,8 +1739,7 @@ struct nfs_rpc_ops {
17401739
int (*setattr) (struct dentry *, struct nfs_fattr *,
17411740
struct iattr *);
17421741
int (*lookup) (struct inode *, struct dentry *,
1743-
struct nfs_fh *, struct nfs_fattr *,
1744-
struct nfs4_label *);
1742+
struct nfs_fh *, struct nfs_fattr *);
17451743
int (*lookupp) (struct inode *, struct nfs_fh *,
17461744
struct nfs_fattr *, struct nfs4_label *);
17471745
int (*access) (struct inode *, struct nfs_access_entry *);

0 commit comments

Comments
 (0)