Return-Path: Received: from mail-io0-f177.google.com ([209.85.223.177]:33202 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753117AbbHRVNR (ORCPT ); Tue, 18 Aug 2015 17:13:17 -0400 Received: by iods203 with SMTP id s203so205028516iod.0 for ; Tue, 18 Aug 2015 14:13:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1419021845-96747-1-git-send-email-trond.myklebust@primarydata.com> <1419021845-96747-2-git-send-email-trond.myklebust@primarydata.com> Date: Tue, 18 Aug 2015 17:13:16 -0400 Message-ID: Subject: Re: [PATCH v3 2/2] NFSv4: Remove incorrect check in can_open_delegated() From: Olga Kornievskaia To: Trond Myklebust Cc: linux-nfs Content-Type: text/plain; charset=UTF-8 Sender: linux-nfs-owner@vger.kernel.org List-ID: On Tue, Aug 18, 2015 at 5:07 PM, Trond Myklebust wrote: > On Tue, Aug 18, 2015 at 1:38 PM, Olga Kornievskaia wrote: >> >> This is the patch that breaks recovery of opens upon server reboot. >> >> I have a test that open a file and gets a write delegation and tried >> to do a write. At this point, I reboot my server so that write fails >> with bad_session and then stale_clientid. Upon completing the >> exchange_id, create_session, and putrootfh, the client no longer sends >> the open to be recovered and instead resends the failed write. It >> would use all 0s stateid (this is 4.1) for the write and for the close >> that follows it. > > Why is the client not attempting to recover the open? That's a bug, > whether or not this patch is correct. I added printks in the path of nfs4_do_reclaim(). Client does "attempt" to recover the open. OPEN never goes on the wire because can_open_delegated() returned true and no action of adding an rpc task gets done. > >> On Fri, Dec 19, 2014 at 3:44 PM, Trond Myklebust >> wrote: >> > Remove an incorrect check for NFS_DELEGATION_NEED_RECLAIM in >> > can_open_delegated(). We are allowed to cache opens even in >> > a situation where we're doing reboot recovery. >> > >> > Signed-off-by: Trond Myklebust >> > --- >> > fs/nfs/nfs4proc.c | 2 -- >> > 1 file changed, 2 deletions(-) >> > >> > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c >> > index 8514b59a8c30..002c7dfedb08 100644 >> > --- a/fs/nfs/nfs4proc.c >> > +++ b/fs/nfs/nfs4proc.c >> > @@ -1119,8 +1119,6 @@ static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode) >> > return 0; >> > if ((delegation->type & fmode) != fmode) >> > return 0; >> > - if (test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags)) >> > - return 0; >> > if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags)) >> > return 0; >> > nfs_mark_delegation_referenced(delegation); >> > -- >> > 2.1.0 >> >