# Re: \[RFC PATCH\] fs: introduce mkdirat2 syscall for atomic mkdir

- From: Drew DeVault \<hidden\>
- Date: 2021-02-28 13:58:19 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2021/02/200760
- Thread: https://ratatoskr.run/linux-fsdevel/2021/02/200743/t.md

```text
On Sat Feb 27, 2021 at 11:03 PM EST, Matthew Wilcox wrote:
> > 1. Program A creates a directory
> > 2. Program A is pre-empted
> > 3. Program B deletes the directory
> > 4. Program A creates a file in that directory
> > 5. RIP
>
> umm ... program B deletes the directory. program A opens it in order to
> use openat(). program A gets ENOENT and exits, confused. that's the
> race you're removing here -- and it seems fairly insignificant to me.

Yes, that is the race being eliminated here. Instead of this, program A
has an fd which holds a reference to the directory, so it just works. A
race is a race. It's an oversight in the API.
```
