summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2018-05-30 16:11:52 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2018-05-31 15:02:16 -0400
commited7e9ad0908a8c2a502f49ceed940d0ce122fe8b (patch)
tree45c6f3d289a084cae5415695591bb9ad7316f6cd
parent991eedb1371dc09b0f9848f59c8898fe63d198c0 (diff)
NFSv4: Fix sillyrename to return the delegation when appropriate
Ensure that we pass down the inode of the file being deleted so that we can return any delegation being held. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-rw-r--r--fs/nfs/nfs3proc.c4
-rw-r--r--fs/nfs/nfs4proc.c5
-rw-r--r--fs/nfs/proc.c4
-rw-r--r--fs/nfs/unlink.c10
-rw-r--r--include/linux/nfs_xdr.h2
5 files changed, 15 insertions, 10 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 6ed6a4195906..5645ef4c5259 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -414,7 +414,9 @@ out:
414} 414}
415 415
416static void 416static void
417nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dentry) 417nfs3_proc_unlink_setup(struct rpc_message *msg,
418 struct dentry *dentry,
419 struct inode *inode)
418{ 420{
419 msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE]; 421 msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE];
420} 422}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 844eafbf1564..d21c5e4220a0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4260,11 +4260,12 @@ static int nfs4_proc_rmdir(struct inode *dir, const struct qstr *name)
4260 return err; 4260 return err;
4261} 4261}
4262 4262
4263static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dentry) 4263static void nfs4_proc_unlink_setup(struct rpc_message *msg,
4264 struct dentry *dentry,
4265 struct inode *inode)
4264{ 4266{
4265 struct nfs_removeargs *args = msg->rpc_argp; 4267 struct nfs_removeargs *args = msg->rpc_argp;
4266 struct nfs_removeres *res = msg->rpc_resp; 4268 struct nfs_removeres *res = msg->rpc_resp;
4267 struct inode *inode = d_inode(dentry);
4268 4269
4269 res->server = NFS_SB(dentry->d_sb); 4270 res->server = NFS_SB(dentry->d_sb);
4270 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE]; 4271 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 80c350b6232a..763f77e7f1f1 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -321,7 +321,9 @@ 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 dentry *dentry) 324nfs_proc_unlink_setup(struct rpc_message *msg,
325 struct dentry *dentry,
326 struct inode *inode)
325{ 327{
326 msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE]; 328 msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE];
327} 329}
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index bf54fc9ae135..6a73b8c808ea 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -85,7 +85,7 @@ static const struct rpc_call_ops nfs_unlink_ops = {
85 .rpc_call_prepare = nfs_unlink_prepare, 85 .rpc_call_prepare = nfs_unlink_prepare,
86}; 86};
87 87
88static void nfs_do_call_unlink(struct nfs_unlinkdata *data) 88static void nfs_do_call_unlink(struct inode *inode, struct nfs_unlinkdata *data)
89{ 89{
90 struct rpc_message msg = { 90 struct rpc_message msg = {
91 .rpc_argp = &data->args, 91 .rpc_argp = &data->args,
@@ -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, data->dentry); 108 NFS_PROTO(dir)->unlink_setup(&msg, data->dentry, inode);
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);
@@ -113,7 +113,7 @@ static void nfs_do_call_unlink(struct nfs_unlinkdata *data)
113 rpc_put_task_async(task); 113 rpc_put_task_async(task);
114} 114}
115 115
116static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data) 116static int nfs_call_unlink(struct dentry *dentry, struct inode *inode, struct nfs_unlinkdata *data)
117{ 117{
118 struct inode *dir = d_inode(dentry->d_parent); 118 struct inode *dir = d_inode(dentry->d_parent);
119 struct dentry *alias; 119 struct dentry *alias;
@@ -153,7 +153,7 @@ static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data)
153 return ret; 153 return ret;
154 } 154 }
155 data->dentry = alias; 155 data->dentry = alias;
156 nfs_do_call_unlink(data); 156 nfs_do_call_unlink(inode, data);
157 return 1; 157 return 1;
158} 158}
159 159
@@ -231,7 +231,7 @@ nfs_complete_unlink(struct dentry *dentry, struct inode *inode)
231 dentry->d_fsdata = NULL; 231 dentry->d_fsdata = NULL;
232 spin_unlock(&dentry->d_lock); 232 spin_unlock(&dentry->d_lock);
233 233
234 if (NFS_STALE(inode) || !nfs_call_unlink(dentry, data)) 234 if (NFS_STALE(inode) || !nfs_call_unlink(dentry, inode, data))
235 nfs_free_unlinkdata(data); 235 nfs_free_unlinkdata(data);
236} 236}
237 237
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 52b481dfd61e..d3cefe57c2a3 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 dentry *); 1594 void (*unlink_setup) (struct rpc_message *, struct dentry *, struct inode *);
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,