aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/unlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/unlink.c')
-rw-r--r--fs/nfs/unlink.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index d639d172d568..a65c7b53d558 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -87,10 +87,9 @@ nfs_copy_dname(struct dentry *dentry, struct nfs_unlinkdata *data)
87 * We delay initializing RPC info until after the call to dentry_iput() 87 * We delay initializing RPC info until after the call to dentry_iput()
88 * in order to minimize races against rename(). 88 * in order to minimize races against rename().
89 */ 89 */
90static void 90static void nfs_async_unlink_init(struct rpc_task *task, void *calldata)
91nfs_async_unlink_init(struct rpc_task *task)
92{ 91{
93 struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata; 92 struct nfs_unlinkdata *data = calldata;
94 struct dentry *dir = data->dir; 93 struct dentry *dir = data->dir;
95 struct rpc_message msg = { 94 struct rpc_message msg = {
96 .rpc_cred = data->cred, 95 .rpc_cred = data->cred,
@@ -116,10 +115,9 @@ nfs_async_unlink_init(struct rpc_task *task)
116 * 115 *
117 * Do the directory attribute update. 116 * Do the directory attribute update.
118 */ 117 */
119static void 118static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
120nfs_async_unlink_done(struct rpc_task *task)
121{ 119{
122 struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata; 120 struct nfs_unlinkdata *data = calldata;
123 struct dentry *dir = data->dir; 121 struct dentry *dir = data->dir;
124 struct inode *dir_i; 122 struct inode *dir_i;
125 123
@@ -141,13 +139,18 @@ nfs_async_unlink_done(struct rpc_task *task)
141 * We need to call nfs_put_unlinkdata as a 'tk_release' task since the 139 * We need to call nfs_put_unlinkdata as a 'tk_release' task since the
142 * rpc_task would be freed too. 140 * rpc_task would be freed too.
143 */ 141 */
144static void 142static void nfs_async_unlink_release(void *calldata)
145nfs_async_unlink_release(struct rpc_task *task)
146{ 143{
147 struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata; 144 struct nfs_unlinkdata *data = calldata;
148 nfs_put_unlinkdata(data); 145 nfs_put_unlinkdata(data);
149} 146}
150 147
148static const struct rpc_call_ops nfs_unlink_ops = {
149 .rpc_call_prepare = nfs_async_unlink_init,
150 .rpc_call_done = nfs_async_unlink_done,
151 .rpc_release = nfs_async_unlink_release,
152};
153
151/** 154/**
152 * nfs_async_unlink - asynchronous unlinking of a file 155 * nfs_async_unlink - asynchronous unlinking of a file
153 * @dentry: dentry to unlink 156 * @dentry: dentry to unlink
@@ -157,7 +160,6 @@ nfs_async_unlink(struct dentry *dentry)
157{ 160{
158 struct dentry *dir = dentry->d_parent; 161 struct dentry *dir = dentry->d_parent;
159 struct nfs_unlinkdata *data; 162 struct nfs_unlinkdata *data;
160 struct rpc_task *task;
161 struct rpc_clnt *clnt = NFS_CLIENT(dir->d_inode); 163 struct rpc_clnt *clnt = NFS_CLIENT(dir->d_inode);
162 int status = -ENOMEM; 164 int status = -ENOMEM;
163 165
@@ -178,17 +180,13 @@ nfs_async_unlink(struct dentry *dentry)
178 nfs_deletes = data; 180 nfs_deletes = data;
179 data->count = 1; 181 data->count = 1;
180 182
181 task = &data->task; 183 rpc_init_task(&data->task, clnt, RPC_TASK_ASYNC, &nfs_unlink_ops, data);
182 rpc_init_task(task, clnt, nfs_async_unlink_done , RPC_TASK_ASYNC);
183 task->tk_calldata = data;
184 task->tk_action = nfs_async_unlink_init;
185 task->tk_release = nfs_async_unlink_release;
186 184
187 spin_lock(&dentry->d_lock); 185 spin_lock(&dentry->d_lock);
188 dentry->d_flags |= DCACHE_NFSFS_RENAMED; 186 dentry->d_flags |= DCACHE_NFSFS_RENAMED;
189 spin_unlock(&dentry->d_lock); 187 spin_unlock(&dentry->d_lock);
190 188
191 rpc_sleep_on(&nfs_delete_queue, task, NULL, NULL); 189 rpc_sleep_on(&nfs_delete_queue, &data->task, NULL, NULL);
192 status = 0; 190 status = 0;
193 out: 191 out:
194 return status; 192 return status;