Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1945474rda; Tue, 24 Oct 2023 07:59:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVCBqWParuqwvyQtBZWr4XqttyXYW2rf/8Fxl6h7t1Rtki73Ct3sBL+oFNtM34tGXJaIbT X-Received: by 2002:a17:902:c401:b0:1c7:37e2:13ff with SMTP id k1-20020a170902c40100b001c737e213ffmr12748234plk.6.1698159557232; Tue, 24 Oct 2023 07:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698159557; cv=none; d=google.com; s=arc-20160816; b=jVHBfK1xthBzNlJ63STdjjli8FiUA/WTPn1wB16crNdImZYCEZKgAxPDlzFeVquHib MpBLCCRyE9Bt8cFvcQFNP2Wyi1pYHRMm222IyP6kakVQqx2EIcMXD2YPwvxaSbdUxLRS azd2CCqJ6XXxQOnH4YZEKY2wrrOwK3l6XHTaIz/uNHvw0+DItc8HTqs3Q1rBf4q4RFi1 Qpz4gQ1AKpoSb3Taah9vjrBsWvBN4sSrfzYDjpESTy+gCM6IhymOPYbfyuOpVums2NDN qg6l8/GQnO3fz28mL2WOhNRB4Zes+CRvucPq6ufq+qRE3+jXZNmI3gacdqcH0UnslCAX VlBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=lgC1tceMFuFWQh3HbwcDE2UVKXUmrKtvxdP2vIm+wYw=; fh=49dYkGGJhhLbKegsH1Wk/0C4D9gWJPELGgGARlTIwkY=; b=k3bR83cI6jr1ewV3/02v5fEaiRf7eljxysxOJN3ugfdP8tyjRzNc+5fqm6Rflje/Vn yM/6Ugi24k2aeamY/FLBPmZQkp6+h9b/HL8Pm8qlRIKA1/VbpZMw13F3iVngPQ26qh44 QwP1j8o4ikV9ugWsW3X5CRVbw+ZKuXeqpWtJZy6fe1Z4QQH2r/FNL5Dz4eplvx9LQAtM C78cChnap/zN843LFU+k4QxHAyWqV70haGs10XtY3HbvGfnLmg8Q90qP1W6ix7P9nRYF hWif2ygsCkfAoc7wx5PKP1VvBiBVsQIrpsvQGMdjNlu5Q9/Xy+KigoBx8ekBnq9u5eT9 LGAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UGBPU5SR; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id m15-20020a170902db0f00b001b8a4954be1si8821279plx.595.2023.10.24.07.59.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:59:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UGBPU5SR; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D6C0780A7904; Tue, 24 Oct 2023 07:59:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234612AbjJXO7L (ORCPT + 99 others); Tue, 24 Oct 2023 10:59:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234594AbjJXO7L (ORCPT ); Tue, 24 Oct 2023 10:59:11 -0400 Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78E05111; Tue, 24 Oct 2023 07:59:09 -0700 (PDT) Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-66d4453ba38so28523926d6.0; Tue, 24 Oct 2023 07:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698159548; x=1698764348; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lgC1tceMFuFWQh3HbwcDE2UVKXUmrKtvxdP2vIm+wYw=; b=UGBPU5SRcFK8aZpJDcKkOsUzxKplU+fEykeBJceljGnYzk6WvOcnpCo1D59Sy86iV9 T4/eqEIlydXIE8RAyncrErdpvWWP/n+hroehfPHau08wlWj7MRf7Hh6DUddSKnnNbwQl b23Fdn+4DmXFf1dINoZzVIGpJrhH9YKfGwtjGCWfxRsygmHIma3U4T8iMGzXcqEycleP El7hzJxDw+MYneyl6548IPhrxy7u1CTsMEscWF1niD4TANBGriDdsy109x2f858p97J9 xLVNibL2cbQHnRBINBDSAM6zwGkgx1UJWfgNyYGn/t9nLUAA8Qfoa5VC7L95NOwYkPll YMaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698159548; x=1698764348; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lgC1tceMFuFWQh3HbwcDE2UVKXUmrKtvxdP2vIm+wYw=; b=FgsalX7c5RV9iluJz36J+7Cff3EaSzJzFHCRHzYqMdx0K+EsOm9HcEMs2jJJR030g2 42sRDRDkNfB4P7kNr7Vn62exxwqpsgsgXdUZkbJkmFlxtdCWqvhbmj0yO294xHT0C7k0 VSZ6L6VOBRHRVbbSsGJ0Z3Ru7X8wMlUT5WUYV9Pzh59KGDasbUG4kcut/hzn5920QA8V zAr/ThbtPX2nFHmchPYtv0KGzO8+AvtgqR77tUO27WJocRVVdZU+Zti7zUikO0d/D6OB gMVuGWRy9jaYxo8DgUSPoBpmTkUZlQn4EgEAe2U2VdKLkp4b1+M5nPIn413CjA9dPMca uUUA== X-Gm-Message-State: AOJu0Yw5ngvApwUVQ5TSMsFnYIiEhKbNn3TUlaoqgGIdlvW5FWxN+v8G YeFfMAKKUSBunmGiekkVjqwr4HQ720rdQY39m2Q= X-Received: by 2002:a05:6214:2266:b0:66d:1174:3b46 with SMTP id gs6-20020a056214226600b0066d11743b46mr19435648qvb.50.1698159548459; Tue, 24 Oct 2023 07:59:08 -0700 (PDT) MIME-Version: 1.0 References: <20231024110109.3007794-1-amir73il@gmail.com> <1CFE0178-CE91-4C99-B43E-33EF78D0BEBF@redhat.com> In-Reply-To: <1CFE0178-CE91-4C99-B43E-33EF78D0BEBF@redhat.com> From: Amir Goldstein Date: Tue, 24 Oct 2023 17:58:57 +0300 Message-ID: Subject: Re: [PATCH] nfs: derive f_fsid from server's fsid To: Benjamin Coddington Cc: Trond Myklebust , Anna Schumaker , Jeff Layton , Chuck Lever , Christian Brauner , Jan Kara , linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 24 Oct 2023 07:59:12 -0700 (PDT) On Tue, Oct 24, 2023 at 5:01=E2=80=AFPM Benjamin Coddington wrote: > > On 24 Oct 2023, at 7:01, Amir Goldstein wrote: > > > Fold the server's 128bit fsid to report f_fsid in statfs(2). > > This is similar to how uuid is folded for f_fsid of ext2/ext4/zonefs. > > > > This allows nfs client to be monitored by fanotify filesystem watch > > for local client access if nfs supports re-export. > > > > For example, with inotify-tools 4.23.8.0, the following command can be > > used to watch local client access over entire nfs filesystem: > > > > fsnotifywatch --filesystem /mnt/nfs > > > > Note that fanotify filesystem watch does not report remote changes on > > server. It provides the same notifications as inotify, but it watches > > over the entire filesystem and reports file handle of objects and fsid > > with events. > > I think this will run into trouble where an NFSv4 will report both > fsid.major and fsid.minor as zero for the special root filesystem. We c= an > expect an NFSv4 client to have one of these per server. > > Could use s_dev from nfs_server for a unique major/minor for each mount o= n > the client, but these values won't be stable against a particular server > export. > That's a good point. Not sure I understand the relation between mount/server/export. If the client mounts the special NFSv4 root filesystem at /mnt/nfs, are the rest of the server exports going to be accessible via the same mount/sb or via new auto mounts of different nfs sb? In any case, f_fsid does not have to be uniform across all inodes of the same sb. This is the case with btrfs, where the the btrfs sb has inodes from the root volume and from sub-volumes. inodes from btrfs sub-volumes have a different f_fsid than inodes in the root btrfs volume. We try to detect this case in fanotify, which currently does not support watching btrfs sub-volume for that reason. I have a WIP branch [1] for handling non-uniform f_fsid in fanotify by introducing the s_op->get_fsid(inode) method. Anyway, IIUC, my proposed f_fsid change is going to be fine for NFSv2/3 and best effort for NFSv4: - For NFSv2/3 mount, f_fsid is a good identifier? - For NFSv4 mount of a specific export, f_fsid is a good identifier? - For the NFSv4 root export mount, f_fsid remains zero as it is now Am I understanding this correctly? Do you see a reason not to make this change? Do you see a reason to limit this change for NFSv2/3? Thanks, Amir. [1] https://github.com/amir73il/linux/commits/inode_fsid