Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7887341ybl; Thu, 16 Jan 2020 07:14:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzRTE8xknIaA8L+cfG0dLRg/lbNbUR3NZfEPuIjHznHmIItZuTOBq0shX89BxvvnTeyxbjb X-Received: by 2002:a9d:3ea:: with SMTP id f97mr2278943otf.42.1579187669467; Thu, 16 Jan 2020 07:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579187669; cv=none; d=google.com; s=arc-20160816; b=DSQ47+lzotVfqtJ1bqAAxRCpMhBeagI1oQRQN4O3mxpZH7LZV/et6C2tl3prUpAYZK D5T8bQiBn8P0wah7mKPYvd2ikIgard/D94l2iYSzlkRe3CgHicxSKr72yhCLeJqJTAKO FTPVdD7x39DyzP4PQMDpGGYCZgjPscQOPE2odMim7nCIGvruBPXygj4VrcgHYScArKUk F28x4a6ZVii4kKOBgQyzk9RkEoSdQsf6TvVH2lRVmAfLTug7WSwHlNBIkGGiC6HN/CDx HhEh0uKs6A4HUzKvwfO8BKaM+LodVf2UXjVtmcvo5bZvTk9CZdw6UwtmxQFGCzsXgIq1 cu0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=DUcwveTOiooHWqdbWNDViWn/M8o8oi8gjp+XFqmlu3Q=; b=gUmCM0SG7IEH2uDt1f+h/oS6FXQbFYpXXl+Xw7oLcr+CqGVbRYunoOsLXUhpQ1Sd7N 8j8i4vuJjqT5QXpvd4XSRH3Sq+ir4WMevqvUBEHesgpH6v6w7bVJX62OFmPpjpW15qNK sYqVrWSVOAY/RSeGTn9Z3/afAqy6HX5oj1GQJlFo+CuYTvaXUFVUFGweTdzglQO6Z3Sp wU93sYkMFLMpSsZyfsihHvCOIbxxycy2ZDM0UatN3S0FLgdkNnR3GehnMhTTACmhAYeQ aJHIztPrqmZEBejoiCRUUqSnLP7Qc82eMfqXXPsJFtqpIBj8lmChKPYcRXj7szh2OFhD 6Ohg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AqgOXEOd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si16678160otj.235.2020.01.16.07.14.09; Thu, 16 Jan 2020 07:14:29 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AqgOXEOd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726189AbgAPPNz (ORCPT + 99 others); Thu, 16 Jan 2020 10:13:55 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:58176 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726160AbgAPPNy (ORCPT ); Thu, 16 Jan 2020 10:13:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579187633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DUcwveTOiooHWqdbWNDViWn/M8o8oi8gjp+XFqmlu3Q=; b=AqgOXEOdych4imjNeYZUy0eafGWoiiG2s/SLoBLYyB1o4Smdn7e4cvDUhUX7/+NlCJ+9KN PcMPYN2btGLGb6LFWqZW4PlLROPd/SHu75QyRZc0TxMXHgyWDqMmLHH4FV543TAC53cUpw YocVrYNLB8tSYxrOvQQZOEQKCpK/3o4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-e19STbyzPZyRYBeN4LCcNw-1; Thu, 16 Jan 2020 10:13:49 -0500 X-MC-Unique: e19STbyzPZyRYBeN4LCcNw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D72EB1005502; Thu, 16 Jan 2020 15:13:48 +0000 (UTC) Received: from [172.16.176.1] (ovpn-64-2.rdu2.redhat.com [10.10.64.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86489811FF; Thu, 16 Jan 2020 15:13:48 +0000 (UTC) From: "Benjamin Coddington" To: "Trond Myklebust" Cc: linux-nfs@vger.kernel.org Subject: Re: Lookup revalidation for OPEN_CLAIM_FH Date: Thu, 16 Jan 2020 10:13:47 -0500 Message-ID: In-Reply-To: <7eae4162d7c8a85bbb7fddab3a818472ec2ebc54.camel@hammerspace.com> References: <31B20BC3-A089-47F9-9821-7A3543FF7413@redhat.com> <7eae4162d7c8a85bbb7fddab3a818472ec2ebc54.camel@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 16 Jan 2020, at 9:35, Trond Myklebust wrote: > On Thu, 2020-01-16 at 08:51 -0500, Benjamin Coddington wrote: >> Hi Trond, >> >> I'd like to fix up lookup revalidation for v4.1+ when the client is >> using >> OPEN_CLAIM_FH. The fixes a while back for Stan Hu's case do not seem >> to >> improve things for v4.1, and actually make the behavior a bit worse >> since we >> no longer pass through nfs_lookup_verify_inode(), which would catch >> the >> cases where nlink == 0. >> >> Would you accept work to _always_ revalidate the dentry's parent for >> CLAIM_FH? Alternatively, it seems that CLAIM_NULL would be >> preferable for >> this case, though I don't know how the client would know when to >> decide >> between them. >> >> Here's a simple reproducer for convenience, I think we've already all >> agreed >> that the behavior we want is for the second open by `cat` to reflect >> the >> results of the move on the server, or at least eventually later opens >> would >> revalidate the dentry: >> >> #!/bin/bash >> >> set -o xtrace >> vers=4.1 >> >> exportfs -ua >> exportfs -o rw,sec=sys,no_root_squash *:/exports >> >> mkdir /mnt/localhost || true >> >> rm -f /exports/file{1,2} >> >> echo this is file 1 > /exports/file1 >> echo this is file 2 > /exports/file2 >> >> mount -t nfs -ov$vers,sec=sys localhost:/exports /mnt/localhost >> >> tail -f /mnt/localhost/file1 & >> sleep 1 >> >> # this is file 1 >> cat /mnt/localhost/file1 >> >> # overwrite the file on the server: >> mv -f /exports/file2 /exports/file1 >> >> # this is file 2 >> cat /mnt/localhost/file1 >> >> killall tail >> # this is file 2 >> cat /mnt/localhost/file1 >> umount /mnt/localhost >> >> >> Switching the $vers variable between v4.0 and v4.1 in this script >> shows the >> difference in behavior. >> > > If somebody needs stronger lookup cache revalidation, then that's what > they have the 'lookupcache=none' mount option for. We have these > 'lookupcache' mount options in order to allow users to tailor the > caching behaviour (on a per-mount basis) should the default behaviour > be insufficiently strict. > > Since your testcase doesn't use that mount option, I don't see what it > is proving other than what we already know about the default lookup > caching: namely that it sacrifices some accuracy in the interest of > file open performance. Thanks for the look. The testcase only provides a comparison of different behavior between v4.0 and v4.1, which is due to our use of CLAIM_NULL vs CLAIM_FH. Indeed, setting lookupcache=none give real-time updates. With default lookupcache, after the directory attributes time out, the client will likewise get the namespace right. So, this isn't a major problem, but we do have some QE folks that are unhappy about it. Can we improve things a bit for v4.1 without sacrificing performance? I can't think of a reason to not go back to CLAIM_NULL in nfs4_file_open(). Maybe it is a bit more work on the server to have to do one extra lookup per open, but we'll end up with the right file each time. It makes sense to keep CLAIM_FH for recovery, but why keep it for regular opens? Ben