Add test for new mount API v5.2
v7 cover Add test for new mount API v5.2
Hi,
hopefully the final version we can merge (so we can continue with Viresh Kumar tests).
Checked with travis [2].
Changes v6->v7
* replaced Zorro's lapi/fsmount.h with Viresh's (1st commit from [1]), added autotools checks for his commit.
* add lapi/fcntl.h to fix AT_FDCWD
Kind regards,
Petr
[1] https://patchwork.ozlabs.org/patch/1237986/
[2] https://travis-ci.org/pevik/ltp/builds/651376895
Petr Vorel (2):
tst_umount: Fail immediately when errno != EBUSY
safe_macros: Use tst_umount() in safe_umount()
Viresh Kumar (1):
lapi/fsmount: Add definitions for fsmount related syscalls
Zorro Lang (1):
syscalls/fsmount01: Add test for fsmount series API
configure.ac | 8 +- include/lapi/fsmount.h | 134 ++++++++++++++++++ include/lapi/syscalls/powerpc64.in | 4 + lib/safe_macros.c | 2 +- lib/tst_device.c | 9 +- runtest/syscalls | 2 + testcases/kernel/syscalls/fsmount/.gitignore | 1 + testcases/kernel/syscalls/fsmount/Makefile | 8 ++ testcases/kernel/syscalls/fsmount/fsmount01.c | 95 +++++++++++++ 9 files changed, 260 insertions(+), 3 deletions(-) create mode 100644 include/lapi/fsmount.h create mode 100644 testcases/kernel/syscalls/fsmount/.gitignore create mode 100644 testcases/kernel/syscalls/fsmount/Makefile create mode 100644 testcases/kernel/syscalls/fsmount/fsmount01.c
Signature · 1 line
2.25.0
PATCH v7 1/4 tst_umount: Fail immediately when errno != EBUSY
Only on EBUSY makes sense to keep trying in a loop. This helps to use tst_umount() in safe_umount() (next commit).
--- lib/tst_device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
lib/tst_device.c +8 -1
@@ -363,10 +363,17 @@ int tst_umount(const char *path)if (!ret)return 0 ; +if (err !=EBUSY ) { +tst_resm (TWARN ,"umount('%s') failed with %s" , + path,tst_strerrno (err)); + errno = err; +return ret; + } +tst_resm (TINFO ,"umount('%s') failed with %s, try %2i..." , path,tst_strerrno (err), i+1 ); -if (i ==0 && err ==EBUSY ) { +if (i ==0 ) {tst_resm (TINFO ,"Likely gvfsd-trash is probing newly " "mounted fs, kill it to speed up tests." ); }
Signature · 1 line
2.25.0
PATCH v7 2/4 safe_macros: Use tst_umount() in safe_umount()
In reply to Petr VorelTo get retry workaround for gvfsd-trash background daemon.
--- lib/safe_macros.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/safe_macros.c +1 -1
@@ -772,7 +772,7 @@ int safe_umount(const char *file, const int lineno, void (*cleanup_fn)(void), {int rval; - rval =umount (target); + rval =tst_umount (target);if (rval ==-1 ) { tst_brkm(TBROK | TERRNO, cleanup_fn,
Signature · 1 line
2.25.0
PATCH v7 3/4 lapi/fsmount: Add definitions for fsmount related syscalls
In reply to Petr VorelFrom: Viresh Kumar <[email protected]>
This adds definitions for all fsmount related syscalls which will be used by multiple syscall tests.
--- configure.ac | 8 ++- include/lapi/fsmount.h | 134 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 include/lapi/fsmount.h
configure.ac +7 -1
@@ -80,15 +80,21 @@ AC_CHECK_FUNCS([ \ execveat \ fallocate \ fchownat \ + fsconfig \ + fsmount \ + fsopen \ + fspick \ fstatat \ getdents \ getdents64 \ - kcmp \ io_pgetevents \ + kcmp \ mkdirat \ mknodat \ modify_ldt \ + move_mount \ name_to_handle_at \ + open_tree \ openat \ pidfd_open \ pidfd_send_signal \
include/lapi/fsmount.h new file +134 -0
134 lines not on this page · raw message
Signature · 1 line
2.25.0
PATCH v7 3/4 lapi/fsmount: Add definitions for fsmount related syscalls
Hi!
Quoted 6 lines
This adds definitions for all fsmount related syscalls which will be used by multiple syscall tests.
Signed-off-by Viresh Kumar <[email protected]>Acked-by Li Wang <[email protected]>[ pvorel: add autotools checks + sort kcmp ]
If we were pedantic the sort is unrelated change that should be commited in a separate patch...
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v7 4/4 syscalls/fsmount01: Add test for fsmount series API
In reply to Petr VorelFrom: Zorro Lang <[email protected]>
Add basic tests tests for new mount API from kernel v5.2. Testing mount and umount filesystems with fsopen(), fsconfig(), fsmount() and move_mount().
NOTE: most of the syscalls numbers were added in previous commits (c2f27f6e9b, 01e4dc2222, 87a2612857).
--- include/lapi/syscalls/powerpc64.in | 4 + runtest/syscalls | 2 + testcases/kernel/syscalls/fsmount/.gitignore | 1 + testcases/kernel/syscalls/fsmount/Makefile | 8 ++ testcases/kernel/syscalls/fsmount/fsmount01.c | 95 +++++++++++++++++++ 5 files changed, 110 insertions(+) create mode 100644 testcases/kernel/syscalls/fsmount/.gitignore create mode 100644 testcases/kernel/syscalls/fsmount/Makefile create mode 100644 testcases/kernel/syscalls/fsmount/fsmount01.c
include/lapi/syscalls/powerpc64.in +4 -0
@@ -371,3 +371,7 @@ pidfd_open 434 pkey_mprotect 386 pkey_alloc 384 pkey_free 385 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432
runtest/syscalls +2 -0
@@ -341,6 +341,8 @@ fpathconf01 fpathconf01 fremovexattr01 fremovexattr01 fremovexattr02 fremovexattr02 +fsmount01 fsmount01 + fstat02 fstat02 fstat02_64 fstat02_64 fstat03 fstat03
testcases/kernel/syscalls/fsmount/.gitignore new file +1 -0
@@ -0,0 +1 @@ +/fsmount01
testcases/kernel/syscalls/fsmount/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2019 Red Hat, Inc. All rights reserved. + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/fsmount/fsmount01.c new file +95 -0
95 lines not on this page · raw message
Signature · 1 line
2.25.0
PATCH v7 4/4 syscalls/fsmount01: Add test for fsmount series API
Hi Petr,
Thanks for the quick response to the patch improvement.
Quoted 9 lines · Petr Vorel
From: Zorro Lang <[email protected]>
Add basic tests tests for new mount API from kernel v5.2. Testing mount and umount filesystems with
fsopen(),fsconfig(),fsmount()andmove_mount().NOTE: most of the syscalls numbers were added in previous commits (
c2f27f6e9b,01e4dc2222,87a2612857).
87a2612857 is invalid?
Quoted 22 lines
Signed-off-by Zorro Lang <[email protected]>Acked-by Li Wang <[email protected]>[ pvorel: rebased, cleanup autotools and other small fixes ]Signed-off-by Petr Vorel <[email protected]>--- include/lapi/syscalls/powerpc64.in | 4 + runtest/syscalls | 2 + testcases/kernel/syscalls/fsmount/.gitignore | 1 + testcases/kernel/syscalls/fsmount/Makefile | 8 ++ testcases/kernel/syscalls/fsmount/fsmount01.c | 95 +++++++++++++++++++ 5 files changed, 110 insertions(+) create mode 100644 testcases/kernel/syscalls/fsmount/.gitignore create mode 100644 testcases/kernel/syscalls/fsmount/Makefile create mode 100644 testcases/kernel/syscalls/fsmount/fsmount01.cinclude/lapi/syscalls/ renamed from include/lapi/syscalls/powerpc64.in +0
-0powerpc64.in
index2c1f105c1..beb0e6812100644
include/lapi/syscalls/powerpc64.in pidfd_open 434 · line 377
Quoted 7 lines
include/lapi/syscalls/powerpc64.in +4
-0@@ -371,3 +371,7 @@ pidfd_open 434 pkey_mprotect 386 pkey_alloc 384 pkey_free 385 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432
As Viresh and I commented in the previous email this four syscalls-number should be deleted from the patch.
Besides that, the patchset looks good to me.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200217/bd3b8350/attachment.htm>
PATCH v7 4/4 syscalls/fsmount01: Add test for fsmount series API
Hi Li,
Quoted 5 lines
Quoted 2 lines
NOTE: most of the syscalls numbers were added in previous commits (
c2f27f6e9b,01e4dc2222,87a2612857).
87a2612857is invalid?
I'm sorry, that was this upcomming commit (besides that it needs to be removed from it) => thanks for a report, I'll remove it.
Quoted 15 lines
Quoted 14 lines
Signed-off-by Zorro Lang <[email protected]>Acked-by Li Wang <[email protected]>[ pvorel: rebased, cleanup autotools and other small fixes ]Signed-off-by Petr Vorel <[email protected]>--- include/lapi/syscalls/powerpc64.in | 4 + runtest/syscalls | 2 + testcases/kernel/syscalls/fsmount/.gitignore | 1 + testcases/kernel/syscalls/fsmount/Makefile | 8 ++ testcases/kernel/syscalls/fsmount/fsmount01.c | 95 +++++++++++++++++++ 5 files changed, 110 insertions(+) create mode 100644 testcases/kernel/syscalls/fsmount/.gitignore create mode 100644 testcases/kernel/syscalls/fsmount/Makefile create mode 100644 testcases/kernel/syscalls/fsmount/fsmount01.c
Quoted 13 lines
include/lapi/syscalls/powerpc64.in pidfd_open 434 · line 377
Quoted 13 lines
include/lapi/syscalls/ renamed from include/lapi/syscalls/powerpc64.in +0
-0powerpc64.in
index2c1f105c1..beb0e6812100644include/lapi/syscalls/powerpc64.in +4
-0@@ -371,3 +371,7 @@ pidfd_open 434 pkey_mprotect 386 pkey_alloc 384 pkey_free 385 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432
Yep.
Quoted 5 lines
As Viresh and I commented in the previous email this four syscalls-number should be deleted from the patch.
Besides that, the patchset looks good to me.
Acked-by Li Wang <[email protected]>
I suppose you ack also the change include/lapi/fsmount.h using lapi/fcntl.h (if not, please let me know).
Kind regards,
Petr
PATCH v7 4/4 syscalls/fsmount01: Add test for fsmount series API
In reply to Petr VorelHi!
Quoted 80 lines
testcases/kernel/syscalls/fsmount/fsmount01.c new file +74
-0@@ -0,0 +1,95 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2019 Red Hat, Inc. All rights reserved. +* Author: Zorro Lang <[email protected]> +* +* Use new mount API from v5.2 (fsopen(), fsconfig(), fsmount(), move_mount()) +* to mount a filesystem without any specified mount options. +*/ + +#include <sys/mount.h> + +#include "tst_test.h" +#include "lapi/fcntl.h" +#include "lapi/fsmount.h" +#include "tst_safe_stdio.h" + +#define LINELENGTH 256 +#define MNTPOINT "newmount_point" +static int sfd, mfd, is_mounted; + +static int ismount (char *mntpoint) +{ +int ret =0 ; +FILE *file; +char line[LINELENGTH ]; + + file =SAFE_FOPEN ("/proc/mounts" ,"r" ); + +while (fgets (line,sizeof (line), file)) { +if (strstr (line, mntpoint) !=NULL ) { + ret =1 ; +break ; + } + } +SAFE_FCLOSE (file); +return ret; +} + +static void cleanup (void ) +{ +if (is_mounted) +SAFE_UMOUNT (MNTPOINT ); +} + +static void test_fsmount (void ) +{ +TEST (fsopen (tst_device->fs_type,FSOPEN_CLOEXEC )); +if (TST_RET <0 ) +tst_brk (TBROK |TTERRNO ,"fsopen %s" , tst_device->fs_type); + sfd =TST_RET ; +tst_res (TPASS ,"fsopen %s" , tst_device->fs_type); + +TEST (fsconfig (sfd,FSCONFIG_SET_STRING ,"source" , tst_device->dev,0 )); +if (TST_RET <0 ) +tst_brk (TBROK |TTERRNO , +"fsconfig set source to %s" , tst_device->dev); +tst_res (TPASS ,"fsconfig set source to %s" , tst_device->dev); + + +TEST (fsconfig (sfd,FSCONFIG_CMD_CREATE ,NULL ,NULL ,0 )); +if (TST_RET <0 ) +tst_brk (TBROK |TTERRNO ,"fsconfig create superblock" ); +tst_res (TPASS ,"fsconfig create superblock" ); + +TEST (fsmount (sfd,FSMOUNT_CLOEXEC ,0 )); +if (TST_RET <0 ) +tst_brk (TBROK |TTERRNO ,"fsmount" ); + mfd =TST_RET ; +tst_res (TPASS ,"fsmount" ); +SAFE_CLOSE (sfd); + +TEST (move_mount (mfd,"" ,AT_FDCWD ,MNTPOINT ,MOVE_MOUNT_F_EMPTY_PATH )); +if (TST_RET <0 ) +tst_brk (TBROK |TTERRNO ,"move_mount attach to mount point" );
testcases/kernel/syscalls/fsmount/fsmount01.c line 84
Quoted 10 lines
testcases/kernel/syscalls/fsmount/fsmount01.c new file +10
-0+ is_mounted =1 ; +tst_res (TPASS ,"move_mount attach to mount point" ); +SAFE_CLOSE (mfd); + +if (ismount (MNTPOINT )) { +tst_res (TPASS ,"new mount API works" ); +SAFE_UMOUNT (MNTPOINT ); + is_mounted =0 ; + }else +tst_res (TFAIL ,"new mount API works" );
^
"device not mounted" ?
Also LKML coding style prefers curly braces over both branches if they are required over one of them.
Other than this the patchset looks fine.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v7 4/4 syscalls/fsmount01: Add test for fsmount series API
Hi,
Quoted 8 lines
testcases/kernel/syscalls/fsmount/fsmount01.c line 84
Quoted 6 lines
testcases/kernel/syscalls/fsmount/fsmount01.c new file +6
-0+if (ismount (MNTPOINT )) { +tst_res (TPASS ,"new mount API works" ); +SAFE_UMOUNT (MNTPOINT ); + is_mounted =0 ; + }else +tst_res (TFAIL ,"new mount API works" );^
"device not mounted" ?
+1.
Quoted 2 lines
Also LKML coding style prefers curly braces over both branches if they are required over one of them.
I'll fix this.
Quoted 1 line
Other than this the patchset looks fine.
+ I'll add sort as a separate change.
Kind regards,
Petr
PATCH v7 4/4 syscalls/fsmount01: Add test for fsmount series API
In reply to Cyril HrubisHi,
Quoted 2 lines
testcases/kernel/syscalls/fsmount/fsmount01.c line 80
Quoted 2 lines
testcases/kernel/syscalls/fsmount/fsmount01.c new file +2
-0+if (ismount (MNTPOINT )) { +tst_res (TPASS ,"new mount API works" );
Also I'll change this to "device mounted".
Quoted 6 lines
testcases/kernel/syscalls/fsmount/fsmount01.c line 84
Quoted 4 lines
testcases/kernel/syscalls/fsmount/fsmount01.c new file +4
-0+SAFE_UMOUNT (MNTPOINT ); + is_mounted =0 ; + }else +tst_res (TFAIL ,"new mount API works" );^
"device not mounted" ?
Kind regards,
Petr
PATCH v7 4/4 syscalls/fsmount01: Add test for fsmount series API
In reply to Cyril HrubisHi,
Quoted 1 line
Other than this the patchset looks fine.
Finally merged, thanks to all reviewers.
Kind regards,
Petr
v7 cover Add test for new mount API v5.2
In reply to Petr VorelQuoted 4 lines · Petr Vorel
Hi,
hopefully the final version we can merge (so we can continue with Viresh Kumar tests).
Unfortunately not :(
Specially because the powerpc64 change is redundant, apart from other minor comments provided.
Few more comments were posted few hours back by /me and Li.
Signature · 1 line
viresh