Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6572584ybi; Wed, 29 May 2019 09:41:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw61dd1Bj90c7X5BPtLgK73CxUpVjlBxTF85nhb/T3GZBjKI68vtmmPUZ03vt1m5LiIU3Cc X-Received: by 2002:a63:2248:: with SMTP id t8mr96740799pgm.358.1559148070336; Wed, 29 May 2019 09:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559148070; cv=none; d=google.com; s=arc-20160816; b=V1GiqN5sx+1iv1rdW8eCiWgrOjVytU7nrrYJUpJkfLG//A4t5qJfNqplQn2LL5Ngad zHeyEoGfsC5kdncLaVCOdCeaFWb/gsgroYkLv9ofwp0Ff+2OFHyxl9qh8urOUiWe6F9J jMTYVqPW7TqC98jjxJbIQOk0XzV56F2r75aTFJHLSpEgpI9TlvNHEHsEp4VsP9fm7qDo bAlEQffFaZUDGe4Ihs5LYoYS945Zd2M6LAHwHWf6D8M3u+JHYi20ly0l+1ebex3vCC9X OOCJR2TbtWJpkEhv/qtvcy9RsmwF9ly4ObKi21782F1QxVGKhQqPcp0ZjwX/kvPtj/TK +1eQ== 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; bh=R3WJetdWn288g3lAqnuxAUzETOLLppvfgrmE1tW18Ok=; b=JwTLr9eu/hzMzQbAp3yie/9oKlIoAqXr7T1HjP8oC8B/G9EKtaLsc3A27sXok+Awb/ ElMYWwq3VW8ZAHAoIY95vTvNzu9wZqJ1B212Ho0Zb1O9m6YptzHDwtDKg8ql/PvNTJpR FxcdJcywzqlc7jsqy/7SeA2P8BnMjDzWvbgnSsVkhSIQS1jNn5aV9bxH50V2s85kRB90 tMvrURdKytEWyBAF5k9PDJNoKoVerB56mkSfVme9PgOl6XLO5nE/f0L5uN4okvJnY6vf E0XfDkbdF2cWdCm1xcey5nksD8G5J/u762BKhMRUDSafsLkD6LJ66iUn+8Veoiw+Vzc3 PiEw== 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; dmarc=fail (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 gn18si11752plb.273.2019.05.29.09.40.49; Wed, 29 May 2019 09:41:10 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726162AbfE2QjQ (ORCPT + 99 others); Wed, 29 May 2019 12:39:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55960 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbfE2QjQ (ORCPT ); Wed, 29 May 2019 12:39:16 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id BBBEC7F7B9; Wed, 29 May 2019 16:39:15 +0000 (UTC) Received: from [10.10.66.66] (ovpn-66-66.rdu2.redhat.com [10.10.66.66]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66147600C4; Wed, 29 May 2019 16:39:14 +0000 (UTC) From: "Benjamin Coddington" To: "Trond Myklebust" Cc: linux-nfs@vger.kernel.org Subject: Re: client lookup_revalidate bug Date: Wed, 29 May 2019 12:39:13 -0400 Message-ID: <66FFF553-5DEE-4B49-A207-7B0D63FBAECB@redhat.com> In-Reply-To: <458733948202ed0fddf37cbb79730b5ebdabd551.camel@hammerspace.com> References: <458733948202ed0fddf37cbb79730b5ebdabd551.camel@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 29 May 2019 16:39:16 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 29 May 2019, at 12:21, Trond Myklebust wrote: > On Wed, 2019-05-29 at 11:08 -0400, Benjamin Coddington wrote: >> Hey, here's an interesting one, this seems wrong: >> >> [root@fedora27_c2_v5 ~]# mkdir /mnt/one >> [root@fedora27_c2_v5 ~]# mkdir /mnt/two >> [root@fedora27_c2_v5 ~]# mount -t nfs -ov4,noac,sec=sys,nosharecache >> 192.168.122.50:/exports /mnt/one >> [root@fedora27_c2_v5 ~]# mount -t nfs -ov4,noac,sec=sys,nosharecache >> 192.168.122.50:/exports /mnt/two >> [root@fedora27_c2_v5 ~]# mkdir /mnt/one/A >> [root@fedora27_c2_v5 ~]# mkdir /mnt/one/B >> [root@fedora27_c2_v5 ~]# touch /mnt/one/A/foo >> [root@fedora27_c2_v5 ~]# cat /mnt/two/A/foo >> [root@fedora27_c2_v5 ~]# mv /mnt/two/A/foo /mnt/two/B/foo >> [root@fedora27_c2_v5 ~]# mv /mnt/one/B/foo /mnt/one/A/foo >> [root@fedora27_c2_v5 ~]# cat /mnt/two/A/foo >> [root@fedora27_c2_v5 ~]# stat /mnt/two/B/foo >> File: /mnt/two/B/foo >> Size: 0 Blocks: 0 IO Block: 262144 regular >> empty >> file >> Device: 2fh/47d Inode: 439603 Links: 1 >> Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: >> ( 0/ root) >> Context: system_u:object_r:nfs_t:s0 >> Access: 2019-05-28 14:00:18.929663705 -0400 >> Modify: 2019-05-28 14:00:18.929663705 -0400 >> Change: 2019-05-28 14:00:58.990124573 -0400 >> Birth: - >> >> >> ^^ that lstat should return -ENOENT. >> >> I think we detect a stale directory by comparing the directory's >> change_attr with the dentry's d_time. But, here's a case where they >> are >> the same! >> >> Am I wrong about this, or any clever ideas to catch this case? >> > > When you are mounting using 'nosharecache' then you are making /mnt/one > and /mnt/two act as if they are different filesystems. The fact that > they are the same on the server, means you are setting up a testcase > where the files+directories are acting like the "changing on the > server" case as far as the client is concerned. > > If you want the above to work in a sane fashion, then just don't use > 'nosharecache'. That was deliberate to avoid having to show two clients in the example.. sorry, I should have been more explicit. I think the client should be able to detect this case, since it can see an updated change_attr for that particular directory -- that is "/mnt/two/B/foo", but maybe it needs to compare the change_attr to its previous value instead of comparing it to the child's d_time? The person who reported it has some workload that flips files between directories on separate clients, and doesn't like it when `mv` reports "source and destination are the same file". Ben