hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/fs/nfs/unlink.c
....@@ -31,7 +31,7 @@
3131 static void
3232 nfs_free_unlinkdata(struct nfs_unlinkdata *data)
3333 {
34
- put_rpccred(data->cred);
34
+ put_cred(data->cred);
3535 kfree(data->args.name.name);
3636 kfree(data);
3737 }
....@@ -39,6 +39,7 @@
3939 /**
4040 * nfs_async_unlink_done - Sillydelete post-processing
4141 * @task: rpc_task of the sillydelete
42
+ * @calldata: pointer to nfs_unlinkdata
4243 *
4344 * Do the directory attribute update.
4445 */
....@@ -54,7 +55,7 @@
5455
5556 /**
5657 * nfs_async_unlink_release - Release the sillydelete data.
57
- * @task: rpc_task of the sillydelete
58
+ * @calldata: struct nfs_unlinkdata to release
5859 *
5960 * We need to call nfs_put_unlinkdata as a 'tk_release' task since the
6061 * rpc_task would be freed too.
....@@ -97,7 +98,7 @@
9798 .callback_ops = &nfs_unlink_ops,
9899 .callback_data = data,
99100 .workqueue = nfsiod_workqueue,
100
- .flags = RPC_TASK_ASYNC,
101
+ .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF,
101102 };
102103 struct rpc_task *task;
103104 struct inode *dir = d_inode(data->dentry->d_parent);
....@@ -159,8 +160,8 @@
159160
160161 /**
161162 * 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
164165 */
165166 static int
166167 nfs_async_unlink(struct dentry *dentry, const struct qstr *name)
....@@ -177,11 +178,7 @@
177178 goto out_free;
178179 data->args.name.len = name->len;
179180
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();
185182 data->res.dir_attr = &data->dir_attr;
186183 init_waitqueue_head(&data->wq);
187184
....@@ -202,8 +199,7 @@
202199 return 0;
203200 out_unlock:
204201 spin_unlock(&dentry->d_lock);
205
- put_rpccred(data->cred);
206
-out_free_name:
202
+ put_cred(data->cred);
207203 kfree(data->args.name.name);
208204 out_free:
209205 kfree(data);
....@@ -307,7 +303,7 @@
307303 iput(data->old_dir);
308304 iput(data->new_dir);
309305 nfs_sb_deactive(sb);
310
- put_rpccred(data->cred);
306
+ put_cred(data->cred);
311307 kfree(data);
312308 }
313309
....@@ -329,6 +325,7 @@
329325 * @new_dir: target directory for the rename
330326 * @old_dentry: original dentry to be renamed
331327 * @new_dentry: dentry to which the old_dentry should be renamed
328
+ * @complete: Function to run on successful completion
332329 *
333330 * It's expected that valid references to the dentries and inodes are held
334331 */
....@@ -344,7 +341,7 @@
344341 .callback_ops = &nfs_rename_ops,
345342 .workqueue = nfsiod_workqueue,
346343 .rpc_client = NFS_CLIENT(old_dir),
347
- .flags = RPC_TASK_ASYNC,
344
+ .flags = RPC_TASK_ASYNC | RPC_TASK_CRED_NOREF,
348345 };
349346
350347 data = kzalloc(sizeof(*data), GFP_KERNEL);
....@@ -352,12 +349,7 @@
352349 return ERR_PTR(-ENOMEM);
353350 task_setup_data.callback_data = data;
354351
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();
361353
362354 msg.rpc_argp = &data->args;
363355 msg.rpc_resp = &data->res;
....@@ -404,12 +396,6 @@
404396 nfs_cancel_async_unlink(dentry);
405397 return;
406398 }
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);
413399 }
414400
415401 #define SILLYNAME_PREFIX ".nfs"