diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2018-03-20 16:43:15 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2018-04-10 16:06:22 -0400 |
commit | 912678dbc592db7ad618f383866ad23e43cd51f3 (patch) | |
tree | 5f035c3461298b24fcf16e3c32223758ca3846b5 /fs | |
parent | 9f7682728728114ed99d8f127f0e1ce3ef9ba857 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dir.c | 5 | ||||
-rw-r--r-- | fs/nfs/nfs3proc.c | 6 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 22 | ||||
-rw-r--r-- | fs/nfs/proc.c | 6 |
4 files changed, 28 insertions, 11 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index b4549e54007d..eb9d782ed674 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1798,12 +1798,11 @@ static int nfs_safe_remove(struct dentry *dentry) | |||
1798 | 1798 | ||
1799 | trace_nfs_remove_enter(dir, dentry); | 1799 | trace_nfs_remove_enter(dir, dentry); |
1800 | if (inode != NULL) { | 1800 | if (inode != NULL) { |
1801 | NFS_PROTO(inode)->return_delegation(inode); | 1801 | error = NFS_PROTO(dir)->remove(dir, dentry); |
1802 | error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); | ||
1803 | if (error == 0) | 1802 | if (error == 0) |
1804 | nfs_drop_nlink(inode); | 1803 | nfs_drop_nlink(inode); |
1805 | } else | 1804 | } else |
1806 | error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); | 1805 | error = NFS_PROTO(dir)->remove(dir, dentry); |
1807 | if (error == -ENOENT) | 1806 | if (error == -ENOENT) |
1808 | nfs_dentry_handle_enoent(dentry); | 1807 | nfs_dentry_handle_enoent(dentry); |
1809 | trace_nfs_remove_exit(dir, dentry, error); | 1808 | trace_nfs_remove_exit(dir, dentry, error); |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 7327930ad970..f4ead71e4350 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -383,11 +383,11 @@ out: | |||
383 | } | 383 | } |
384 | 384 | ||
385 | static int | 385 | static int |
386 | nfs3_proc_remove(struct inode *dir, const struct qstr *name) | 386 | nfs3_proc_remove(struct inode *dir, struct dentry *dentry) |
387 | { | 387 | { |
388 | struct nfs_removeargs arg = { | 388 | struct nfs_removeargs arg = { |
389 | .fh = NFS_FH(dir), | 389 | .fh = NFS_FH(dir), |
390 | .name = *name, | 390 | .name = dentry->d_name, |
391 | }; | 391 | }; |
392 | struct nfs_removeres res; | 392 | struct nfs_removeres res; |
393 | struct rpc_message msg = { | 393 | struct rpc_message msg = { |
@@ -397,7 +397,7 @@ nfs3_proc_remove(struct inode *dir, const struct qstr *name) | |||
397 | }; | 397 | }; |
398 | int status = -ENOMEM; | 398 | int status = -ENOMEM; |
399 | 399 | ||
400 | dprintk("NFS call remove %s\n", name->name); | 400 | dprintk("NFS call remove %pd2\n", dentry); |
401 | res.dir_attr = nfs_alloc_fattr(); | 401 | res.dir_attr = nfs_alloc_fattr(); |
402 | if (res.dir_attr == NULL) | 402 | if (res.dir_attr == NULL) |
403 | goto out; | 403 | goto out; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f4216b6b01c9..810ebd2f5174 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4200,10 +4200,28 @@ static int _nfs4_proc_remove(struct inode *dir, const struct qstr *name) | |||
4200 | return status; | 4200 | return status; |
4201 | } | 4201 | } |
4202 | 4202 | ||
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) |
4204 | { | 4204 | { |
4205 | struct nfs4_exception exception = { }; | 4205 | struct nfs4_exception exception = { }; |
4206 | struct inode *inode = d_inode(dentry); | ||
4206 | int err; | 4207 | 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 | |||
4207 | do { | 4225 | do { |
4208 | err = _nfs4_proc_remove(dir, name); | 4226 | err = _nfs4_proc_remove(dir, name); |
4209 | trace_nfs4_remove(dir, name, err); | 4227 | trace_nfs4_remove(dir, name, err); |
@@ -9601,7 +9619,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { | |||
9601 | .link = nfs4_proc_link, | 9619 | .link = nfs4_proc_link, |
9602 | .symlink = nfs4_proc_symlink, | 9620 | .symlink = nfs4_proc_symlink, |
9603 | .mkdir = nfs4_proc_mkdir, | 9621 | .mkdir = nfs4_proc_mkdir, |
9604 | .rmdir = nfs4_proc_remove, | 9622 | .rmdir = nfs4_proc_rmdir, |
9605 | .readdir = nfs4_proc_readdir, | 9623 | .readdir = nfs4_proc_readdir, |
9606 | .mknod = nfs4_proc_mknod, | 9624 | .mknod = nfs4_proc_mknod, |
9607 | .statfs = nfs4_proc_statfs, | 9625 | .statfs = nfs4_proc_statfs, |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index f7fd9192d4bc..b2e81a110133 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -300,11 +300,11 @@ out: | |||
300 | } | 300 | } |
301 | 301 | ||
302 | static int | 302 | static int |
303 | nfs_proc_remove(struct inode *dir, const struct qstr *name) | 303 | nfs_proc_remove(struct inode *dir, struct dentry *dentry) |
304 | { | 304 | { |
305 | struct nfs_removeargs arg = { | 305 | struct nfs_removeargs arg = { |
306 | .fh = NFS_FH(dir), | 306 | .fh = NFS_FH(dir), |
307 | .name = *name, | 307 | .name = dentry->d_name, |
308 | }; | 308 | }; |
309 | struct rpc_message msg = { | 309 | struct rpc_message msg = { |
310 | .rpc_proc = &nfs_procedures[NFSPROC_REMOVE], | 310 | .rpc_proc = &nfs_procedures[NFSPROC_REMOVE], |
@@ -312,7 +312,7 @@ nfs_proc_remove(struct inode *dir, const struct qstr *name) | |||
312 | }; | 312 | }; |
313 | int status; | 313 | int status; |
314 | 314 | ||
315 | dprintk("NFS call remove %s\n", name->name); | 315 | dprintk("NFS call remove %pd2\n",dentry); |
316 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); | 316 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
317 | nfs_mark_for_revalidate(dir); | 317 | nfs_mark_for_revalidate(dir); |
318 | 318 | ||