* [LTP] [PATCH v3 0/2] Fix fanotify14
@ 2023-10-20 15:06 Martin Doucha
2023-10-20 15:06 ` [LTP] [PATCH v3 1/2] Add fanotify_get_supported_init_flags() helper function Martin Doucha
2023-10-20 15:06 ` [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags Martin Doucha
0 siblings, 2 replies; 10+ messages in thread
From: Martin Doucha @ 2023-10-20 15:06 UTC (permalink / raw)
To: Amir Goldstein, Jan Kara, ltp
Fanotify14 tests some fanotify_init() flags which are not supported
on older kernels but doesn't properly check for their availability.
Add a reusable helper function for fanotify_init() feature detection
and fix kernel support checks in fanotify14.
After discussion in the SUSE LTP team, I've decided to fix my previous
patchset and submit it again.
Martin Doucha (2):
Add fanotify_get_supported_init_flags() helper function
fanotify14: Improve check for unsupported init flags
testcases/kernel/syscalls/fanotify/fanotify.h | 43 +++++++++++++++++++
.../kernel/syscalls/fanotify/fanotify14.c | 15 ++++---
2 files changed, 52 insertions(+), 6 deletions(-)
--
2.42.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 10+ messages in thread
* [LTP] [PATCH v3 1/2] Add fanotify_get_supported_init_flags() helper function
2023-10-20 15:06 [LTP] [PATCH v3 0/2] Fix fanotify14 Martin Doucha
@ 2023-10-20 15:06 ` Martin Doucha
2023-10-20 15:55 ` Amir Goldstein
2023-10-20 15:06 ` [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags Martin Doucha
1 sibling, 1 reply; 10+ messages in thread
From: Martin Doucha @ 2023-10-20 15:06 UTC (permalink / raw)
To: Amir Goldstein, Jan Kara, ltp
Since FAN_ALL_INIT_FLAGS constant is deprecated, the kernel has added
new fanotify feature flags and there is no other way to check
for their support, we need to manually check which init flags needed
by our tests are available.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
Changes since v1:
- Fixed check for FAN_REPORT_NAME
- Added longer patch description
Changes since v2:
- Added a table of flag dependencies so that each individual flag is tested
together with all additional required flags
The helper function also checks that it wasn't called with a new uknown
flag which might require dependency table update. In that case, the test
will fail and advise the developer to review documentation and update
the dependency table.
testcases/kernel/syscalls/fanotify/fanotify.h | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index 75a081dc9..78424a350 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -217,6 +217,49 @@ static inline int fanotify_init_flags_supported_by_kernel(unsigned int flags)
return fanotify_init_flags_supported_on_fs(flags, NULL);
}
+#define TST_FANOTIFY_INIT_KNOWN_FLAGS \
+ (FAN_REPORT_DFID_NAME_TARGET | FAN_REPORT_TID | FAN_REPORT_PIDFD | \
+ FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
+
+/*
+ * Check support of given init flags one by one and return those which are
+ * supported.
+ */
+static inline unsigned int fanotify_get_supported_init_flags(unsigned int flags,
+ const char *fname)
+{
+ unsigned int i, flg, arg, ret = 0;
+ static const struct { unsigned int flag, deps; } deplist[] = {
+ {FAN_REPORT_NAME, FAN_REPORT_DIR_FID},
+ {FAN_REPORT_TARGET_FID, FAN_REPORT_DFID_NAME_FID},
+ {0, 0}
+ };
+
+ if (flags & ~TST_FANOTIFY_INIT_KNOWN_FLAGS) {
+ tst_brk(TBROK, "fanotify_init() feature check called with unknown flags %x, please update flag dependency table if needed",
+ flags & ~TST_FANOTIFY_INIT_KNOWN_FLAGS);
+ }
+
+ for (flg = 1; flg; flg <<= 1) {
+ if (!(flags & flg))
+ continue;
+
+ arg = flg;
+
+ for (i = 0; deplist[i].flag; i++) {
+ if (deplist[i].flag == flg) {
+ arg |= deplist[i].deps;
+ break;
+ }
+ }
+
+ if (!fanotify_init_flags_supported_on_fs(arg, fname))
+ ret |= flg;
+ }
+
+ return ret;
+}
+
typedef void (*tst_res_func_t)(const char *file, const int lineno,
int ttype, const char *fmt, ...);
--
2.42.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags
2023-10-20 15:06 [LTP] [PATCH v3 0/2] Fix fanotify14 Martin Doucha
2023-10-20 15:06 ` [LTP] [PATCH v3 1/2] Add fanotify_get_supported_init_flags() helper function Martin Doucha
@ 2023-10-20 15:06 ` Martin Doucha
2023-10-20 16:05 ` Amir Goldstein
1 sibling, 1 reply; 10+ messages in thread
From: Martin Doucha @ 2023-10-20 15:06 UTC (permalink / raw)
To: Amir Goldstein, Jan Kara, ltp
Test case 8 of fanotify14 uses init flags supported only on kernel 5.9+
but does not properly check for their support. Rewrite fanotify feature
checks using new helper function.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
Changes since v1:
- Added FAN_CLASS_* constants to support check in setup()
- Added longer patch description
Changes since v2: None
I'd rather not squash this patch so that it can be reverted without
potentially breaking other tests.
testcases/kernel/syscalls/fanotify/fanotify14.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
index 4596511f0..0bb789188 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify14.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
@@ -45,8 +45,8 @@
static int pipes[2] = {-1, -1};
static int fanotify_fd;
-static int fan_report_target_fid_unsupported;
static int ignore_mark_unsupported;
+static unsigned int supported_init_flags;
struct test_case_flags_t {
unsigned long long flags;
@@ -246,9 +246,8 @@ static void do_test(unsigned int number)
tst_res(TINFO, "Test case %d: fanotify_init(%s, O_RDONLY)", number,
tc->init.desc);
- if (fan_report_target_fid_unsupported && tc->init.flags & FAN_REPORT_TARGET_FID) {
- FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_TARGET_FID,
- fan_report_target_fid_unsupported);
+ if (tc->init.flags & ~supported_init_flags) {
+ tst_res(TCONF, "Unsupported init flags");
return;
}
@@ -317,11 +316,15 @@ out:
static void do_setup(void)
{
+ unsigned int all_init_flags = FAN_REPORT_DFID_NAME_TARGET |
+ FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT;
+
/* Require FAN_REPORT_FID support for all tests to simplify per test case requirements */
REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_FID, MNTPOINT);
- fan_report_target_fid_unsupported =
- fanotify_init_flags_supported_on_fs(FAN_REPORT_DFID_NAME_TARGET, MNTPOINT);
+ supported_init_flags = fanotify_get_supported_init_flags(all_init_flags,
+ MNTPOINT);
+
ignore_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_IGNORE_SURV);
/* Create temporary test file to place marks on */
--
2.42.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v3 1/2] Add fanotify_get_supported_init_flags() helper function
2023-10-20 15:06 ` [LTP] [PATCH v3 1/2] Add fanotify_get_supported_init_flags() helper function Martin Doucha
@ 2023-10-20 15:55 ` Amir Goldstein
2023-10-23 12:50 ` Petr Vorel
0 siblings, 1 reply; 10+ messages in thread
From: Amir Goldstein @ 2023-10-20 15:55 UTC (permalink / raw)
To: Martin Doucha; +Cc: Jan Kara, ltp
On Fri, Oct 20, 2023 at 6:07 PM Martin Doucha <mdoucha@suse.cz> wrote:
>
> Since FAN_ALL_INIT_FLAGS constant is deprecated, the kernel has added
> new fanotify feature flags and there is no other way to check
> for their support, we need to manually check which init flags needed
> by our tests are available.
>
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
>
> Changes since v1:
> - Fixed check for FAN_REPORT_NAME
> - Added longer patch description
>
> Changes since v2:
> - Added a table of flag dependencies so that each individual flag is tested
> together with all additional required flags
>
> The helper function also checks that it wasn't called with a new uknown
> flag which might require dependency table update. In that case, the test
> will fail and advise the developer to review documentation and update
> the dependency table.
>
This is much more sane than the previous version :)
You may add:
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
> testcases/kernel/syscalls/fanotify/fanotify.h | 43 +++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
> index 75a081dc9..78424a350 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify.h
> +++ b/testcases/kernel/syscalls/fanotify/fanotify.h
> @@ -217,6 +217,49 @@ static inline int fanotify_init_flags_supported_by_kernel(unsigned int flags)
> return fanotify_init_flags_supported_on_fs(flags, NULL);
> }
>
> +#define TST_FANOTIFY_INIT_KNOWN_FLAGS \
> + (FAN_REPORT_DFID_NAME_TARGET | FAN_REPORT_TID | FAN_REPORT_PIDFD | \
> + FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
> +
> +/*
> + * Check support of given init flags one by one and return those which are
> + * supported.
> + */
> +static inline unsigned int fanotify_get_supported_init_flags(unsigned int flags,
> + const char *fname)
> +{
> + unsigned int i, flg, arg, ret = 0;
> + static const struct { unsigned int flag, deps; } deplist[] = {
> + {FAN_REPORT_NAME, FAN_REPORT_DIR_FID},
> + {FAN_REPORT_TARGET_FID, FAN_REPORT_DFID_NAME_FID},
> + {0, 0}
> + };
> +
> + if (flags & ~TST_FANOTIFY_INIT_KNOWN_FLAGS) {
> + tst_brk(TBROK, "fanotify_init() feature check called with unknown flags %x, please update flag dependency table if needed",
> + flags & ~TST_FANOTIFY_INIT_KNOWN_FLAGS);
> + }
> +
> + for (flg = 1; flg; flg <<= 1) {
> + if (!(flags & flg))
> + continue;
> +
> + arg = flg;
> +
> + for (i = 0; deplist[i].flag; i++) {
> + if (deplist[i].flag == flg) {
> + arg |= deplist[i].deps;
> + break;
> + }
> + }
> +
> + if (!fanotify_init_flags_supported_on_fs(arg, fname))
> + ret |= flg;
> + }
> +
> + return ret;
> +}
> +
> typedef void (*tst_res_func_t)(const char *file, const int lineno,
> int ttype, const char *fmt, ...);
>
> --
> 2.42.0
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags
2023-10-20 15:06 ` [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags Martin Doucha
@ 2023-10-20 16:05 ` Amir Goldstein
2023-10-23 12:51 ` Martin Doucha
0 siblings, 1 reply; 10+ messages in thread
From: Amir Goldstein @ 2023-10-20 16:05 UTC (permalink / raw)
To: Martin Doucha; +Cc: Jan Kara, ltp
On Fri, Oct 20, 2023 at 6:07 PM Martin Doucha <mdoucha@suse.cz> wrote:
>
> Test case 8 of fanotify14 uses init flags supported only on kernel 5.9+
> but does not properly check for their support. Rewrite fanotify feature
> checks using new helper function.
>
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
>
> Changes since v1:
> - Added FAN_CLASS_* constants to support check in setup()
> - Added longer patch description
>
> Changes since v2: None
>
> I'd rather not squash this patch so that it can be reverted without
> potentially breaking other tests.
>
> testcases/kernel/syscalls/fanotify/fanotify14.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
> index 4596511f0..0bb789188 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify14.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
> @@ -45,8 +45,8 @@
>
> static int pipes[2] = {-1, -1};
> static int fanotify_fd;
> -static int fan_report_target_fid_unsupported;
> static int ignore_mark_unsupported;
> +static unsigned int supported_init_flags;
>
> struct test_case_flags_t {
> unsigned long long flags;
> @@ -246,9 +246,8 @@ static void do_test(unsigned int number)
> tst_res(TINFO, "Test case %d: fanotify_init(%s, O_RDONLY)", number,
> tc->init.desc);
>
> - if (fan_report_target_fid_unsupported && tc->init.flags & FAN_REPORT_TARGET_FID) {
> - FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_TARGET_FID,
> - fan_report_target_fid_unsupported);
> + if (tc->init.flags & ~supported_init_flags) {
> + tst_res(TCONF, "Unsupported init flags"
suggest to preserve the information printed by
FANOTIFY_INIT_FLAGS_ERR_MSG, you can use tc->init.desc
the for the flag name string.
Otherwise, you may add:
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
> return;
> }
>
> @@ -317,11 +316,15 @@ out:
>
> static void do_setup(void)
> {
> + unsigned int all_init_flags = FAN_REPORT_DFID_NAME_TARGET |
> + FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT;
> +
> /* Require FAN_REPORT_FID support for all tests to simplify per test case requirements */
> REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_FID, MNTPOINT);
>
> - fan_report_target_fid_unsupported =
> - fanotify_init_flags_supported_on_fs(FAN_REPORT_DFID_NAME_TARGET, MNTPOINT);
> + supported_init_flags = fanotify_get_supported_init_flags(all_init_flags,
> + MNTPOINT);
> +
> ignore_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_IGNORE_SURV);
>
> /* Create temporary test file to place marks on */
> --
> 2.42.0
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v3 1/2] Add fanotify_get_supported_init_flags() helper function
2023-10-20 15:55 ` Amir Goldstein
@ 2023-10-23 12:50 ` Petr Vorel
0 siblings, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2023-10-23 12:50 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Jan Kara, ltp
Hi Martin, Amir,
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags
2023-10-20 16:05 ` Amir Goldstein
@ 2023-10-23 12:51 ` Martin Doucha
2023-10-23 13:35 ` Petr Vorel
2023-10-23 13:52 ` Amir Goldstein
0 siblings, 2 replies; 10+ messages in thread
From: Martin Doucha @ 2023-10-23 12:51 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Jan Kara, ltp
On 20. 10. 23 18:05, Amir Goldstein wrote:
> On Fri, Oct 20, 2023 at 6:07 PM Martin Doucha <mdoucha@suse.cz> wrote:
>>
>> Test case 8 of fanotify14 uses init flags supported only on kernel 5.9+
>> but does not properly check for their support. Rewrite fanotify feature
>> checks using new helper function.
>>
>> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
>> ---
>>
>> Changes since v1:
>> - Added FAN_CLASS_* constants to support check in setup()
>> - Added longer patch description
>>
>> Changes since v2: None
>>
>> I'd rather not squash this patch so that it can be reverted without
>> potentially breaking other tests.
>>
>> testcases/kernel/syscalls/fanotify/fanotify14.c | 15 +++++++++------
>> 1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
>> index 4596511f0..0bb789188 100644
>> --- a/testcases/kernel/syscalls/fanotify/fanotify14.c
>> +++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
>> @@ -45,8 +45,8 @@
>>
>> static int pipes[2] = {-1, -1};
>> static int fanotify_fd;
>> -static int fan_report_target_fid_unsupported;
>> static int ignore_mark_unsupported;
>> +static unsigned int supported_init_flags;
>>
>> struct test_case_flags_t {
>> unsigned long long flags;
>> @@ -246,9 +246,8 @@ static void do_test(unsigned int number)
>> tst_res(TINFO, "Test case %d: fanotify_init(%s, O_RDONLY)", number,
>> tc->init.desc);
>>
>> - if (fan_report_target_fid_unsupported && tc->init.flags & FAN_REPORT_TARGET_FID) {
>> - FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_TARGET_FID,
>> - fan_report_target_fid_unsupported);
>> + if (tc->init.flags & ~supported_init_flags) {
>> + tst_res(TCONF, "Unsupported init flags"
>
> suggest to preserve the information printed by
> FANOTIFY_INIT_FLAGS_ERR_MSG, you can use tc->init.desc
> the for the flag name string.
tc->init.desc gets printed by the TINFO message at the start of the
patch chunk. The return value from fanotify_init_flags_supported_on_fs()
is not preserved anywhere by the new fanotify_get_supported_init_flags()
helper function so I have nothing to pass as the second argument of
FANOTIFY_INIT_FLAGS_ERR_MSG().
--
Martin Doucha mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags
2023-10-23 12:51 ` Martin Doucha
@ 2023-10-23 13:35 ` Petr Vorel
2023-10-23 13:52 ` Amir Goldstein
1 sibling, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2023-10-23 13:35 UTC (permalink / raw)
To: Martin Doucha; +Cc: Jan Kara, ltp
Hi all,
...
> > > - if (fan_report_target_fid_unsupported && tc->init.flags & FAN_REPORT_TARGET_FID) {
> > > - FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_TARGET_FID,
> > > - fan_report_target_fid_unsupported);
> > > + if (tc->init.flags & ~supported_init_flags) {
> > > + tst_res(TCONF, "Unsupported init flags"
> > suggest to preserve the information printed by
> > FANOTIFY_INIT_FLAGS_ERR_MSG, you can use tc->init.desc
> > the for the flag name string.
> tc->init.desc gets printed by the TINFO message at the start of the patch
> chunk. The return value from fanotify_init_flags_supported_on_fs() is not
> preserved anywhere by the new fanotify_get_supported_init_flags() helper
> function so I have nothing to pass as the second argument of
> FANOTIFY_INIT_FLAGS_ERR_MSG().
You were faster than me. I don't know if it's worth to do mapping with function
similar to *tst_strerrno() in lib/errnos.h and print info about unsupported flag
(as string) in fanotify_get_supported_init_flags()).
BTW original error message does not print problematic flag in init (e.g.
FAN_REPORT_DFID_NAME_TARGET), but the corresponding one in the test
(FAN_REPORT_DFID_NAME_TARGET).
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags
2023-10-23 12:51 ` Martin Doucha
2023-10-23 13:35 ` Petr Vorel
@ 2023-10-23 13:52 ` Amir Goldstein
2023-10-24 19:19 ` Petr Vorel
1 sibling, 1 reply; 10+ messages in thread
From: Amir Goldstein @ 2023-10-23 13:52 UTC (permalink / raw)
To: Martin Doucha; +Cc: Jan Kara, ltp
On Mon, Oct 23, 2023 at 3:51 PM Martin Doucha <mdoucha@suse.cz> wrote:
>
> On 20. 10. 23 18:05, Amir Goldstein wrote:
> > On Fri, Oct 20, 2023 at 6:07 PM Martin Doucha <mdoucha@suse.cz> wrote:
> >>
> >> Test case 8 of fanotify14 uses init flags supported only on kernel 5.9+
> >> but does not properly check for their support. Rewrite fanotify feature
> >> checks using new helper function.
> >>
> >> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> >> ---
> >>
> >> Changes since v1:
> >> - Added FAN_CLASS_* constants to support check in setup()
> >> - Added longer patch description
> >>
> >> Changes since v2: None
> >>
> >> I'd rather not squash this patch so that it can be reverted without
> >> potentially breaking other tests.
> >>
> >> testcases/kernel/syscalls/fanotify/fanotify14.c | 15 +++++++++------
> >> 1 file changed, 9 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
> >> index 4596511f0..0bb789188 100644
> >> --- a/testcases/kernel/syscalls/fanotify/fanotify14.c
> >> +++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
> >> @@ -45,8 +45,8 @@
> >>
> >> static int pipes[2] = {-1, -1};
> >> static int fanotify_fd;
> >> -static int fan_report_target_fid_unsupported;
> >> static int ignore_mark_unsupported;
> >> +static unsigned int supported_init_flags;
> >>
> >> struct test_case_flags_t {
> >> unsigned long long flags;
> >> @@ -246,9 +246,8 @@ static void do_test(unsigned int number)
> >> tst_res(TINFO, "Test case %d: fanotify_init(%s, O_RDONLY)", number,
> >> tc->init.desc);
> >>
> >> - if (fan_report_target_fid_unsupported && tc->init.flags & FAN_REPORT_TARGET_FID) {
> >> - FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_TARGET_FID,
> >> - fan_report_target_fid_unsupported);
> >> + if (tc->init.flags & ~supported_init_flags) {
> >> + tst_res(TCONF, "Unsupported init flags"
> >
> > suggest to preserve the information printed by
> > FANOTIFY_INIT_FLAGS_ERR_MSG, you can use tc->init.desc
> > the for the flag name string.
>
> tc->init.desc gets printed by the TINFO message at the start of the
> patch chunk. The return value from fanotify_init_flags_supported_on_fs()
> is not preserved anywhere by the new fanotify_get_supported_init_flags()
> helper function so I have nothing to pass as the second argument of
> FANOTIFY_INIT_FLAGS_ERR_MSG().
>
OK.
Thanks,
Amir.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags
2023-10-23 13:52 ` Amir Goldstein
@ 2023-10-24 19:19 ` Petr Vorel
0 siblings, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2023-10-24 19:19 UTC (permalink / raw)
To: Amir Goldstein; +Cc: Jan Kara, ltp
...
> > >> static int pipes[2] = {-1, -1};
> > >> static int fanotify_fd;
> > >> -static int fan_report_target_fid_unsupported;
> > >> static int ignore_mark_unsupported;
> > >> +static unsigned int supported_init_flags;
> > >> struct test_case_flags_t {
> > >> unsigned long long flags;
> > >> @@ -246,9 +246,8 @@ static void do_test(unsigned int number)
> > >> tst_res(TINFO, "Test case %d: fanotify_init(%s, O_RDONLY)", number,
> > >> tc->init.desc);
> > >> - if (fan_report_target_fid_unsupported && tc->init.flags & FAN_REPORT_TARGET_FID) {
> > >> - FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_TARGET_FID,
> > >> - fan_report_target_fid_unsupported);
> > >> + if (tc->init.flags & ~supported_init_flags) {
> > >> + tst_res(TCONF, "Unsupported init flags"
> > > suggest to preserve the information printed by
> > > FANOTIFY_INIT_FLAGS_ERR_MSG, you can use tc->init.desc
> > > the for the flag name string.
> > tc->init.desc gets printed by the TINFO message at the start of the
> > patch chunk. The return value from fanotify_init_flags_supported_on_fs()
> > is not preserved anywhere by the new fanotify_get_supported_init_flags()
> > helper function so I have nothing to pass as the second argument of
> > FANOTIFY_INIT_FLAGS_ERR_MSG().
> OK.
Amir, thanks for your ack of this final issue. I merged the patchset.
Kind regards,
Petr
> Thanks,
> Amir.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-10-24 19:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20 15:06 [LTP] [PATCH v3 0/2] Fix fanotify14 Martin Doucha
2023-10-20 15:06 ` [LTP] [PATCH v3 1/2] Add fanotify_get_supported_init_flags() helper function Martin Doucha
2023-10-20 15:55 ` Amir Goldstein
2023-10-23 12:50 ` Petr Vorel
2023-10-20 15:06 ` [LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags Martin Doucha
2023-10-20 16:05 ` Amir Goldstein
2023-10-23 12:51 ` Martin Doucha
2023-10-23 13:35 ` Petr Vorel
2023-10-23 13:52 ` Amir Goldstein
2023-10-24 19:19 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox