fanotify ltp tests for v5.7-rc1
v2 cover fanotify ltp tests for v5.7-rc1
Hi Petr,
Following patches test fanotify kernel code merged to v5.7-rc1.
Changes since v1:
- Patch to fanotify09 has already been merged
- Addressed comments by Petr, Cyril, Matthew and added reviewed-by
- Added patch to use new helper fanotify_save_fid by other tests
Patch 3 adds a new test for the new event type FAN_MODIFY_DIR, which carries a new event format (parent fid + name).
The man page patches for FAN_MODIFY_DIR have already been merged.
Thanks all for the review,
Amir.
Amir Goldstein (4):
syscalls/fanotify15: Minor corrections syscalls/fanotify15: Add a test case for inode marks syscalls/fanotify: New test for FAN_MODIFY_DIR syscalls/fanotify: Use fanotify_save_fid() helper
runtest/syscalls | 1 + testcases/kernel/syscalls/fanotify/.gitignore | 1 + testcases/kernel/syscalls/fanotify/fanotify.h | 36 +- .../kernel/syscalls/fanotify/fanotify13.c | 44 +- .../kernel/syscalls/fanotify/fanotify15.c | 191 ++++++--- .../kernel/syscalls/fanotify/fanotify16.c | 403 ++++++++++++++++++ 6 files changed, 596 insertions(+), 80 deletions(-) create mode 100644 testcases/kernel/syscalls/fanotify/fanotify16.c
Signature · 1 line
2.17.1
PATCH v2 1/4 syscalls/fanotify15: Minor corrections
- Fix calculation of events buffer size
- Read file events and dir events in two batches
- Generate FAN_MODIFY event explicitly with truncate() operation instead of FAN_ATTRIB event implicitly with create() operation
- FAN_MODIFY and FAN_DELETE_SELF may or may not be merged
- Use macro FAN_MOVE for FAN_MOVED_FROM | FAN_MOVED_TO
--- .../kernel/syscalls/fanotify/fanotify15.c | 63 +++++++++++++------ 1 file changed, 43 insertions(+), 20 deletions(-)
testcases/kernel/syscalls/fanotify/fanotify15.c +43 -20
@@ -25,8 +25,14 @@#if defined(HAVE_SYS_FANOTIFY_H )#include <sys/fanotify.h> -#define BUF_SIZE 256 -#define EVENT_MAX 256 +#define EVENT_MAX 10 + +/* Size of the event structure, not including file handle */ +#define EVENT_SIZE (sizeof(struct fanotify_event_metadata) + \ + sizeof(struct fanotify_event_info_fid)) +/* Double events buffer size to account for file handles */ +#define EVENT_BUF_LEN (EVENT_MAX * EVENT_SIZE * 2) +#define MOUNT_POINT "mntpoint"#define TEST_DIR MOUNT_POINT"/test_dir"
@@ -44,7 +50,7 @@ struct event_t { };static int fanotify_fd; -static char events_buf[BUF_SIZE ]; +static char events_buf[EVENT_BUF_LEN ];static struct event_t event_set[EVENT_MAX ];static void do_test (void )
@@ -56,24 +62,23 @@ static void do_test(void)struct fanotify_event_info_fid *event_fid;if (fanotify_mark (fanotify_fd,FAN_MARK_ADD |FAN_MARK_FILESYSTEM , -FAN_CREATE |FAN_DELETE |FAN_ATTRIB | -FAN_MOVED_FROM |FAN_MOVED_TO | -FAN_DELETE_SELF |FAN_ONDIR , +FAN_CREATE |FAN_DELETE |FAN_MOVE | +FAN_MODIFY |FAN_DELETE_SELF |FAN_ONDIR ,AT_FDCWD ,TEST_DIR ) ==-1 ) {if (errno ==ENODEV )tst_brk (TCONF ,"FAN_REPORT_FID not supported on %s " "filesystem" , tst_device->fs_type);tst_brk (TBROK |TERRNO , -"fanotify_mark(%d, FAN_MARK_ADD, FAN_CREATE | " -"FAN_DELETE | FAN_MOVED_FROM | FAN_MOVED_TO | " -"FAN_DELETE_SELF | FAN_ONDIR, AT_FDCWD, %s) failed" , +"fanotify_mark(%d, FAN_MARK_ADD | FAN_MARK_FILESYSTEM, " +"FAN_CREATE | FAN_DELETE | FAN_MOVE | " +"FAN_MODIFY | FAN_DELETE_SELF | FAN_ONDIR, " +"AT_FDCWD, %s) failed" , fanotify_fd,TEST_DIR ); } -/* Generate a sequence of events */ - event_set[count].mask =FAN_CREATE |FAN_MOVED_FROM |FAN_MOVED_TO | \ -FAN_DELETE ; +/* All dirent events on testdir are merged */ + event_set[count].mask =FAN_CREATE |FAN_MOVE |FAN_DELETE ; event_set[count].handle.handle_bytes =MAX_HANDLE_SZ ;fanotify_get_fid (TEST_DIR , &event_set[count].fsid, &event_set[count].handle);
@@ -82,9 +87,22 @@ static void do_test(void) fd =SAFE_CREAT (FILE1 ,0644 );SAFE_CLOSE (fd); +/* +* Event on child file is not merged with dirent events. +*/ + event_set[count].mask =FAN_MODIFY ; + event_set[count].handle.handle_bytes =MAX_HANDLE_SZ ; +fanotify_get_fid (FILE1 , &event_set[count].fsid, + &event_set[count].handle); + count++; + +SAFE_TRUNCATE (FILE1 ,1 );SAFE_RENAME (FILE1 ,FILE2 ); - event_set[count].mask =FAN_ATTRIB |FAN_DELETE_SELF ; +/* +* FAN_DELETE_SELF may be merged with FAN_MODIFY event above. +*/ + event_set[count].mask =FAN_DELETE_SELF ; event_set[count].handle.handle_bytes =MAX_HANDLE_SZ ;fanotify_get_fid (FILE2 , &event_set[count].fsid, &event_set[count].handle);
@@ -92,6 +110,9 @@ static void do_test(void)SAFE_UNLINK (FILE2 ); +/* Read file events from the event queue */ + len =SAFE_READ (0 , fanotify_fd, events_buf,EVENT_BUF_LEN ); +/* * Generate a sequence of events on a directory. Subsequent events * are merged, so it's required that we set FAN_ONDIR once in
@@ -99,8 +120,7 @@ static void do_test(void)* took place. Events on subdirectories are not merged with events * on non-subdirectories. */ - event_set[count].mask =FAN_ONDIR |FAN_CREATE |FAN_MOVED_FROM | \ -FAN_MOVED_TO |FAN_DELETE ; + event_set[count].mask =FAN_ONDIR |FAN_CREATE |FAN_MOVE |FAN_DELETE ; event_set[count].handle.handle_bytes =MAX_HANDLE_SZ ;fanotify_get_fid (TEST_DIR , &event_set[count].fsid, &event_set[count].handle);
@@ -118,13 +138,12 @@ static void do_test(void)SAFE_RMDIR (DIR2 ); -/* Read events from the event queue */ - len =SAFE_READ (0 , fanotify_fd, events_buf,BUF_SIZE ); +/* Read dir events from the event queue */ + len +=SAFE_READ (0 , fanotify_fd, events_buf + len,EVENT_BUF_LEN - len);/* Process each event in buffer */ for (i =0 , metadata = (struct fanotify_event_metadata *) events_buf; -FAN_EVENT_OK (metadata, len); - metadata =FAN_EVENT_NEXT (metadata,len), i++) { +FAN_EVENT_OK (metadata, len); i++) { event_fid = (struct fanotify_event_info_fid *) (metadata +1 ); event_file_handle = (struct file_handle *) event_fid->handle;
@@ -141,7 +160,7 @@ static void do_test(void)"Received unexpected file descriptor %d in " "event. Expected to get FAN_NOFD(%d)" , metadata->fd, FAN_NOFD); - }else if (metadata->mask != event_set[i].mask) { + }else if (!(metadata->mask & event_set[i].mask)) { tst_res(TFAIL, "Got event: mask=%llx (expected %llx) " "pid=%u fd=%d",
@@ -197,6 +216,10 @@ static void do_test(void) *(unsigned long *) event_file_handle->f_handle); } + metadata->mask &= ~event_set[i].mask; +/* No events left in current mask? Go for next event */ +if (metadata->mask ==0 ) + metadata =FAN_EVENT_NEXT (metadata, len); }for (; i < count; i++)
Signature · 1 line
2.17.1
PATCH v2 2/4 syscalls/fanotify15: Add a test case for inode marks
In reply to Amir GoldsteinTest reporting events with fid also with recusrive inode marks:
- Test events "on self" (FAN_DELETE_SELF) on file and dir
- Test events "on child" (FAN_MODIFY) on file
With recursive inode marks, verify that the FAN_MODIFY event reported to parent "on child" is merged with the FAN_MODIFY event reported to child.
The new test case is a regression test for commit f367a62a7cad:
fanotify: merge duplicate events on parent and child
--- .../kernel/syscalls/fanotify/fanotify15.c | 81 +++++++++++++++++-- 1 file changed, 73 insertions(+), 8 deletions(-)
testcases/kernel/syscalls/fanotify/fanotify15.c +73 -8
@@ -9,6 +9,10 @@* Test file that has been purposely designed to verify * FAN_REPORT_FID functionality while using newly defined dirent * events. +* +* Test case #1 is a regression test for commit f367a62a7cad: +* +* fanotify: merge duplicate events on parent and child */ #define _GNU_SOURCE#include "config.h"
@@ -53,28 +57,49 @@ static int fanotify_fd;static char events_buf[EVENT_BUF_LEN ];static struct event_t event_set[EVENT_MAX ]; -static void do_test (void ) +static struct test_case_t { +const char *tname; +struct fanotify_mark_type mark; +unsigned long mask; +} test_cases[] = { + { +"FAN_REPORT_FID on filesystem including FAN_DELETE_SELF" , +INIT_FANOTIFY_MARK_TYPE (FILESYSTEM ), +FAN_DELETE_SELF , + }, + { +"FAN_REPORT_FID on directory with FAN_EVENT_ON_CHILD" , +INIT_FANOTIFY_MARK_TYPE (INODE ), +FAN_EVENT_ON_CHILD , + }, +}; + +static void do_test (unsigned int number) {int i, fd, len, count =0 ;struct file_handle *event_file_handle;struct fanotify_event_metadata *metadata;struct fanotify_event_info_fid *event_fid; +struct test_case_t *tc = &test_cases[number]; +struct fanotify_mark_type *mark = &tc->mark; + +tst_res (TINFO ,"Test #%d: %s" , number, tc->tname); -if (fanotify_mark (fanotify_fd,FAN_MARK_ADD |FAN_MARK_FILESYSTEM , +if (fanotify_mark (fanotify_fd,FAN_MARK_ADD | mark->flag, tc->mask |FAN_CREATE |FAN_DELETE |FAN_MOVE | -FAN_MODIFY |FAN_DELETE_SELF |FAN_ONDIR , +FAN_MODIFY |FAN_ONDIR ,AT_FDCWD ,TEST_DIR ) ==-1 ) {if (errno ==ENODEV )tst_brk (TCONF ,"FAN_REPORT_FID not supported on %s " "filesystem" , tst_device->fs_type);tst_brk (TBROK |TERRNO , -"fanotify_mark(%d, FAN_MARK_ADD | FAN_MARK_FILESYSTEM, " +"fanotify_mark(%d, FAN_MARK_ADD | %s, " "FAN_CREATE | FAN_DELETE | FAN_MOVE | " -"FAN_MODIFY | FAN_DELETE_SELF | FAN_ONDIR, " +"FAN_MODIFY | FAN_ONDIR | 0x%lx, " "AT_FDCWD, %s) failed" , - fanotify_fd,TEST_DIR ); + fanotify_fd, mark->name, tc->mask,TEST_DIR ); }/* All dirent events on testdir are merged */
@@ -87,8 +112,21 @@ static void do_test(void) fd =SAFE_CREAT (FILE1 ,0644 );SAFE_CLOSE (fd); +/* Recursive watch file for events "on self" */ +if (mark->flag ==FAN_MARK_INODE && +fanotify_mark (fanotify_fd,FAN_MARK_ADD | mark->flag, +FAN_MODIFY |FAN_DELETE_SELF , +AT_FDCWD ,FILE1 ) ==-1 ) { +tst_brk (TBROK |TERRNO , +"fanotify_mark(%d, FAN_MARK_ADD | %s, " +"FAN_DELETE_SELF, AT_FDCWD, %s) failed" , + fanotify_fd, mark->name,FILE1 ); + } +/* * Event on child file is not merged with dirent events. +* FAN_MODIFY event reported on file mark should be merged with the +* FAN_MODIFY event reported on parent directory watch. */ event_set[count].mask =FAN_MODIFY ; event_set[count].handle.handle_bytes =MAX_HANDLE_SZ ;
@@ -128,6 +166,17 @@ static void do_test(void)SAFE_MKDIR (DIR1 ,0755 ); +/* Recursive watch subdir for events "on self" */ +if (mark->flag ==FAN_MARK_INODE && +fanotify_mark (fanotify_fd,FAN_MARK_ADD | mark->flag, +FAN_DELETE_SELF |FAN_ONDIR , +AT_FDCWD ,DIR1 ) ==-1 ) { +tst_brk (TBROK |TERRNO , +"fanotify_mark(%d, FAN_MARK_ADD | %s," +"FAN_DELETE_SELF | FAN_ONDIR, AT_FDCWD, %s) failed" , + fanotify_fd, mark->name,DIR1 ); + } +SAFE_RENAME (DIR1 ,DIR2 ); event_set[count].mask =FAN_ONDIR |FAN_DELETE_SELF ;
@@ -141,6 +190,17 @@ static void do_test(void)/* Read dir events from the event queue */ len +=SAFE_READ (0 , fanotify_fd, events_buf + len,EVENT_BUF_LEN - len); +/* +* Cleanup the mark +*/ +if (fanotify_mark (fanotify_fd,FAN_MARK_FLUSH | mark->flag,0 , +AT_FDCWD ,TEST_DIR ) <0 ) { +tst_brk (TBROK |TERRNO , +"fanotify_mark (%d, FAN_MARK_FLUSH | %s, 0," +"AT_FDCWD, '" TEST_DIR "') failed" , + fanotify_fd, mark->name); + } +/* Process each event in buffer */ for (i =0 , metadata = (struct fanotify_event_metadata *) events_buf;FAN_EVENT_OK (metadata, len); i++) {
@@ -259,9 +319,14 @@ static struct tst_test test = { .mount_device = 1, .mntpoint = MOUNT_POINT, .all_filesystems = 1, - .test_all = do_test, + .test = do_test, + .tcnt = ARRAY_SIZE(test_cases), .setup = do_setup, - .cleanup = do_cleanup + .cleanup = do_cleanup, + .tags = (const struct tst_tag []) { + {"linux-git" ,"f367a62a7cad" }, + {} + } };#else
Signature · 1 line
2.17.1
PATCH v2 2/4 syscalls/fanotify15: Add a test case for inode marks
Quoted 11 lines · Amir Goldstein
Test reporting events with fid also with recusrive inode marks:
- Test events "on self" (FAN_DELETE_SELF) on file and dir
- Test events "on child" (FAN_MODIFY) on fileWith recursive inode marks, verify that the
FAN_MODIFYevent reported to parent "on child" is merged with theFAN_MODIFYevent reported to child.The new test case is a regression test for commit
f367a62a7cad:fanotify: merge duplicate events on parent and child
The test looks OK but do we want a test for this? I mean: A test like this seems to imply we promise to merge identical events. Although that is a good general guideline, I consider it rather an optimization that may or may not happen but userspace should not rely on it. Thoughts?
Honza
Quoted 157 lines
Signed-off-by Amir Goldstein <[email protected]>Reviewed-by Petr Vorel <[email protected]>Reviewed-by Cyril Hrubis <[email protected]>Reviewed-by Matthew Bobrowski <[email protected]>--- .../kernel/syscalls/fanotify/fanotify15.c | 81 +++++++++++++++++-- 1 file changed, 73 insertions(+), 8 deletions(-)testcases/kernel/syscalls/fanotify/fanotify15.c +73
-8@@ -9,6 +9,10 @@* Test file that has been purposely designed to verify * FAN_REPORT_FID functionality while using newly defined dirent * events. +* +* Test case #1 is a regression test for commit f367a62a7cad: +* +* fanotify: merge duplicate events on parent and child */ #define _GNU_SOURCE#include "config.h" @@ -53,28 +57,49 @@ static int fanotify_fd;static char events_buf[EVENT_BUF_LEN ];static struct event_t event_set[EVENT_MAX ]; -static void do_test (void ) +static struct test_case_t { +const char *tname; +struct fanotify_mark_type mark; +unsigned long mask; +} test_cases[] = { + { +"FAN_REPORT_FID on filesystem including FAN_DELETE_SELF" , +INIT_FANOTIFY_MARK_TYPE (FILESYSTEM ), +FAN_DELETE_SELF , + }, + { +"FAN_REPORT_FID on directory with FAN_EVENT_ON_CHILD" , +INIT_FANOTIFY_MARK_TYPE (INODE ), +FAN_EVENT_ON_CHILD , + }, +}; + +static void do_test (unsigned int number) {int i, fd, len, count =0 ;struct file_handle *event_file_handle;struct fanotify_event_metadata *metadata;struct fanotify_event_info_fid *event_fid; +struct test_case_t *tc = &test_cases[number]; +struct fanotify_mark_type *mark = &tc->mark; + +tst_res (TINFO ,"Test #%d: %s" , number, tc->tname); -if (fanotify_mark (fanotify_fd,FAN_MARK_ADD |FAN_MARK_FILESYSTEM , +if (fanotify_mark (fanotify_fd,FAN_MARK_ADD | mark->flag, tc->mask |FAN_CREATE |FAN_DELETE |FAN_MOVE | -FAN_MODIFY |FAN_DELETE_SELF |FAN_ONDIR , +FAN_MODIFY |FAN_ONDIR ,AT_FDCWD ,TEST_DIR ) ==-1 ) {if (errno ==ENODEV )tst_brk (TCONF ,"FAN_REPORT_FID not supported on %s " "filesystem" , tst_device->fs_type);tst_brk (TBROK |TERRNO , -"fanotify_mark(%d, FAN_MARK_ADD | FAN_MARK_FILESYSTEM, " +"fanotify_mark(%d, FAN_MARK_ADD | %s, " "FAN_CREATE | FAN_DELETE | FAN_MOVE | " -"FAN_MODIFY | FAN_DELETE_SELF | FAN_ONDIR, " +"FAN_MODIFY | FAN_ONDIR | 0x%lx, " "AT_FDCWD, %s) failed" , - fanotify_fd,TEST_DIR ); + fanotify_fd, mark->name, tc->mask,TEST_DIR ); }/* All dirent events on testdir are merged */ @@ -87,8 +112,21 @@ static void do_test(void) fd =SAFE_CREAT (FILE1 ,0644 );SAFE_CLOSE (fd); +/* Recursive watch file for events "on self" */ +if (mark->flag ==FAN_MARK_INODE && +fanotify_mark (fanotify_fd,FAN_MARK_ADD | mark->flag, +FAN_MODIFY |FAN_DELETE_SELF , +AT_FDCWD ,FILE1 ) ==-1 ) { +tst_brk (TBROK |TERRNO , +"fanotify_mark(%d, FAN_MARK_ADD | %s, " +"FAN_DELETE_SELF, AT_FDCWD, %s) failed" , + fanotify_fd, mark->name,FILE1 ); + } +/* * Event on child file is not merged with dirent events. +* FAN_MODIFY event reported on file mark should be merged with the +* FAN_MODIFY event reported on parent directory watch. */ event_set[count].mask =FAN_MODIFY ; event_set[count].handle.handle_bytes =MAX_HANDLE_SZ ;@@ -128,6 +166,17 @@ static void do_test(void)SAFE_MKDIR (DIR1 ,0755 ); +/* Recursive watch subdir for events "on self" */ +if (mark->flag ==FAN_MARK_INODE && +fanotify_mark (fanotify_fd,FAN_MARK_ADD | mark->flag, +FAN_DELETE_SELF |FAN_ONDIR , +AT_FDCWD ,DIR1 ) ==-1 ) { +tst_brk (TBROK |TERRNO , +"fanotify_mark(%d, FAN_MARK_ADD | %s," +"FAN_DELETE_SELF | FAN_ONDIR, AT_FDCWD, %s) failed" , + fanotify_fd, mark->name,DIR1 ); + } +SAFE_RENAME (DIR1 ,DIR2 ); event_set[count].mask =FAN_ONDIR |FAN_DELETE_SELF ;@@ -141,6 +190,17 @@ static void do_test(void)/* Read dir events from the event queue */ len +=SAFE_READ (0 , fanotify_fd, events_buf + len,EVENT_BUF_LEN - len); +/* +* Cleanup the mark +*/ +if (fanotify_mark (fanotify_fd,FAN_MARK_FLUSH | mark->flag,0 , +AT_FDCWD ,TEST_DIR ) <0 ) { +tst_brk (TBROK |TERRNO , +"fanotify_mark (%d, FAN_MARK_FLUSH | %s, 0," +"AT_FDCWD, '" TEST_DIR "') failed" , + fanotify_fd, mark->name); + } +/* Process each event in buffer */ for (i =0 , metadata = (struct fanotify_event_metadata *) events_buf;FAN_EVENT_OK (metadata, len); i++) {@@ -259,9 +319,14 @@ static struct tst_test test = { .mount_device = 1, .mntpoint = MOUNT_POINT, .all_filesystems = 1, - .test_all = do_test, + .test = do_test, + .tcnt = ARRAY_SIZE(test_cases), .setup = do_setup, - .cleanup = do_cleanup + .cleanup = do_cleanup, + .tags = (const struct tst_tag []) { + {"linux-git" ,"f367a62a7cad" }, + {} + } };#else Signature · 1 line
2.17.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH v2 2/4 syscalls/fanotify15: Add a test case for inode marks
Quoted 10 lines · Jan Kara
Quoted 8 lines · Amir Goldstein
Test reporting events with fid also with recusrive inode marks:
- Test events "on self" (FAN_DELETE_SELF) on file and dir
- Test events "on child" (FAN_MODIFY) on fileWith recursive inode marks, verify that the
FAN_MODIFYevent reported to parent "on child" is merged with theFAN_MODIFYevent reported to child.
Quoted 8 lines
Quoted 3 lines
The new test case is a regression test for commit
f367a62a7cad:fanotify: merge duplicate events on parent and child
The test looks OK but do we want a test for this? I mean: A test like this seems to imply we promise to merge identical events. Although that is a good general guideline, I consider it rather an optimization that may or may not happen but userspace should not rely on it. Thoughts?
The thing is, those are not really two identical events.
This is in fact the same event (fsnotify_change() hook was called once). The fact that listener process may have an inode watch, parent directory watch and a filesystem watch should not affect the number of read events.
Now it's true that internally, fsnotify_dentry() emits two event flavors to parent and to victim. For inotify it even made some sense, because listener would read two different event flavors with two different formats. With fanotify (either reporting fd or fid) receiving two events makes very little sense.
I agree that the fix (merging those events) is best effort and we cannot commit to merging the events, but this isolated regression test does check the best effort fix reliably and this is the reason I think it should stay.
Upcoming FAN_REPORT_NAME is about to change the picture a bit towards the inotify behavior - victim watch gets event without name, parent watch gets event with name, filesystem watch gets both event flavors... that is, if you will agree to this behavior, but we shall continue this discussion on the fanotiify_name patches....
Thanks,
Amir.
PATCH v2 2/4 syscalls/fanotify15: Add a test case for inode marks
Quoted 20 lines · Amir Goldstein
Quoted 10 lines · Jan Kara
Quoted 8 lines · Amir Goldstein
Test reporting events with fid also with recusrive inode marks:
- Test events "on self" (FAN_DELETE_SELF) on file and dir
- Test events "on child" (FAN_MODIFY) on fileWith recursive inode marks, verify that the
FAN_MODIFYevent reported to parent "on child" is merged with theFAN_MODIFYevent reported to child.Quoted 8 lines
Quoted 3 lines
The new test case is a regression test for commit
f367a62a7cad:fanotify: merge duplicate events on parent and child
The test looks OK but do we want a test for this? I mean: A test like this seems to imply we promise to merge identical events. Although that is a good general guideline, I consider it rather an optimization that may or may not happen but userspace should not rely on it. Thoughts?
Quoted 4 lines
The thing is, those are not really two identical events.
This is in fact the same event (fsnotify_change()hook was called once). The fact that listener process may have an inode watch, parent directory watch and a filesystem watch should not affect the number of read events.
Yeah, I agree that in this case we should be merging the event if sanely possible (which is why I've merged that patch).
Quoted 10 lines
Now it's true that internally,
fsnotify_dentry()emits two event flavors to parent and to victim. For inotify it even made some sense, because listener would read two different event flavors with two different formats. With fanotify (either reporting fd or fid) receiving two events makes very little sense.I agree that the fix (merging those events) is best effort and we cannot commit to merging the events, but this isolated regression test does check the best effort fix reliably and this is the reason I think it should stay.
OK, I'm not too concerned about this test. But still the functionality is more in the area of "nice to have" than "must have" so in future we may break this if the implementation would get too hairy. But I guess we can remove the test in that case.
Quoted 5 lines
Upcoming
FAN_REPORT_NAMEis about to change the picture a bit towards the inotify behavior - victim watch gets event without name, parent watch gets event with name, filesystem watch gets both event flavors... that is, if you will agree to this behavior, but we shall continue this discussion on thefanotiify_namepatches....
Yes.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH v2 2/4 syscalls/fanotify15: Add a test case for inode marks
Hi Jan,
...
Quoted 28 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
The new test case is a regression test for commit
f367a62a7cad:fanotify: merge duplicate events on parent and child
The test looks OK but do we want a test for this? I mean: A test like this seems to imply we promise to merge identical events. Although that is a good general guideline, I consider it rather an optimization that may or may not happen but userspace should not rely on it. Thoughts?
Quoted 4 lines
The thing is, those are not really two identical events.
This is in fact the same event (fsnotify_change()hook was called once). The fact that listener process may have an inode watch, parent directory watch and a filesystem watch should not affect the number of read events.Yeah, I agree that in this case we should be merging the event if sanely possible (which is why I've merged that patch).
Quoted 10 lines
Now it's true that internally,
fsnotify_dentry()emits two event flavors to parent and to victim. For inotify it even made some sense, because listener would read two different event flavors with two different formats. With fanotify (either reporting fd or fid) receiving two events makes very little sense.I agree that the fix (merging those events) is best effort and we cannot commit to merging the events, but this isolated regression test does check the best effort fix reliably and this is the reason I think it should stay.
Quoted 4 lines
OK, I'm not too concerned about this test. But still the functionality is more in the area of "nice to have" than "must have" so in future we may break this if the implementation would get too hairy. But I guess we can remove the test in that case.
Yes, nothing is set in stone.
Quoted 7 lines
Quoted 5 lines
Upcoming
FAN_REPORT_NAMEis about to change the picture a bit towards the inotify behavior - victim watch gets event without name, parent watch gets event with name, filesystem watch gets both event flavors... that is, if you will agree to this behavior, but we shall continue this discussion on thefanotiify_namepatches....Yes.
Can I add your ack tag to the whole patchset?
Or do you still consider whether any of them should be merged?
Kind regards,
Petr
Quoted 1 line
Honza
PATCH v2 2/4 syscalls/fanotify15: Add a test case for inode marks
Quoted 43 lines · Petr Vorel
Hi Jan,
...
Quoted 28 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
The new test case is a regression test for commit
f367a62a7cad:fanotify: merge duplicate events on parent and child
The test looks OK but do we want a test for this? I mean: A test like this seems to imply we promise to merge identical events. Although that is a good general guideline, I consider it rather an optimization that may or may not happen but userspace should not rely on it. Thoughts?
Quoted 4 lines
The thing is, those are not really two identical events.
This is in fact the same event (fsnotify_change()hook was called once). The fact that listener process may have an inode watch, parent directory watch and a filesystem watch should not affect the number of read events.Yeah, I agree that in this case we should be merging the event if sanely possible (which is why I've merged that patch).
Quoted 10 lines
Now it's true that internally,
fsnotify_dentry()emits two event flavors to parent and to victim. For inotify it even made some sense, because listener would read two different event flavors with two different formats. With fanotify (either reporting fd or fid) receiving two events makes very little sense.I agree that the fix (merging those events) is best effort and we cannot commit to merging the events, but this isolated regression test does check the best effort fix reliably and this is the reason I think it should stay.
Quoted 4 lines
OK, I'm not too concerned about this test. But still the functionality is more in the area of "nice to have" than "must have" so in future we may break this if the implementation would get too hairy. But I guess we can remove the test in that case.
Yes, nothing is set in stone.
Quoted 5 lines
Quoted 5 lines
Upcoming
FAN_REPORT_NAMEis about to change the picture a bit towards the inotify behavior - victim watch gets event without name, parent watch gets event with name, filesystem watch gets both event flavors... that is, if you will agree to this behavior, but we shall continue this discussion on thefanotiify_namepatches....
Quoted 3 lines
Quoted 1 line
Yes.
Can I add your ack tag to the whole patchset?
Or do you still consider whether any of them should be merged?
Feel free to add my Ack-by tag:
I didn't check all the details but overall the patches look good to me.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH v2 2/4 syscalls/fanotify15: Add a test case for inode marks
Hi all,
Quoted 8 lines
Quoted 2 lines
Can I add your ack tag to the whole patchset?
Or do you still consider whether any of them should be merged?Feel free to add my Ack-by tag:
Acked-by Jan Kara <[email protected]>I didn't check all the details but overall the patches look good to me.
Merged with that few small fixes we discussed.
Thanks for your work!
Quoted 1 line
Honza
Kind regards,
Petr
PATCH v2 3/4 syscalls/fanotify: New test for FAN_MODIFY_DIR
In reply to Amir Goldstein- Watch dir modify events with name info
- Watch self delete events w/o name info
- Test inode and filesystem marks
- Check getting events for all file and dir names
--- runtest/syscalls | 1 + testcases/kernel/syscalls/fanotify/.gitignore | 1 + testcases/kernel/syscalls/fanotify/fanotify.h | 36 +- .../kernel/syscalls/fanotify/fanotify16.c | 403 ++++++++++++++++++ 4 files changed, 438 insertions(+), 3 deletions(-) create mode 100644 testcases/kernel/syscalls/fanotify/fanotify16.c
runtest/syscalls +1 -0
@@ -575,6 +575,7 @@ fanotify12 fanotify12 fanotify13 fanotify13 fanotify14 fanotify14 fanotify15 fanotify15 +fanotify16 fanotify16 ioperm01 ioperm01 ioperm02 ioperm02
testcases/kernel/syscalls/fanotify/.gitignore +1 -0
@@ -13,4 +13,5 @@ /fanotify13 /fanotify14 /fanotify15 +/fanotify16 /fanotify_child
testcases/kernel/syscalls/fanotify/fanotify.h +33 -3
@@ -41,6 +41,9 @@ static long fanotify_mark(int fd, unsigned int flags, uint64_t mask,#ifndef FAN_REPORT_TID #define FAN_REPORT_TID 0x00000100#endif +#ifndef FAN_REPORT_FID +#define FAN_REPORT_FID 0x00000200 +#endif #ifndef FAN_MARK_INODE #define FAN_MARK_INODE 0
@@ -79,9 +82,8 @@ static long fanotify_mark(int fd, unsigned int flags, uint64_t mask,#ifndef FAN_OPEN_EXEC_PERM #define FAN_OPEN_EXEC_PERM 0x00040000#endif - -#ifndef FAN_REPORT_FID -#define FAN_REPORT_FID 0x00000200 +#ifndef FAN_DIR_MODIFY +#define FAN_DIR_MODIFY 0x00080000#endif /*
@@ -106,6 +108,13 @@ typedef struct {#define __kernel_fsid_t lapi_fsid_t#endif /* __kernel_fsid_t */ +#ifndef FAN_EVENT_INFO_TYPE_FID +#define FAN_EVENT_INFO_TYPE_FID 1 +#endif +#ifndef FAN_EVENT_INFO_TYPE_DFID_NAME +#define FAN_EVENT_INFO_TYPE_DFID_NAME 2 +#endif + #ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER struct fanotify_event_info_header { uint8_t info_type;
@@ -155,6 +164,27 @@ static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid, "name_to_handle_at(AT_FDCWD, %s, ...) failed", path); } } + +struct fanotify_fid_t { +__kernel_fsid_t fsid; +struct file_handle handle; +char buf[MAX_HANDLE_SZ ]; +}; + +static inline void fanotify_save_fid (const char *path, +struct fanotify_fid_t *fid) +{ +int *fh = (int *)(fid->handle.f_handle); + + fh[0 ] = fh[1 ] = fh[2 ] =0 ; + fid->handle.handle_bytes =MAX_HANDLE_SZ ; +fanotify_get_fid (path, &fid->fsid, &fid->handle); + +tst_res (TINFO , +"fid(%s) = %x.%x.%x.%x.%x..." , path, +FSID_VAL_MEMBER (fid->fsid,0 ),FSID_VAL_MEMBER (fid->fsid,1 ), + fh[0 ], fh[1 ], fh[2 ]); +}#endif /* HAVE_NAME_TO_HANDLE_AT */ #define INIT_FANOTIFY_MARK_TYPE (t) \
testcases/kernel/syscalls/fanotify/fanotify16.c new file +403 -0
403 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 3/4 syscalls/fanotify: New test for FAN_MODIFY_DIR
Hi Amir,
while waiting for you and Jan to agree whether whole patchset should be merged I have 2 fixes for v2.
testcases/kernel/syscalls/fanotify/fanotify.h static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid, · line 186
Quoted 13 lines
testcases/kernel/syscalls/fanotify/fanotify.h +13
-0+static inline void fanotify_save_fid (const char *path, +struct fanotify_fid_t *fid) +{ +int *fh = (int *)(fid->handle.f_handle); + + fh[0 ] = fh[1 ] = fh[2 ] =0 ; + fid->handle.handle_bytes =MAX_HANDLE_SZ ; +fanotify_get_fid (path, &fid->fsid, &fid->handle); + +tst_res (TINFO , +"fid(%s) = %x.%x.%x.%x.%x..." , path, +FSID_VAL_MEMBER (fid->fsid,0 ),FSID_VAL_MEMBER (fid->fsid,1 ), + fh[0 ], fh[1 ], fh[2 ]);
We're using __kernel_fsid_t, which has val member on both libc and musl, thus it must be:
- "fid(%s) = %x.%x.%x.%x.%x...", path,
- FSID_VAL_MEMBER(fid->fsid, 0), FSID_VAL_MEMBER(fid->fsid, 1),
- fh[0], fh[1], fh[2]);
+ "fid(%s) = %x.%x.%x.%x.%x...", path, fid->fsid.val[0],
+ fid->fsid.val[1], fh[0], fh[1], fh[2]);
...
Quoted 4 lines
testcases/kernel/syscalls/fanotify/fanotify16.c new file +4
-0+ }else if (memcmp (&event_fid->fsid, &expected->fid->fsid, +sizeof (event_fid->fsid)) !=0 ) { +tst_res (TFAIL , + "got event: mask=%llx pid=%u fd=%d name='%s' "
testcases/kernel/syscalls/fanotify/fanotify16.c line 323
Quoted 10 lines
testcases/kernel/syscalls/fanotify/fanotify16.c new file +10
-0+"len=%d info_type=%d info_len=%d fh_len=%d " +"fsid=%x.%x (expected %x.%x)" , + (unsigned long long )event->mask, + (unsigned )event->pid, event->fd, filename, + event->event_len, info_type, + event_fid->hdr.len, fhlen, +FSID_VAL_MEMBER (event_fid->fsid,0 ), +FSID_VAL_MEMBER (event_fid->fsid,1 ), +FSID_VAL_MEMBER (expected->fid->fsid,0 ), + FSID_VAL_MEMBER(expected->fid->fsid, 1));
Also here 3rd and 4th access must be direct as it is event_t:
- FSID_VAL_MEMBER(expected->fid->fsid, 0),
- FSID_VAL_MEMBER(expected->fid->fsid, 1));
+ expected->fid->fsid.val[0],
+ expected->fid->fsid.val[1]);
FYI FSID_VAL_MEMBER is only for event_fid. I'm sorry, although there is a note in fanotify.h, it's a bit confusing (see f37704d6c fanotify: Fix FSID_VAL_MEMBER() usage).
There is also warning on array size on newer compilers:
378 | sprintf(fname1, "%s/%s", dname1, FILE_NAME1);
| ^~
In file included from /usr/include/stdio.h:867,
from fanotify16.c:13:
/usr/include/bits/stdio2.h:36:10: note: ?__builtin___sprintf_chk? output between 12 and 267 bytes into a destination of size 256
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~fanotify16.c:379:22: warning: ?%s? directive writing 10 bytes into a region of size between 0 and 255 [-Wformat-overflow=]
379 | sprintf(fname2, "%s/%s", dname1, FILE_NAME2);
| ^~
It can be fixed by increasing the size of fname1 and fname2:
-static char fname1[BUF_SIZE], fname2[BUF_SIZE]; +static char fname1[BUF_SIZE + 11], fname2[BUF_SIZE + 11];
I don't like that code but on the other hand don't like introducing warnings either.
Kind regards,
Petr
PATCH v2 3/4 syscalls/fanotify: New test for FAN_MODIFY_DIR
Quoted 23 lines · Petr Vorel
Hi Amir,
while waiting for you and Jan to agree whether whole patchset should be merged I have 2 fixes for v2.
testcases/kernel/syscalls/fanotify/fanotify.h static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid, · line 186
Quoted 13 lines
testcases/kernel/syscalls/fanotify/fanotify.h +13
-0+static inline void fanotify_save_fid (const char *path, +struct fanotify_fid_t *fid) +{ +int *fh = (int *)(fid->handle.f_handle); + + fh[0 ] = fh[1 ] = fh[2 ] =0 ; + fid->handle.handle_bytes =MAX_HANDLE_SZ ; +fanotify_get_fid (path, &fid->fsid, &fid->handle); + +tst_res (TINFO , +"fid(%s) = %x.%x.%x.%x.%x..." , path, +FSID_VAL_MEMBER (fid->fsid,0 ),FSID_VAL_MEMBER (fid->fsid,1 ), + fh[0 ], fh[1 ], fh[2 ]);We're using
__kernel_fsid_t, which has val member on both libc and musl, thus it must be:
Review
Quoted 5 lines
(quoted diff) +2
-3- "fid(%s) = %x.%x.%x.%x.%x...", path, - FSID_VAL_MEMBER(fid->fsid, 0), FSID_VAL_MEMBER(fid->fsid, 1), - fh[0], fh[1], fh[2]); + "fid(%s) = %x.%x.%x.%x.%x...", path, fid->fsid.val[0], + fid->fsid.val[1], fh[0], fh[1], fh[2]);
Sure. I didn't get the whole FSID_VAL_MEMBER thing correctly. Whatever works on all platforms.
Its just an info message anyway.
Quoted 45 lines
...
Quoted 4 lines
testcases/kernel/syscalls/fanotify/fanotify16.c new file +4
-0+ }else if (memcmp (&event_fid->fsid, &expected->fid->fsid, +sizeof (event_fid->fsid)) !=0 ) { +tst_res (TFAIL , + "got event: mask=%llx pid=%u fd=%d name='%s' "testcases/kernel/syscalls/fanotify/fanotify16.c line 323
Quoted 10 lines
testcases/kernel/syscalls/fanotify/fanotify16.c new file +10
-0+"len=%d info_type=%d info_len=%d fh_len=%d " +"fsid=%x.%x (expected %x.%x)" , + (unsigned long long )event->mask, + (unsigned )event->pid, event->fd, filename, + event->event_len, info_type, + event_fid->hdr.len, fhlen, +FSID_VAL_MEMBER (event_fid->fsid,0 ), +FSID_VAL_MEMBER (event_fid->fsid,1 ), +FSID_VAL_MEMBER (expected->fid->fsid,0 ), + FSID_VAL_MEMBER(expected->fid->fsid, 1));Also here 3rd and 4th access must be direct as it is
event_t:(quoted diff) +2
-2- FSID_VAL_MEMBER(expected->fid->fsid, 0), - FSID_VAL_MEMBER(expected->fid->fsid, 1)); + expected->fid->fsid.val[0], + expected->fid->fsid.val[1]);FYI
FSID_VAL_MEMBERis only forevent_fid. I'm sorry, although there is a note infanotify.h, it's a bit confusing (seef37704d6cfanotify: FixFSID_VAL_MEMBER()usage).There is also warning on array size on newer compilers:
378 |
sprintf(fname1, "%s/%s", dname1, FILE_NAME1);
| ^~
In file included from/usr/include/stdio.h:867,from fanotify16.c:13: /usr/include/bits/stdio2.h:36:10: note: ?__builtin___sprintf_chk? output between 12 and 267 bytes into a destination of size 256 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~fanotify16.c:379:22: warning: ?%s? directive writing 10 bytes into a region of size between 0 and 255 [-Wformat-overflow=]
379 |sprintf(fname2, "%s/%s", dname1, FILE_NAME2);
| ^~It can be fixed by increasing the size of fname1 and fname2:
(quoted diff) +1
-1-static char fname1[BUF_SIZE], fname2[BUF_SIZE]; +static char fname1[BUF_SIZE + 11], fname2[BUF_SIZE + 11];
Quoted 2 lines
I don't like that code but on the other hand don't like introducing warnings either.
Whatever works for you is fine by me.
Thanks,
Amir.
PATCH v2 4/4 syscalls/fanotify: Use fanotify_save_fid() helper
In reply to Amir GoldsteinReduce some boiler plate code in FAN_REPORT_FID tests and save fid only once per object instead of once per expected event.
--- .../kernel/syscalls/fanotify/fanotify13.c | 44 ++++++------- .../kernel/syscalls/fanotify/fanotify15.c | 63 +++++++++---------- 2 files changed, 50 insertions(+), 57 deletions(-)
testcases/kernel/syscalls/fanotify/fanotify13.c +20 -24
@@ -44,18 +44,16 @@ #if defined(HAVE_NAME_TO_HANDLE_AT) struct event_t { unsigned long long expected_mask; - __kernel_fsid_t fsid; - struct file_handle handle; - char buf[MAX_HANDLE_SZ]; }; static struct object_t { const char *path; int is_dir; + struct fanotify_fid_t fid; } objects[] = { - {FILE_PATH_ONE, 0}, - {FILE_PATH_TWO, 0}, - {DIR_PATH_ONE, 1} + {FILE_PATH_ONE, 0, {}}, + {FILE_PATH_TWO, 0, {}}, + {DIR_PATH_ONE, 1, {}} }; static struct test_case_t {
@@ -108,11 +106,8 @@ static void create_objects(void)static void get_object_stats (void ) {unsigned int i; -for (i =0 ; i <ARRAY_SIZE (objects); i++) { - event_set[i].handle.handle_bytes =MAX_HANDLE_SZ ; -fanotify_get_fid (objects[i].path, &event_set[i].fsid, - &event_set[i].handle); - } +for (i =0 ; i <ARRAY_SIZE (objects); i++) +fanotify_save_fid (objects[i].path, &objects[i].fid); }static int setup_marks (unsigned int fd,struct test_case_t *tc)
@@ -130,8 +125,8 @@ static int setup_marks(unsigned int fd, struct test_case_t *tc) "kernel");return 1 ; }else if (errno ==ENODEV && - !event_set[i].fsid.val[0 ] && - !event_set[i].fsid.val[1 ]) { + !FSID_VAL_MEMBER (objects[i].fid.fsid,0 ) && + !FSID_VAL_MEMBER (objects[i].fid.fsid,1 )) { tst_res(TCONF, "FAN_REPORT_FID not supported on " "filesystem type %s",
@@ -207,6 +202,7 @@ static void do_test(unsigned int number)for (i =0 , metadata = (struct fanotify_event_metadata *) events_buf;FAN_EVENT_OK (metadata, len); metadata =FAN_EVENT_NEXT (metadata, len), i++) { +struct fanotify_fid_t *expected_fid = &objects[i].fid; event_fid = (struct fanotify_event_info_fid *) (metadata +1 ); event_file_handle = (struct file_handle *) event_fid->handle;
@@ -226,43 +222,43 @@ static void do_test(unsigned int number) event_set[i].expected_mask);/* Verify handle_bytes returned in event */ -if (event_file_handle->handle_bytes - != event_set[i].handle.handle_bytes) { +if (event_file_handle->handle_bytes != + expected_fid->handle.handle_bytes) {tst_res (TFAIL ,"handle_bytes (%x) returned in event does not " "equal to handle_bytes (%x) returned in " "name_to_handle_at(2)" , event_file_handle->handle_bytes, - event_set[i].handle.handle_bytes); + expected_fid->handle.handle_bytes);continue ; }/* Verify handle_type returned in event */ if (event_file_handle->handle_type != - event_set[i].handle.handle_type) { + expected_fid->handle.handle_type) {tst_res (TFAIL ,"handle_type (%x) returned in event does not " "equal to handle_type (%x) returned in " "name_to_handle_at(2)" , event_file_handle->handle_type, - event_set[i].handle.handle_type); + expected_fid->handle.handle_type);continue ; }/* Verify file identifier f_handle returned in event */ if (memcmp (event_file_handle->f_handle, - event_set[i].handle.f_handle, - event_set[i].handle.handle_bytes) !=0 ) { + expected_fid->handle.f_handle, + expected_fid->handle.handle_bytes) !=0 ) {tst_res (TFAIL , -"event_file_handle->f_handle does not match " -"event_set[i].handle.f_handle returned in " +"file_handle returned in event does not match " +"the file_handle returned in " "name_to_handle_at(2)" );continue ; }/* Verify filesystem ID fsid returned in event */ -if (memcmp (&event_fid->fsid, &event_set[i].fsid, -sizeof (event_set[i].fsid)) !=0 ) { +if (memcmp (&event_fid->fsid, &expected_fid->fsid, +sizeof (expected_fid->fsid)) !=0 ) {tst_res (TFAIL ,"event_fid.fsid != stat.f_fsid that was " "obtained via statfs(2)" );
testcases/kernel/syscalls/fanotify/fanotify15.c +30 -33
158 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 4/4 syscalls/fanotify: Use fanotify_save_fid() helper
Quoted 6 lines · Amir Goldstein
Reduce some boiler plate code in
FAN_REPORT_FIDtests and save fid only once per object instead of once per expected event.Suggested-by Matthew Bobrowski <[email protected]>Signed-off-by Amir Goldstein <[email protected]>---
Nice, thanks for cleaning up those other tests too. Changes look fine to me.
/M
PATCH v2 4/4 syscalls/fanotify: Use fanotify_save_fid() helper
In reply to Amir GoldsteinHi Amir,
Quoted 2 lines
Reduce some boiler plate code in
FAN_REPORT_FIDtests and save fid only once per object instead of once per expected event.
+1
testcases/kernel/syscalls/fanotify/fanotify13.c static int setup_marks(unsigned int fd, struct test_case_t *tc) · line 129
Quoted 9 lines
static int
setup_marks(unsigned int fd, struct test_case_t *tc)testcases/kernel/syscalls/fanotify/fanotify13.c +2
-2@@ -130,8 +125,8 @@ static int setup_marks(unsigned int fd, struct test_case_t *tc) "kernel");return 1 ; }else if (errno ==ENODEV && - !event_set[i].fsid.val[0 ] && - !event_set[i].fsid.val[1 ]) { + !FSID_VAL_MEMBER (objects[i].fid.fsid,0 ) && + !FSID_VAL_MEMBER (objects[i].fid.fsid,1 )) {
For the same reasons as the previous commits this diff is needed:
- !FSID_VAL_MEMBER(objects[i].fid.fsid, 0) &&
- !FSID_VAL_MEMBER(objects[i].fid.fsid, 1)) {
+ !objects[i].fid.fsid.val[0] &&
+ !objects[i].fid.fsid.val[1]) {Kind regards,
Petr
v2 cover fanotify ltp tests for v5.7-rc1
In reply to Amir GoldsteinHi Amir,
Quoted 4 lines
Hi Petr,
Following patches test fanotify kernel code merged to v5.7-rc1.
Quoted 8 lines
Changes since v1:
- Patch to fanotify09 has already been merged
- Addressed comments by Petr, Cyril, Matthew and added reviewed-by
- Added patch to use new helperfanotify_save_fidby other testsPatch 3 adds a new test for the new event type
FAN_MODIFY_DIR, which carries a new event format (parent fid + name).
The man page patches forFAN_MODIFY_DIRhave already been merged.
LGTM, I'll just fix failure on MUSl and then merge
https://travis-ci.org/github/pevik/ltp/jobs/682785812
Kind regards,
Petr
Quoted 17 lines
Thanks all for the review,
Amir.Amir Goldstein (4):
syscalls/fanotify15: Minor corrections syscalls/fanotify15: Add a test case for inode marks syscalls/fanotify: New test forFAN_MODIFY_DIRsyscalls/fanotify: Usefanotify_save_fid()helperruntest/syscalls | 1 + testcases/kernel/syscalls/fanotify/.gitignore | 1 + testcases/kernel/syscalls/fanotify/fanotify.h | 36 +- .../kernel/syscalls/fanotify/fanotify13.c | 44 +- .../kernel/syscalls/fanotify/fanotify15.c | 191 ++++++--- .../kernel/syscalls/fanotify/fanotify16.c | 403 ++++++++++++++++++ 6 files changed, 596 insertions(+), 80 deletions(-) create mode 100644 testcases/kernel/syscalls/fanotify/fanotify16.c