Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp382671rdb; Tue, 23 Jan 2024 02:41:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHESdNnYnqm8u0BZvPLlnHMDmr13VioE/dD1px4pqZkAFdfVWBgADug6mS+2n95D+ypwAX/ X-Received: by 2002:a17:90a:eb14:b0:290:295:342 with SMTP id j20-20020a17090aeb1400b0029002950342mr2262864pjz.95.1706006490563; Tue, 23 Jan 2024 02:41:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706006490; cv=pass; d=google.com; s=arc-20160816; b=I3N5SyOjCBp1D4cC6tf8syur+cwiRYqXhdCPFwo80s+3dhT15UqLIRR9oe5vseXqXo kCVN76L9wVM0Qc2y/JRzPrMP20418LLniU3BWXt8l8YFvMQ7mXqndXzAbxIieMuJ6n9I 81pS8jXLS4pWk/tHipZpaTQ1HiBp4J9bmV2XLaadH/pAHYkRjlm3HcExJoEA4ZCcq9mE +WGCkGD3AwKxlnipU9V733Uuaj6ViQO9yQw1w7HgFA/tKn0L+KVsYKoH0k+gIwGg19nl RkciPwpWGBeVkitBg+0kbiQHySEyrmVIS3jIlstTjCK4RHKzct9ZaoSqpYcw+79vvfhS iuyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=lEuib/EdgbaI5BOajtxygHVDzAAtoC80tI3q672HVNo=; fh=jOKR+LUejp7EggohR0Rd/oCi+7dD7Xw9IMkQLR4mJt0=; b=pAesvJAp9n9Ks27cc4+MSln5uN7WZS9rHlpvfwg2ow6AsTdCxfx8kj8H99+B4dHH5Q mn7a39In3KIoK5XNshA+C4ChAMiltJsSorjmHvXUo0SYsTowou17Q1chVvUh1TceYyBH I1e4CLeaDbcN3TIgsZZeSQlEYGdKmSjb0r+yTj38xj36CH+ZYcwhtxHCAp9EpBKmLkVu 4qS4NZrPciW1UUEuIMOLytTA3cU7Q+P0xQ43+FC5NP1ppQzJP7mgh1pAEKAEgwsZc8WC JakET1D7iY3GStwxE0umJtROB5MA5am9KMu5cLyva3scxUT6hZCjF2iQ7LHoPq656Qcv KfSQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-35110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35110-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id w9-20020a17090aea0900b0029006dc5d23si9696166pjy.58.2024.01.23.02.41.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:41:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-35110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35110-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E56E2B23749 for ; Tue, 23 Jan 2024 10:41:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A051E5C8F0; Tue, 23 Jan 2024 10:40:54 +0000 (UTC) Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 444C35C619; Tue, 23 Jan 2024 10:40:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.112 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706006454; cv=none; b=IYp+m96QVaiQKW1NU4ErEet1UnYCw18wyVJhhchBD1JRCO9IADZDjt6ACvoExYJscLtZY24o72jpuk1r0ktMbQtQCj1Sq8+aRGzQtzHsozUDlNwkUCoP02nFKKa2+/5p2/40p9tgPtF6FBqtII+6eHI/ubgs92u1VzhqPjZ/TiE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706006454; c=relaxed/simple; bh=x/7+wwKxczN3ej1c6k89cW/RUSox0yusws0gWmDca6o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pRqXfimOFngLIKPl1iIAWPQGG1EVYCZ87hY1DYSSw4zQXQpe+AcupVXGuCqihnPwUHJ9LrJacxBR/2VDJbabuBecqEK/DWIkW32zJX2rw10AMN3UTF4Zn+NAx9mSHNCv3sBRDlbzYo5hu/HTbh8AMR1KChRmzIxFr5ec6Clnduk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; arc=none smtp.client-ip=115.124.30.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0W.CZc3u_1706006441; Received: from 30.221.145.142(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0W.CZc3u_1706006441) by smtp.aliyun-inc.com; Tue, 23 Jan 2024 18:40:42 +0800 Message-ID: <3d1d06de-cb59-40d7-b0df-110e7dc904d6@linux.alibaba.com> Date: Tue, 23 Jan 2024 18:40:40 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC] fuse: disable support for file handle when FUSE_EXPORT_SUPPORT not configured Content-Language: en-US To: Amir Goldstein Cc: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240123093701.94166-1-jefflexu@linux.alibaba.com> From: Jingbo Xu In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/23/24 6:17 PM, Amir Goldstein wrote: > If you somehow find a way to mitigate the regression for NFS export of > old fuse servers (maybe an opt-in Kconfig?), your patch is also going to > regress AT_HANDLE_FID functionality, which can be used by fanotify to > monitor fuse. > > AT_HANDLE_FID flag to name_to_handle_at(2) means that > open_by_handle_at(2) is not supposed to be called on that fh. > > The correct way to deal with that would be something like this: > > +static const struct export_operations fuse_fid_operations = { > + .encode_fh = fuse_encode_fh, > +}; > + > static const struct export_operations fuse_export_operations = { > .fh_to_dentry = fuse_fh_to_dentry, > .fh_to_parent = fuse_fh_to_parent, > @@ -1529,12 +1533,16 @@ static void fuse_fill_attr_from_inode(struct > fuse_attr *attr, > > static void fuse_sb_defaults(struct super_block *sb) > { > + struct fuse_mount *fm = get_fuse_mount_super(sb); > + > sb->s_magic = FUSE_SUPER_MAGIC; > sb->s_op = &fuse_super_operations; > sb->s_xattr = fuse_xattr_handlers; > sb->s_maxbytes = MAX_LFS_FILESIZE; > sb->s_time_gran = 1; > - sb->s_export_op = &fuse_export_operations; > + if (fm->fc->export_support) > + sb->s_export_op = &fuse_export_operations; > + else > + sb->s_export_op = &fuse_fid_operations; > sb->s_iflags |= SB_I_IMA_UNVERIFIABLE_SIGNATURE; > if (sb->s_user_ns != &init_user_ns) > sb->s_iflags |= SB_I_UNTRUSTED_MOUNTER; > > --- > > This would make name_to_handle_at() without AT_HANDLE_FID fail > and name_to_handle_at() with AT_HANDLE_FID to succeed as it should. > Oh I didn't notice this. Many thanks! -- Thanks, Jingbo