aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2018-03-20 16:43:17 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2018-04-10 16:06:22 -0400
commit977fcc2b0b41c1fc82e8349995695e207ccb6684 (patch)
treeb2e2df6573dccd1c6e249702f8960262114bdc31
parentf2c2c552f119db84d85a53a8bd76479f34df02b1 (diff)
NFS: Add a delegation return into nfs4_proc_unlink_setup()
Ensure that when we do finally delete the file, then we return the delegation. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r--fs/nfs/nfs3proc.c2
-rw-r--r--fs/nfs/nfs4proc.c9
-rw-r--r--fs/nfs/proc.c2
-rw-r--r--fs/nfs/unlink.c2
-rw-r--r--include/linux/nfs_xdr.h2
5 files changed, 10 insertions, 7 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 08875dc17b52..ae03307bd8cd 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -411,7 +411,7 @@ out:
411} 411}
412 412
413static void 413static void
414nfs3_proc_unlink_setup(struct rpc_message *msg, struct inode *dir) 414nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dentry)
415{ 415{
416 msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE]; 416 msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE];
417} 417}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index b06a820b570d..21daeac114fe 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4231,17 +4231,20 @@ static int nfs4_proc_rmdir(struct inode *dir, const struct qstr *name)
4231 return err; 4231 return err;
4232} 4232}
4233 4233
4234static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct inode *dir) 4234static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dentry)
4235{ 4235{
4236 struct nfs_server *server = NFS_SERVER(dir);
4237 struct nfs_removeargs *args = msg->rpc_argp; 4236 struct nfs_removeargs *args = msg->rpc_argp;
4238 struct nfs_removeres *res = msg->rpc_resp; 4237 struct nfs_removeres *res = msg->rpc_resp;
4238 struct inode *inode = d_inode(dentry);
4239 4239
4240 res->server = server; 4240 res->server = NFS_SB(dentry->d_sb);
4241 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE]; 4241 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
4242 nfs4_init_sequence(&args->seq_args, &res->seq_res, 1); 4242 nfs4_init_sequence(&args->seq_args, &res->seq_res, 1);
4243 4243
4244 nfs_fattr_init(res->dir_attr); 4244 nfs_fattr_init(res->dir_attr);
4245
4246 if (inode)
4247 nfs4_inode_return_delegation(inode);
4245} 4248}
4246 4249
4247static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data) 4250static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data)
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 39dc9276b1f6..318b3f34a6d0 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -321,7 +321,7 @@ nfs_proc_remove(struct inode *dir, struct dentry *dentry)
321} 321}
322 322
323static void 323static void
324nfs_proc_unlink_setup(struct rpc_message *msg, struct inode *dir) 324nfs_proc_unlink_setup(struct rpc_message *msg, struct dentry *dentry)
325{ 325{
326 msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE]; 326 msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE];
327} 327}
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 44f101411422..bf54fc9ae135 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -105,7 +105,7 @@ static void nfs_do_call_unlink(struct nfs_unlinkdata *data)
105 data->args.fh = NFS_FH(dir); 105 data->args.fh = NFS_FH(dir);
106 nfs_fattr_init(data->res.dir_attr); 106 nfs_fattr_init(data->res.dir_attr);
107 107
108 NFS_PROTO(dir)->unlink_setup(&msg, dir); 108 NFS_PROTO(dir)->unlink_setup(&msg, data->dentry);
109 109
110 task_setup_data.rpc_client = NFS_CLIENT(dir); 110 task_setup_data.rpc_client = NFS_CLIENT(dir);
111 task = rpc_run_task(&task_setup_data); 111 task = rpc_run_task(&task_setup_data);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 4b87e2d726b1..c4ba58b3c0f8 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1591,7 +1591,7 @@ struct nfs_rpc_ops {
1591 int (*create) (struct inode *, struct dentry *, 1591 int (*create) (struct inode *, struct dentry *,
1592 struct iattr *, int); 1592 struct iattr *, int);
1593 int (*remove) (struct inode *, struct dentry *); 1593 int (*remove) (struct inode *, struct dentry *);
1594 void (*unlink_setup) (struct rpc_message *, struct inode *dir); 1594 void (*unlink_setup) (struct rpc_message *, struct dentry *);
1595 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *); 1595 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1596 int (*unlink_done) (struct rpc_task *, struct inode *); 1596 int (*unlink_done) (struct rpc_task *, struct inode *);
1597 void (*rename_setup) (struct rpc_message *msg, 1597 void (*rename_setup) (struct rpc_message *msg,