.. | .. |
---|
31 | 31 | static void |
---|
32 | 32 | nfs_free_unlinkdata(struct nfs_unlinkdata *data) |
---|
33 | 33 | { |
---|
34 | | - put_rpccred(data->cred); |
---|
| 34 | + put_cred(data->cred); |
---|
35 | 35 | kfree(data->args.name.name); |
---|
36 | 36 | kfree(data); |
---|
37 | 37 | } |
---|
.. | .. |
---|
39 | 39 | /** |
---|
40 | 40 | * nfs_async_unlink_done - Sillydelete post-processing |
---|
41 | 41 | * @task: rpc_task of the sillydelete |
---|
| 42 | + * @calldata: pointer to nfs_unlinkdata |
---|
42 | 43 | * |
---|
43 | 44 | * Do the directory attribute update. |
---|
44 | 45 | */ |
---|
.. | .. |
---|
54 | 55 | |
---|
55 | 56 | /** |
---|
56 | 57 | * nfs_async_unlink_release - Release the sillydelete data. |
---|
57 | | - * @task: rpc_task of the sillydelete |
---|
| 58 | + * @calldata: struct nfs_unlinkdata to release |
---|
58 | 59 | * |
---|
59 | 60 | * We need to call nfs_put_unlinkdata as a 'tk_release' task since the |
---|
60 | 61 | * rpc_task would be freed too. |
---|
.. | .. |
---|
97 | 98 | .callback_ops = &nfs_unlink_ops, |
---|
98 | 99 | .callback_data = data, |
---|
99 | 100 | .workqueue = nfsiod_workqueue, |
---|
100 | | - .flags = RPC_TASK_ASYNC, |
---|
| 101 | + .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF, |
---|
101 | 102 | }; |
---|
102 | 103 | struct rpc_task *task; |
---|
103 | 104 | struct inode *dir = d_inode(data->dentry->d_parent); |
---|
.. | .. |
---|
159 | 160 | |
---|
160 | 161 | /** |
---|
161 | 162 | * nfs_async_unlink - asynchronous unlinking of a file |
---|
162 | | - * @dir: parent directory of dentry |
---|
163 | | - * @dentry: dentry to unlink |
---|
| 163 | + * @dentry: parent directory of dentry |
---|
| 164 | + * @name: name of dentry to unlink |
---|
164 | 165 | */ |
---|
165 | 166 | static int |
---|
166 | 167 | nfs_async_unlink(struct dentry *dentry, const struct qstr *name) |
---|
.. | .. |
---|
177 | 178 | goto out_free; |
---|
178 | 179 | data->args.name.len = name->len; |
---|
179 | 180 | |
---|
180 | | - data->cred = rpc_lookup_cred(); |
---|
181 | | - if (IS_ERR(data->cred)) { |
---|
182 | | - status = PTR_ERR(data->cred); |
---|
183 | | - goto out_free_name; |
---|
184 | | - } |
---|
| 181 | + data->cred = get_current_cred(); |
---|
185 | 182 | data->res.dir_attr = &data->dir_attr; |
---|
186 | 183 | init_waitqueue_head(&data->wq); |
---|
187 | 184 | |
---|
.. | .. |
---|
202 | 199 | return 0; |
---|
203 | 200 | out_unlock: |
---|
204 | 201 | spin_unlock(&dentry->d_lock); |
---|
205 | | - put_rpccred(data->cred); |
---|
206 | | -out_free_name: |
---|
| 202 | + put_cred(data->cred); |
---|
207 | 203 | kfree(data->args.name.name); |
---|
208 | 204 | out_free: |
---|
209 | 205 | kfree(data); |
---|
.. | .. |
---|
307 | 303 | iput(data->old_dir); |
---|
308 | 304 | iput(data->new_dir); |
---|
309 | 305 | nfs_sb_deactive(sb); |
---|
310 | | - put_rpccred(data->cred); |
---|
| 306 | + put_cred(data->cred); |
---|
311 | 307 | kfree(data); |
---|
312 | 308 | } |
---|
313 | 309 | |
---|
.. | .. |
---|
329 | 325 | * @new_dir: target directory for the rename |
---|
330 | 326 | * @old_dentry: original dentry to be renamed |
---|
331 | 327 | * @new_dentry: dentry to which the old_dentry should be renamed |
---|
| 328 | + * @complete: Function to run on successful completion |
---|
332 | 329 | * |
---|
333 | 330 | * It's expected that valid references to the dentries and inodes are held |
---|
334 | 331 | */ |
---|
.. | .. |
---|
344 | 341 | .callback_ops = &nfs_rename_ops, |
---|
345 | 342 | .workqueue = nfsiod_workqueue, |
---|
346 | 343 | .rpc_client = NFS_CLIENT(old_dir), |
---|
347 | | - .flags = RPC_TASK_ASYNC, |
---|
| 344 | + .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF, |
---|
348 | 345 | }; |
---|
349 | 346 | |
---|
350 | 347 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
---|
.. | .. |
---|
352 | 349 | return ERR_PTR(-ENOMEM); |
---|
353 | 350 | task_setup_data.callback_data = data; |
---|
354 | 351 | |
---|
355 | | - data->cred = rpc_lookup_cred(); |
---|
356 | | - if (IS_ERR(data->cred)) { |
---|
357 | | - struct rpc_task *task = ERR_CAST(data->cred); |
---|
358 | | - kfree(data); |
---|
359 | | - return task; |
---|
360 | | - } |
---|
| 352 | + data->cred = get_current_cred(); |
---|
361 | 353 | |
---|
362 | 354 | msg.rpc_argp = &data->args; |
---|
363 | 355 | msg.rpc_resp = &data->res; |
---|
.. | .. |
---|
404 | 396 | nfs_cancel_async_unlink(dentry); |
---|
405 | 397 | return; |
---|
406 | 398 | } |
---|
407 | | - |
---|
408 | | - /* |
---|
409 | | - * vfs_unlink and the like do not issue this when a file is |
---|
410 | | - * sillyrenamed, so do it here. |
---|
411 | | - */ |
---|
412 | | - fsnotify_nameremove(dentry, 0); |
---|
413 | 399 | } |
---|
414 | 400 | |
---|
415 | 401 | #define SILLYNAME_PREFIX ".nfs" |
---|