mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jori Koolstra <jkoolstra@xs4all.nl>
To: NeilBrown <neil@brown.name>, NeilBrown <neilb@ownmail.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Aleksa Sarai <cyphar@cyphar.com>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Jeff Layton <jlayton@kernel.org>,
	Mateusz Guzik <mjguzik@gmail.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Charles Mirabile <cmirabil@redhat.com>
Subject: Re: [RFC PATCH v6 3/9] vfs: prepare vfs_creat|mkdir_no_perm for reuse in lookup_open()
Date: Sun, 14 Jun 2026 20:39:21 +0200 (CEST)	[thread overview]
Message-ID: <430695106.1691908.1781462361803@kpc.webmail.kpnmail.nl> (raw)
In-Reply-To: <178044120271.2082204.8038449401223306061@noble.neil.brown.name>


> Op 03-06-2026 01:00 CEST schreef NeilBrown <neilb@ownmail.net>:
> 
>  
> On Mon, 01 Jun 2026, Jori Koolstra wrote:
> > To implement O_CREAT|O_DIRECTORY we will have to repeat some of the
> > logic that is now in vfs_mkdir() (e.g. do error checks in the same
> > order). Separate this out in vfs_mkdir_no_perm(), which does all the
> > non-permission related work of vfs_mkdir(). Permission checking for the
> > lookup_open() path is timed differently because we may just be doing an
> > open and no create. Similar considerations give rise to
> > vfs_create_no_perm().
> > 
> > Moving the fsnotify_* calls also allows us to deal with this in one
> > place for each type of operation. This does mean that we also need
> > to move the fsnotify_* calls into atomic_open() for the atomic open
> > case, but this actually reduces duplicate code in open_last_lookups()
> > and dentry_create().
> > 
> > Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
> > ---
> >  fs/namei.c | 105 ++++++++++++++++++++++++++++++++++-------------------
> >  1 file changed, 68 insertions(+), 37 deletions(-)
> > 
> > diff --git a/fs/namei.c b/fs/namei.c
> > index 4cd132fe3981..2a35dd72ee96 100644
> > --- a/fs/namei.c
> > +++ b/fs/namei.c
> > @@ -4171,6 +4171,24 @@ static inline umode_t vfs_prepare_mode(struct mnt_idmap *idmap,
> >  	return mode;
> >  }
> >  
> > +static inline
> > +int vfs_create_no_perm(struct mnt_idmap *idmap, struct dentry *dentry,
> > +		       umode_t mode, struct delegated_inode *di, bool excl)
> >
> 
> I meant to mention this on my first review but got distracted.
> 
> I would rather this function didn't have the "bool excl" arg, not
> because it is "bool", but because it is not needed.
> The 'excl' flag to ->create is not needed and I would like to get rid of
> it.  We don't have to do that immediately, but I'd rather not perpetuate
> it.
> 
> There are two sort of fileystems - local and cluster.
> cluster filesystems support ->atomic_open and so ->create is *never*
> called with 'excl' false.  All vfs_create() calls (which are either mknod or
> internal) are exclusive.
> 
> local filesystems do not support ->atomic_open but *always* ignore the
> excl flag.  The only time ->create is called with 'excl' being false is
> after VFS has already checked that the file doesn't exist, and is
> holding a lock so that the there cannot be a concurrent create.
> 
> So we can change all filesystems that currently notice 'excl' to assume
> that it is always 'true' and we can deprecate the flag.
> 

Ah, yes, I see. I have changed this now.

> Maybe I should post some patches, but for you could leave the 'bool
> excl' out of this patch, that would be great.
> 

I can do that as well if you want, crediting you. I am busy on these
things now anyway.

> Thanks,
> NeilBrown

All the best,
Jori.

  reply	other threads:[~2026-06-14 18:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-31 18:20 [RFC PATCH v6 0/9] vfs: add O_CREAT|O_DIRECTORY to open*(2) Jori Koolstra
2026-05-31 18:20 ` [RFC PATCH v6 1/9] fs/namei.c: make lookup_last() use trailing_slashes() Jori Koolstra
2026-06-01  2:09   ` NeilBrown
2026-05-31 18:20 ` [RFC PATCH v6 2/9] fs/namei.c: move create error && negative dentry case in lookup_open up Jori Koolstra
2026-06-01  2:16   ` NeilBrown
2026-05-31 18:20 ` [RFC PATCH v6 3/9] vfs: prepare vfs_creat|mkdir_no_perm for reuse in lookup_open() Jori Koolstra
2026-06-01  3:20   ` NeilBrown
2026-06-02 23:00   ` NeilBrown
2026-06-14 18:39     ` Jori Koolstra [this message]
2026-05-31 18:20 ` [RFC PATCH v6 4/9] vfs: lookup_open(): move setting FMODE_CREATED up when calling create() Jori Koolstra
2026-06-01  2:34   ` NeilBrown
2026-06-02 13:41     ` Christian Brauner
2026-06-03 13:19       ` Jori Koolstra
2026-05-31 18:20 ` [RFC PATCH v6 5/9] vfs: lookup_open(): move audit_inode_child() and i_op->create check to before try_break_deleg() Jori Koolstra
2026-06-01  2:56   ` NeilBrown
2026-06-01 16:27     ` Paul Moore
2026-06-14 18:36       ` Jori Koolstra
2026-05-31 18:20 ` [RFC PATCH v6 6/9] vfs: lookup_open(): use vfs_create_no_perm() Jori Koolstra
2026-05-31 18:20 ` [RFC PATCH v6 7/9] vfs: add O_CREAT|O_DIRECTORY to open*(2) Jori Koolstra
2026-06-01  3:16   ` NeilBrown
2026-06-14 18:27     ` Jori Koolstra
2026-05-31 18:20 ` [RFC PATCH v6 8/9] vfs: move O_IS_MKDIR check out atomic_open() to individual filesystems Jori Koolstra
2026-06-01  3:18   ` NeilBrown
2026-05-31 18:20 ` [RFC PATCH v6 9/9] selftest: add tests for open*(O_CREAT|O_DIRECTORY) Jori Koolstra

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=430695106.1691908.1781462361803@kpc.webmail.kpnmail.nl \
    --to=jkoolstra@xs4all.nl \
    --cc=brauner@kernel.org \
    --cc=cmirabil@redhat.com \
    --cc=cyphar@cyphar.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjguzik@gmail.com \
    --cc=neil@brown.name \
    --cc=neilb@ownmail.net \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®