aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2024-01-25 11:08:55 +0200
committerPetr Vorel <pvorel@suse.cz>2024-01-25 15:42:29 +0100
commitbae8ec9a3937154defdf96a5d6f1b165aebebbe5 (patch)
tree1f4315b134021b82040866e7444354a03507426e
parent3626124a42adfe536af2abff63213fa1ccc63795 (diff)
downloadltp-bae8ec9a3937154defdf96a5d6f1b165aebebbe5.tar.gz
fanotify{01,09,10}: Check for report fid support with mount mark
There are now filesystems other than overlayfs (e.g. fuse) that do not support filesystem and mount marks with FAN_REPORT_FID. Adapt tests to runs correctly on those filesystems (tested with ntfs-3g). Link: https://lore.kernel.org/ltp/CAOQ4uxjMiPG5E5=jirxT_D=NDxdUfA2Vp8u1yNZ=YH_SxC0S8Q@mail.gmail.com/ Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify01.c14
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify09.c5
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify10.c5
3 files changed, 18 insertions, 6 deletions
diff --git a/testcases/kernel/syscalls/fanotify/fanotify01.c b/testcases/kernel/syscalls/fanotify/fanotify01.c
index 5ce1dc76a..e4398f236 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify01.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify01.c
@@ -76,6 +76,7 @@ static char fname[BUF_SIZE];
static char buf[BUF_SIZE];
static int fd_notify;
static int fan_report_fid_unsupported;
+static int mount_mark_fid_unsupported;
static int filesystem_mark_unsupported;
static unsigned long long event_set[EVENT_MAX];
@@ -88,16 +89,22 @@ static void test_fanotify(unsigned int n)
struct fanotify_mark_type *mark = &tc->mark;
int fd, ret, len, i = 0, test_num = 0;
int tst_count = 0;
+ int report_fid = (tc->init_flags & FAN_REPORT_FID);
tst_res(TINFO, "Test #%d: %s", n, tc->tname);
- if (fan_report_fid_unsupported && (tc->init_flags & FAN_REPORT_FID)) {
+ if (fan_report_fid_unsupported && report_fid) {
FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_FID, fan_report_fid_unsupported);
return;
}
if (filesystem_mark_unsupported && mark->flag == FAN_MARK_FILESYSTEM) {
- tst_res(TCONF, "FAN_MARK_FILESYSTEM not supported in kernel?");
+ FANOTIFY_MARK_FLAGS_ERR_MSG(mark, filesystem_mark_unsupported);
+ return;
+ }
+
+ if (mount_mark_fid_unsupported && report_fid && mark->flag != FAN_MARK_INODE) {
+ FANOTIFY_MARK_FLAGS_ERR_MSG(mark, mount_mark_fid_unsupported);
return;
}
@@ -342,6 +349,9 @@ static void setup(void)
fan_report_fid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_FID, fname);
filesystem_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_FILESYSTEM, fname);
+ mount_mark_fid_unsupported = fanotify_flags_supported_on_fs(FAN_REPORT_FID,
+ FAN_MARK_MOUNT,
+ FAN_OPEN, fname);
}
static void cleanup(void)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify09.c b/testcases/kernel/syscalls/fanotify/fanotify09.c
index 6bb1b9e70..f61c4e45a 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify09.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify09.c
@@ -480,8 +480,9 @@ static void test_fanotify(unsigned int n)
static void setup(void)
{
- fan_report_dfid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_DFID_NAME,
- MOUNT_PATH);
+ fan_report_dfid_unsupported = fanotify_flags_supported_on_fs(FAN_REPORT_DFID_NAME,
+ FAN_MARK_MOUNT,
+ FAN_OPEN, MOUNT_PATH);
ignore_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_IGNORE_SURV,
MOUNT_PATH);
diff --git a/testcases/kernel/syscalls/fanotify/fanotify10.c b/testcases/kernel/syscalls/fanotify/fanotify10.c
index f30eba9ec..6c89ca1d0 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify10.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify10.c
@@ -882,8 +882,9 @@ static void setup(void)
MOUNT_PATH);
ignore_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_IGNORE_SURV,
MOUNT_PATH);
- fan_report_dfid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_DFID_NAME,
- MOUNT_PATH);
+ fan_report_dfid_unsupported = fanotify_flags_supported_on_fs(FAN_REPORT_DFID_NAME,
+ FAN_MARK_MOUNT,
+ FAN_OPEN, MOUNT_PATH);
if (fan_report_dfid_unsupported) {
FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_DFID_NAME, fan_report_dfid_unsupported);
/* Limit tests to legacy priority classes */