[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFfO_h6Jv-86pcG-ZVayEnydY+MJZoXhkT0ORey8yd8NqVzyvg@mail.gmail.com>
Date: Mon, 26 Jan 2026 22:31:35 +0600
From: Dorjoy Chowdhury <dorjoychy111@...il.com>
To: Jan Kara <jack@...e.cz>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
viro@...iv.linux.org.uk, brauner@...nel.org, jlayton@...nel.org,
chuck.lever@...cle.com, alex.aring@...il.com, arnd@...db.de
Subject: Re: [PATCH v2 1/2] open: new O_REGULAR flag support
On Mon, Jan 26, 2026 at 10:10 PM Jan Kara <jack@...e.cz> wrote:
>
> On Mon 26-01-26 21:39:21, Dorjoy Chowdhury wrote:
> > This flag indicates the path should be opened if it's a regular file.
> > A relevant error code ENOTREGULAR(35) has been introduced. For example,
> > if open is called on path /dev/null with O_REGULAR in the flag param,
> > it will return -ENOTREGULAR.
> >
> > When used in combination with O_CREAT, either the regular file is
> > created, or if the path already exists, it is opened if it's a regular
> > file. Otherwise, -ENOTREGULAR is returned.
> >
> > -EINVAL is returned when O_REGULAR is combined with O_DIRECTORY (not
> > part of O_TMPFILE) because it doesn't make sense to open a path that
> > is both a directory and a regular file.
> >
> > Signed-off-by: Dorjoy Chowdhury <dorjoychy111@...il.com>
>
> The feature looks useful to me (but the justification with the danger of
> being tricked into opening some device nodes would be nice to have here in
> the changelog).
>
Good suggestion. Will put something related to this in v3 submission.
> > diff --git a/arch/parisc/include/uapi/asm/fcntl.h b/arch/parisc/include/uapi/asm/fcntl.h
> > index 03dee816cb13..efd763335ff7 100644
> > --- a/arch/parisc/include/uapi/asm/fcntl.h
> > +++ b/arch/parisc/include/uapi/asm/fcntl.h
> > @@ -19,6 +19,7 @@
> >
> > #define O_PATH 020000000
> > #define __O_TMPFILE 040000000
> > +#define O_REGULAR 060000000
>
> This looks wrong? O_REGULAR is overlapping with O_PATH and __O_TMPFILE???
>
Yes, this is wrong (pointed out by Arnd as well -
https://lore.kernel.org/linux-fsdevel/6c9d7f9b-36ea-4222-8c10-843f726b6e62@app.fastmail.com/).
Arnd also pointed out if we should use an earlier bit (e.g.,
000000100) or use a new one (e.g., 0100000000) which I asked about in
the thread. Please let us know in the thread if you have any
suggestions on this so that we can all be on the same page. Thanks!
Regards,
Dorjoy
Powered by blists - more mailing lists