fanotify01: Fix regression on kernels < v6.8
PATCH 1/1 fanotify01: Fix regression on kernels < v6.8
There was a test regression in case the TMPDIR has a zero fsid.
Kernels < v6.8 do not allow setting inodes marks on such fs, while kernels >= v6.8 do allow to set inode marks but on on a single fs.
Adjust the test expectation in those two different cases.
---
Petr,
I reproduced this but with TMPDIR set to ntfs-3g mount path, which has zero fsid link nfs.
Tested that fix works on new (upstream) and old v6.6 kernels.
Thanks,
Amir.
testcases/kernel/syscalls/fanotify/fanotify01.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/fanotify/fanotify01.c +11 -5
@@ -75,6 +75,7 @@ static char fname[BUF_SIZE];static char buf[BUF_SIZE ];static int fd_notify;static int fan_report_fid_unsupported; +static int tmpfs_report_fid_unsupported;static int mount_mark_fid_unsupported;static int inode_mark_fid_xdev;static int filesystem_mark_unsupported;
@@ -335,9 +336,11 @@ pass:* When tested fs has zero fsid (e.g. fuse) and events are reported * with fsid+fid, watching different filesystems is not supported. */ - ret = report_fid ? inode_mark_fid_xdev :0 ; -TST_EXP_FD_OR_FAIL (fanotify_mark (fd_notify,FAN_MARK_ADD ,FAN_CLOSE_WRITE , -AT_FDCWD ,"." ), ret); +if (!tmpfs_report_fid_unsupported) { + ret = report_fid ? inode_mark_fid_xdev :0 ; +TST_EXP_FD_OR_FAIL (fanotify_mark (fd_notify,FAN_MARK_ADD ,FAN_CLOSE_WRITE , +AT_FDCWD ,"." ), ret); + }/* Remove mark to clear FAN_MARK_IGNORED_SURV_MODIFY */ SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_REMOVE | mark->flag,
@@ -373,8 +376,11 @@ static void setup(void) inode_mark_fid_xdev =EXDEV ; } -if (fanotify_flags_supported_on_fs (FAN_REPORT_FID ,FAN_MARK_MOUNT ,FAN_OPEN ,"." )) { - inode_mark_fid_xdev = (errno ==ENODEV ) ?EXDEV : errno; + tmpfs_report_fid_unsupported =fanotify_init_flags_supported_on_fs (FAN_REPORT_FID ,"." ); +if (!tmpfs_report_fid_unsupported && +fanotify_flags_supported_on_fs (FAN_REPORT_FID ,FAN_MARK_MOUNT ,FAN_OPEN ,"." ) && + (errno ==ENODEV || errno ==EXDEV )) { + inode_mark_fid_xdev =EXDEV ;tst_res (TINFO |TERRNO ,"TMPDIR does not support reporting events with fid from multi fs" ); } }
Signature · 5 lines
2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 11 lines · Amir Goldstein
There was a test regression in case the TMPDIR has a zero fsid.
Kernels < v6.8 do not allow setting inodes marks on such fs, while kernels >= v6.8 do allow to set inode marks but on on a single fs.
Adjust the test expectation in those two different cases.
Reported-by Naresh Kamboju <[email protected]>Link https://lore.kernel.org/ltp/CA+G9fYtJO4DbiabJwpSamTPHjPzyrD3O6ZCwm2+CDEUA7f+ZYw@mail.gmail.com/ open hereFixes db197b7b5 ("fanotify01: fix test failure when running with nfs TMPDIR")Signed-off-by Amir Goldstein <[email protected]>
Thanks for fixing this up. The patch looks good to me. Feel free to add:
Honza
Quoted 59 lines
---
Petr,
I reproduced this but with TMPDIR set to ntfs-3g mount path, which has zero fsid link nfs.
Tested that fix works on new (upstream) and old v6.6 kernels.
Thanks,
Amir.testcases/kernel/syscalls/fanotify/fanotify01.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)testcases/kernel/syscalls/fanotify/fanotify01.c +11
-5@@ -75,6 +75,7 @@ static char fname[BUF_SIZE];static char buf[BUF_SIZE ];static int fd_notify;static int fan_report_fid_unsupported; +static int tmpfs_report_fid_unsupported;static int mount_mark_fid_unsupported;static int inode_mark_fid_xdev;static int filesystem_mark_unsupported;@@ -335,9 +336,11 @@ pass:* When tested fs has zero fsid (e.g. fuse) and events are reported * with fsid+fid, watching different filesystems is not supported. */ - ret = report_fid ? inode_mark_fid_xdev :0 ; -TST_EXP_FD_OR_FAIL (fanotify_mark (fd_notify,FAN_MARK_ADD ,FAN_CLOSE_WRITE , -AT_FDCWD ,"." ), ret); +if (!tmpfs_report_fid_unsupported) { + ret = report_fid ? inode_mark_fid_xdev :0 ; +TST_EXP_FD_OR_FAIL (fanotify_mark (fd_notify,FAN_MARK_ADD ,FAN_CLOSE_WRITE , +AT_FDCWD ,"." ), ret); + }/* Remove mark to clear FAN_MARK_IGNORED_SURV_MODIFY */ SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_REMOVE | mark->flag,@@ -373,8 +376,11 @@ static void setup(void) inode_mark_fid_xdev =EXDEV ; } -if (fanotify_flags_supported_on_fs (FAN_REPORT_FID ,FAN_MARK_MOUNT ,FAN_OPEN ,"." )) { - inode_mark_fid_xdev = (errno ==ENODEV ) ?EXDEV : errno; + tmpfs_report_fid_unsupported =fanotify_init_flags_supported_on_fs (FAN_REPORT_FID ,"." ); +if (!tmpfs_report_fid_unsupported && +fanotify_flags_supported_on_fs (FAN_REPORT_FID ,FAN_MARK_MOUNT ,FAN_OPEN ,"." ) && + (errno ==ENODEV || errno ==EXDEV )) { + inode_mark_fid_xdev =EXDEV ;tst_res (TINFO |TERRNO ,"TMPDIR does not support reporting events with fid from multi fs" ); } }Signature · 1 line
2.43.0
Signature · 5 lines
Jan Kara <[email protected]> SUSE Labs, CR -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Amir,
Quoted 7 lines · Amir Goldstein
There was a test regression in case the TMPDIR has a zero fsid.
Kernels < v6.8 do not allow setting inodes marks on such fs, while kernels >= v6.8 do allow to set inode marks but on on a single fs.
Adjust the test expectation in those two different cases.
Thanks for providing a fix patch,
this patch was tested and the reported failures have been fixed.
Quoted 61 lines
Reported-by Naresh Kamboju <[email protected]>Link https://lore.kernel.org/ltp/CA+G9fYtJO4DbiabJwpSamTPHjPzyrD3O6ZCwm2+CDEUA7f+ZYw@mail.gmail.com/ open hereFixes db197b7b5 ("fanotify01: fix test failure when running with nfs TMPDIR")Signed-off-by Amir Goldstein <[email protected]>---
Petr,
I reproduced this but with TMPDIR set to ntfs-3g mount path, which has zero fsid link nfs.
Tested that fix works on new (upstream) and old v6.6 kernels.
Thanks,
Amir.testcases/kernel/syscalls/fanotify/fanotify01.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)testcases/kernel/syscalls/fanotify/fanotify01.c +11
-6@@ -75,6 +75,7 @@ static char fname[BUF_SIZE];static char buf[BUF_SIZE ];static int fd_notify;static int fan_report_fid_unsupported; +static int tmpfs_report_fid_unsupported;static int mount_mark_fid_unsupported;static int inode_mark_fid_xdev;static int filesystem_mark_unsupported;@@ -335,9 +336,11 @@ pass:* When tested fs has zero fsid (e.g. fuse) and events are reported * with fsid+fid, watching different filesystems is not supported. */ - ret = report_fid ? inode_mark_fid_xdev :0 ; -TST_EXP_FD_OR_FAIL (fanotify_mark (fd_notify,FAN_MARK_ADD ,FAN_CLOSE_WRITE , -AT_FDCWD ,"." ), ret); +if (!tmpfs_report_fid_unsupported) { + ret = report_fid ? inode_mark_fid_xdev :0 ; +TST_EXP_FD_OR_FAIL (fanotify_mark (fd_notify,FAN_MARK_ADD ,FAN_CLOSE_WRITE , +AT_FDCWD ,"." ), ret); + }/* Remove mark to clear FAN_MARK_IGNORED_SURV_MODIFY */ SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_REMOVE | mark->flag,@@ -373,8 +376,11 @@ static void setup(void) inode_mark_fid_xdev =EXDEV ; } -if (fanotify_flags_supported_on_fs (FAN_REPORT_FID ,FAN_MARK_MOUNT ,FAN_OPEN ,"." )) { - inode_mark_fid_xdev = (errno ==ENODEV ) ?EXDEV : errno; + tmpfs_report_fid_unsupported =fanotify_init_flags_supported_on_fs (FAN_REPORT_FID ,"." ); +if (!tmpfs_report_fid_unsupported && +fanotify_flags_supported_on_fs (FAN_REPORT_FID ,FAN_MARK_MOUNT ,FAN_OPEN ,"." ) && + (errno ==ENODEV || errno ==EXDEV )) { + inode_mark_fid_xdev =EXDEV ;tst_res (TINFO |TERRNO ,"TMPDIR does not support reporting events with fid from multi fs" ); } } --
Quoted 1 line
2.43.0
LAVA test jobs 1 :
https://lkft.validation.linaro.org/scheduler/job/8338092#L2028
LAVA test jobs 2 :
https://lkft.validation.linaro.org/scheduler/job/8338077#L4569
- Naresh
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedHi!
Merged, thanks.
- Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp