Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1075716rdb; Wed, 24 Jan 2024 04:19:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEn6xtScRLX6X4RAu19BkJQS8ko4wGsRTydpUQtqjOrDyBZtwVG+DFc56RVLl8veCcwZpxM X-Received: by 2002:a05:6a00:4fcd:b0:6dd:816a:94db with SMTP id le13-20020a056a004fcd00b006dd816a94dbmr1947502pfb.27.1706098768073; Wed, 24 Jan 2024 04:19:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706098768; cv=pass; d=google.com; s=arc-20160816; b=RHznFy+wXsTjO2DemVk8r/AsK7m7uWGzR4s2aTgBtF2t4ja94OmqBvVhzSBc4gqu54 s85bZT42RbUQ5gzcOAwJHU8X4/7vlASejne6F7AcjlkeyfSNOA8Xv63kt8Halx2MfAgL E4MiaRzgy0W0XoqZybDAmjNmRhjY2QEcR/MHSgOXITXlCHymMbRL/gHy+DE2SXltFQGl q/fo5wp11wCQjxrahjpvMmRVf7YWfn9n0NJAkXcwYDQ6qW8sguj/tDMn4yflYwY9W1d6 Ci7EurL3fwceQH9FTYPyqIy5s10W/XC9CIn6iqjmYXjswV9BYiIV6nrMJtPV06msuqV6 4yNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=R534gPYSNr7qXXwj05XS3LR+Dft8ZupD8G2mc4eLBbQ=; fh=WoJWmkAfkOfyvA9Tcd+OqgZMxUzsLxfcMcBOwzDaGXQ=; b=W+LRiyszPudBYdSPMHmJptvhzf9lcnCJKLXydqyhmDeyqmowTwJ9jMCJteY1v6qXcm ASxExaFM3/W5drNOBvTM6C5YEP0AOKkKZTFuHxiD/jOnb4SRpI5GHIYFzqPlS80hmCfd 4tkkR1UmqnZcgtF4jjwkn92KQR7GvN4FPfZ3/gwd/XJFY7jrMDyLLabC5gfsR1uMM8Id 7wLuMg1pLYYb14cb6/vUPWaJD+Riq2LuVlCew3sCCxNhyRjDM3oJrg9p3v36fCMxsXUk +5vee1/h2ojsBTfbyzI+c8Aij/oLEPKXdSRI9igEJC0eTd1b+V/54nvodv7Rz64JrRgI p9Vg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=eY2C3aO6; arc=pass (i=1 spf=pass spfdomain=szeredi.hu dkim=pass dkdomain=szeredi.hu dmarc=pass fromdomain=szeredi.hu); spf=pass (google.com: domain of linux-kernel+bounces-36952-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36952-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jw14-20020a056a00928e00b006dda07733c2si841326pfb.183.2024.01.24.04.19.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 04:19:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36952-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=eY2C3aO6; arc=pass (i=1 spf=pass spfdomain=szeredi.hu dkim=pass dkdomain=szeredi.hu dmarc=pass fromdomain=szeredi.hu); spf=pass (google.com: domain of linux-kernel+bounces-36952-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36952-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 26A322823EB for ; Wed, 24 Jan 2024 12:17:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E8DA63110; Wed, 24 Jan 2024 12:17:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="eY2C3aO6" Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 291A762A19 for ; Wed, 24 Jan 2024 12:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706098633; cv=none; b=j6cAVxzyZY8xNSUyqI8d+eAKhybXaVl6+OcOn1yXZUWtdw5PCbbAV6EMaH1cT4TdN28lDlUDWQ/1sE1kBk4pvCLkdz4Hlecu7JiOfUONP6JwouOZyyDTE7WO4u7tqn9ZHzOWOic30bx9GXJ3bK7VhgxiQzEGfro9H//+7nuEyKw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706098633; c=relaxed/simple; bh=9rIW4BZC82xuUDbZFWKobPmRbLgwvfViOByLftgM8f0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=BLL3B4kbreH+ea84J6hfG9ifna+5G3LK+YibjIqe7KQUEZ2WH8KmrCgRZcTty9OFXQ6HHu24m9Hdw4rQ2mKC3Z6namBJA/aJkhpeC5769tFigQ7Q9jgC6PPV83dnzfrQLT0V13/ah0PQRShabP3aGuyYFRQmwb0C4P02WWrj8Qg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu; spf=pass smtp.mailfrom=szeredi.hu; dkim=pass (1024-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b=eY2C3aO6; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szeredi.hu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=szeredi.hu Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a310409589aso103002666b.3 for ; Wed, 24 Jan 2024 04:17:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1706098628; x=1706703428; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=R534gPYSNr7qXXwj05XS3LR+Dft8ZupD8G2mc4eLBbQ=; b=eY2C3aO6WLIbI3GT251VVVbSFjASKKxtAzhUmudwDd6PxAXES28URJT61sXMPCvdN+ qBKu5kDHelOLa/vJEcyuWN3SMyhXFyxWO3qBQ/RzOQfcwJywNdgZ03mfXbNfU8Mkjb5i I9Xjdyvb3AMBZo1DFN1+ycalxUOPQVcELysNg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706098628; x=1706703428; h=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=R534gPYSNr7qXXwj05XS3LR+Dft8ZupD8G2mc4eLBbQ=; b=rAfJ4JP70LVZHu+b59wmCDiq/WOrL0a4748sDLlqIXuV8vxkPu9j1GDFN+Cps9YFtG q8Lg1tIWDka7d1U/YI99Sf6gNDhNzJSdI7fAnF/5I50uBEpQtBeAmUvE2LxldTxaXr+i 4qByXcEN3pwJCt3H0j62DABWaMDlE8Fo1RrQwymN42SMqQSNyqX553ha4bwSCuRTWKaT unnn8Eb7ARqHv3yboI85QodNX6l4AtLjVaDozNs9mimYuwDfrdVQiyvcRinG8qIw3EzJ JdyVWsa40GaRxPh1OxcEJ2z1J17GP88zKagFmlpLqEP0j8ZOcx07Zk7h3knzooFlZaeO 6oNw== X-Gm-Message-State: AOJu0YyvQ9iS/5VxmXRpQNruI1B1rIjk7jJ+uP8VE4iPTPvqfMHsyr9k 9vtntnHn7jCxd59p5W5ZnslGEuc63d1aUVot1ddfyzI7OWCRaMz/O6j3aDwH86AmMYcMIH2oa0s v68WPG5lggzfkD+9ADQCV8o4QnKwwdCLRFI0r7Q== X-Received: by 2002:a17:907:a805:b0:a31:4083:4d06 with SMTP id vo5-20020a170907a80500b00a3140834d06mr121802ejc.85.1706098628041; Wed, 24 Jan 2024 04:17:08 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240124113042.44300-1-jefflexu@linux.alibaba.com> In-Reply-To: <20240124113042.44300-1-jefflexu@linux.alibaba.com> From: Miklos Szeredi Date: Wed, 24 Jan 2024 13:16:56 +0100 Message-ID: Subject: Re: [PATCH] fuse: add support for explicit export disabling To: Jingbo Xu Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, amir73il@gmail.com Content-Type: text/plain; charset="UTF-8" On Wed, 24 Jan 2024 at 12:30, Jingbo Xu wrote: > > open_by_handle_at(2) can fail with -ESTALE with a valid handle returned > by a previous name_to_handle_at(2) for evicted fuse inodes, which is > especially common when entry_valid_timeout is 0, e.g. when the fuse > daemon is in "cache=none" mode. > > The time sequence is like: > > name_to_handle_at(2) # succeed > evict fuse inode > open_by_handle_at(2) # fail > > The root cause is that, with 0 entry_valid_timeout, the dput() called in > name_to_handle_at(2) will trigger iput -> evict(), which will send > FUSE_FORGET to the daemon. The following open_by_handle_at(2) will send > a new FUSE_LOOKUP request upon inode cache miss since the previous inode > eviction. Then the fuse daemon may fail the FUSE_LOOKUP request with > -ENOENT as the cached metadata of the requested inode has already been > cleaned up during the previous FUSE_FORGET. The returned -ENOENT is > treated as -ESTALE when open_by_handle_at(2) returns. > > This confuses the application somehow, as open_by_handle_at(2) fails > when the previous name_to_handle_at(2) succeeds. The returned errno is > also confusing as the requested file is not deleted and already there. > It is reasonable to fail name_to_handle_at(2) early in this case, after > which the application can fallback to open(2) to access files. > > Since this issue typically appears when entry_valid_timeout is 0 which > is configured by the fuse daemon, the fuse daemon is the right person to > explicitly disable the export when required. > > Also considering FUSE_EXPORT_SUPPORT actually indicates the support for > lookups of "." and "..", and there are existing fuse daemons supporting > export without FUSE_EXPORT_SUPPORT set, for compatibility, we add a new > INIT flag for such purpose. This looks good overall. > > Signed-off-by: Jingbo Xu > --- > RFC: https://lore.kernel.org/all/20240123093701.94166-1-jefflexu@linux.alibaba.com/ > --- > fs/fuse/inode.c | 11 ++++++++++- > include/uapi/linux/fuse.h | 2 ++ > 2 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c > index 2a6d44f91729..851940c0e930 100644 > --- a/fs/fuse/inode.c > +++ b/fs/fuse/inode.c > @@ -1110,6 +1110,11 @@ static struct dentry *fuse_get_parent(struct dentry *child) > return parent; > } > > +/* only for fid encoding; no support for file handle */ > +static const struct export_operations fuse_fid_operations = { Nit: I'd call this fuse_no_export_operations (or something else that emphasizes the fact that this is only for encoding and not for full export support). Thanks, Miklos