public inbox for linux-api@vger.kernel.org
 help / color / mirror / Atom feed
From: Jori Koolstra <jkoolstra@xs4all.nl>
To: Christian Brauner <brauner@kernel.org>, Aleksa Sarai <cyphar@cyphar.com>
Cc: Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Arnd Bergmann <arnd@arndb.de>, "H . Peter Anvin" <hpa@zytor.com>,
	Jan Kara <jack@suse.cz>, Peter Zijlstra <peterz@infradead.org>,
	Andrey Albershteyn <aalbersh@redhat.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Thomas Weißschuh <thomas.weissschuh@linutronix.de>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	cmirabil@redhat.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jeff Layton <jlayton@kernel.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-api@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [RFC PATCH v2 1/2] vfs: syscalls: add mkdirat2() that returns an O_DIRECTORY fd
Date: Mon, 4 May 2026 19:41:15 +0200 (CEST)	[thread overview]
Message-ID: <1600596489.77018.1777916475931@kpc.webmail.kpnmail.nl> (raw)
In-Reply-To: <20260427-umlegen-aufbau-ee3a97f1528a@brauner>


> Op 27-04-2026 17:48 CEST schreef Christian Brauner <brauner@kernel.org>:
> 
> So definitely a patchset worthing doing but this will be hairy. And
> Mateusz is right. As written this doesn't work. The canonical pattern
> how e.g., dentry_open() does it is to preallocate the file.
> 

Is this because of Mateusz point that we should fail as soon as possible
to prevent any fs changes from taking effect?

But like Mateusz points out, this is not really happening for open() with
O_CREAT either. So is there any policy for what we do and do not tolerate?
(although I agree we should definitely preallocate the file; thanks for
pointing that pattern out).

> I do wonder though whether we shouldn't just make O_CREAT | O_DIRECTORY
> work. I remember that I had a vague comment about this in [1] a few
> years ago (cf. [1]). It might even be less hairy to get that one right
> as all the thinking for O_CREAT is already there.
> 
> What was the rationale for mkdirat2() instead of threading this through
> openat()/openat2() with O_CREAT?
> 

Because of Mateusz' objection, but I agree with Aleksa (and you in 2023)
that this is intuitive and you mentioned POSIX allows for it.

But a more general issue, that also applies to this mkdirat2 patch,
is Linus' objection in that same thread.[1] However, the use-case of
the UAPI request is different. Still, do we have any concrete examples
of programs that need to do such permissions/ownership/labels
/timestamps/acls/xattrs changes concurrently with another process
that has delete and create permissions in the same folder, and that
currently relies on the fstat() workaround?

> And side-question: @Jeff, can nfs atomic open deal with O_CREAT |
> O_DIRECTORY?
> 
> [1]: 43b450632676 ("open: return EINVAL for O_DIRECTORY | O_CREAT")


[1]: https://lore.kernel.org/lkml/CAHk-=wgLimhZ8px+BxTvkonBGHr9oFcjrk4tmE2-_mmd3vBGdg@mail.gmail.com/

  parent reply	other threads:[~2026-05-04 17:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-12 13:54 [RFC PATCH v2 0/2] vfs: syscalls: add mkdirat2() that returns an O_DIRECTORY fd Jori Koolstra
2026-04-12 13:54 ` [RFC PATCH v2 1/2] " Jori Koolstra
2026-04-24 10:09   ` Mateusz Guzik
2026-04-27 15:14     ` Christian Brauner
2026-04-27 16:30       ` Mateusz Guzik
2026-04-28  8:55         ` Christian Brauner
2026-04-28 14:39           ` Mateusz Guzik
2026-04-27 15:48   ` Christian Brauner
2026-04-28  1:14     ` Aleksa Sarai
2026-04-28  6:39     ` Jeff Layton
2026-04-28  7:01       ` Jeff Layton
2026-04-28 13:39     ` Stefan Metzmacher
2026-04-28 13:49       ` Stefan Metzmacher
2026-04-28 14:01       ` Paulo Alcantara
2026-05-04 17:41     ` Jori Koolstra [this message]
2026-04-12 13:54 ` [RFC PATCH v2 2/2] selftest: add tests for mkdirat2() 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=1600596489.77018.1777916475931@kpc.webmail.kpnmail.nl \
    --to=jkoolstra@xs4all.nl \
    --cc=aalbersh@redhat.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=brauner@kernel.org \
    --cc=cmirabil@redhat.com \
    --cc=cyphar@cyphar.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    --cc=thomas.weissschuh@linutronix.de \
    --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