Skip to content

Commit 912678d

Browse files
trondmypdamschuma-ntap
authored andcommitted
NFS: Move the delegation return down into nfs4_proc_remove()
Move the delegation return out of generic code and down into the NFSv4 specific unlink code. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 9f76827 commit 912678d

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed

fs/nfs/dir.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,12 +1798,11 @@ static int nfs_safe_remove(struct dentry *dentry)
17981798

17991799
trace_nfs_remove_enter(dir, dentry);
18001800
if (inode != NULL) {
1801-
NFS_PROTO(inode)->return_delegation(inode);
1802-
error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
1801+
error = NFS_PROTO(dir)->remove(dir, dentry);
18031802
if (error == 0)
18041803
nfs_drop_nlink(inode);
18051804
} else
1806-
error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
1805+
error = NFS_PROTO(dir)->remove(dir, dentry);
18071806
if (error == -ENOENT)
18081807
nfs_dentry_handle_enoent(dentry);
18091808
trace_nfs_remove_exit(dir, dentry, error);

fs/nfs/nfs3proc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,11 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
383383
}
384384

385385
static int
386-
nfs3_proc_remove(struct inode *dir, const struct qstr *name)
386+
nfs3_proc_remove(struct inode *dir, struct dentry *dentry)
387387
{
388388
struct nfs_removeargs arg = {
389389
.fh = NFS_FH(dir),
390-
.name = *name,
390+
.name = dentry->d_name,
391391
};
392392
struct nfs_removeres res;
393393
struct rpc_message msg = {
@@ -397,7 +397,7 @@ nfs3_proc_remove(struct inode *dir, const struct qstr *name)
397397
};
398398
int status = -ENOMEM;
399399

400-
dprintk("NFS call remove %s\n", name->name);
400+
dprintk("NFS call remove %pd2\n", dentry);
401401
res.dir_attr = nfs_alloc_fattr();
402402
if (res.dir_attr == NULL)
403403
goto out;

fs/nfs/nfs4proc.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4200,10 +4200,28 @@ static int _nfs4_proc_remove(struct inode *dir, const struct qstr *name)
42004200
return status;
42014201
}
42024202

4203-
static int nfs4_proc_remove(struct inode *dir, const struct qstr *name)
4203+
static int nfs4_proc_remove(struct inode *dir, struct dentry *dentry)
42044204
{
42054205
struct nfs4_exception exception = { };
4206+
struct inode *inode = d_inode(dentry);
42064207
int err;
4208+
4209+
if (inode)
4210+
nfs4_inode_return_delegation(inode);
4211+
do {
4212+
err = _nfs4_proc_remove(dir, &dentry->d_name);
4213+
trace_nfs4_remove(dir, &dentry->d_name, err);
4214+
err = nfs4_handle_exception(NFS_SERVER(dir), err,
4215+
&exception);
4216+
} while (exception.retry);
4217+
return err;
4218+
}
4219+
4220+
static int nfs4_proc_rmdir(struct inode *dir, const struct qstr *name)
4221+
{
4222+
struct nfs4_exception exception = { };
4223+
int err;
4224+
42074225
do {
42084226
err = _nfs4_proc_remove(dir, name);
42094227
trace_nfs4_remove(dir, name, err);
@@ -9601,7 +9619,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
96019619
.link = nfs4_proc_link,
96029620
.symlink = nfs4_proc_symlink,
96039621
.mkdir = nfs4_proc_mkdir,
9604-
.rmdir = nfs4_proc_remove,
9622+
.rmdir = nfs4_proc_rmdir,
96059623
.readdir = nfs4_proc_readdir,
96069624
.mknod = nfs4_proc_mknod,
96079625
.statfs = nfs4_proc_statfs,

fs/nfs/proc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,19 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
300300
}
301301

302302
static int
303-
nfs_proc_remove(struct inode *dir, const struct qstr *name)
303+
nfs_proc_remove(struct inode *dir, struct dentry *dentry)
304304
{
305305
struct nfs_removeargs arg = {
306306
.fh = NFS_FH(dir),
307-
.name = *name,
307+
.name = dentry->d_name,
308308
};
309309
struct rpc_message msg = {
310310
.rpc_proc = &nfs_procedures[NFSPROC_REMOVE],
311311
.rpc_argp = &arg,
312312
};
313313
int status;
314314

315-
dprintk("NFS call remove %s\n", name->name);
315+
dprintk("NFS call remove %pd2\n",dentry);
316316
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
317317
nfs_mark_for_revalidate(dir);
318318

include/linux/nfs_xdr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ struct nfs_rpc_ops {
15901590
unsigned int);
15911591
int (*create) (struct inode *, struct dentry *,
15921592
struct iattr *, int);
1593-
int (*remove) (struct inode *, const struct qstr *);
1593+
int (*remove) (struct inode *, struct dentry *);
15941594
void (*unlink_setup) (struct rpc_message *, struct inode *dir);
15951595
void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
15961596
int (*unlink_done) (struct rpc_task *, struct inode *);

0 commit comments

Comments
 (0)