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 /fs/nfs/nfs4proc.c | |
parent | 88be9f990fe70f0f177ef44a16a477599e91f825 (diff) |
NFSv4: Cleanup: pass the nfs_open_context to open recovery code
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 38 |
1 files changed, 19 insertions, 19 deletions
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 | } |