All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] NFS: Remove bad delegations during open recovery
@ 2012-09-26 19:25 bjschuma
  2012-09-26 19:25 ` [PATCH v2 2/2] NFS: Always use the open stateid when checking for expired opens bjschuma
  2012-09-26 22:19 ` [PATCH v2 1/2] NFS: Remove bad delegations during open recovery William Dauchy
  0 siblings, 2 replies; 5+ messages in thread
From: bjschuma @ 2012-09-26 19:25 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs

From: Bryan Schumaker <bjschuma@netapp.com>

I put the client into an open recovery loop by:
	Client: Open file
		read half
	Server: Expire client (echo 0 > /sys/kernel/debug/nfsd/forget_clients)
	Client: Drop vm cache (echo 3 > /proc/sys/vm/drop_caches)
		finish reading file

This causes a loop because the client never updates the nfs4_state after
discovering that the delegation is invalid.  This means it will keep
trying to read using the bad delegation rather than attempting to re-open
the file.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
CC: stable@vger.kernel.org [3.4+]
---
 fs/nfs/nfs4proc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1e50326..1d49168 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1774,7 +1774,11 @@ static void nfs41_clear_delegation_stateid(struct nfs4_state *state)
 		 * informs us the stateid is unrecognized. */
 		if (status != -NFS4ERR_BAD_STATEID)
 			nfs41_free_stateid(server, stateid);
+		nfs_remove_bad_delegation(state->inode);
 
+		write_seqlock(&state->seqlock);
+		nfs4_stateid_copy(&state->stateid, &state->open_stateid);
+		write_sequnlock(&state->seqlock);
 		clear_bit(NFS_DELEGATED_STATE, &state->flags);
 	}
 }
-- 
1.7.12.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] NFS: Always use the open stateid when checking for expired opens
  2012-09-26 19:25 [PATCH v2 1/2] NFS: Remove bad delegations during open recovery bjschuma
@ 2012-09-26 19:25 ` bjschuma
  2012-09-26 22:19 ` [PATCH v2 1/2] NFS: Remove bad delegations during open recovery William Dauchy
  1 sibling, 0 replies; 5+ messages in thread
From: bjschuma @ 2012-09-26 19:25 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs

From: Bryan Schumaker <bjschuma@netapp.com>

If we are reading through a delegation, and the delegation is OK then
state->stateid will still point to a delegation stateid and not an open
stateid.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
---
 fs/nfs/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1d49168..f35c243 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1794,7 +1794,7 @@ static void nfs41_clear_delegation_stateid(struct nfs4_state *state)
 static int nfs41_check_open_stateid(struct nfs4_state *state)
 {
 	struct nfs_server *server = NFS_SERVER(state->inode);
-	nfs4_stateid *stateid = &state->stateid;
+	nfs4_stateid *stateid = &state->open_stateid;
 	int status;
 
 	/* If a state reset has been done, test_stateid is unneeded */
-- 
1.7.12.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] NFS: Remove bad delegations during open recovery
  2012-09-26 19:25 [PATCH v2 1/2] NFS: Remove bad delegations during open recovery bjschuma
  2012-09-26 19:25 ` [PATCH v2 2/2] NFS: Always use the open stateid when checking for expired opens bjschuma
@ 2012-09-26 22:19 ` William Dauchy
  2012-09-27 12:35   ` Bryan Schumaker
  1 sibling, 1 reply; 5+ messages in thread
From: William Dauchy @ 2012-09-26 22:19 UTC (permalink / raw)
  To: bjschuma; +Cc: Trond.Myklebust, linux-nfs

On Wed, Sep 26, 2012 at 9:25 PM,  <bjschuma@netapp.com> wrote:
> This causes a loop because the client never updates the nfs4_state after
> discovering that the delegation is invalid.  This means it will keep
> trying to read using the bad delegation rather than attempting to re-open
> the file.

Oh, I already encountered this bug but never found the time to debug
it / report it.

Thanks a lot! I'll try to test it soon.

-- 
William

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] NFS: Remove bad delegations during open recovery
  2012-09-26 22:19 ` [PATCH v2 1/2] NFS: Remove bad delegations during open recovery William Dauchy
@ 2012-09-27 12:35   ` Bryan Schumaker
  2012-09-28 17:02     ` William Dauchy
  0 siblings, 1 reply; 5+ messages in thread
From: Bryan Schumaker @ 2012-09-27 12:35 UTC (permalink / raw)
  To: William Dauchy; +Cc: Trond.Myklebust, linux-nfs

On 09/26/2012 06:19 PM, William Dauchy wrote:
> On Wed, Sep 26, 2012 at 9:25 PM,  <bjschuma@netapp.com> wrote:
>> This causes a loop because the client never updates the nfs4_state after
>> discovering that the delegation is invalid.  This means it will keep
>> trying to read using the bad delegation rather than attempting to re-open
>> the file.
> 
> Oh, I already encountered this bug but never found the time to debug
> it / report it.
> 
> Thanks a lot! I'll try to test it soon.
> 

Awesome!  Let me know how your tests go, thanks.

- Bryan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] NFS: Remove bad delegations during open recovery
  2012-09-27 12:35   ` Bryan Schumaker
@ 2012-09-28 17:02     ` William Dauchy
  0 siblings, 0 replies; 5+ messages in thread
From: William Dauchy @ 2012-09-28 17:02 UTC (permalink / raw)
  To: Bryan Schumaker; +Cc: Trond.Myklebust, linux-nfs

On Thu, Sep 27, 2012 at 2:35 PM, Bryan Schumaker <bjschuma@netapp.com> wrote:
> Awesome!  Let me know how your tests go, thanks.

Oh I didn't saw it was nfs4.1 specific since the header shows "NFS:
Remove bad delegations during open recovery"
Sorry, I thought about a general nfs bug.

Regards,
-- 
William

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-09-28 17:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-26 19:25 [PATCH v2 1/2] NFS: Remove bad delegations during open recovery bjschuma
2012-09-26 19:25 ` [PATCH v2 2/2] NFS: Always use the open stateid when checking for expired opens bjschuma
2012-09-26 22:19 ` [PATCH v2 1/2] NFS: Remove bad delegations during open recovery William Dauchy
2012-09-27 12:35   ` Bryan Schumaker
2012-09-28 17:02     ` William Dauchy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.