public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v7 0/4] Add test for new mount API v5.2
@ 2020-02-17  8:46 Petr Vorel
  2020-02-17  8:46 ` [LTP] [PATCH v7 1/4] tst_umount: Fail immediately when errno != EBUSY Petr Vorel
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Petr Vorel @ 2020-02-17  8:46 UTC (permalink / raw)
  To: ltp

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

-- 
2.25.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 1/4] tst_umount: Fail immediately when errno != EBUSY
  2020-02-17  8:46 [LTP] [PATCH v7 0/4] Add test for new mount API v5.2 Petr Vorel
@ 2020-02-17  8:46 ` Petr Vorel
  2020-02-17  8:46 ` [LTP] [PATCH v7 2/4] safe_macros: Use tst_umount() in safe_umount() Petr Vorel
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Petr Vorel @ 2020-02-17  8:46 UTC (permalink / raw)
  To: ltp

Only on EBUSY makes sense to keep trying in a loop.
This helps to use tst_umount() in safe_umount() (next commit).

Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Reported-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Li Wang <liwang@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/tst_device.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/tst_device.c b/lib/tst_device.c
index 89b9c96de..8b5459def 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -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.");
 		}
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 2/4] safe_macros: Use tst_umount() in safe_umount()
  2020-02-17  8:46 [LTP] [PATCH v7 0/4] Add test for new mount API v5.2 Petr Vorel
  2020-02-17  8:46 ` [LTP] [PATCH v7 1/4] tst_umount: Fail immediately when errno != EBUSY Petr Vorel
@ 2020-02-17  8:46 ` Petr Vorel
  2020-02-17  8:46 ` [LTP] [PATCH v7 3/4] lapi/fsmount: Add definitions for fsmount related syscalls Petr Vorel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Petr Vorel @ 2020-02-17  8:46 UTC (permalink / raw)
  To: ltp

To get retry workaround for gvfsd-trash background daemon.

Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/safe_macros.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index 41fa4ca83..deb19d2df 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -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,
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 3/4] lapi/fsmount: Add definitions for fsmount related syscalls
  2020-02-17  8:46 [LTP] [PATCH v7 0/4] Add test for new mount API v5.2 Petr Vorel
  2020-02-17  8:46 ` [LTP] [PATCH v7 1/4] tst_umount: Fail immediately when errno != EBUSY Petr Vorel
  2020-02-17  8:46 ` [LTP] [PATCH v7 2/4] safe_macros: Use tst_umount() in safe_umount() Petr Vorel
@ 2020-02-17  8:46 ` Petr Vorel
  2020-02-17 13:49   ` Cyril Hrubis
  2020-02-17  8:46 ` [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API Petr Vorel
  2020-02-17  9:14 ` [LTP] [PATCH v7 0/4] Add test for new mount API v5.2 Viresh Kumar
  4 siblings, 1 reply; 13+ messages in thread
From: Petr Vorel @ 2020-02-17  8:46 UTC (permalink / raw)
  To: ltp

From: Viresh Kumar <viresh.kumar@linaro.org>

This adds definitions for all fsmount related syscalls which will be
used by multiple syscall tests.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Li Wang <liwang@redhat.com>
[ pvorel: add autotools checks + sort kcmp ]
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 configure.ac           |   8 ++-
 include/lapi/fsmount.h | 134 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 141 insertions(+), 1 deletion(-)
 create mode 100644 include/lapi/fsmount.h

