diff options
Diffstat (limited to 'fs/nfs/proc.c')
-rw-r--r-- | fs/nfs/proc.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 611bec22f552..ac40b8535d7e 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -177,7 +177,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
177 | } | 177 | } |
178 | 178 | ||
179 | static int | 179 | static int |
180 | nfs_proc_lookup(struct inode *dir, struct qstr *name, | 180 | nfs_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name, |
181 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | 181 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) |
182 | { | 182 | { |
183 | struct nfs_diropargs arg = { | 183 | struct nfs_diropargs arg = { |
@@ -258,7 +258,7 @@ static void nfs_free_createdata(const struct nfs_createdata *data) | |||
258 | 258 | ||
259 | static int | 259 | static int |
260 | nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | 260 | nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, |
261 | int flags, struct nameidata *nd) | 261 | int flags, struct nfs_open_context *ctx) |
262 | { | 262 | { |
263 | struct nfs_createdata *data; | 263 | struct nfs_createdata *data; |
264 | struct rpc_message msg = { | 264 | struct rpc_message msg = { |
@@ -365,17 +365,32 @@ static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir) | |||
365 | return 1; | 365 | return 1; |
366 | } | 366 | } |
367 | 367 | ||
368 | static void | ||
369 | nfs_proc_rename_setup(struct rpc_message *msg, struct inode *dir) | ||
370 | { | ||
371 | msg->rpc_proc = &nfs_procedures[NFSPROC_RENAME]; | ||
372 | } | ||
373 | |||
374 | static int | ||
375 | nfs_proc_rename_done(struct rpc_task *task, struct inode *old_dir, | ||
376 | struct inode *new_dir) | ||
377 | { | ||
378 | if (nfs_async_handle_expired_key(task)) | ||
379 | return 0; | ||
380 | nfs_mark_for_revalidate(old_dir); | ||
381 | nfs_mark_for_revalidate(new_dir); | ||
382 | return 1; | ||
383 | } | ||
384 | |||
368 | static int | 385 | static int |
369 | nfs_proc_rename(struct inode *old_dir, struct qstr *old_name, | 386 | nfs_proc_rename(struct inode *old_dir, struct qstr *old_name, |
370 | struct inode *new_dir, struct qstr *new_name) | 387 | struct inode *new_dir, struct qstr *new_name) |
371 | { | 388 | { |
372 | struct nfs_renameargs arg = { | 389 | struct nfs_renameargs arg = { |
373 | .fromfh = NFS_FH(old_dir), | 390 | .old_dir = NFS_FH(old_dir), |
374 | .fromname = old_name->name, | 391 | .old_name = old_name, |
375 | .fromlen = old_name->len, | 392 | .new_dir = NFS_FH(new_dir), |
376 | .tofh = NFS_FH(new_dir), | 393 | .new_name = new_name, |
377 | .toname = new_name->name, | ||
378 | .tolen = new_name->len | ||
379 | }; | 394 | }; |
380 | struct rpc_message msg = { | 395 | struct rpc_message msg = { |
381 | .rpc_proc = &nfs_procedures[NFSPROC_RENAME], | 396 | .rpc_proc = &nfs_procedures[NFSPROC_RENAME], |
@@ -443,7 +458,7 @@ nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page, | |||
443 | fattr = nfs_alloc_fattr(); | 458 | fattr = nfs_alloc_fattr(); |
444 | status = -ENOMEM; | 459 | status = -ENOMEM; |
445 | if (fh == NULL || fattr == NULL) | 460 | if (fh == NULL || fattr == NULL) |
446 | goto out; | 461 | goto out_free; |
447 | 462 | ||
448 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); | 463 | status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); |
449 | nfs_mark_for_revalidate(dir); | 464 | nfs_mark_for_revalidate(dir); |
@@ -456,6 +471,7 @@ nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page, | |||
456 | if (status == 0) | 471 | if (status == 0) |
457 | status = nfs_instantiate(dentry, fh, fattr); | 472 | status = nfs_instantiate(dentry, fh, fattr); |
458 | 473 | ||
474 | out_free: | ||
459 | nfs_free_fattr(fattr); | 475 | nfs_free_fattr(fattr); |
460 | nfs_free_fhandle(fh); | 476 | nfs_free_fhandle(fh); |
461 | out: | 477 | out: |
@@ -519,14 +535,14 @@ nfs_proc_rmdir(struct inode *dir, struct qstr *name) | |||
519 | */ | 535 | */ |
520 | static int | 536 | static int |
521 | nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | 537 | nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, |
522 | u64 cookie, struct page *page, unsigned int count, int plus) | 538 | u64 cookie, struct page **pages, unsigned int count, int plus) |
523 | { | 539 | { |
524 | struct inode *dir = dentry->d_inode; | 540 | struct inode *dir = dentry->d_inode; |
525 | struct nfs_readdirargs arg = { | 541 | struct nfs_readdirargs arg = { |
526 | .fh = NFS_FH(dir), | 542 | .fh = NFS_FH(dir), |
527 | .cookie = cookie, | 543 | .cookie = cookie, |
528 | .count = count, | 544 | .count = count, |
529 | .pages = &page, | 545 | .pages = pages, |
530 | }; | 546 | }; |
531 | struct rpc_message msg = { | 547 | struct rpc_message msg = { |
532 | .rpc_proc = &nfs_procedures[NFSPROC_READDIR], | 548 | .rpc_proc = &nfs_procedures[NFSPROC_READDIR], |
@@ -705,6 +721,8 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
705 | .unlink_setup = nfs_proc_unlink_setup, | 721 | .unlink_setup = nfs_proc_unlink_setup, |
706 | .unlink_done = nfs_proc_unlink_done, | 722 | .unlink_done = nfs_proc_unlink_done, |
707 | .rename = nfs_proc_rename, | 723 | .rename = nfs_proc_rename, |
724 | .rename_setup = nfs_proc_rename_setup, | ||
725 | .rename_done = nfs_proc_rename_done, | ||
708 | .link = nfs_proc_link, | 726 | .link = nfs_proc_link, |
709 | .symlink = nfs_proc_symlink, | 727 | .symlink = nfs_proc_symlink, |
710 | .mkdir = nfs_proc_mkdir, | 728 | .mkdir = nfs_proc_mkdir, |
@@ -714,7 +732,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
714 | .statfs = nfs_proc_statfs, | 732 | .statfs = nfs_proc_statfs, |
715 | .fsinfo = nfs_proc_fsinfo, | 733 | .fsinfo = nfs_proc_fsinfo, |
716 | .pathconf = nfs_proc_pathconf, | 734 | .pathconf = nfs_proc_pathconf, |
717 | .decode_dirent = nfs_decode_dirent, | 735 | .decode_dirent = nfs2_decode_dirent, |
718 | .read_setup = nfs_proc_read_setup, | 736 | .read_setup = nfs_proc_read_setup, |
719 | .read_done = nfs_read_done, | 737 | .read_done = nfs_read_done, |
720 | .write_setup = nfs_proc_write_setup, | 738 | .write_setup = nfs_proc_write_setup, |
@@ -723,4 +741,5 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
723 | .lock = nfs_proc_lock, | 741 | .lock = nfs_proc_lock, |
724 | .lock_check_bounds = nfs_lock_check_bounds, | 742 | .lock_check_bounds = nfs_lock_check_bounds, |
725 | .close_context = nfs_close_context, | 743 | .close_context = nfs_close_context, |
744 | .init_client = nfs_init_client, | ||
726 | }; | 745 | }; |