* [PATCH 0/3] NFS recover from delegation stateid error
@ 2012-03-06 14:46 andros
2012-03-06 14:46 ` [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation andros
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: andros @ 2012-03-06 14:46 UTC (permalink / raw)
To: trond.myklebust; +Cc: linux-nfs, Andy Adamson
From: Andy Adamson <andros@netapp.com>
These patches fix recovery from NFS4ERR_BAD_STATEID, NFS4ERR_ADMIN_REVOKED, and
NFS4ERR_DELEG_REVOKED errors by removing the delegation record, testing the
delegation stateid, and recovering via an OPEN with CLAIM_NULL.
Tested with a pynfs test that removes the pynfs server delegation stateid
and return NFS4ERR_BAD_STATEID upon a READ.
Andy Adamson (1):
NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested
Trond Myklebust (2):
NFSv4.1: Fix the checking of the stateid when returning a delegation
NFS: Properly handle the case where the delegation is revoked
fs/nfs/callback_proc.c | 6 +++---
fs/nfs/delegation.c | 13 ++++++++++++-
fs/nfs/delegation.h | 1 +
fs/nfs/nfs4_fs.h | 2 ++
fs/nfs/nfs4proc.c | 16 ++++++++++++++--
fs/nfs/nfs4state.c | 31 ++++++++++++++++++++++++++++++-
6 files changed, 62 insertions(+), 7 deletions(-)
--
1.7.6.4
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation 2012-03-06 14:46 [PATCH 0/3] NFS recover from delegation stateid error andros @ 2012-03-06 14:46 ` andros 2012-03-06 14:57 ` Myklebust, Trond 2012-03-06 14:46 ` [PATCH 2/3] NFS: Properly handle the case where the delegation is revoked andros 2012-03-06 14:46 ` [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested andros 2 siblings, 1 reply; 12+ messages in thread From: andros @ 2012-03-06 14:46 UTC (permalink / raw) To: trond.myklebust; +Cc: linux-nfs, Trond Myklebust, stable From: Trond Myklebust <Trond.Myklebust@netapp.com> nfs41_validate_delegation_stateid is broken if we supply a stateid with a non-zero sequence id. Instead of trying to match the sequence id, the function assumes that we always want to error. While this is true for a delegation callback, it is not true in general. Also fix a typo in nfs4_callback_recall. Reported-by: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: stable@vger.kernel.org --- fs/nfs/callback_proc.c | 6 +++--- fs/nfs/delegation.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index f71978d..63190c1 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c @@ -86,8 +86,7 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, res = 0; break; case -ENOENT: - if (res != 0) - res = htonl(NFS4ERR_BAD_STATEID); + res = htonl(NFS4ERR_BAD_STATEID); break; default: res = htonl(NFS4ERR_RESOURCE); @@ -328,7 +327,8 @@ int nfs41_validate_delegation_stateid(struct nfs_delegation *delegation, const n if (delegation == NULL) return 0; - if (stateid->stateid.seqid != 0) + if (stateid->stateid.seqid != 0 && + stateid->stateid.seqid != delegation->stateid.stateid.seqid) return 0; if (memcmp(&delegation->stateid.stateid.other, &stateid->stateid.other, diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 7f26540..1596098 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -531,7 +531,7 @@ void nfs_expire_unreferenced_delegations(struct nfs_client *clp) /** * nfs_async_inode_return_delegation - asynchronously return a delegation * @inode: inode to process - * @stateid: state ID information from CB_RECALL arguments + * @stateid: state ID information * * Returns zero on success, or a negative errno value. */ -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation 2012-03-06 14:46 ` [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation andros @ 2012-03-06 14:57 ` Myklebust, Trond 2012-03-06 15:13 ` Adamson, Andy 0 si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pOZXRBcHANClRyb25kLk15a2xlYnVzdEBuZXRhcHAuY29tDQp3d3cu bmV0YXBwLmNvbQ0KDQo= ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation 2012-03-06 14:57 ` Myklebust, Trond @ 2012-03-06 15:13 ` Adamson, Andy 2012-03-06 18:20 ` J. Bruce Fields 0 siblings, 1 reply; 12+ messages in thread From: Adamson, Andy @ 2012-03-06 15:13 UTC (permalink / raw) To: Myklebust, Trond Cc: Adamson, Andy, linux-nfs@vger.kernel.org, stable@vger.kernel.org On Mar 6, 2012, at 9:57 AM, Myklebust, Trond wrote: > On Tue, 2012-03-06 at 09:46 -0500, andros@netapp.com wrote: >> From: Trond Myklebust <Trond.Myklebust@netapp.com> >> >> nfs41_validate_delegation_stateid is broken if we supply a stateid with >> a non-zero sequence id. Instead of trying to match the sequence id, >> the function assumes that we always want to error. While this is >> true for a delegation callback, it is not true in general. >> >> Also fix a typo in nfs4_callback_recall. >> >> Reported-by: Andy Adamson <andros@netapp.com> >> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> > > Did you really intend to Cc: stable on these before we've committed them > upstream? I guess I misunderstood when to add the Cc: stable. -->Andy > > -- > Trond Myklebust > Linux NFS client maintainer > > NetApp > Trond.Myklebust@netapp.com > www.netapp.com > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation 2012-03-06 15:13 ` Adamson, Andy @ 2012-03-06 18:20 ` J. Bruce Fields 0 siblings, 0 replies; 12+ messages in thread From: J. Bruce Fields @ 2012-03-06 18:20 UTC (permalink / raw) To: Adamson, Andy Cc: Myklebust, Trond, linux-nfs@vger.kernel.org, stable@vger.kernel.org On Tue, Mar 06, 2012 at 03:13:37PM +0000, Adamson, Andy wrote: > > On Mar 6, 2012, at 9:57 AM, Myklebust, Trond wrote: > > > On Tue, 2012-03-06 at 09:46 -0500, andros@netapp.com wrote: > >> From: Trond Myklebust <Trond.Myklebust@netapp.com> > >> > >> nfs41_validate_delegation_stateid is broken if we supply a stateid with > >> a non-zero sequence id. Instead of trying to match the sequence id, > >> the function assumes that we always want to error. While this is > >> true for a delegation callback, it is not true in general. > >> > >> Also fix a typo in nfs4_callback_recall. > >> > >> Reported-by: Andy Adamson <andros@netapp.com> > >> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> > > > > Did you really intend to Cc: stable on these before we've committed them > > upstream? > > I guess I misunderstood when to add the Cc: stable. Me too--I thought the stable folks would wait till they see a commit? Though adding a Cc: line with the Signed-off-by's and leaving them out of the email header would seem simpler. --b. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] NFS: Properly handle the case where the delegation is revoked 2012-03-06 14:46 [PATCH 0/3] NFS recover from delegation stateid error andros 2012-03-06 14:46 ` [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation andros @ 2012-03-06 14:46 ` andros 2012-03-06 14:46 ` [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested andros 2 siblings, 0 replies; 12+ messages in thread From: andros @ 2012-03-06 14:46 UTC (permalink / raw) To: trond.myklebust; +Cc: linux-nfs, Trond Myklebust, stable From: Trond Myklebust <Trond.Myklebust@netapp.com> If we know that the delegation stateid is bad or revoked, we need to remove that delegation as soon as possible, and then mark all the stateids that relied on that delegation for recovery. We cannot use the delegation as part of the recovery process. Also note that NFSv4.1 uses a different error code (NFS4ERR_DELEG_REVOKED) to indicate that the delegation was revoked. Finally, ensure that setlk() and setattr() can both recover safely from a revoked delegation. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: stable@vger.kernel.org --- fs/nfs/delegation.c | 11 +++++++++++ fs/nfs/delegation.h | 1 + fs/nfs/nfs4_fs.h | 2 ++ fs/nfs/nfs4proc.c | 16 ++++++++++++++-- fs/nfs/nfs4state.c | 26 ++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 2 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 1596098..c14512c 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -466,6 +466,17 @@ static void nfs_delegation_run_state_manager(struct nfs_client *clp) nfs4_schedule_state_manager(clp); } +void nfs_remove_bad_delegation(struct inode *inode) +{ + struct nfs_delegation *delegation; + + delegation = nfs_detach_delegation(NFS_I(inode), NFS_SERVER(inode)); + if (delegation) { + nfs_inode_find_state_and_recover(inode, &delegation->stateid); + nfs_free_delegation(delegation); + } +} + /** * nfs_expire_all_delegation_types * @clp: client to process diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h index d9322e4..691a796 100644 --- a/fs/nfs/delegation.h +++ b/fs/nfs/delegation.h @@ -45,6 +45,7 @@ void nfs_expire_unreferenced_delegations(struct nfs_client *clp); void nfs_handle_cb_pathdown(struct nfs_client *clp); int nfs_client_return_marked_delegations(struct nfs_client *clp); int nfs_delegations_present(struct nfs_client *clp); +void nfs_remove_bad_delegation(struct inode *inode); void nfs_delegation_mark_reclaim(struct nfs_client *clp); void nfs_delegation_reap_unclaimed(struct nfs_client *clp); diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index b133b50..6b53cca 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -318,6 +318,8 @@ extern void nfs4_put_open_state(struct nfs4_state *); extern void nfs4_close_state(struct nfs4_state *, fmode_t); extern void nfs4_close_sync(struct nfs4_state *, fmode_t); extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); +extern void nfs_inode_find_state_and_recover(struct inode *inode, + const nfs4_stateid *stateid); extern void nfs4_schedule_lease_recovery(struct nfs_client *); extern void nfs4_schedule_state_manager(struct nfs_client *); extern void nfs4_schedule_path_down_recovery(struct nfs_client *clp); diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0d5134a..2722388 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -267,8 +267,11 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc switch(errorcode) { case 0: return 0; + case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: + if (state != NULL) + nfs_remove_bad_delegation(state->inode); case -NFS4ERR_OPENMODE: if (state == NULL) break; @@ -1329,6 +1332,7 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state * The show must go on: exit, but mark the * stateid as needing recovery. */ + case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: nfs4_schedule_stateid_recovery(server, state); @@ -1929,7 +1933,9 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, struct nfs4_state *state) { struct nfs_server *server = NFS_SERVER(inode); - struct nfs4_exception exception = { }; + struct nfs4_exception exception = { + .state = state, + }; int err; do { err = nfs4_handle_exception(server, @@ -3753,8 +3759,11 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, if (task->tk_status >= 0) return 0; switch(task->tk_status) { + case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: + if (state != NULL) + nfs_remove_bad_delegation(state->inode); case -NFS4ERR_OPENMODE: if (state == NULL) break; @@ -4595,7 +4604,9 @@ out: static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) { - struct nfs4_exception exception = { }; + struct nfs4_exception exception = { + .state = state, + }; int err; do { @@ -4688,6 +4699,7 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) * The show must go on: exit, but mark the * stateid as needing recovery. */ + case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: case -NFS4ERR_OPENMODE: diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 653bfd7..7bd9822 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1103,6 +1103,32 @@ void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4 nfs4_schedule_state_manager(clp); } +void nfs_inode_find_state_and_recover(struct inode *inode, + const nfs4_stateid *stateid) +{ + struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; + struct nfs_inode *nfsi = NFS_I(inode); + struct nfs_open_context *ctx; + struct nfs4_state *state; + bool found = false; + + spin_lock(&inode->i_lock); + list_for_each_entry(ctx, &nfsi->open_files, list) { + state = ctx->state; + if (state == NULL) + continue; + if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) + continue; + if (memcmp(state->stateid.data, stateid->data, sizeof(state->stateid.data)) != 0) + continue; + nfs4_state_mark_reclaim_nograce(clp, state); + found = true; + } + spin_unlock(&inode->i_lock); + if (found) + nfs4_schedule_state_manager(clp); +} + static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_recovery_ops *ops) { struct inode *inode = state->inode; -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested 2012-03-06 14:46 [PATCH 0/3] NFS recover from delegation stateid error andros 2012-03-06 14:46 ` [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation andros 2012-03-06 14:46 ` [PATCH 2/3] NFS: Properly handle the case where the delegation is revoked andros @ 2012-03-06 14:46 ` andros 2012-03-06 14:53 ` Myklebust, Trond 2 siblings, 1 reply; 12+ messages in thread From: andros @ 2012-03-06 14:46 UTC (permalink / raw) To: trond.myklebust; +Cc: linux-nfs, Andy Adamson, stable From: Andy Adamson <andros@netapp.com> nfs41_open_expired() will test the delegation stateid based on NFS_DELEGATED_STATE being set. If the stateid is bad, nfs4_open_recover will clear the NFS_DELEGATED_STATE bit recovering the delegation. Signed-off-by: Andy Adamson <andros@netapp.com> Cc: stable@vger.kernel.org --- fs/nfs/nfs4state.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 7bd9822..44fcd60 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -696,7 +696,10 @@ static void __nfs4_close(struct nfs4_state *state, call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); } if (newstate == 0) +{ +printk("%s CLEAR NFS_DELEGATED_STATE state %p\n", __func__, state); clear_bit(NFS_DELEGATED_STATE, &state->flags); +} } nfs4_state_set_mode_locked(state, newstate); spin_unlock(&owner->so_lock); @@ -1097,7 +1100,7 @@ void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4 { struct nfs_client *clp = server->nfs_client; - if (test_and_clear_bit(NFS_DELEGATED_STATE, &state->flags)) + if (test_bit(NFS_DELEGATED_STATE, &state->flags)) nfs_async_inode_return_delegation(state->inode, &state->stateid); nfs4_state_mark_reclaim_nograce(clp, state); nfs4_schedule_state_manager(clp); -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested 2012-03-06 14:46 ` [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested andros @ 2012-03-06 14:53 ` Myklebust, Trond 2012-03-06 14:55 ` Andy Adamson 2012-03-06 15:12 ` Andy Adamson 0 siblings, 2 replies; 12+ messages in thread From: Myklebust, Trond @ 2012-03-06 14:53 UTC (permalink / raw) To: Adamson, Andy; +Cc: linux-nfs@vger.kernel.org, stable@vger.kernel.org T24gVHVlLCAyMDEyLTAzLTA2IGF0IDA5OjQ2IC0wNTAwLCBhbmRyb3NAbmV0YXBwLmNvbSB3cm90 ZToNCj4gRnJvbTogQW5keSBBZGFtc29uIDxhbmRyb3NAbmV0YXBwLmNvbT4NCj4gDQo+IG5mczQx X29wZW5fZXhwaXJlZCgpIHdpbGwgdGVzdCB0aGUgZGV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biBtYXJrZWQNCmZvciByZXR1cm4sIGFuZCB3ZSd2ZSB0aHJvd24gb3V0IHRoZSBkZWxlZ2F0 aW9uIGl0c2VsZi4NCg0KTGV0J3Mgbm90IGh1cnJ5IHRoaXMgaW50byB0aGUgc3RhYmxlIHRyZWUg eWV0Li4uDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWlu ZXINCg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20N Cg0K ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested 2012-03-06 14:53 ` Myklebust, Trond @ 2012-03-06 14:55 ` Andy Adamson 2012-03-06 15:12 ` Andy Adamson 1 sibling, 0 replies; 12+ messages in thread From: Andy Adamson @ 2012-03-06 14:55 UTC (permalink / raw) To: Myklebust, Trond Cc: Adamson, Andy, linux-nfs@vger.kernel.org, stable@vger.kernel.org On Tue, Mar 6, 2012 at 9:53 AM, Myklebust, Trond <Trond.Myklebust@netapp.com> wrote: > On Tue, 2012-03-06 at 09:46 -0500, andros@netapp.com wrote: >> From: Andy Adamson <andros@netapp.com> >> >> nfs41_open_expired() will test the delegation stateid based on >> NFS_DELEGATED_STATE being set. If the stateid is bad, nfs4_open_recover >> will clear the NFS_DELEGATED_STATE bit recovering the delegation. >> >> Signed-off-by: Andy Adamson <andros@netapp.com> >> Cc: stable@vger.kernel.org >> --- >> fs/nfs/nfs4state.c | 5 ++++- >> 1 files changed, 4 insertions(+), 1 deletions(-) >> >> diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c >> index 7bd9822..44fcd60 100644 >> --- a/fs/nfs/nfs4state.c >> +++ b/fs/nfs/nfs4state.c >> @@ -696,7 +696,10 @@ static void __nfs4_close(struct nfs4_state *state, >> call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); >> } >> if (newstate == 0) >> +{ >> +printk("%s CLEAR NFS_DELEGATED_STATE state %p\n", __func__, state); >> clear_bit(NFS_DELEGATED_STATE, &state->flags); >> +}\ > > Ewww..... yep, still had stupid development messages -- resent immediately! -->Andy > >> } >> nfs4_state_set_mode_locked(state, newstate); >> spin_unlock(&owner->so_lock); >> @@ -1097,7 +1100,7 @@ void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4 >> { >> struct nfs_client *clp = server->nfs_client; >> >> - if (test_and_clear_bit(NFS_DELEGATED_STATE, &state->flags)) >> + if (test_bit(NFS_DELEGATED_STATE, &state->flags)) >> nfs_async_inode_return_delegation(state->inode, &state->stateid); >> nfs4_state_mark_reclaim_nograce(clp, state); >> nfs4_schedule_state_manager(clp); > > Actually, the latest incarnation of the patch 2/3 removes the > async_inode_return_delegation from nfs4_schedule_stateid_recovery. We > don't need to return the delegation if all the stateids have been marked > for return, and we've thrown out the delegation itself. > > Let's not hurry this into the stable tree yet... > > -- > Trond Myklebust > Linux NFS client maintainer > > NetApp > Trond.Myklebust@netapp.com > www.netapp.com > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested 2012-03-06 14:53 ` Myklebust, Trond 2012-03-06 14:55 ` Andy Adamson @ 2012-03-06 15:12 ` Andy Adamson 2012-03-06 15:17 ` Myklebust, Trond 1 sibling, 1 reply; 12+ messages in thread From: Andy Adamson @ 2012-03-06 15:12 UTC (permalink / raw) To: Myklebust, Trond Cc: Adamson, Andy, linux-nfs@vger.kernel.org, stable@vger.kernel.org On Tue, Mar 6, 2012 at 9:53 AM, Myklebust, Trond <Trond.Myklebust@netapp.com> wrote: > On Tue, 2012-03-06 at 09:46 -0500, andros@netapp.com wrote: >> From: Andy Adamson <andros@netapp.com> >> >> nfs41_open_expired() will test the delegation stateid based on >> NFS_DELEGATED_STATE being set. If the stateid is bad, nfs4_open_recover >> will clear the NFS_DELEGATED_STATE bit recovering the delegation. >> >> Signed-off-by: Andy Adamson <andros@netapp.com> >> Cc: stable@vger.kernel.org >> --- >> fs/nfs/nfs4state.c | 5 ++++- >> 1 files changed, 4 insertions(+), 1 deletions(-) >> >> diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c >> index 7bd9822..44fcd60 100644 >> --- a/fs/nfs/nfs4state.c >> +++ b/fs/nfs/nfs4state.c >> @@ -696,7 +696,10 @@ static void __nfs4_close(struct nfs4_state *state, >> call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); >> } >> if (newstate == 0) >> +{ >> +printk("%s CLEAR NFS_DELEGATED_STATE state %p\n", __func__, state); >> clear_bit(NFS_DELEGATED_STATE, &state->flags); >> +}\ > > Ewww..... > >> } >> nfs4_state_set_mode_locked(state, newstate); >> spin_unlock(&owner->so_lock); >> @@ -1097,7 +1100,7 @@ void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4 >> { >> struct nfs_client *clp = server->nfs_client; >> >> - if (test_and_clear_bit(NFS_DELEGATED_STATE, &state->flags)) >> + if (test_bit(NFS_DELEGATED_STATE, &state->flags)) >> nfs_async_inode_return_delegation(state->inode, &state->stateid); >> nfs4_state_mark_reclaim_nograce(clp, state); >> nfs4_schedule_state_manager(clp); > > Actually, the latest incarnation of the patch 2/3 removes the > async_inode_return_delegation from nfs4_schedule_stateid_recovery. OK - but I think we still need to postpone clearing the NFS_DELEGATED_STATE bit until after calling nfs41_open_expired. Otherwise nfs41_check_expired_stateid will not test the delegation stateid, and nfs4_open_recover will not be called, as no stateid is deemed bad, and the OPEN with CLAIM_NULL to (potentially) recover the delegation will not be sent. In this case, the old bad delegation stateid will be resent. > We > don't need to return the delegation if all the stateids have been marked > for return, and we've thrown out the delegation itself. > > Let's not hurry this into the stable tree yet... OK. -->Andy > > -- > Trond Myklebust > Linux NFS client maintainer > > NetApp > Trond.Myklebust@netapp.com > www.netapp.com > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested 2012-03-06 15:12 ` Andy Adamson @ 2012-03-06 15:17 ` Myklebust, Trond 0 siblings, 0 replies; 12+ messages in thread From: Myklebust, Trond @ 2012-03-06 15:17 UTC (permalink / raw) To: Andy Adamson Cc: Adamson, Andy, linux-nfs@vger.kernel.org, stable@vger.kernel.org T24gVHVlLCAyMDEyLTAzLTA2IGF0IDEwOjEyIC0wNTAwLCBBbmR5IEFkYW1zb24gd3JvdGU6DQo+ IE9uIFR1ZSwgTWFyIDYsIDIwMTIgYXQgOTo1MyBBTSwgTXlrbGVidXN0LCBUcm9uZA0KPiA8VHJv bmQuTXlrbGVidXN0QG5ldGFwcC5jb20+IHdyb3RlOg0KPiA+IE9uIFR1ZSwgMjAxMi0wMy0wNiBh dCAwOTo0NiAtMDUwMCwgYW5kcm9zQG5ldGFwcC5jb20gd3JvdGU6DQo+ID4+IEZyb206IEFuZHkg QWRhbXNvbiA8YW5kcm9zQG5ldGFwcC5jb20+DQo+ID4+DQo+ID4+IG5mczQxX29wZW5fZXhwaXJl ZCgpIHdpbGwgdGVzdCB0aGUgZGVsZWdhdGlvbiBzdGF0ZWlkIGJhc2VkIG9uDQo+ID4+IE5GU19E RUxFR0FURURfU1RBVEUgYmVpbmcgc2V0LiBJZiB0aGUgc3RhdGVpZCBpcyBiYWQsIG5mczRfb3Bl bl9yZWNvdmVyDQo+ID4+IHdpbGwgY2xlYXIgdGhlIE5GU19ERUxFR0FURURfU1RBVEUgYml0IHJl Y292ZXJpbmcgdGhlIGRlbGVnYXRpb24uDQo+ID4+DQo+ID4+IFNpZ25lZC1vZmYtYnk6IEFuZHkg QWRhbXNvbiA8YW5kcm9zQG5ldGFwcC5jb20+DQo+ID4+IENjOiBzdGFibGVAdmdlci5rZXJuZWwu b3JnDQo+ID4+IC0tLQ0KPiA+PiAgZnMvbmZzL25mczRzdGF0ZS5jIHwgICAgNSArKysrLQ0KPiA+ PiAgMSBmaWxl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FuZCBuZnM0X29wZW5fcmVjb3ZlciB3aWxsIG5vdCBiZSBjYWxsZWQsIGFzIG5v IHN0YXRlaWQgaXMNCj4gZGVlbWVkIGJhZCwgYW5kIHRoZSBPUEVOIHdpdGggQ0xBSU1fTlVMTCB0 byAocG90ZW50aWFsbHkpIHJlY292ZXIgdGhlDQo+IGRlbGVnYXRpb24gd2lsbCBub3QgYmUgc2Vu dC4gSW4gdGhpcyBjYXNlLCB0aGUgb2xkIGJhZCBkZWxlZ2F0aW9uDQo+IHN0YXRlaWQgd2lsbCBi ZSByZXNlbnQuDQoNCkFncmVlZC4gUGxlYXNlIHNlZSB0aGUgJ3YyJyBwYXRjaCB0aGF0IEkgc2Vu dCB5b3U6IGl0IHJlbW92ZXMgX2JvdGhfDQpsaW5lcyBhYm92ZSAodGhlIHRlc3QvY2xlYXJpbmcg b2YgdGhlIGJpdCBhbmQgdGhlIGRlbGVnYXRpb24gcmV0dXJuKS4NCg0KLS0gDQpUcm9uZCBNeWts ZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lcg0KDQpOZXRBcHANClRyb25kLk15a2xl YnVzdEBuZXRhcHAuY29tDQp3d3cubmV0YXBwLmNvbQ0KDQo= ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested @ 2012-03-06 14:54 andros 0 siblings, 0 replies; 12+ messages in thread From: andros @ 2012-03-06 14:54 UTC (permalink / raw) To: trond.myklebust; +Cc: linux-nfs, Andy Adamson, stable From: Andy Adamson <andros@netapp.com> nfs41_open_expired() will test the delegation stateid based on NFS_DELEGATED_STATE being set. If the stateid is bad, nfs4_open_recover will clear the NFS_DELEGATED_STATE bit recovering the delegation. Signed-off-by: Andy Adamson <andros@netapp.com> Cc: stable@vger.kernel.org --- fs/nfs/nfs4state.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 7bd9822..5c92185 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1097,7 +1097,7 @@ void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4 { struct nfs_client *clp = server->nfs_client; - if (test_and_clear_bit(NFS_DELEGATED_STATE, &state->flags)) + if (test_bit(NFS_DELEGATED_STATE, &state->flags)) nfs_async_inode_return_delegation(state->inode, &state->stateid); nfs4_state_mark_reclaim_nograce(clp, state); nfs4_schedule_state_manager(clp); -- 1.7.6.4 ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-03-06 18:20 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-03-06 14:46 [PATCH 0/3] NFS recover from delegation stateid error andros 2012-03-06 14:46 ` [PATCH 1/3] NFSv4.1: Fix the checking of the stateid when returning a delegation andros 2012-03-06 14:57 ` Myklebust, Trond 2012-03-06 15:13 ` Adamson, Andy 2012-03-06 18:20 ` J. Bruce Fields 2012-03-06 14:46 ` [PATCH 2/3] NFS: Properly handle the case where the delegation is revoked andros 2012-03-06 14:46 ` [PATCH 3/3] NFSv4.1 do not clear NFS_DELEAGED_STATE until stateid is tested andros 2012-03-06 14:53 ` Myklebust, Trond 2012-03-06 14:55 ` Andy Adamson 2012-03-06 15:12 ` Andy Adamson 2012-03-06 15:17 ` Myklebust, Trond -- strict thread matches above, loose matches on Subject: below -- 2012-03-06 14:54 andros
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).