diff --git a/configure.ac b/configure.ac
index df4e8c832..df407ce35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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 \
diff --git a/include/lapi/fsmount.h b/include/lapi/fsmount.h
new file mode 100644
index 000000000..87f2f229c
--- /dev/null
+++ b/include/lapi/fsmount.h
@@ -0,0 +1,134 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 Linaro Limited. All rights reserved.
+ * Author: Viresh Kumar <viresh.kumar@linaro.org>
+ */
+
+#ifndef FSMOUNT_H__
+#define FSMOUNT_H__
+
+#include <fcntl.h>
+#include <sys/mount.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+
+#include "config.h"
+#include "lapi/syscalls.h"
+
+#ifndef HAVE_FSOPEN
+int fsopen(const char *fsname, unsigned int flags)
+{
+	return tst_syscall(__NR_fsopen, fsname, flags);
+}
+#endif /* HAVE_FSOPEN */
+
+#ifndef HAVE_FSCONFIG
+int fsconfig(int fd, unsigned int cmd, const char *key,
+	     const void *value, int aux)
+{
+	return tst_syscall(__NR_fsconfig, fd, cmd, key, value, aux);
+}
+#endif /* HAVE_FSCONFIG */
+
+#ifndef HAVE_FSMOUNT
+int fsmount(int fd, unsigned int flags, unsigned int mount_attrs)
+{
+	return tst_syscall(__NR_fsmount, fd, flags, mount_attrs);
+}
+#endif /* HAVE_FSMOUNT */
+
+#ifndef HAVE_FSPICK
+int fspick(int dirfd, const char *pathname, unsigned int flags)
+{
+	return tst_syscall(__NR_fspick, dirfd, pathname, flags);
+}
+#endif /* HAVE_FSPICK */
+
+#ifndef HAVE_MOVE_MOUNT
+int move_mount(int from_dirfd, const char *from_pathname, int to_dirfd,
+	       const char *to_pathname, unsigned int flags)
+{
+	return tst_syscall(__NR_move_mount, from_dirfd, from_pathname, to_dirfd,
+			   to_pathname, flags);
+}
+#endif /* HAVE_MOVE_MOUNT */
+
+#ifndef HAVE_OPEN_TREE
+int open_tree(int dirfd, const char *pathname, unsigned int flags)
+{
+	return tst_syscall(__NR_open_tree, dirfd, pathname, flags);
+}
+#endif /* HAVE_OPEN_TREE */
+
+/*
+ * New headers added in kernel after 5.2 release, create them for old userspace.
+*/
+
+#ifndef OPEN_TREE_CLONE
+
+/*
+ * open_tree() flags.
+ */
+#define OPEN_TREE_CLONE		1		/* Clone the target tree and attach the clone */
+#define OPEN_TREE_CLOEXEC	O_CLOEXEC	/* Close the file on execve() */
+
+/*
+ * move_mount() flags.
+ */
+#define MOVE_MOUNT_F_SYMLINKS		0x00000001 /* Follow symlinks on from path */
+#define MOVE_MOUNT_F_AUTOMOUNTS		0x00000002 /* Follow automounts on from path */
+#define MOVE_MOUNT_F_EMPTY_PATH		0x00000004 /* Empty from path permitted */
+#define MOVE_MOUNT_T_SYMLINKS		0x00000010 /* Follow symlinks on to path */
+#define MOVE_MOUNT_T_AUTOMOUNTS		0x00000020 /* Follow automounts on to path */
+#define MOVE_MOUNT_T_EMPTY_PATH		0x00000040 /* Empty to path permitted */
+#define MOVE_MOUNT__MASK		0x00000077
+
+/*
+ * fsopen() flags.
+ */
+#define FSOPEN_CLOEXEC		0x00000001
+
+/*
+ * fspick() flags.
+ */
+#define FSPICK_CLOEXEC		0x00000001
+#define FSPICK_SYMLINK_NOFOLLOW	0x00000002
+#define FSPICK_NO_AUTOMOUNT	0x00000004
+#define FSPICK_EMPTY_PATH	0x00000008
+
+/*
+ * The type of fsconfig() call made.
+ */
+enum fsconfig_command {
+	FSCONFIG_SET_FLAG	= 0,	/* Set parameter, supplying no value */
+	FSCONFIG_SET_STRING	= 1,	/* Set parameter, supplying a string value */
+	FSCONFIG_SET_BINARY	= 2,	/* Set parameter, supplying a binary blob value */
+	FSCONFIG_SET_PATH	= 3,	/* Set parameter, supplying an object by path */
+	FSCONFIG_SET_PATH_EMPTY	= 4,	/* Set parameter, supplying an object by (empty) path */
+	FSCONFIG_SET_FD		= 5,	/* Set parameter, supplying an object by fd */
+	FSCONFIG_CMD_CREATE	= 6,	/* Invoke superblock creation */
+	FSCONFIG_CMD_RECONFIGURE = 7,	/* Invoke superblock reconfiguration */
+};
+
+/*
+ * fsmount() flags.
+ */
+#define FSMOUNT_CLOEXEC		0x00000001
+
+/*
+ * Mount attributes.
+ */
+#define MOUNT_ATTR_RDONLY	0x00000001 /* Mount read-only */
+#define MOUNT_ATTR_NOSUID	0x00000002 /* Ignore suid and sgid bits */
+#define MOUNT_ATTR_NODEV	0x00000004 /* Disallow access to device special files */
+#define MOUNT_ATTR_NOEXEC	0x00000008 /* Disallow program execution */
+#define MOUNT_ATTR__ATIME	0x00000070 /* Setting on how atime should be updated */
+#define MOUNT_ATTR_RELATIME	0x00000000 /* - Update atime relative to mtime/ctime. */
+#define MOUNT_ATTR_NOATIME	0x00000010 /* - Do not update access times. */
+#define MOUNT_ATTR_STRICTATIME	0x00000020 /* - Always perform atime updates */
+#define MOUNT_ATTR_NODIRATIME	0x00000080 /* Do not update directory access times */
+
+#endif /* OPEN_TREE_CLONE */
+
+
+#endif /* FSMOUNT_H__ */
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API
  2020-02-17  8:46 [LTP] [PATCH v7 0/4] Add test for new mount API v5.2 Petr Vorel
                   ` (2 preceding siblings ...)
  2020-02-17  8:46 ` [LTP] [PATCH v7 3/4] lapi/fsmount: Add definitions for fsmount related syscalls Petr Vorel
