Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp577212rwr; Thu, 27 Apr 2023 05:40:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6yky8X82h0eokFYhgOLaVKs2i5/UivjzvH7a239iSGSYb6tRSJYnJagTpC0DmNdFkhwyJH X-Received: by 2002:a17:90b:1e4f:b0:247:9d19:311f with SMTP id pi15-20020a17090b1e4f00b002479d19311fmr1725644pjb.30.1682599208498; Thu, 27 Apr 2023 05:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682599208; cv=none; d=google.com; s=arc-20160816; b=qfLgGgjje1SmTbp6X6HjlWad78+GkuLuvSovHP6bUSGHmOBFlTIzoULpRFLwQmGWwc YJc45/X2KTW3XoS50Htsy05vcjVLxgkpk7AdMMkNjvCtQwpY97H2LnXIfW6tU303Y/wU r6R3dNqMgDik6JIkH4258q/80XyU8fNN8xknrQJRTcs0d1cnk1SFTLVJXhENWhljuZYj fUZeq+n2Juvnq1B4FFH49Dqzk46T10UFsp9Z/X3AmsVxR/jW3xhW8PMQuruYHcfc0hmW PpLwOlunh6UPURlKI3hKZfPQxJEpcr5Y5oTgyJ9JS+BdlopUhwkQkS5YmfJr6rDuvIjG yJuA== 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=c4upoSGz+k+e+el5zscXUKPfxUEDiAW8o9zGPiapxio=; b=ofjUtm1lm2d9emYGsx0MLChKfzT3zlNC2fTGw2phb00cpvk7XfXge4rRaG0weJpufw 0idf8LBO9IMUZygOdp5ZJB5gOchflTjcuMIcXIcXddfyr/DQheOfQvpa78yTx9T1HP8H PolaGMa6pEgUiK0EOPhVzjohb7n3RNR9NFkPqNTvgDzgDrT9E5+mkc/BXaN2ZelarDGy jcX7EIAgEfnXqbHxvWI79ABIGawqP+chUXhIMjG0UynIdVzPL70r6laeuj0O2CJhai9S KYpJFHDobB5AXulrGDuP1bjjhwVF6HTCCSKJYgQ8tFEPFabEqGzMQM7xlxXSwkVBY0fm FQrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DPnim84K; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d13-20020a17090ad98d00b002471d40b4d0si20513796pjv.106.2023.04.27.05.39.48; Thu, 27 Apr 2023 05:40:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DPnim84K; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243850AbjD0M2o (ORCPT + 99 others); Thu, 27 Apr 2023 08:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243996AbjD0M2h (ORCPT ); Thu, 27 Apr 2023 08:28:37 -0400 Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85DE15BB7; Thu, 27 Apr 2023 05:28:35 -0700 (PDT) Received: by mail-ua1-x92d.google.com with SMTP id a1e0cc1a2514c-77217c862b3so2620299241.3; Thu, 27 Apr 2023 05:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682598514; x=1685190514; 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=c4upoSGz+k+e+el5zscXUKPfxUEDiAW8o9zGPiapxio=; b=DPnim84Ki8Z5lVy0hY7rTRJQ17k6jHg37OMO7mxe19JyrOc2XGr+8vD5AN0jNAiNA4 FkBTmCDOdHhnXz/kNZkbfCIssDVpSVhkpWJL81ToU1eQa4vIxRJnNsw1s8cHQozj5j6S /1N60U8POemboyMsf5Ks2QHaSQN386N0LTFzwStylM6p2n83XosvIgG4q7gmgKvfz/sH WOPBCpXI1AIel1RmDPTX7zYSybJA4ZrURGdH+HrQXfwqyP/N8IFqGcs/Z16imtzHZQ2n xcULxnlzz4J0IIEQsRT2l6nbxBx0iXU14m51RSqaAjWK+xX1G8RX8dkemsikMXqwS7Zw G9+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682598514; x=1685190514; 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=c4upoSGz+k+e+el5zscXUKPfxUEDiAW8o9zGPiapxio=; b=YatOIi1xlaO8SRoM8bT0nC45tOpgeTO+UUEGfZfyHow8DURcmWFH3nJGI20Ch9XeQd QeA2QxcwJ/LEP2Nuh7jYXiJ8Qv0QsW3dcDXGlEbiXRg1OLce5GoDeunahMaKXuGWC8BR JY+L8vKOZljb5JBFwWsgDGux/11kxshj9gsAq06ogGh0MZErxcjPs9F+ocMtZaCvV1nc M1XgxFfZVdH/hMq8RopSt9CtCzztmVZ+WECRNtc5u5hZABHaNzbNquHImoP0LG0eq5Cl dy9k0G1WUDGdqn+Buqn00SOaojsXm0uCjHpdJys5ykqbqyboenawC6FNY5Ltkr2uBVIv Dmcw== X-Gm-Message-State: AC+VfDyGdzbSxzLTrV0es+Pc+PoKkrLpDewATUSVlojipVoY83PWTKE2 W56SdtPRephnMDI5oBjO2+oCH2NHCAge/3DkG0s= X-Received: by 2002:a05:6102:3579:b0:42f:ec21:1c18 with SMTP id bh25-20020a056102357900b0042fec211c18mr589937vsb.35.1682598514273; Thu, 27 Apr 2023 05:28:34 -0700 (PDT) MIME-Version: 1.0 References: <20230425130105.2606684-1-amir73il@gmail.com> <20230425130105.2606684-5-amir73il@gmail.com> <20230427114849.cv3kzxk7rvxpohjc@quack3> In-Reply-To: <20230427114849.cv3kzxk7rvxpohjc@quack3> From: Amir Goldstein Date: Thu, 27 Apr 2023 15:28:23 +0300 Message-ID: Subject: Re: [RFC][PATCH 4/4] fanotify: support reporting non-decodeable file handles To: Jan Kara Cc: Christian Brauner , Miklos Szeredi , linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, Chuck Lever , Jeff Layton , Linux NFS Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org s_export_op On Thu, Apr 27, 2023 at 2:48=E2=80=AFPM Jan Kara wrote: > > On Tue 25-04-23 16:01:05, Amir Goldstein wrote: > > fanotify users do not always need to decode the file handles reported > > with FAN_REPORT_FID. > > > > Relax the restriction that filesystem needs to support NFS export and > > allow reporting file handles from filesystems that only support ecoding > > unique file handles. > > > > For such filesystems, users will have to use the AT_HANDLE_FID of > > name_to_handle_at(2) if they want to compare the object in path to the > > object fid reported in an event. > > > > Signed-off-by: Amir Goldstein > ... > > diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fa= notify_user.c > > index 8f430bfad487..a5af84cbb30d 100644 > > --- a/fs/notify/fanotify/fanotify_user.c > > +++ b/fs/notify/fanotify/fanotify_user.c > > @@ -1586,11 +1586,9 @@ static int fanotify_test_fid(struct dentry *dent= ry) > > * We need to make sure that the file system supports at least > > * encoding a file handle so user can use name_to_handle_at() to > > * compare fid returned with event to the file handle of watched > > - * objects. However, name_to_handle_at() requires that the > > - * filesystem also supports decoding file handles. > > + * objects, but it does not need to support decoding file handles= . > > */ > > - if (!dentry->d_sb->s_export_op || > > - !dentry->d_sb->s_export_op->fh_to_dentry) > > + if (!dentry->d_sb->s_export_op) > > return -EOPNOTSUPP; > > So AFAICS the only thing you require is that s_export_op is set to > *something* as exportfs_encode_inode_fh() can deal with NULL ->encode_fh > just fine without any filesystem cooperation. What is the reasoning behin= d > the dentry->d_sb->s_export_op check? Is there an implicit expectation tha= t > if s_export_op is set to something, the filesystem has sensible > i_generation? Or is it just a caution that you don't want the functionali= ty > to be enabled for unexpected filesystems? A little bit of both. Essentially, I do not want to use the generic encoding unless the filesyste= m opted-in to say "This is how objects should be identified". The current fs that have s_export_op && !s_export_op->encode_fh practically make that statement because they support NFS export (i.e. they implement fh_to_dentry()). I don't like the implicit fallback to generic encoding, especially when introducing this new functionality of encode_fid(). Before posting this patch set I had two earlier revisions. One that changed the encode_fh() to mandatory and converted all the INO32_GEN fs to explicitly set s_export_op.encode_fh =3D generic_encode_ino32_fh, And one that marked all the INO32_GEN fs with s_export_op.flags =3D EXPORT_OP_ENCODE_INO32_GEN in both cases there was no blind fallback to INO32_GEN. But in the end, these added noise without actual value so I dropped them, because the d_sb->s_export_op check is anyway a pretty strong indication for opt-in to export fids. CC exportfs maintainers in case they have an opinion one way or the other. > In either case it would be good > to capture the reasoning either in a comment or the changelog... > Will do. Thanks, Amir.