[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiMy72pfXi7SQZoth5tY9bkXaA+_4vpoY_tOhqAmowvBw@mail.gmail.com>
Date: Tue, 12 Nov 2024 16:58:06 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Amir Goldstein <amir73il@...il.com>
Cc: Josef Bacik <josef@...icpanda.com>, kernel-team@...com, linux-fsdevel@...r.kernel.org,
jack@...e.cz, brauner@...nel.org, linux-xfs@...r.kernel.org,
linux-btrfs@...r.kernel.org, linux-mm@...ck.org, linux-ext4@...r.kernel.org
Subject: Re: [PATCH v7 07/18] fsnotify: generate pre-content permission event
on open
On Tue, 12 Nov 2024 at 15:41, Amir Goldstein <amir73il@...il.com> wrote:
>
> You wrote it should be called "in the open path" - that is ambiguous.
> pre-content hook must be called without sb_writers held, so current
> (in linux-next) location of fsnotify_open_perm() is not good in case of
> O_CREATE flag, so I am not sure where a good location is.
> Easier is to drop this patch.
Dropping that patch obviously removes my objection.
But since none of the whole "return errors" is valid with a truncate
or a new file creation anyway, isn't the whole thing kind of moot?
I guess do_open() could do it, but only inside a
if (!error && !do_truncate && !(file->f_mode & FMODE_CREATED))
error = fsnotify_opened_old(file);
kind of thing. With a big comment about how this is a pre-read hook,
and not relevant for a new file or a truncate event since then it's
always empty anyway.
But hey, if you don't absolutely need it in the first place, not
having it is *MUCH* preferable.
It sounds like the whole point was to catch reads - not opens. So then
you should catch it at read() time, not at open() time.
Linus
Powered by blists - more mailing lists