Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7002828ybi; Thu, 13 Jun 2019 08:00:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBlT3Yp5OvqpttQKwAurglJjN22uKSJou1k8JgrHhY+Di2MEn85GDZUE6m7h4poj5piv7e X-Received: by 2002:a17:902:9a42:: with SMTP id x2mr72153798plv.106.1560438050594; Thu, 13 Jun 2019 08:00:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560438050; cv=none; d=google.com; s=arc-20160816; b=JjPcPEH8kwJkR2OjElKxVpKOdwCVlRam5RWoFSwIv6wdR2N0YShgQfL5IX7NssxTAM DNu3tFv08o8/rSuVAqtUUYFbLeGeBXE3RVIspsNUtkuruQElmw44WPL8Nc2hbkw76h6l K2D+p7SWWHU8heXXLqLPVdLedF3IxmrKTC+uOnbYyjQjXyqI8pHPTPmSziW3bVV8Oh9k j10fJC43kMA+6mOrDZufVof8p7qmIv6If6RdOg30cSWNRw1qa5FMIKXBYW+yS5K/ervx gJXsczHdTTAfQoFYJQ/mIMH3yHp2DDCNNVnph8gc4gVeuJU/29dNmPBQ7/se9jdXL1rt 8irw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:from:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date; bh=kVjntXs+5kU9614Hcc1q5ryPiorl9ocGFx8oLxPnogM=; b=AUgrvLhYejYGT5brOJB/cDl+Rjl4muYKuy0y8ZhCzmJbQFhvXoIRfbhFe8aYfnRgQ0 5qUbh4aSpIQtMThB1ow3L03IudwJmBgP7VCyuaGljmB7A+r0P1FNPY4bxaIZcQKXdwUs 6b2rMF20H4umCkV4FVO7xyAtJR6r3GLlASpojanxutzKMGNvLRBX6Qt9wh2ZMzbPO7v3 PSYsnSMDIIz3HjoRJpWeMzQwXPkR+JfflZnaFQiLuDkW1JPe0oIe8Ted773cdcSZ6/MC YA5/Zy44r98Ze2QPxJW8Rr2lWzwkvQT+iRMJn54rSHMVxC5/E/Go4uCb9QeU8zl+WBKK 6g5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g64si26013pgc.555.2019.06.13.08.00.17; Thu, 13 Jun 2019 08:00:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732607AbfFMO7n (ORCPT + 99 others); Thu, 13 Jun 2019 10:59:43 -0400 Received: from fieldses.org ([173.255.197.46]:52438 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732605AbfFMOvu (ORCPT ); Thu, 13 Jun 2019 10:51:50 -0400 Received: by fieldses.org (Postfix, from userid 2815) id 04208BC5; Thu, 13 Jun 2019 10:51:50 -0400 (EDT) Date: Thu, 13 Jun 2019 10:51:49 -0400 To: Benjamin Coddington Cc: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, linux-nfs@vger.kernel.org Subject: Re: [PATCH] NFS: Don't skip lookup when holding a delegation Message-ID: <20190613145149.GD2145@fieldses.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Jun 12, 2019 at 10:45:13AM -0400, Benjamin Coddington wrote: > If we skip lookup revalidation while holding a delegation, we might miss > that the file has changed directories on the server. The delegation should prevent the file disappearing from this directory, so if I've been following the discussion, the bug was due to overlooking the case where the change happened before we got the delegation. Given that history it seems worth calling out that case specifically? Maybe a comment along the lines of: /* * Note that the file can't move while we hold a * delegation. But this dentry could have been cached * before we got a delegation. So it's only safe to * skip revalidation when the parent directory is * unchanged: */ But maybe there's a pithier way to say that. --b. > The directory's > change attribute should still be checked against the dentry's d_time to > perform a complete revalidation. > > Signed-off-by: Benjamin Coddington > --- > fs/nfs/dir.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c > index a71d0b42d160..10cc684dc082 100644 > --- a/fs/nfs/dir.c > +++ b/fs/nfs/dir.c > @@ -1269,12 +1269,13 @@ nfs_do_lookup_revalidate(struct inode *dir, struct dentry *dentry, > goto out_bad; > } > > - if (NFS_PROTO(dir)->have_delegation(inode, FMODE_READ)) > - return nfs_lookup_revalidate_delegated(dir, dentry, inode); > - > /* Force a full look up iff the parent directory has changed */ > if (!(flags & (LOOKUP_EXCL | LOOKUP_REVAL)) && > nfs_check_verifier(dir, dentry, flags & LOOKUP_RCU)) { > + > + if (NFS_PROTO(dir)->have_delegation(inode, FMODE_READ)) > + return nfs_lookup_revalidate_delegated(dir, dentry, inode); > + > error = nfs_lookup_verify_inode(inode, flags); > if (error) { > if (error == -ESTALE) > @@ -1707,9 +1708,6 @@ nfs4_do_lookup_revalidate(struct inode *dir, struct dentry *dentry, > if (inode == NULL) > goto full_reval; > > - if (NFS_PROTO(dir)->have_delegation(inode, FMODE_READ)) > - return nfs_lookup_revalidate_delegated(dir, dentry, inode); > - > /* NFS only supports OPEN on regular files */ > if (!S_ISREG(inode->i_mode)) > goto full_reval; > -- > 2.20.1