From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp02-ext3.udag.de (smtp02-ext3.udag.de [62.146.106.33]) (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 A338010FD; Sat, 21 Feb 2026 15:19:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.146.106.33 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771687191; cv=none; b=m52iom3IsWpjrTDwr5333DhHxY7Zu46DbdgoXQftTrDE05Z1NnekohgA9Sb9l2fA38S4oPW8EbYI7yMNYTY6jL9CbLJZYLX0Gvo52wtnRm8mVQTzRNHFXd3kWbyDnHOrt8LDrhiHMBZefgFH1bmyYkdRYX0telL7bTcMex30HyM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771687191; c=relaxed/simple; bh=u8dL696XVDzEYCd0JVe+OfPkcCDWJzeROsAnPH2aPRM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ato/0174ypeh+5QHZfmKRlkOWC2g9x8jAN1A+tMOIG4PX6xi/VAi1BIZbh5tD8yV1D2yviAl87O0pA2xAC3MYctHbUR63jWHAUe+n4I8sWdehxfn/sUWRcZmAFlh5zk2k3/EK4CUp5quqmbUKOOPSFpD/jqr8Z1SQpCttyt29LM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=birthelmer.de; spf=pass smtp.mailfrom=birthelmer.de; arc=none smtp.client-ip=62.146.106.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=birthelmer.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=birthelmer.de Received: from localhost (200-143-067-156.ip-addr.inexio.net [156.67.143.200]) by smtp02-ext3.udag.de (Postfix) with ESMTPA id 68F70E00F1; Sat, 21 Feb 2026 16:19:40 +0100 (CET) Authentication-Results: smtp02-ext3.udag.de; auth=pass smtp.auth=birthelmercom-0001 smtp.mailfrom=horst@birthelmer.de Date: Sat, 21 Feb 2026 16:19:39 +0100 From: Horst Birthelmer To: Jim Harris Cc: Miklos Szeredi , 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 Message-ID: References: <20260220204102.21317-1-jiharris@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > > 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 > --- > 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