From: Jan Kara <jack@suse.cz>
To: Max Kellermann <max.kellermann@ionos.com>
Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, amir73il@gmail.com
Subject: Re: [PATCH 3/4] inotify_user: add system call inotify_add_watch_at()
Date: Mon, 18 Sep 2023 14:40:50 +0200 [thread overview]
Message-ID: <20230918124050.hzbgpci42illkcec@quack3> (raw)
In-Reply-To: <20230918123217.932179-3-max.kellermann@ionos.com>
On Mon 18-09-23 14:32:16, Max Kellermann wrote:
> This implements a missing piece in the inotify API: referring to a
> file by a directory file descriptor and a path name. This can be
> solved in userspace currently only by doing something similar to:
>
> int old = open(".");
> fchdir(dfd);
> inotify_add_watch(....);
> fchdir(old);
>
> Support for LOOKUP_EMPTY is still missing. We could add another IN_*
> flag for that (which would clutter the IN_* flags list further) or
> add a "flags" parameter to the new system call (which would however
> duplicate features already present via special IN_* flags).
>
> To: Jan Kara <jack@suse.cz>
> Cc: Amir Goldstein <amir73il@gmail.com>
> To: linux-fsdevel@vger.kernel.org
> To: linux-kernel@vger.kernel.org
> Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Thanks for the patches! But generally we don't add new functionality to the
inotify API and rather steer users towards fanotify. In this particular
case fanotify_mark(2) already has the support for dirfd + name. Is there
any problem with using fanotify for you? Note that since kernel 5.13 you
don't need CAP_SYS_ADMIN capability for fanotify functionality that is
more-or-less equivalent to what inotify provides.
Honza
> ---
> fs/notify/inotify/inotify_user.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index b6e6f6ab21f8..8a9096c5ebb1 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -797,6 +797,12 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
> return do_inotify_add_watch(fd, AT_FDCWD, pathname, mask);
> }
>
> +SYSCALL_DEFINE4(inotify_add_watch_at, int, fd, int, dfd, const char __user *, pathname,
> + u32, mask)
> +{
> + return do_inotify_add_watch(fd, dfd, pathname, mask);
> +}
> +
> SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
> {
> struct fsnotify_group *group;
> --
> 2.39.2
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2023-09-18 12:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 12:32 [PATCH 1/4] inotify_user: pass directory fd to inotify_find_inode() Max Kellermann
2023-09-18 12:32 ` [PATCH 2/4] inotify_user: move code to do_inotify_add_watch() Max Kellermann
2023-09-18 12:32 ` [PATCH 3/4] inotify_user: add system call inotify_add_watch_at() Max Kellermann
2023-09-18 12:40 ` Jan Kara [this message]
2023-09-18 13:57 ` Max Kellermann
2023-09-18 14:23 ` Jan Kara
2023-09-18 15:28 ` Amir Goldstein
2023-09-18 19:45 ` Max Kellermann
2023-09-18 12:32 ` [PATCH 4/4] arch: register inotify_add_watch_at Max Kellermann
2023-09-18 20:24 ` kernel test robot
2023-09-18 20:24 ` kernel test robot
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=20230918124050.hzbgpci42illkcec@quack3 \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=max.kellermann@ionos.com \
/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
all inboxes | Powered by JetHome®