public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Jan Kara <jack@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] fanotify: Fix broken tests due to fanotify_events_supported_by_kernel()
Date: Mon, 27 Nov 2023 17:22:37 +0100	[thread overview]
Message-ID: <20231127162237.GA288945@pevik> (raw)
In-Reply-To: <20231127154013.2625-1-jack@suse.cz>

Hi Jan,

> When LTP test is run with CWD in btrfs subvolume, tests like fanotify16
> fail with:

> fanotify.h:169: TBROK: fanotify_mark (3, FAN_MARK_ADD, ..., AT_FDCWD, ".") failed: EXDEV (18)

I'll have a deeper look tomorrow, but actually with this patch it fails

LTP_SINGLE_FS_TYPE=btrfs ./fanotify16
...
fanotify.h:168: TBROK: fanotify_mark (3, FAN_MARK_ADD | 0, 10000000, AT_FDCWD, ".") failed: EXDEV (18)

And it works without it. What am I missing?

Tested on 6.7.0-rc1-2.g86e46c2-default

> This is because fanotify_events_supported_by_kernel() try to place a
> mark onto CWD and that is forbidden for btrfs subvolumes. Change
> fanotify_events_supported_by_kernel() to use "/" instead of "." which
> has higher chances of working for btrfs.

> Also update the error message to provide a bit more info.

> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  testcases/kernel/syscalls/fanotify/fanotify.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

> diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
> index 32b510cdc178..f2fe0c05b449 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify.h
> +++ b/testcases/kernel/syscalls/fanotify/fanotify.h
> @@ -161,12 +161,13 @@ static inline int fanotify_events_supported_by_kernel(uint64_t mask,

>  	fd = SAFE_FANOTIFY_INIT(init_flags, O_RDONLY);

> -	if (fanotify_mark(fd, FAN_MARK_ADD | mark_flags, mask, AT_FDCWD, ".") < 0) {
> +	if (fanotify_mark(fd, FAN_MARK_ADD | mark_flags, mask, AT_FDCWD, "/") < 0) {
>  		if (errno == EINVAL) {
>  			rval = -1;
>  		} else {
>  			tst_brk(TBROK | TERRNO,
> -				"fanotify_mark (%d, FAN_MARK_ADD, ..., AT_FDCWD, \".\") failed", fd);
> +				"fanotify_mark (%d, FAN_MARK_ADD | %x, %llx, AT_FDCWD, \".\") failed",
				"fanotify_mark (%d, FAN_MARK_ADD | %x, %llx, AT_FDCWD, \"/\") failed",

(You changed directory . to /, thus error message should be updated as well)

Kind regards,
Petr

> +				fd, mark_flags, (unsigned long long)mask);
>  		}
>  	}

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2023-11-27 16:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 15:40 [LTP] [PATCH] fanotify: Fix broken tests due to fanotify_events_supported_by_kernel() Jan Kara
2023-11-27 16:22 ` Petr Vorel [this message]
2023-11-27 17:40 ` Amir Goldstein
2023-11-27 18:26   ` Jan Kara
2023-11-27 22:07     ` Petr Vorel
2023-11-28 11:14       ` Amir Goldstein
2023-11-28 11:30         ` Petr Vorel

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=20231127162237.GA288945@pevik \
    --to=pvorel@suse.cz \
    --cc=jack@suse.cz \
    --cc=ltp@lists.linux.it \
    /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