public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Horst Birthelmer <horst@birthelmer.de>
To: Jim Harris <jim.harris@nvidia.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	linux-fsdevel@vger.kernel.org,  linux-kernel@vger.kernel.org,
	mgurtovoy@nvidia.com, ksztyber@nvidia.com
Subject: Re: [PATCH] fuse: skip lookup during atomic_open() when O_CREAT is set
Date: Sat, 21 Feb 2026 16:19:39 +0100	[thread overview]
Message-ID: <aZnLtrqN3u8N66GU@fedora-2.fritz.box> (raw)
In-Reply-To: <20260220204102.21317-1-jiharris@nvidia.com>

Hi Jim,

On Fri, Feb 20, 2026 at 01:41:02PM -0700, Jim Harris wrote:
> From: Jim Harris <jim.harris@nvidia.com>
> 
> When O_CREAT is set, we don't need the lookup. The lookup doesn't
> harm anything, but it's an extra FUSE operation that's not required.
> 
> Signed-off-by: Jim Harris <jim.harris@nvidia.com>
> ---
>  fs/fuse/dir.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
> index f25ee47822ad..35f65d49ed2a 100644
> --- a/fs/fuse/dir.c
> +++ b/fs/fuse/dir.c
> @@ -895,7 +895,8 @@ static int fuse_create_open(struct mnt_idmap *idmap, struct inode *dir,
>  		goto out_err;
>  	}
>  	kfree(forget);
> -	d_instantiate(entry, inode);
> +	d_drop(entry);
> +	d_splice_alias(inode, entry);
>  	entry->d_time = epoch;
>  	fuse_change_entry_timeout(entry, &outentry);
>  	fuse_dir_changed(dir);
> @@ -936,14 +937,15 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry,
>  	if (fuse_is_bad(dir))
>  		return -EIO;
>  
> -	if (d_in_lookup(entry)) {
> -		struct dentry *res = fuse_lookup(dir, entry, 0);
> -		if (res || d_really_is_positive(entry))
> -			return finish_no_open(file, res);
> -	}
> +	if (!(flags & O_CREAT)) {
> +		if (d_in_lookup(entry)) {
> +			struct dentry *res = fuse_lookup(dir, entry, 0);
>  
> -	if (!(flags & O_CREAT))
> +			if (res || d_really_is_positive(entry))
> +				return finish_no_open(file, res);
> +		}
>  		return finish_no_open(file, NULL);
> +	}
>  
>  	/* Only creates */
>  	file->f_mode |= FMODE_CREATED;
> -- 
> 2.43.0
> 
> 

I have been looking at that code lately a lot since I was planning to
replace it with a compound.
I'm not entirely convinced that your proposal is the right direction. 
I would involve O_EXCL as well, since that lookup could actually 
help in that case.

Take a look at what Miklos wrote here:
https://lore.kernel.org/linux-fsdevel/CAJfpegsDxsMsyfP4a_5H1q91xFtwcEdu9-WBnzWKwjUSrPNdmw@mail.gmail.com/

Cheers,
Horst

  reply	other threads:[~2026-02-21 15:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 20:41 [PATCH] fuse: skip lookup during atomic_open() when O_CREAT is set Jim Harris
2026-02-21 15:19 ` Horst Birthelmer [this message]
2026-02-23 15:09   ` Miklos Szeredi
2026-02-23 15:36     ` Bernd Schubert
2026-02-23 15:53       ` Miklos Szeredi
2026-02-23 16:43         ` Luis Henriques
2026-02-23 16:48         ` Bernd Schubert
2026-02-23 18:55         ` Horst Birthelmer
2026-02-24 15:33           ` Miklos Szeredi
2026-02-26 23:11             ` Jim Harris
2026-02-27  7:59               ` Horst Birthelmer
2026-02-23 14:57 ` Miklos Szeredi
2026-02-23 16:41 ` Bernd Schubert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aZnLtrqN3u8N66GU@fedora-2.fritz.box \
    --to=horst@birthelmer.de \
    --cc=jim.harris@nvidia.com \
    --cc=ksztyber@nvidia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgurtovoy@nvidia.com \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox