Re: [RFC PATCH 1/2] vfs: syscalls: add mkdirat_fd()
From: David Laight
Date: Thu Apr 09 2026 - 03:47:42 EST
On Wed, 8 Apr 2026 23:16:31 +0200 (CEST)
Jori Koolstra <jkoolstra@xxxxxxxxx> wrote:
> > Op 07-04-2026 11:00 CEST schreef Mateusz Guzik <mjguzik@xxxxxxxxx>:
...
> > I am not saying it's impossible. I am saying mkdir was always a
> > separate codepath and in order to change that you would need to add a
> > branchfest to open. I don't see any reason to go that route.
The open code is complex enough that an extra branch won't matter.
> That's a fair point. But there's also upsides like Aleksa has mentioned.
> I'm not very opinionated on the matter, especially since I don't know why
> those paths were ever separated.
I doubt they were ever joined.
mkdir() is more likely to have been separated from mknod() when the code
to add the "." and ".." entries was moved into the kernel filesystem code.
I'm not sure when that would have happened, mvdir() was done in userspace
with the link() and unlink() system calls until (at least) the mid 1980s.
It was probably the complexity of locking in SMP kernels that make both "."
and ".." be 'canned' names rather than just references to another directory.
(Yes, it used to be easy to make ".." refer to the 'wrong' place and get
find to loop.)
Of course, this all predates Linux.
David
>
> Thanks,
> Jori.
>