From: "Darrick J. Wong" <djwong@kernel.org>
To: Andrey Albershteyn <aalbersh@kernel.org>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH v2] generic/791: don't run if kernel misses FANOTIFY
Date: Thu, 21 May 2026 07:47:30 -0700 [thread overview]
Message-ID: <20260521144730.GR9568@frogsfrogsfrogs> (raw)
In-Reply-To: <20260521082648.843312-1-aalbersh@kernel.org>
On Thu, May 21, 2026 at 10:26:46AM +0200, Andrey Albershteyn wrote:
> If FANOTIFY=no in the kernel, then fs-monitor will fail to start. Fix
> fs-monitor error codes to detect and skip the test on "Function not
> implemented" code.
>
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
> ---
> Changes from v1:
> - Remove returning of errno
> - Instead of checking for error code add new -c argument to fs-monitor
Looks good to me now!
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
>
> ---
> src/fs-monitor.c | 19 ++++++++++++++++++-
> tests/generic/791 | 3 +++
> 2 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/src/fs-monitor.c b/src/fs-monitor.c
> index 0cf09677a3ef..dd91a5d7f623 100644
> --- a/src/fs-monitor.c
> +++ b/src/fs-monitor.c
> @@ -117,6 +117,8 @@ next_event:
> int main(int argc, char **argv)
> {
> int fd;
> + int opt;
> + int check = 0;
>
> char buffer[BUFSIZ];
>
> @@ -125,14 +127,29 @@ int main(int argc, char **argv)
> return 1;
> }
>
> + while ((opt = getopt(argc, argv, "c")) != -1) {
> + switch (opt) {
> + case 'c':
> + check = 1;
> + break;
> + default:
> + fprintf(stderr, "Usage: %s [-c] path\n",
> + argv[0]);
> + exit(EXIT_FAILURE);
> + }
> + }
> +
> fd = fanotify_init(FAN_CLASS_NOTIF|FAN_REPORT_FID, O_RDONLY);
> + if (check)
> + exit(fd < 0);
> +
> if (fd < 0) {
> perror("fanotify_init");
> errx(1, "fanotify_init");
> }
>
> if (fanotify_mark(fd, FAN_MARK_ADD|FAN_MARK_FILESYSTEM,
> - FAN_FS_ERROR, AT_FDCWD, argv[1])) {
> + FAN_FS_ERROR, AT_FDCWD, argv[optind])) {
> perror("fanotify_mark");
> errx(1, "fanotify_mark");
> }
> diff --git a/tests/generic/791 b/tests/generic/791
> index 90242292cba2..edefbb7767c3 100755
> --- a/tests/generic/791
> +++ b/tests/generic/791
> @@ -65,6 +65,9 @@ _dmerror_mount >> $seqres.full 2>&1
>
> test $FSTYP = xfs && _xfs_force_bdev data $SCRATCH_MNT
>
> +$here/src/fs-monitor -c $SCRATCH_MNT &> /dev/null || \
> + _notrun "fanotify too old"
> +
> # Write a file with 4 file blocks worth of data, figure out the LBA to target
> victim=$SCRATCH_MNT/a
> file_blksz=$(_get_file_block_size $SCRATCH_MNT)
> --
> 2.51.2
>
next prev parent reply other threads:[~2026-05-21 14:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 8:26 [PATCH v2] generic/791: don't run if kernel misses FANOTIFY Andrey Albershteyn
2026-05-21 14:47 ` Darrick J. Wong [this message]
2026-05-25 6:16 ` Christoph Hellwig
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=20260521144730.GR9568@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=aalbersh@kernel.org \
--cc=fstests@vger.kernel.org \
/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