@ 2020-02-17  8:46 ` Petr Vorel
  2020-02-17  9:16   ` Li Wang
  2020-02-17 13:52   ` Cyril Hrubis
  2020-02-17  9:14 ` [LTP] [PATCH v7 0/4] Add test for new mount API v5.2 Viresh Kumar
  4 siblings, 2 replies; 13+ messages in thread
From: Petr Vorel @ 2020-02-17  8:46 UTC (permalink / raw)
  To: ltp

From: Zorro Lang <zlang@redhat.com>

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).

Signed-off-by: Zorro Lang <zlang@redhat.com>
Acked-by: Li Wang <liwang@redhat.com>
[ pvorel: rebased, cleanup autotools and other small fixes ]
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 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

diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in
index 2c1f105c1..beb0e6812 100644
--- a/include/lapi/syscalls/powerpc64.in
+++ b/include/lapi/syscalls/powerpc64.in
@@ -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
diff --git a/runtest/syscalls b/runtest/syscalls
index 0743cf4e3..72e729c1c 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -341,6 +341,8 @@ fpathconf01 fpathconf01
 fremovexattr01 fremovexattr01
 fremovexattr02 fremovexattr02
 
+fsmount01 fsmount01
+
 fstat02 fstat02
 fstat02_64 fstat02_64
 fstat03 fstat03
