diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-05 11:46:42 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:24 -0400 |
commit | 539cd03a5708c9861a3e738e6f363ad743c85ddf (patch) | |
tree | 3d786675f645621b9a04c7b7aad2bbbca9cc5241 | |
parent | 88be9f990fe70f0f177ef44a16a477599e91f825 (diff) |
NFSv4: Cleanup: pass the nfs_open_context to open recovery code
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/delegation.c | 2 | ||||
-rw-r--r-- | fs/nfs/delegation.h | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 38 |
3 files changed, 21 insertions, 21 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index b47c156a711d..9f17b91205cf 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -74,7 +74,7 @@ again: | |||
74 | continue; | 74 | continue; |
75 | get_nfs_open_context(ctx); | 75 | get_nfs_open_context(ctx); |
76 | spin_unlock(&inode->i_lock); | 76 | spin_unlock(&inode->i_lock); |
77 | err = nfs4_open_delegation_recall(ctx->path.dentry, state); | 77 | err = nfs4_open_delegation_recall(ctx, state); |
78 | if (err >= 0) | 78 | if (err >= 0) |
79 | err = nfs_delegation_claim_locks(ctx, state); | 79 | err = nfs_delegation_claim_locks(ctx, state); |
80 | put_nfs_open_context(ctx); | 80 | put_nfs_open_context(ctx); |
diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h index 2cfd4b24c7fe..f6e42fb21afb 100644 --- a/fs/nfs/delegation.h +++ b/fs/nfs/delegation.h | |||
@@ -39,7 +39,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp); | |||
39 | 39 | ||
40 | /* NFSv4 delegation-related procedures */ | 40 | /* NFSv4 delegation-related procedures */ |
41 | int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid); | 41 | int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid); |
42 | int nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state *state); | 42 | int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state); |
43 | int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl); | 43 | int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl); |
44 | int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode); | 44 | int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode); |
45 | 45 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 4d641cbdbde1..c83db9def0fe 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -462,7 +462,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * | |||
462 | * OPEN_RECLAIM: | 462 | * OPEN_RECLAIM: |
463 | * reclaim state on the server after a reboot. | 463 | * reclaim state on the server after a reboot. |
464 | */ | 464 | */ |
465 | static int _nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) | 465 | static int _nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state *state) |
466 | { | 466 | { |
467 | struct nfs_delegation *delegation = NFS_I(state->inode)->delegation; | 467 | struct nfs_delegation *delegation = NFS_I(state->inode)->delegation; |
468 | struct nfs4_opendata *opendata; | 468 | struct nfs4_opendata *opendata; |
@@ -478,7 +478,7 @@ static int _nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state | |||
478 | } | 478 | } |
479 | delegation_type = delegation->type; | 479 | delegation_type = delegation->type; |
480 | } | 480 | } |
481 | opendata = nfs4_opendata_alloc(dentry, sp, 0, NULL); | 481 | opendata = nfs4_opendata_alloc(ctx->path.dentry, state->owner, 0, NULL); |
482 | if (opendata == NULL) | 482 | if (opendata == NULL) |
483 | return -ENOMEM; | 483 | return -ENOMEM; |
484 | opendata->o_arg.claim = NFS4_OPEN_CLAIM_PREVIOUS; | 484 | opendata->o_arg.claim = NFS4_OPEN_CLAIM_PREVIOUS; |
@@ -490,13 +490,13 @@ static int _nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state | |||
490 | return status; | 490 | return status; |
491 | } | 491 | } |
492 | 492 | ||
493 | static int nfs4_do_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) | 493 | static int nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state *state) |
494 | { | 494 | { |
495 | struct nfs_server *server = NFS_SERVER(state->inode); | 495 | struct nfs_server *server = NFS_SERVER(state->inode); |
496 | struct nfs4_exception exception = { }; | 496 | struct nfs4_exception exception = { }; |
497 | int err; | 497 | int err; |
498 | do { | 498 | do { |
499 | err = _nfs4_do_open_reclaim(sp, state, dentry); | 499 | err = _nfs4_do_open_reclaim(ctx, state); |
500 | if (err != -NFS4ERR_DELAY) | 500 | if (err != -NFS4ERR_DELAY) |
501 | break; | 501 | break; |
502 | nfs4_handle_exception(server, err, &exception); | 502 | nfs4_handle_exception(server, err, &exception); |
@@ -512,12 +512,12 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta | |||
512 | ctx = nfs4_state_find_open_context(state); | 512 | ctx = nfs4_state_find_open_context(state); |
513 | if (IS_ERR(ctx)) | 513 | if (IS_ERR(ctx)) |
514 | return PTR_ERR(ctx); | 514 | return PTR_ERR(ctx); |
515 | ret = nfs4_do_open_reclaim(sp, state, ctx->path.dentry); | 515 | ret = nfs4_do_open_reclaim(ctx, state); |
516 | put_nfs_open_context(ctx); | 516 | put_nfs_open_context(ctx); |
517 | return ret; | 517 | return ret; |
518 | } | 518 | } |
519 | 519 | ||
520 | static int _nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state *state) | 520 | static int _nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state) |
521 | { | 521 | { |
522 | struct nfs4_state_owner *sp = state->owner; | 522 | struct nfs4_state_owner *sp = state->owner; |
523 | struct nfs4_opendata *opendata; | 523 | struct nfs4_opendata *opendata; |
@@ -525,7 +525,7 @@ static int _nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state | |||
525 | 525 | ||
526 | if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) | 526 | if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) |
527 | return 0; | 527 | return 0; |
528 | opendata = nfs4_opendata_alloc(dentry, sp, 0, NULL); | 528 | opendata = nfs4_opendata_alloc(ctx->path.dentry, sp, 0, NULL); |
529 | if (opendata == NULL) | 529 | if (opendata == NULL) |
530 | return -ENOMEM; | 530 | return -ENOMEM; |
531 | opendata->o_arg.claim = NFS4_OPEN_CLAIM_DELEGATE_CUR; | 531 | opendata->o_arg.claim = NFS4_OPEN_CLAIM_DELEGATE_CUR; |
@@ -536,13 +536,13 @@ static int _nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state | |||
536 | return ret; | 536 | return ret; |
537 | } | 537 | } |
538 | 538 | ||
539 | int nfs4_open_delegation_recall(struct dentry *dentry, struct nfs4_state *state) | 539 | int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state) |
540 | { | 540 | { |
541 | struct nfs4_exception exception = { }; | 541 | struct nfs4_exception exception = { }; |
542 | struct nfs_server *server = NFS_SERVER(dentry->d_inode); | 542 | struct nfs_server *server = NFS_SERVER(state->inode); |
543 | int err; | 543 | int err; |
544 | do { | 544 | do { |
545 | err = _nfs4_open_delegation_recall(dentry, state); | 545 | err = _nfs4_open_delegation_recall(ctx, state); |
546 | switch (err) { | 546 | switch (err) { |
547 | case 0: | 547 | case 0: |
548 | return err; | 548 | return err; |
@@ -811,7 +811,7 @@ static int nfs4_recover_expired_lease(struct nfs_server *server) | |||
811 | * reclaim state on the server after a network partition. | 811 | * reclaim state on the server after a network partition. |
812 | * Assumes caller holds the appropriate lock | 812 | * Assumes caller holds the appropriate lock |
813 | */ | 813 | */ |
814 | static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) | 814 | static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *state) |
815 | { | 815 | { |
816 | struct inode *inode = state->inode; | 816 | struct inode *inode = state->inode; |
817 | struct nfs_delegation *delegation = NFS_I(inode)->delegation; | 817 | struct nfs_delegation *delegation = NFS_I(inode)->delegation; |
@@ -820,34 +820,34 @@ static int _nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st | |||
820 | int ret; | 820 | int ret; |
821 | 821 | ||
822 | if (delegation != NULL && !(delegation->flags & NFS_DELEGATION_NEED_RECLAIM)) { | 822 | if (delegation != NULL && !(delegation->flags & NFS_DELEGATION_NEED_RECLAIM)) { |
823 | ret = _nfs4_do_access(inode, sp->so_cred, openflags); | 823 | ret = _nfs4_do_access(inode, ctx->cred, openflags); |
824 | if (ret < 0) | 824 | if (ret < 0) |
825 | return ret; | 825 | return ret; |
826 | memcpy(&state->stateid, &delegation->stateid, sizeof(state->stateid)); | 826 | memcpy(&state->stateid, &delegation->stateid, sizeof(state->stateid)); |
827 | set_bit(NFS_DELEGATED_STATE, &state->flags); | 827 | set_bit(NFS_DELEGATED_STATE, &state->flags); |
828 | return 0; | 828 | return 0; |
829 | } | 829 | } |
830 | opendata = nfs4_opendata_alloc(dentry, sp, openflags, NULL); | 830 | opendata = nfs4_opendata_alloc(ctx->path.dentry, state->owner, openflags, NULL); |
831 | if (opendata == NULL) | 831 | if (opendata == NULL) |
832 | return -ENOMEM; | 832 | return -ENOMEM; |
833 | ret = nfs4_open_recover(opendata, state); | 833 | ret = nfs4_open_recover(opendata, state); |
834 | if (ret == -ESTALE) { | 834 | if (ret == -ESTALE) { |
835 | /* Invalidate the state owner so we don't ever use it again */ | 835 | /* Invalidate the state owner so we don't ever use it again */ |
836 | nfs4_drop_state_owner(sp); | 836 | nfs4_drop_state_owner(state->owner); |
837 | d_drop(dentry); | 837 | d_drop(ctx->path.dentry); |
838 | } | 838 | } |
839 | nfs4_opendata_free(opendata); | 839 | nfs4_opendata_free(opendata); |
840 | return ret; | 840 | return ret; |
841 | } | 841 | } |
842 | 842 | ||
843 | static inline int nfs4_do_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state, struct dentry *dentry) | 843 | static inline int nfs4_do_open_expired(struct nfs_open_context *ctx, struct nfs4_state *state) |
844 | { | 844 | { |
845 | struct nfs_server *server = NFS_SERVER(dentry->d_inode); | 845 | struct nfs_server *server = NFS_SERVER(state->inode); |
846 | struct nfs4_exception exception = { }; | 846 | struct nfs4_exception exception = { }; |
847 | int err; | 847 | int err; |
848 | 848 | ||
849 | do { | 849 | do { |
850 | err = _nfs4_open_expired(sp, state, dentry); | 850 | err = _nfs4_open_expired(ctx, state); |
851 | if (err == -NFS4ERR_DELAY) | 851 | if (err == -NFS4ERR_DELAY) |
852 | nfs4_handle_exception(server, err, &exception); | 852 | nfs4_handle_exception(server, err, &exception); |
853 | } while (exception.retry); | 853 | } while (exception.retry); |
@@ -862,7 +862,7 @@ static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *sta | |||
862 | ctx = nfs4_state_find_open_context(state); | 862 | ctx = nfs4_state_find_open_context(state); |
863 | if (IS_ERR(ctx)) | 863 | if (IS_ERR(ctx)) |
864 | return PTR_ERR(ctx); | 864 | return PTR_ERR(ctx); |
865 | ret = nfs4_do_open_expired(sp, state, ctx->path.dentry); | 865 | ret = nfs4_do_open_expired(ctx, state); |
866 | put_nfs_open_context(ctx); | 866 | put_nfs_open_context(ctx); |
867 | return ret; | 867 | return ret; |
868 | } | 868 | } |