diff --git a/testcases/kernel/syscalls/fsmount/.gitignore b/testcases/kernel/syscalls/fsmount/.gitignore
new file mode 100644
index 000000000..e2f01ea17
--- /dev/null
+++ b/testcases/kernel/syscalls/fsmount/.gitignore
@@ -0,0 +1 @@
+/fsmount01
diff --git a/testcases/kernel/syscalls/fsmount/Makefile b/testcases/kernel/syscalls/fsmount/Makefile
new file mode 100644
index 000000000..cc80d2efd
--- /dev/null
+++ b/testcases/kernel/syscalls/fsmount/Makefile
@@ -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
diff --git a/testcases/kernel/syscalls/fsmount/fsmount01.c b/testcases/kernel/syscalls/fsmount/fsmount01.c
new file mode 100644
index 000000000..464458080
--- /dev/null
+++ b/testcases/kernel/syscalls/fsmount/fsmount01.c
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2019 Red Hat, Inc.  All rights reserved.
+ * Author: Zorro Lang <zlang@redhat.com>
+ *
+ * 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");
+	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");
+}
+
+static struct tst_test test = {
+	.test_all = test_fsmount,
+	.cleanup = cleanup,
+	.needs_root = 1,
+	.mntpoint = MNTPOINT,
+	.format_device = 1,
+	.all_filesystems = 1,
+	.dev_fs_flags = TST_FS_SKIP_FUSE,
+};
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 0/4] Add test for new mount API v5.2
  2020-02-17  8:46 [LTP] [PATCH v7 0/4] Add test for new mount API v5.2 Petr Vorel
                   ` (3 preceding siblings ...)
  2020-02-17  8:46 ` [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API Petr Vorel
@ 2020-02-17  9:14 ` Viresh Kumar
  4 siblings, 0 replies; 13+ messages in thread
From: Viresh Kumar @ 2020-02-17  9:14 UTC (permalink / raw)
  To: ltp

On 17-02-20, 09:46, Petr Vorel wrote:
> 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.

-- 
viresh

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API
  2020-02-17  8:46 ` [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API Petr Vorel
@ 2020-02-17  9:16   ` Li Wang
  2020-02-17  9:38     ` Petr Vorel
  2020-02-17 13:52   ` Cyril Hrubis
  1 sibling, 1 reply; 13+ messages in thread
From: Li Wang @ 2020-02-17  9:16 UTC (permalink / raw)
  To: ltp

Hi Petr,

Thanks for the quick response to the patch improvement.

On Mon, Feb 17, 2020 at 4:47 PM Petr Vorel <pvorel@suse.cz> wrote:

> From: Zorro Lang <zlang@redhat.com>
>
> 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).
>

87a2612857 is invalid?


> Signed-off-by: Zorro Lang <zlang@redhat.com>
> Acked-by: Li Wang <liwang@redhat.com>
> [ pvorel: rebased, cleanup autotools and other small fixes ]
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  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
>
> diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/
> powerpc64.in
> index 2c1f105c1..beb0e6812 100644
> --- a/include/lapi/syscalls/powerpc64.in
> +++ b/include/lapi/syscalls/powerpc64.in
> @@ -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.
    Acked-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200217/bd3b8350/attachment.htm>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API
  2020-02-17  9:16   ` Li Wang
@ 2020-02-17  9:38     ` Petr Vorel
  0 siblings, 0 replies; 13+ messages in thread
From: Petr Vorel @ 2020-02-17  9:38 UTC (permalink / raw)
  To: ltp

Hi Li,

> > NOTE: most of the syscalls numbers were added in previous commits
> > (c2f27f6e9b, 01e4dc2222, 87a2612857).


> 87a2612857 is 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.


> > Signed-off-by: Zorro Lang <zlang@redhat.com>
> > Acked-by: Li Wang <liwang@redhat.com>
> > [ pvorel: rebased, cleanup autotools and other small fixes ]
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  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

> > diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/
> > powerpc64.in
> > index 2c1f105c1..beb0e6812 100644
> > --- a/include/lapi/syscalls/powerpc64.in
> > +++ b/include/lapi/syscalls/powerpc64.in
> > @@ -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.

> 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 <liwang@redhat.com>
I suppose you ack also the change include/lapi/fsmount.h using lapi/fcntl.h
(if not, please let me know).

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 3/4] lapi/fsmount: Add definitions for fsmount related syscalls
  2020-02-17  8:46 ` [LTP] [PATCH v7 3/4] lapi/fsmount: Add definitions for fsmount related syscalls Petr Vorel
@ 2020-02-17 13:49   ` Cyril Hrubis
  0 siblings, 0 replies; 13+ messages in thread
From: Cyril Hrubis @ 2020-02-17 13:49 UTC (permalink / raw)
  To: ltp

Hi!
> This adds definitions for all fsmount related syscalls which will be
> used by multiple syscall tests.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> Acked-by: Li Wang <liwang@redhat.com>
> [ pvorel: add autotools checks + sort kcmp ]

If we were pedantic the sort is unrelated change that should be commited
in a separate patch...

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API
  2020-02-17  8:46 ` [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API Petr Vorel
  2020-02-17  9:16   ` Li Wang
@ 2020-02-17 13:52   ` Cyril Hrubis
  2020-02-17 14:04     ` Petr Vorel
                       ` (2 more replies)
  1 sibling, 3 replies; 13+ messages in thread
From: Cyril Hrubis @ 2020-02-17 13:52 UTC (permalink / raw)
  To: ltp

Hi!
> diff --git a/testcases/kernel/syscalls/fsmount/fsmount01.c b/testcases/kernel/syscalls/fsmount/fsmount01.c
> new file mode 100644
> index 000000000..464458080
> --- /dev/null
> +++ b/testcases/kernel/syscalls/fsmount/fsmount01.c
> @@ -0,0 +1,95 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2019 Red Hat, Inc.  All rights reserved.
> + * Author: Zorro Lang <zlang@redhat.com>
> + *
> + * 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");
> +	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.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API
  2020-02-17 13:52   ` Cyril Hrubis
@ 2020-02-17 14:04     ` Petr Vorel
  2020-02-17 14:13     ` Petr Vorel
  2020-02-17 15:02     ` Petr Vorel
  2 siblings, 0 replies; 13+ messages in thread
From: Petr Vorel @ 2020-02-17 14:04 UTC (permalink / raw)
  To: ltp

Hi,

> > +	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.

> Also LKML coding style prefers curly braces over both branches if they
> are required over one of them.
I'll fix this.

> Other than this the patchset looks fine.

+ I'll add sort as a separate change.

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API
  2020-02-17 13:52   ` Cyril Hrubis
  2020-02-17 14:04     ` Petr Vorel
@ 2020-02-17 14:13     ` Petr Vorel
  2020-02-17 15:02     ` Petr Vorel
  2 siblings, 0 replies; 13+ messages in thread
From: Petr Vorel @ 2020-02-17 14:13 UTC (permalink / raw)
  To: ltp

Hi,

> > +	if (ismount(MNTPOINT)) {
> > +		tst_res(TPASS, "new mount API works");
Also I'll change this to "device mounted".

> > +		SAFE_UMOUNT(MNTPOINT);
> > +		is_mounted = 0;
> > +	} else
> > +		tst_res(TFAIL, "new mount API works");
>                                   ^
> 				"device not mounted" ?

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API
  2020-02-17 13:52   ` Cyril Hrubis
  2020-02-17 14:04     ` Petr Vorel
  2020-02-17 14:13     ` Petr Vorel
@ 2020-02-17 15:02     ` Petr Vorel
  2 siblings, 0 replies; 13+ messages in thread
From: Petr Vorel @ 2020-02-17 15:02 UTC (permalink / raw)
  To: ltp

Hi,

> Other than this the patchset looks fine.
Finally merged, thanks to all reviewers.

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-02-17 15:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-17  8:46 [LTP] [PATCH v7 0/4] Add test for new mount API v5.2 Petr Vorel
2020-02-17  8:46 ` [LTP] [PATCH v7 1/4] tst_umount: Fail immediately when errno != EBUSY Petr Vorel
2020-02-17  8:46 ` [LTP] [PATCH v7 2/4] safe_macros: Use tst_umount() in safe_umount() Petr Vorel
2020-02-17  8:46 ` [LTP] [PATCH v7 3/4] lapi/fsmount: Add definitions for fsmount related syscalls Petr Vorel
2020-02-17 13:49   ` Cyril Hrubis
2020-02-17  8:46 ` [LTP] [PATCH v7 4/4] syscalls/fsmount01: Add test for fsmount series API Petr Vorel
2020-02-17  9:16   ` Li Wang
2020-02-17  9:38     ` Petr Vorel
2020-02-17 13:52   ` Cyril Hrubis
2020-02-17 14:04     ` Petr Vorel
2020-02-17 14:13     ` Petr Vorel
2020-02-17 15:02     ` Petr Vorel
2020-02-17  9:14 ` [LTP] [PATCH v7 0/4] Add test for new mount API v5.2 Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox