* [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format
@ 2021-10-18 13:09 Yang Xu
2021-10-18 13:09 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06:Also " Yang Xu
` (4 more replies)
0 siblings, 5 replies; 15+ messages in thread
From: Yang Xu @ 2021-10-18 13:09 UTC (permalink / raw)
To: ltp
Since usrquota and groupquota supports visible quota files
with two formats(vfsv0 and vfsv1) on ext4, so add a test variants to
test it.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
include/lapi/quotactl.h | 8 +++
.../kernel/syscalls/quotactl/quotactl01.c | 67 +++++++++++++++----
2 files changed, 61 insertions(+), 14 deletions(-)
diff --git a/include/lapi/quotactl.h b/include/lapi/quotactl.h
index c1ec9d6e1..348b70b58 100644
--- a/include/lapi/quotactl.h
+++ b/include/lapi/quotactl.h
@@ -75,4 +75,12 @@ struct fs_quota_statv {
# define Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */
#endif
+#ifndef QFMT_VFS_V0
+# define QFMT_VFS_V0 2
+#endif
+
+#ifndef QFMT_VFS_V1
+# define QFMT_VFS_V1 4
+#endif
+
#endif /* LAPI_QUOTACTL_H__ */
diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
index 56146b595..4b791a03a 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl01.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
@@ -1,37 +1,60 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Crackerjack Project., 2007
- * Copyright (c) 2016-2019 FUJITSU LIMITED. All rights reserved
+ * Copyright (c) 2016-2021 FUJITSU LIMITED. All rights reserved
* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+ * Author: Yang Xu <xuyang2018.jy@fujitsu.com>
+ */
+
+/*\
+ * [Description]
+ * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems
+ * with visible quota files(cover two formats, vfsv0 and vfsv1):
*
- * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems:
* 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for user.
- * 2) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
+ *
+ * 2 quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
* for user.
+ *
* 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
* for user.
+ *
* 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
* flag for user.
+ *
* 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
* flag for user.
+ *
* 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for user.
+ *
* 7) quotactl(2) succeeds to update quota usages with Q_SYNC flag for user.
+ *
* 8) quotactl(2) succeeds to get disk quota limit greater than or equal to
* ID with Q_GETNEXTQUOTA flag for user.
+ *
* 9) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for user.
+ *
* 10) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for group.
+ *
* 11) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
* for group.
+ *
* 12) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
* for group.
+ *
* 13) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
* flag for group.
+ *
* 14) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
* flag for group.
+ *
* 15) quotactl(2) succeeds to get quota format with Q_GETFMT flag for group.
+ *
* 16) quotactl(2) succeeds to update quota usages with Q_SYNC flag for group.
+ *
* 17) quotactl(2) succeeds to get disk quota limit greater than or equal to
* ID with Q_GETNEXTQUOTA flag for group.
+ *
* 18) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for group.
*/
@@ -43,16 +66,12 @@
#include "lapi/quotactl.h"
#include "tst_test.h"
-#ifndef QFMT_VFS_V0
-# define QFMT_VFS_V0 2
-#endif
#define USRPATH MNTPOINT "/aquota.user"
#define GRPPATH MNTPOINT "/aquota.group"
-#define FMTID QFMT_VFS_V0
#define MNTPOINT "mntpoint"
-static int32_t fmt_id = FMTID;
-static int test_id;
+static int32_t fmt_id;
+static int test_id, mount_flag;
static char usrpath[] = USRPATH;
static char grppath[] = GRPPATH;
static struct dqblk set_dq = {
@@ -163,9 +182,22 @@ static struct tcase {
static void setup(void)
{
- const char *const cmd[] = {"quotacheck", "-ugF", "vfsv0", MNTPOINT, NULL};
-
- SAFE_CMD(cmd, NULL, NULL);
+ const char *const vfsv0_cmd[] = {"quotacheck", "-ugF", "vfsv0", MNTPOINT, NULL};
+ const char *const vfsv1_cmd[] = {"quotacheck", "-ugF", "vfsv1", MNTPOINT, NULL};
+
+ SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
+ SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "usrquota,grpquota");
+ mount_flag = 1;
+
+ if (tst_variant) {
+ tst_res(TINFO, "quotactl() with vfsv1 format");
+ SAFE_CMD(vfsv1_cmd, NULL, NULL);
+ fmt_id = QFMT_VFS_V1;
+ } else {
+ tst_res(TINFO, "quotactl() with vfsv0 format");
+ SAFE_CMD(vfsv0_cmd, NULL, NULL);
+ fmt_id = QFMT_VFS_V0;
+ }
test_id = geteuid();
if (access(USRPATH, F_OK) == -1)
@@ -182,6 +214,12 @@ static void setup(void)
getnextquota_nsup = 1;
}
+static void cleanup(void)
+{
+ if (mount_flag && tst_umount(MNTPOINT))
+ tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
+}
+
static void verify_quota(unsigned int n)
{
struct tcase *tc = &tcases[n];
@@ -222,13 +260,14 @@ static struct tst_test test = {
},
.test = verify_quota,
.tcnt = ARRAY_SIZE(tcases),
- .mount_device = 1,
+ .needs_device = 1,
.dev_fs_type = "ext4",
.mntpoint = MNTPOINT,
- .mnt_data = "usrquota,grpquota",
.needs_cmds = (const char *const []) {
"quotacheck",
NULL
},
.setup = setup,
+ .cleanup = cleanup,
+ .test_variants = 2,
};
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [LTP] [PATCH v1 02/11] syscalls/quotactl06:Also test with vfsv1 format
2021-10-18 13:09 [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Yang Xu
@ 2021-10-18 13:09 ` Yang Xu
2021-10-20 8:51 ` xuyang2018.jy
2021-10-26 13:45 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06???Also " Cyril Hrubis
2021-10-18 13:09 ` [LTP] [PATCH v1 03/11] syscalls/quotactl04: Remove useless quotactl mount options Yang Xu
` (3 subsequent siblings)
4 siblings, 2 replies; 15+ messages in thread
From: Yang Xu @ 2021-10-18 13:09 UTC (permalink / raw)
To: ltp
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
.../kernel/syscalls/quotactl/quotactl06.c | 59 +++++++++++++++----
1 file changed, 46 insertions(+), 13 deletions(-)
diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c
index a10d1ca07..f53f088d8 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl06.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
@@ -1,26 +1,42 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Copyright (c) 2019-2021 FUJITSU LIMITED. All rights reserved.
* Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Tests basic error handling of the quotactl syscall with visible quota files
+ * (cover two formats, vfsv0 and vfsv1):
*
- * Tests basic error handling of the quotactl syscall.
* 1) quotactl fails with EACCES when cmd is Q_QUOTAON and addr
* existed but not a regular file.
+ *
* 2) quotaclt fails with ENOENT when the file specified by special
* or addr does not exist.
+ *
* 3) quotactl fails with EBUSTY when cmd is Q_QUOTAON and another
* Q_QUOTAON had already been performed.
+ *
* 4) quotactl fails with EFAULT when addr or special is invalid.
+ *
* 5) quotactl fails with EINVAL when cmd or type is invalid.
+ *
* 6) quotactl fails with ENOTBLK when special is not a block device.
+ *
* 7) quotactl fails with ESRCH when no disk quota is found for the
* indicated user and quotas have not been turned on for this fs.
+ *
* 8) quotactl fails with ESRCH when cmd is Q_QUOTAON, but the quota
* format was not found.
+ *
* 9) quotactl fails with ESRCH when cmd is Q_GETNEXTQUOTA, but there
* is no ID greater than or equal to id that has an active quota.
+ *
* 10) quotactl fails with ERANGE when cmd is Q_SETQUOTA, but the
* specified limits are out of the range allowed by the quota format.
+ *
* 11) quotactl fails with EPERM when the caller lacked the required
* privilege (CAP_SYS_ADMIN) for the specified operation.
*/
@@ -32,10 +48,7 @@
#include "tst_capability.h"
#define OPTION_INVALID 999
-#define QFMT_VFS_V0 2
#define USRPATH MNTPOINT "/aquota.user"
-#define FMTID QFMT_VFS_V0
-
#define MNTPOINT "mntpoint"
#define TESTDIR1 MNTPOINT "/testdir1"
#define TESTDIR2 MNTPOINT "/testdir2"
@@ -43,10 +56,10 @@
static char usrpath[] = USRPATH;
static char testdir1[] = TESTDIR1;
static char testdir2[] = TESTDIR2;
-static int32_t fmt_id = FMTID;
+static int32_t fmt_id;
static int32_t fmt_invalid = 999;
static int test_invalid;
-static int test_id;
+static int test_id, mount_flag;
static int getnextquota_nsup;
static struct if_nextdqblk res_ndq;
@@ -105,7 +118,7 @@ static void verify_quotactl(unsigned int n)
if (tc->on_flag) {
TEST(quotactl(QCMD(Q_QUOTAON, USRQUOTA), tst_device->dev,
- FMTID, usrpath));
+ fmt_id, usrpath));
if (TST_RET == -1)
tst_brk(TBROK,
"quotactl with Q_QUOTAON returned %ld", TST_RET);
@@ -135,7 +148,7 @@ static void verify_quotactl(unsigned int n)
if (quota_on) {
TEST(quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), tst_device->dev,
- FMTID, usrpath));
+ fmt_id, usrpath));
if (TST_RET == -1)
tst_brk(TBROK,
"quotactl with Q_QUOTAOFF returned %ld", TST_RET);
@@ -150,10 +163,23 @@ static void verify_quotactl(unsigned int n)
static void setup(void)
{
- const char *const cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
+ const char *const vfsv0_cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
+ const char *const vfsv1_cmd[] = {"quotacheck", "-uF", "vfsv1", MNTPOINT, NULL};
unsigned int i;
- SAFE_CMD(cmd, NULL, NULL);
+ SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
+ SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "usrquota");
+ mount_flag = 1;
+
+ if (tst_variant) {
+ tst_res(TINFO, "quotactl() with vfsv1 format");
+ SAFE_CMD(vfsv1_cmd, NULL, NULL);
+ fmt_id = QFMT_VFS_V1;
+ } else {
+ tst_res(TINFO, "quotactl() with vfsv0 format");
+ SAFE_CMD(vfsv0_cmd, NULL, NULL);
+ fmt_id = QFMT_VFS_V0;
+ }
if (access(USRPATH, F_OK) == -1)
tst_brk(TFAIL | TERRNO, "user quotafile didn't exist");
@@ -175,8 +201,15 @@ static void setup(void)
}
}
+static void cleanup(void)
+{
+ if (mount_flag && tst_umount(MNTPOINT))
+ tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
+}
+
static struct tst_test test = {
.setup = setup,
+ .cleanup = cleanup,
.needs_kconfigs = (const char *[]) {
"CONFIG_QFMT_V2",
NULL
@@ -185,11 +218,11 @@ static struct tst_test test = {
.test = verify_quotactl,
.dev_fs_type = "ext4",
.mntpoint = MNTPOINT,
- .mount_device = 1,
- .mnt_data = "usrquota",
+ .needs_device = 1,
.needs_cmds = (const char *const []) {
"quotacheck",
NULL
},
.needs_root = 1,
+ .test_variants = 2,
};
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [LTP] [PATCH v1 03/11] syscalls/quotactl04: Remove useless quotactl mount options
2021-10-18 13:09 [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Yang Xu
2021-10-18 13:09 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06:Also " Yang Xu
@ 2021-10-18 13:09 ` Yang Xu
2021-10-26 14:03 ` Cyril Hrubis
2021-10-18 13:09 ` [LTP] [PATCH v1 04/11] syscalls/quotactl[3, 5, 7]: Add docparse formatting Yang Xu
` (2 subsequent siblings)
4 siblings, 1 reply; 15+ messages in thread
From: Yang Xu @ 2021-10-18 13:09 UTC (permalink / raw)
To: ltp
When use -O quota options for mkfs.ext4, quota mount option
will be ignored[1]. So remove it.
Also add docparse formatting.
[1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7c319d3
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
testcases/kernel/syscalls/quotactl/quotactl04.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
index fd3afc888..ca6a94263 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl04.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
@@ -2,22 +2,33 @@
/*
* Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
* Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+
+/*\
+ * [Description]
*
* This testcase checks the basic flag of quotactl(2) for project quota on
* non-XFS filesystems.
*
* 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for project.
+ *
* 2) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
* for project.
+ *
* 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
* for project.
+ *
* 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
* flag for project.
+ *
* 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
* flag for project.
+ *
* 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for project.
+ *
* 7) quotactl(2) succeeds to get disk quota limit greater than or equal to
* ID with Q_GETNEXTQUOTA flag for project.
+ *
* 8) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for project.
*
* Minimum e2fsprogs version required is 1.43.
@@ -34,10 +45,6 @@
#include "tst_safe_stdio.h"
#include "tst_test.h"
-#ifndef QFMT_VFS_V1
-# define QFMT_VFS_V1 4
-#endif
-
#define FMTID QFMT_VFS_V1
#define MNTPOINT "mntpoint"
static int32_t fmt_id = FMTID;
@@ -141,7 +148,7 @@ static void setup(void)
tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for quota,project option, test skipped");
pclose(f);
SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
- do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "quota");
+ do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
}
static void cleanup(void)
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [LTP] [PATCH v1 04/11] syscalls/quotactl[3, 5, 7]: Add docparse formatting
2021-10-18 13:09 [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Yang Xu
2021-10-18 13:09 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06:Also " Yang Xu
2021-10-18 13:09 ` [LTP] [PATCH v1 03/11] syscalls/quotactl04: Remove useless quotactl mount options Yang Xu
@ 2021-10-18 13:09 ` Yang Xu
2021-10-26 14:05 ` Cyril Hrubis
2021-10-18 13:09 ` [LTP] [PATCH v1 05/11] lapi/syscalls: Add syscall number for quotactl_fd Yang Xu
2021-10-26 13:36 ` [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Cyril Hrubis
4 siblings, 1 reply; 15+ messages in thread
From: Yang Xu @ 2021-10-18 13:09 UTC (permalink / raw)
To: ltp
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
testcases/kernel/syscalls/quotactl/quotactl03.c | 13 ++++++-------
testcases/kernel/syscalls/quotactl/quotactl05.c | 13 +++++++++++--
testcases/kernel/syscalls/quotactl/quotactl07.c | 4 ++++
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/testcases/kernel/syscalls/quotactl/quotactl03.c b/testcases/kernel/syscalls/quotactl/quotactl03.c
index 3ec931727..9711b7f07 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl03.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl03.c
@@ -4,10 +4,9 @@
* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
*/
-/*
- * Test Name: quotactl03
+/*\
+ * [Description]
*
- * Description:
* quotactl(2) with XGETNEXTQUOTA looks for the next active quota for an user
* equal or higher to a given ID, in this test the ID is specified to a value
* close to UINT_MAX(max value of unsigned int). When reaching the upper limit
@@ -16,11 +15,11 @@
*
* This kernel bug of xfs has been fixed in:
*
- * commit 657bdfb7f5e68ca5e2ed009ab473c429b0d6af85
- * Author: Eric Sandeen <sandeen@redhat.com>
- * Date: Tue Jan 17 11:43:38 2017 -0800
+ * commit 657bdfb7f5e68ca5e2ed009ab473c429b0d6af85
+ * Author: Eric Sandeen <sandeen@redhat.com>
+ * Date: Tue Jan 17 11:43:38 2017 -0800
*
- * xfs: don't wrap ID in xfs_dq_get_next_id
+ * xfs: don't wrap ID in xfs_dq_get_next_id
*/
#define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/quotactl/quotactl05.c b/testcases/kernel/syscalls/quotactl/quotactl05.c
index e811e47a4..fbc7f5924 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl05.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl05.c
@@ -2,19 +2,28 @@
/*
* Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
* Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * This testcase checks basic flags of quotactl(2) for project on an XFS filesystem:
*
- * This testcase checks basic flags of quotactl(2) for project on an XFS file
- * system:
* 1) quotactl(2) succeeds to turn off xfs quota and get xfs quota off status
* for project.
+ *
* 2) quotactl(2) succeeds to turn on xfs quota and get xfs quota on status
* for project.
+ *
* 3) quotactl(2) succeeds to set and use Q_XGETQUOTA to get xfs disk quota
* limits for project.
+ *
* 4) quotactl(2) succeeds to set and use Q_XGETNEXTQUOTA to get xfs disk
* quota limits Cgreater than or equal to ID for project.
+ *
* 5) quotactl(2) succeeds to turn off xfs quota and get xfs quota off statv
* for project.
+ *
* 6) quotactl(2) succeeds to turn on xfs quota and get xfs quota on statv
* for project.
*/
diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c
index db477589b..a55416f0e 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl07.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl07.c
@@ -2,6 +2,10 @@
/*
* Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
* Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+
+/*\
+ * [Description]
*
* This is a regresstion test for kernel commit 3dd4d40b4208
* ("xfs: Sanity check flags of Q_XQUOTARM call").
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [LTP] [PATCH v1 05/11] lapi/syscalls: Add syscall number for quotactl_fd
2021-10-18 13:09 [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Yang Xu
` (2 preceding siblings ...)
2021-10-18 13:09 ` [LTP] [PATCH v1 04/11] syscalls/quotactl[3, 5, 7]: Add docparse formatting Yang Xu
@ 2021-10-18 13:09 ` Yang Xu
2021-10-26 14:09 ` Cyril Hrubis
2021-10-26 13:36 ` [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Cyril Hrubis
4 siblings, 1 reply; 15+ messages in thread
From: Yang Xu @ 2021-10-18 13:09 UTC (permalink / raw)
To: ltp
Add syscall number for quotactl_fd, refer to glibc's submission[1].
[1]https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=89dc0372a9055e7ef86fe19be6201fa0b16b2f0e
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
include/lapi/syscalls/aarch64.in | 1 +
include/lapi/syscalls/arc.in | 1 +
include/lapi/syscalls/arm.in | 1 +
include/lapi/syscalls/hppa.in | 1 +
include/lapi/syscalls/i386.in | 1 +
include/lapi/syscalls/ia64.in | 1 +
include/lapi/syscalls/mips_n32.in | 1 +
include/lapi/syscalls/mips_n64.in | 1 +
include/lapi/syscalls/mips_o32.in | 1 +
include/lapi/syscalls/powerpc.in | 1 +
include/lapi/syscalls/powerpc64.in | 1 +
include/lapi/syscalls/s390.in | 1 +
include/lapi/syscalls/s390x.in | 1 +
include/lapi/syscalls/sh.in | 1 +
include/lapi/syscalls/sparc.in | 1 +
include/lapi/syscalls/sparc64.in | 1 +
include/lapi/syscalls/x86_64.in | 1 +
17 files changed, 17 insertions(+)
diff --git a/include/lapi/syscalls/aarch64.in b/include/lapi/syscalls/aarch64.in
index a47185954..89b63ee4b 100644
--- a/include/lapi/syscalls/aarch64.in
+++ b/include/lapi/syscalls/aarch64.in
@@ -294,4 +294,5 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
_sysctl 1078
diff --git a/include/lapi/syscalls/arc.in b/include/lapi/syscalls/arc.in
index 9c1654b0b..72420754a 100644
--- a/include/lapi/syscalls/arc.in
+++ b/include/lapi/syscalls/arc.in
@@ -314,3 +314,4 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/arm.in b/include/lapi/syscalls/arm.in
index ded2f5e03..2a78d7c3c 100644
--- a/include/lapi/syscalls/arm.in
+++ b/include/lapi/syscalls/arm.in
@@ -392,3 +392,4 @@ close_range (__NR_SYSCALL_BASE+436)
openat2 (__NR_SYSCALL_BASE+437)
pidfd_getfd (__NR_SYSCALL_BASE+438)
epoll_pwait2 (__NR_SYSCALL_BASE+441)
+quotactl_fd (__NR_SYSCALL_BASE+443)
diff --git a/include/lapi/syscalls/hppa.in b/include/lapi/syscalls/hppa.in
index d8f142b6a..2f0fc8153 100644
--- a/include/lapi/syscalls/hppa.in
+++ b/include/lapi/syscalls/hppa.in
@@ -41,3 +41,4 @@ fspick 433
pidfd_open 434
close_range 436
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/i386.in b/include/lapi/syscalls/i386.in
index f69268e10..34a8a621f 100644
--- a/include/lapi/syscalls/i386.in
+++ b/include/lapi/syscalls/i386.in
@@ -428,3 +428,4 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/ia64.in b/include/lapi/syscalls/ia64.in
index 3ba2406c4..b729cd3f0 100644
--- a/include/lapi/syscalls/ia64.in
+++ b/include/lapi/syscalls/ia64.in
@@ -341,3 +341,4 @@ close_range 1460
openat2 1461
pidfd_getfd 1462
epoll_pwait2 1465
+quotactl_fd 1467
diff --git a/include/lapi/syscalls/mips_n32.in b/include/lapi/syscalls/mips_n32.in
index dad8107f4..46098a616 100644
--- a/include/lapi/syscalls/mips_n32.in
+++ b/include/lapi/syscalls/mips_n32.in
@@ -369,3 +369,4 @@ faccessat2 6439
process_madvise 6440
epoll_pwait2 6441
mount_setattr 6442
+quotactl_fd 6443
diff --git a/include/lapi/syscalls/mips_n64.in b/include/lapi/syscalls/mips_n64.in
index a6c0c8cdd..07f96ac5d 100644
--- a/include/lapi/syscalls/mips_n64.in
+++ b/include/lapi/syscalls/mips_n64.in
@@ -345,3 +345,4 @@ faccessat2 5439
process_madvise 5440
epoll_pwait2 5441
mount_setattr 5442
+quotactl_fd 5443
diff --git a/include/lapi/syscalls/mips_o32.in b/include/lapi/syscalls/mips_o32.in
index 238f77009..5e64a4a1c 100644
--- a/include/lapi/syscalls/mips_o32.in
+++ b/include/lapi/syscalls/mips_o32.in
@@ -415,3 +415,4 @@ faccessat2 4439
process_madvise 4440
epoll_pwait2 4441
mount_setattr 4442
+quotactl_fd 4443
diff --git a/include/lapi/syscalls/powerpc.in b/include/lapi/syscalls/powerpc.in
index a4ed2169c..f4e85940c 100644
--- a/include/lapi/syscalls/powerpc.in
+++ b/include/lapi/syscalls/powerpc.in
@@ -421,3 +421,4 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in
index a4ed2169c..f4e85940c 100644
--- a/include/lapi/syscalls/powerpc64.in
+++ b/include/lapi/syscalls/powerpc64.in
@@ -421,3 +421,4 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/s390.in b/include/lapi/syscalls/s390.in
index d99e5fd9e..3e16d8475 100644
--- a/include/lapi/syscalls/s390.in
+++ b/include/lapi/syscalls/s390.in
@@ -408,3 +408,4 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/s390x.in b/include/lapi/syscalls/s390x.in
index f26cdaaae..beb0819af 100644
--- a/include/lapi/syscalls/s390x.in
+++ b/include/lapi/syscalls/s390x.in
@@ -356,3 +356,4 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/sh.in b/include/lapi/syscalls/sh.in
index 20ee61ccc..a81cf8297 100644
--- a/include/lapi/syscalls/sh.in
+++ b/include/lapi/syscalls/sh.in
@@ -402,3 +402,4 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/sparc.in b/include/lapi/syscalls/sparc.in
index 86decdd82..6a7817ae5 100644
--- a/include/lapi/syscalls/sparc.in
+++ b/include/lapi/syscalls/sparc.in
@@ -407,3 +407,4 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/sparc64.in b/include/lapi/syscalls/sparc64.in
index 02dfe473a..d3995181c 100644
--- a/include/lapi/syscalls/sparc64.in
+++ b/include/lapi/syscalls/sparc64.in
@@ -372,3 +372,4 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
diff --git a/include/lapi/syscalls/x86_64.in b/include/lapi/syscalls/x86_64.in
index cf6d78bf6..a5b2a24fe 100644
--- a/include/lapi/syscalls/x86_64.in
+++ b/include/lapi/syscalls/x86_64.in
@@ -349,6 +349,7 @@ close_range 436
openat2 437
pidfd_getfd 438
epoll_pwait2 441
+quotactl_fd 443
rt_sigaction 512
rt_sigreturn 513
ioctl 514
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 02/11] syscalls/quotactl06:Also test with vfsv1 format
2021-10-18 13:09 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06:Also " Yang Xu
@ 2021-10-20 8:51 ` xuyang2018.jy
2021-10-26 13:45 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06???Also " Cyril Hrubis
1 sibling, 0 replies; 15+ messages in thread
From: xuyang2018.jy @ 2021-10-20 8:51 UTC (permalink / raw)
To: ltp
Hi All
For this patch, vfsv0 and vfsv1 should have different limit when tesing
ERANGE error.
vfsv0: 2^42 bytes
vfsv11: 2^63 -1 bytes (Also sent a patch to man-pages) after kernel 4.1[1].
--- a/testcases/kernel/syscalls/quotactl/quotactl06.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
@@ -175,10 +175,12 @@ static void setup(void)
tst_res(TINFO, "quotactl() with vfsv1 format");
SAFE_CMD(vfsv1_cmd, NULL, NULL);
fmt_id = QFMT_VFS_V1;
+ set_dqmax.dqb_bsoftlimit = 0x20000000000000; //2^53 << 10
} else {
tst_res(TINFO, "quotactl() with vfsv0 format");
SAFE_CMD(vfsv0_cmd, NULL, NULL);
fmt_id = QFMT_VFS_V0;
+ set_dqmax.dqb_bsoftlimit = 0x100000000; // 2^32 << 10
}
if (access(USRPATH, F_OK) == -1)
Also for old kernel ie centos7 without patch[2], we can't meet ERANGE
error for vfsv1 format because it doesn't use block shift.
[1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=7e08da50cf
[2]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=14bf61ff
Best Regards
Yang Xu
> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com>
> ---
> .../kernel/syscalls/quotactl/quotactl06.c | 59 +++++++++++++++----
> 1 file changed, 46 insertions(+), 13 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c
> index a10d1ca07..f53f088d8 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl06.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
> @@ -1,26 +1,42 @@
> // SPDX-License-Identifier: GPL-2.0-or-later
> /*
> - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
> + * Copyright (c) 2019-2021 FUJITSU LIMITED. All rights reserved.
> * Author: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
> + */
> +
> +/*\
> + * [Description]
> + *
> + * Tests basic error handling of the quotactl syscall with visible quota files
> + * (cover two formats, vfsv0 and vfsv1):
> *
> - * Tests basic error handling of the quotactl syscall.
> * 1) quotactl fails with EACCES when cmd is Q_QUOTAON and addr
> * existed but not a regular file.
> + *
> * 2) quotaclt fails with ENOENT when the file specified by special
> * or addr does not exist.
> + *
> * 3) quotactl fails with EBUSTY when cmd is Q_QUOTAON and another
> * Q_QUOTAON had already been performed.
> + *
> * 4) quotactl fails with EFAULT when addr or special is invalid.
> + *
> * 5) quotactl fails with EINVAL when cmd or type is invalid.
> + *
> * 6) quotactl fails with ENOTBLK when special is not a block device.
> + *
> * 7) quotactl fails with ESRCH when no disk quota is found for the
> * indicated user and quotas have not been turned on for this fs.
> + *
> * 8) quotactl fails with ESRCH when cmd is Q_QUOTAON, but the quota
> * format was not found.
> + *
> * 9) quotactl fails with ESRCH when cmd is Q_GETNEXTQUOTA, but there
> * is no ID greater than or equal to id that has an active quota.
> + *
> * 10) quotactl fails with ERANGE when cmd is Q_SETQUOTA, but the
> * specified limits are out of the range allowed by the quota format.
> + *
> * 11) quotactl fails with EPERM when the caller lacked the required
> * privilege (CAP_SYS_ADMIN) for the specified operation.
> */
> @@ -32,10 +48,7 @@
> #include "tst_capability.h"
>
> #define OPTION_INVALID 999
> -#define QFMT_VFS_V0 2
> #define USRPATH MNTPOINT "/aquota.user"
> -#define FMTID QFMT_VFS_V0
> -
> #define MNTPOINT "mntpoint"
> #define TESTDIR1 MNTPOINT "/testdir1"
> #define TESTDIR2 MNTPOINT "/testdir2"
> @@ -43,10 +56,10 @@
> static char usrpath[] = USRPATH;
> static char testdir1[] = TESTDIR1;
> static char testdir2[] = TESTDIR2;
> -static int32_t fmt_id = FMTID;
> +static int32_t fmt_id;
> static int32_t fmt_invalid = 999;
> static int test_invalid;
> -static int test_id;
> +static int test_id, mount_flag;
> static int getnextquota_nsup;
>
> static struct if_nextdqblk res_ndq;
> @@ -105,7 +118,7 @@ static void verify_quotactl(unsigned int n)
>
> if (tc->on_flag) {
> TEST(quotactl(QCMD(Q_QUOTAON, USRQUOTA), tst_device->dev,
> - FMTID, usrpath));
> + fmt_id, usrpath));
> if (TST_RET == -1)
> tst_brk(TBROK,
> "quotactl with Q_QUOTAON returned %ld", TST_RET);
> @@ -135,7 +148,7 @@ static void verify_quotactl(unsigned int n)
>
> if (quota_on) {
> TEST(quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), tst_device->dev,
> - FMTID, usrpath));
> + fmt_id, usrpath));
> if (TST_RET == -1)
> tst_brk(TBROK,
> "quotactl with Q_QUOTAOFF returned %ld", TST_RET);
> @@ -150,10 +163,23 @@ static void verify_quotactl(unsigned int n)
>
> static void setup(void)
> {
> - const char *const cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
> + const char *const vfsv0_cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
> + const char *const vfsv1_cmd[] = {"quotacheck", "-uF", "vfsv1", MNTPOINT, NULL};
> unsigned int i;
>
> - SAFE_CMD(cmd, NULL, NULL);
> + SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
> + SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "usrquota");
> + mount_flag = 1;
> +
> + if (tst_variant) {
> + tst_res(TINFO, "quotactl() with vfsv1 format");
> + SAFE_CMD(vfsv1_cmd, NULL, NULL);
> + fmt_id = QFMT_VFS_V1;
> + } else {
> + tst_res(TINFO, "quotactl() with vfsv0 format");
> + SAFE_CMD(vfsv0_cmd, NULL, NULL);
> + fmt_id = QFMT_VFS_V0;
> + }
>
> if (access(USRPATH, F_OK) == -1)
> tst_brk(TFAIL | TERRNO, "user quotafile didn't exist");
> @@ -175,8 +201,15 @@ static void setup(void)
> }
> }
>
> +static void cleanup(void)
> +{
> + if (mount_flag&& tst_umount(MNTPOINT))
> + tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
> +}
> +
> static struct tst_test test = {
> .setup = setup,
> + .cleanup = cleanup,
> .needs_kconfigs = (const char *[]) {
> "CONFIG_QFMT_V2",
> NULL
> @@ -185,11 +218,11 @@ static struct tst_test test = {
> .test = verify_quotactl,
> .dev_fs_type = "ext4",
> .mntpoint = MNTPOINT,
> - .mount_device = 1,
> - .mnt_data = "usrquota",
> + .needs_device = 1,
> .needs_cmds = (const char *const []) {
> "quotacheck",
> NULL
> },
> .needs_root = 1,
> + .test_variants = 2,
> };
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format
2021-10-18 13:09 [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Yang Xu
` (3 preceding siblings ...)
2021-10-18 13:09 ` [LTP] [PATCH v1 05/11] lapi/syscalls: Add syscall number for quotactl_fd Yang Xu
@ 2021-10-26 13:36 ` Cyril Hrubis
2021-10-27 2:46 ` xuyang2018.jy
4 siblings, 1 reply; 15+ messages in thread
From: Cyril Hrubis @ 2021-10-26 13:36 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
> +/*\
> + * [Description]
> + * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems
^
ext4?
It seems that the test is using ext4 only, are there any other
filesystems that should be tested here?
> + * with visible quota files(cover two formats, vfsv0 and vfsv1):
> *
> - * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems:
> * 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for user.
> - * 2) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
> + *
> + * 2 quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
> * for user.
> + *
> * 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
> * for user.
> + *
> * 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
> * flag for user.
> + *
> * 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
> * flag for user.
> + *
> * 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for user.
> + *
> * 7) quotactl(2) succeeds to update quota usages with Q_SYNC flag for user.
> + *
> * 8) quotactl(2) succeeds to get disk quota limit greater than or equal to
> * ID with Q_GETNEXTQUOTA flag for user.
> + *
> * 9) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for user.
> + *
> * 10) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for group.
> + *
> * 11) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
> * for group.
> + *
> * 12) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
> * for group.
> + *
> * 13) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
> * flag for group.
> + *
> * 14) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
> * flag for group.
> + *
> * 15) quotactl(2) succeeds to get quota format with Q_GETFMT flag for group.
> + *
> * 16) quotactl(2) succeeds to update quota usages with Q_SYNC flag for group.
> + *
> * 17) quotactl(2) succeeds to get disk quota limit greater than or equal to
> * ID with Q_GETNEXTQUOTA flag for group.
> + *
> * 18) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for group.
> */
This does not render as a list in asciidoc once the documentation is
rendered. I would have converted it to a bulleted style lists, i.e. the
list items would start with - instead of 1).
Also it's a bit poinless to repeat the quotactl(2) succeeds on each
line. It would make much more sense to put that part to the sentence
that describes the list as:
* This testcases checks that quotactl(2) succeeds to:
*
* - turn on quota with Q_QUOTAON flag
* - ...
> @@ -43,16 +66,12 @@
> #include "lapi/quotactl.h"
> #include "tst_test.h"
>
> -#ifndef QFMT_VFS_V0
> -# define QFMT_VFS_V0 2
> -#endif
> #define USRPATH MNTPOINT "/aquota.user"
> #define GRPPATH MNTPOINT "/aquota.group"
> -#define FMTID QFMT_VFS_V0
> #define MNTPOINT "mntpoint"
>
> -static int32_t fmt_id = FMTID;
> -static int test_id;
> +static int32_t fmt_id;
> +static int test_id, mount_flag;
> static char usrpath[] = USRPATH;
> static char grppath[] = GRPPATH;
> static struct dqblk set_dq = {
> @@ -163,9 +182,22 @@ static struct tcase {
>
> static void setup(void)
> {
> - const char *const cmd[] = {"quotacheck", "-ugF", "vfsv0", MNTPOINT, NULL};
> -
> - SAFE_CMD(cmd, NULL, NULL);
> + const char *const vfsv0_cmd[] = {"quotacheck", "-ugF", "vfsv0", MNTPOINT, NULL};
> + const char *const vfsv1_cmd[] = {"quotacheck", "-ugF", "vfsv1", MNTPOINT, NULL};
> +
> + SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
> + SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "usrquota,grpquota");
> + mount_flag = 1;
Why are you moving the mount from the tst_test structure here?
Do we have to remount the device to change the quota format?
> + if (tst_variant) {
> + tst_res(TINFO, "quotactl() with vfsv1 format");
> + SAFE_CMD(vfsv1_cmd, NULL, NULL);
> + fmt_id = QFMT_VFS_V1;
> + } else {
> + tst_res(TINFO, "quotactl() with vfsv0 format");
> + SAFE_CMD(vfsv0_cmd, NULL, NULL);
> + fmt_id = QFMT_VFS_V0;
> + }
>
> test_id = geteuid();
> if (access(USRPATH, F_OK) == -1)
> @@ -182,6 +214,12 @@ static void setup(void)
> getnextquota_nsup = 1;
> }
>
> +static void cleanup(void)
> +{
> + if (mount_flag && tst_umount(MNTPOINT))
> + tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
> +}
> +
> static void verify_quota(unsigned int n)
> {
> struct tcase *tc = &tcases[n];
> @@ -222,13 +260,14 @@ static struct tst_test test = {
> },
> .test = verify_quota,
> .tcnt = ARRAY_SIZE(tcases),
> - .mount_device = 1,
> + .needs_device = 1,
> .dev_fs_type = "ext4",
> .mntpoint = MNTPOINT,
> - .mnt_data = "usrquota,grpquota",
> .needs_cmds = (const char *const []) {
> "quotacheck",
> NULL
> },
> .setup = setup,
> + .cleanup = cleanup,
> + .test_variants = 2,
> };
> --
> 2.23.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 02/11] syscalls/quotactl06???Also test with vfsv1 format
2021-10-18 13:09 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06:Also " Yang Xu
2021-10-20 8:51 ` xuyang2018.jy
@ 2021-10-26 13:45 ` Cyril Hrubis
2021-10-27 2:50 ` xuyang2018.jy
1 sibling, 1 reply; 15+ messages in thread
From: Cyril Hrubis @ 2021-10-26 13:45 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Hi!
> --- a/testcases/kernel/syscalls/quotactl/quotactl06.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
> @@ -1,26 +1,42 @@
> // SPDX-License-Identifier: GPL-2.0-or-later
> /*
> - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
> + * Copyright (c) 2019-2021 FUJITSU LIMITED. All rights reserved.
> * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> + */
> +
> +/*\
> + * [Description]
> + *
> + * Tests basic error handling of the quotactl syscall with visible quota files
> + * (cover two formats, vfsv0 and vfsv1):
> *
> - * Tests basic error handling of the quotactl syscall.
> * 1) quotactl fails with EACCES when cmd is Q_QUOTAON and addr
> * existed but not a regular file.
> + *
> * 2) quotaclt fails with ENOENT when the file specified by special
> * or addr does not exist.
> + *
> * 3) quotactl fails with EBUSTY when cmd is Q_QUOTAON and another
> * Q_QUOTAON had already been performed.
> + *
> * 4) quotactl fails with EFAULT when addr or special is invalid.
> + *
> * 5) quotactl fails with EINVAL when cmd or type is invalid.
> + *
> * 6) quotactl fails with ENOTBLK when special is not a block device.
> + *
> * 7) quotactl fails with ESRCH when no disk quota is found for the
> * indicated user and quotas have not been turned on for this fs.
> + *
> * 8) quotactl fails with ESRCH when cmd is Q_QUOTAON, but the quota
> * format was not found.
> + *
> * 9) quotactl fails with ESRCH when cmd is Q_GETNEXTQUOTA, but there
> * is no ID greater than or equal to id that has an active quota.
> + *
> * 10) quotactl fails with ERANGE when cmd is Q_SETQUOTA, but the
> * specified limits are out of the range allowed by the quota format.
> + *
> * 11) quotactl fails with EPERM when the caller lacked the required
> * privilege (CAP_SYS_ADMIN) for the specified operation.
> */
Same comments apply here as well.
> @@ -32,10 +48,7 @@
> #include "tst_capability.h"
>
> #define OPTION_INVALID 999
> -#define QFMT_VFS_V0 2
> #define USRPATH MNTPOINT "/aquota.user"
> -#define FMTID QFMT_VFS_V0
> -
> #define MNTPOINT "mntpoint"
> #define TESTDIR1 MNTPOINT "/testdir1"
> #define TESTDIR2 MNTPOINT "/testdir2"
> @@ -43,10 +56,10 @@
> static char usrpath[] = USRPATH;
> static char testdir1[] = TESTDIR1;
> static char testdir2[] = TESTDIR2;
> -static int32_t fmt_id = FMTID;
> +static int32_t fmt_id;
> static int32_t fmt_invalid = 999;
> static int test_invalid;
> -static int test_id;
> +static int test_id, mount_flag;
> static int getnextquota_nsup;
>
> static struct if_nextdqblk res_ndq;
> @@ -105,7 +118,7 @@ static void verify_quotactl(unsigned int n)
>
> if (tc->on_flag) {
> TEST(quotactl(QCMD(Q_QUOTAON, USRQUOTA), tst_device->dev,
> - FMTID, usrpath));
> + fmt_id, usrpath));
> if (TST_RET == -1)
> tst_brk(TBROK,
> "quotactl with Q_QUOTAON returned %ld", TST_RET);
> @@ -135,7 +148,7 @@ static void verify_quotactl(unsigned int n)
>
> if (quota_on) {
> TEST(quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), tst_device->dev,
> - FMTID, usrpath));
> + fmt_id, usrpath));
> if (TST_RET == -1)
> tst_brk(TBROK,
> "quotactl with Q_QUOTAOFF returned %ld", TST_RET);
> @@ -150,10 +163,23 @@ static void verify_quotactl(unsigned int n)
>
> static void setup(void)
> {
> - const char *const cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
> + const char *const vfsv0_cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
> + const char *const vfsv1_cmd[] = {"quotacheck", "-uF", "vfsv1", MNTPOINT, NULL};
If we are going to repeat this snippet in each test it may make sense to
put it into a header as we do with variants:
static struct quotactl_variant {
int32_t fmt_id;
const char *fmt_name;
} variants[] = {
{.fmt_id = QFMT_VFS_V0, .fmt_name = "vfsv0"}
{.fmt_id = QFMT_VFS_V1, .fmt_name = "vfsv1"}
};
Then we can construct the rest easily from these as:
const char *const cmd[] = {"quotacheck", "-uF", variants[variant].fmt_name, MNTPOINT, NULL};
tst_res(TINFO, "quotactl() with %s format", variants[variant].fmt_name);
SAFE_CMD(cmd, NULL, NULL);
fmt_id = variants[variant].fmt_id;
> unsigned int i;
>
> - SAFE_CMD(cmd, NULL, NULL);
> + SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
> + SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "usrquota");
> + mount_flag = 1;
> +
> + if (tst_variant) {
> + tst_res(TINFO, "quotactl() with vfsv1 format");
> + SAFE_CMD(vfsv1_cmd, NULL, NULL);
> + fmt_id = QFMT_VFS_V1;
> + } else {
> + tst_res(TINFO, "quotactl() with vfsv0 format");
> + SAFE_CMD(vfsv0_cmd, NULL, NULL);
> + fmt_id = QFMT_VFS_V0;
> + }
>
> if (access(USRPATH, F_OK) == -1)
> tst_brk(TFAIL | TERRNO, "user quotafile didn't exist");
> @@ -175,8 +201,15 @@ static void setup(void)
> }
> }
>
> +static void cleanup(void)
> +{
> + if (mount_flag && tst_umount(MNTPOINT))
> + tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
> +}
> +
> static struct tst_test test = {
> .setup = setup,
> + .cleanup = cleanup,
> .needs_kconfigs = (const char *[]) {
> "CONFIG_QFMT_V2",
> NULL
> @@ -185,11 +218,11 @@ static struct tst_test test = {
> .test = verify_quotactl,
> .dev_fs_type = "ext4",
> .mntpoint = MNTPOINT,
> - .mount_device = 1,
> - .mnt_data = "usrquota",
> + .needs_device = 1,
> .needs_cmds = (const char *const []) {
> "quotacheck",
> NULL
> },
> .needs_root = 1,
> + .test_variants = 2,
> };
> --
> 2.23.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 03/11] syscalls/quotactl04: Remove useless quotactl mount options
2021-10-18 13:09 ` [LTP] [PATCH v1 03/11] syscalls/quotactl04: Remove useless quotactl mount options Yang Xu
@ 2021-10-26 14:03 ` Cyril Hrubis
2021-10-27 2:52 ` xuyang2018.jy
0 siblings, 1 reply; 15+ messages in thread
From: Cyril Hrubis @ 2021-10-26 14:03 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Hi!
> When use -O quota options for mkfs.ext4, quota mount option
> will be ignored[1]. So remove it.
>
> Also add docparse formatting.
>
> [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7c319d3
>
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
> testcases/kernel/syscalls/quotactl/quotactl04.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
> index fd3afc888..ca6a94263 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl04.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
> @@ -2,22 +2,33 @@
> /*
> * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
> * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> + */
> +
> +/*\
> + * [Description]
> *
> * This testcase checks the basic flag of quotactl(2) for project quota on
> * non-XFS filesystems.
> *
> * 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for project.
> + *
> * 2) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
> * for project.
> + *
> * 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
> * for project.
> + *
> * 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
> * flag for project.
> + *
> * 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
> * flag for project.
> + *
> * 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for project.
> + *
> * 7) quotactl(2) succeeds to get disk quota limit greater than or equal to
> * ID with Q_GETNEXTQUOTA flag for project.
> + *
> * 8) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for project.
> *
> * Minimum e2fsprogs version required is 1.43.
Here as well, the list should be changed to render properly in
asciidoc.
> @@ -34,10 +45,6 @@
> #include "tst_safe_stdio.h"
> #include "tst_test.h"
>
> -#ifndef QFMT_VFS_V1
> -# define QFMT_VFS_V1 4
> -#endif
> -
> #define FMTID QFMT_VFS_V1
> #define MNTPOINT "mntpoint"
> static int32_t fmt_id = FMTID;
> @@ -141,7 +148,7 @@ static void setup(void)
> tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for quota,project option, test skipped");
> pclose(f);
> SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
> - do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "quota");
> + do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
> }
>
> static void cleanup(void)
> --
> 2.23.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 04/11] syscalls/quotactl[3, 5, 7]: Add docparse formatting
2021-10-18 13:09 ` [LTP] [PATCH v1 04/11] syscalls/quotactl[3, 5, 7]: Add docparse formatting Yang Xu
@ 2021-10-26 14:05 ` Cyril Hrubis
2021-10-27 2:54 ` xuyang2018.jy
0 siblings, 1 reply; 15+ messages in thread
From: Cyril Hrubis @ 2021-10-26 14:05 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Hi!
> -/*
> - * Test Name: quotactl03
> +/*\
> + * [Description]
> *
> - * Description:
> * quotactl(2) with XGETNEXTQUOTA looks for the next active quota for an user
> * equal or higher to a given ID, in this test the ID is specified to a value
> * close to UINT_MAX(max value of unsigned int). When reaching the upper limit
> @@ -16,11 +15,11 @@
> *
> * This kernel bug of xfs has been fixed in:
> *
> - * commit 657bdfb7f5e68ca5e2ed009ab473c429b0d6af85
> - * Author: Eric Sandeen <sandeen@redhat.com>
> - * Date: Tue Jan 17 11:43:38 2017 -0800
> + * commit 657bdfb7f5e68ca5e2ed009ab473c429b0d6af85
> + * Author: Eric Sandeen <sandeen@redhat.com>
> + * Date: Tue Jan 17 11:43:38 2017 -0800
> *
> - * xfs: don't wrap ID in xfs_dq_get_next_id
> + * xfs: don't wrap ID in xfs_dq_get_next_id
The commit hash of this fix should also go into the tags in the tst_test
structure.
> */
>
> #define _GNU_SOURCE
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl05.c b/testcases/kernel/syscalls/quotactl/quotactl05.c
> index e811e47a4..fbc7f5924 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl05.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl05.c
> @@ -2,19 +2,28 @@
> /*
> * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
> * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> + */
> +
> +/*\
> + * [Description]
> + *
> + * This testcase checks basic flags of quotactl(2) for project on an XFS filesystem:
> *
> - * This testcase checks basic flags of quotactl(2) for project on an XFS file
> - * system:
> * 1) quotactl(2) succeeds to turn off xfs quota and get xfs quota off status
> * for project.
> + *
> * 2) quotactl(2) succeeds to turn on xfs quota and get xfs quota on status
> * for project.
> + *
> * 3) quotactl(2) succeeds to set and use Q_XGETQUOTA to get xfs disk quota
> * limits for project.
> + *
> * 4) quotactl(2) succeeds to set and use Q_XGETNEXTQUOTA to get xfs disk
> * quota limits Cgreater than or equal to ID for project.
> + *
> * 5) quotactl(2) succeeds to turn off xfs quota and get xfs quota off statv
> * for project.
> + *
> * 6) quotactl(2) succeeds to turn on xfs quota and get xfs quota on statv
> * for project.
> */
Here as well, the list should be fixed to render as a list.
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c
> index db477589b..a55416f0e 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl07.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl07.c
> @@ -2,6 +2,10 @@
> /*
> * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
> * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> + */
> +
> +/*\
> + * [Description]
> *
> * This is a regresstion test for kernel commit 3dd4d40b4208
> * ("xfs: Sanity check flags of Q_XQUOTARM call").
> --
> 2.23.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 05/11] lapi/syscalls: Add syscall number for quotactl_fd
2021-10-18 13:09 ` [LTP] [PATCH v1 05/11] lapi/syscalls: Add syscall number for quotactl_fd Yang Xu
@ 2021-10-26 14:09 ` Cyril Hrubis
0 siblings, 0 replies; 15+ messages in thread
From: Cyril Hrubis @ 2021-10-26 14:09 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format
2021-10-26 13:36 ` [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Cyril Hrubis
@ 2021-10-27 2:46 ` xuyang2018.jy
0 siblings, 0 replies; 15+ messages in thread
From: xuyang2018.jy @ 2021-10-27 2:46 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
HI Cyril
>> +/*\
>> + * [Description]
>> + * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems
> ^
> ext4?
>
> It seems that the test is using ext4 only, are there any other
> filesystems that should be tested here?
Yes, Good catch. I will test other filesystem.
>
>> + * with visible quota files(cover two formats, vfsv0 and vfsv1):
>> *
>> - * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems:
>> * 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for user.
>> - * 2) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
>> + *
>> + * 2 quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
>> * for user.
>> + *
>> * 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
>> * for user.
>> + *
>> * 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
>> * flag for user.
>> + *
>> * 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
>> * flag for user.
>> + *
>> * 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for user.
>> + *
>> * 7) quotactl(2) succeeds to update quota usages with Q_SYNC flag for user.
>> + *
>> * 8) quotactl(2) succeeds to get disk quota limit greater than or equal to
>> * ID with Q_GETNEXTQUOTA flag for user.
>> + *
>> * 9) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for user.
>> + *
>> * 10) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for group.
>> + *
>> * 11) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
>> * for group.
>> + *
>> * 12) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
>> * for group.
>> + *
>> * 13) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
>> * flag for group.
>> + *
>> * 14) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
>> * flag for group.
>> + *
>> * 15) quotactl(2) succeeds to get quota format with Q_GETFMT flag for group.
>> + *
>> * 16) quotactl(2) succeeds to update quota usages with Q_SYNC flag for group.
>> + *
>> * 17) quotactl(2) succeeds to get disk quota limit greater than or equal to
>> * ID with Q_GETNEXTQUOTA flag for group.
>> + *
>> * 18) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for group.
>> */
>
> This does not render as a list in asciidoc once the documentation is
> rendered. I would have converted it to a bulleted style lists, i.e. the
> list items would start with - instead of 1).
>
> Also it's a bit poinless to repeat the quotactl(2) succeeds on each
> line. It would make much more sense to put that part to the sentence
> that describes the list as:
>
> * This testcases checks that quotactl(2) succeeds to:
> *
> * - turn on quota with Q_QUOTAON flag
> * - ...
Ok, got it.
>
>> @@ -43,16 +66,12 @@
>> #include "lapi/quotactl.h"
>> #include "tst_test.h"
>>
>> -#ifndef QFMT_VFS_V0
>> -# define QFMT_VFS_V0 2
>> -#endif
>> #define USRPATH MNTPOINT "/aquota.user"
>> #define GRPPATH MNTPOINT "/aquota.group"
>> -#define FMTID QFMT_VFS_V0
>> #define MNTPOINT "mntpoint"
>>
>> -static int32_t fmt_id = FMTID;
>> -static int test_id;
>> +static int32_t fmt_id;
>> +static int test_id, mount_flag;
>> static char usrpath[] = USRPATH;
>> static char grppath[] = GRPPATH;
>> static struct dqblk set_dq = {
>> @@ -163,9 +182,22 @@ static struct tcase {
>>
>> static void setup(void)
>> {
>> - const char *const cmd[] = {"quotacheck", "-ugF", "vfsv0", MNTPOINT, NULL};
>> -
>> - SAFE_CMD(cmd, NULL, NULL);
>> + const char *const vfsv0_cmd[] = {"quotacheck", "-ugF", "vfsv0", MNTPOINT, NULL};
>> + const char *const vfsv1_cmd[] = {"quotacheck", "-ugF", "vfsv1", MNTPOINT, NULL};
>> +
>> + SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
>> + SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "usrquota,grpquota");
>> + mount_flag = 1;
>
> Why are you moving the mount from the tst_test structure here?
>
> Do we have to remount the device to change the quota format?
I think we don't need to remount the device and we can remove quota file
directly to change the quota format. Thanks.
Best Regards
Yang Xu
>
>> + if (tst_variant) {
>> + tst_res(TINFO, "quotactl() with vfsv1 format");
>> + SAFE_CMD(vfsv1_cmd, NULL, NULL);
>> + fmt_id = QFMT_VFS_V1;
>> + } else {
>> + tst_res(TINFO, "quotactl() with vfsv0 format");
>> + SAFE_CMD(vfsv0_cmd, NULL, NULL);
>> + fmt_id = QFMT_VFS_V0;
>> + }
>>
>> test_id = geteuid();
>> if (access(USRPATH, F_OK) == -1)
>> @@ -182,6 +214,12 @@ static void setup(void)
>> getnextquota_nsup = 1;
>> }
>>
>> +static void cleanup(void)
>> +{
>> + if (mount_flag&& tst_umount(MNTPOINT))
>> + tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
>> +}
>> +
>> static void verify_quota(unsigned int n)
>> {
>> struct tcase *tc =&tcases[n];
>> @@ -222,13 +260,14 @@ static struct tst_test test = {
>> },
>> .test = verify_quota,
>> .tcnt = ARRAY_SIZE(tcases),
>> - .mount_device = 1,
>> + .needs_device = 1,
>> .dev_fs_type = "ext4",
>> .mntpoint = MNTPOINT,
>> - .mnt_data = "usrquota,grpquota",
>> .needs_cmds = (const char *const []) {
>> "quotacheck",
>> NULL
>> },
>> .setup = setup,
>> + .cleanup = cleanup,
>> + .test_variants = 2,
>> };
>> --
>> 2.23.0
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 02/11] syscalls/quotactl06???Also test with vfsv1 format
2021-10-26 13:45 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06???Also " Cyril Hrubis
@ 2021-10-27 2:50 ` xuyang2018.jy
0 siblings, 0 replies; 15+ messages in thread
From: xuyang2018.jy @ 2021-10-27 2:50 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
Hi Cyril
> Hi!
>> --- a/testcases/kernel/syscalls/quotactl/quotactl06.c
>> +++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
>> @@ -1,26 +1,42 @@
>> // SPDX-License-Identifier: GPL-2.0-or-later
>> /*
>> - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
>> + * Copyright (c) 2019-2021 FUJITSU LIMITED. All rights reserved.
>> * Author: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
>> + */
>> +
>> +/*\
>> + * [Description]
>> + *
>> + * Tests basic error handling of the quotactl syscall with visible quota files
>> + * (cover two formats, vfsv0 and vfsv1):
>> *
>> - * Tests basic error handling of the quotactl syscall.
>> * 1) quotactl fails with EACCES when cmd is Q_QUOTAON and addr
>> * existed but not a regular file.
>> + *
>> * 2) quotaclt fails with ENOENT when the file specified by special
>> * or addr does not exist.
>> + *
>> * 3) quotactl fails with EBUSTY when cmd is Q_QUOTAON and another
>> * Q_QUOTAON had already been performed.
>> + *
>> * 4) quotactl fails with EFAULT when addr or special is invalid.
>> + *
>> * 5) quotactl fails with EINVAL when cmd or type is invalid.
>> + *
>> * 6) quotactl fails with ENOTBLK when special is not a block device.
>> + *
>> * 7) quotactl fails with ESRCH when no disk quota is found for the
>> * indicated user and quotas have not been turned on for this fs.
>> + *
>> * 8) quotactl fails with ESRCH when cmd is Q_QUOTAON, but the quota
>> * format was not found.
>> + *
>> * 9) quotactl fails with ESRCH when cmd is Q_GETNEXTQUOTA, but there
>> * is no ID greater than or equal to id that has an active quota.
>> + *
>> * 10) quotactl fails with ERANGE when cmd is Q_SETQUOTA, but the
>> * specified limits are out of the range allowed by the quota format.
>> + *
>> * 11) quotactl fails with EPERM when the caller lacked the required
>> * privilege (CAP_SYS_ADMIN) for the specified operation.
>> */
>
> Same comments apply here as well.
Got it.
>> @@ -32,10 +48,7 @@
>> #include "tst_capability.h"
>>
>> #define OPTION_INVALID 999
>> -#define QFMT_VFS_V0 2
>> #define USRPATH MNTPOINT "/aquota.user"
>> -#define FMTID QFMT_VFS_V0
>> -
>> #define MNTPOINT "mntpoint"
>> #define TESTDIR1 MNTPOINT "/testdir1"
>> #define TESTDIR2 MNTPOINT "/testdir2"
>> @@ -43,10 +56,10 @@
>> static char usrpath[] = USRPATH;
>> static char testdir1[] = TESTDIR1;
>> static char testdir2[] = TESTDIR2;
>> -static int32_t fmt_id = FMTID;
>> +static int32_t fmt_id;
>> static int32_t fmt_invalid = 999;
>> static int test_invalid;
>> -static int test_id;
>> +static int test_id, mount_flag;
>> static int getnextquota_nsup;
>>
>> static struct if_nextdqblk res_ndq;
>> @@ -105,7 +118,7 @@ static void verify_quotactl(unsigned int n)
>>
>> if (tc->on_flag) {
>> TEST(quotactl(QCMD(Q_QUOTAON, USRQUOTA), tst_device->dev,
>> - FMTID, usrpath));
>> + fmt_id, usrpath));
>> if (TST_RET == -1)
>> tst_brk(TBROK,
>> "quotactl with Q_QUOTAON returned %ld", TST_RET);
>> @@ -135,7 +148,7 @@ static void verify_quotactl(unsigned int n)
>>
>> if (quota_on) {
>> TEST(quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), tst_device->dev,
>> - FMTID, usrpath));
>> + fmt_id, usrpath));
>> if (TST_RET == -1)
>> tst_brk(TBROK,
>> "quotactl with Q_QUOTAOFF returned %ld", TST_RET);
>> @@ -150,10 +163,23 @@ static void verify_quotactl(unsigned int n)
>>
>> static void setup(void)
>> {
>> - const char *const cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
>> + const char *const vfsv0_cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
>> + const char *const vfsv1_cmd[] = {"quotacheck", "-uF", "vfsv1", MNTPOINT, NULL};
>
> If we are going to repeat this snippet in each test it may make sense to
> put it into a header as we do with variants:
>
> static struct quotactl_variant {
> int32_t fmt_id;
> const char *fmt_name;
> } variants[] = {
> {.fmt_id = QFMT_VFS_V0, .fmt_name = "vfsv0"}
> {.fmt_id = QFMT_VFS_V1, .fmt_name = "vfsv1"}
> };
>
> Then we can construct the rest easily from these as:
>
> const char *const cmd[] = {"quotacheck", "-uF", variants[variant].fmt_name, MNTPOINT, NULL};
>
> tst_res(TINFO, "quotactl() with %s format", variants[variant].fmt_name);
>
> SAFE_CMD(cmd, NULL, NULL);
> fmt_id = variants[variant].fmt_id;
Sounds great.
Best Regards
Yang Xu
>
>
>> unsigned int i;
>>
>> - SAFE_CMD(cmd, NULL, NULL);
>> + SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
>> + SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "usrquota");
>> + mount_flag = 1;
>> +
>> + if (tst_variant) {
>> + tst_res(TINFO, "quotactl() with vfsv1 format");
>> + SAFE_CMD(vfsv1_cmd, NULL, NULL);
>> + fmt_id = QFMT_VFS_V1;
>> + } else {
>> + tst_res(TINFO, "quotactl() with vfsv0 format");
>> + SAFE_CMD(vfsv0_cmd, NULL, NULL);
>> + fmt_id = QFMT_VFS_V0;
>> + }
>>
>> if (access(USRPATH, F_OK) == -1)
>> tst_brk(TFAIL | TERRNO, "user quotafile didn't exist");
>> @@ -175,8 +201,15 @@ static void setup(void)
>> }
>> }
>>
>> +static void cleanup(void)
>> +{
>> + if (mount_flag&& tst_umount(MNTPOINT))
>> + tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
>> +}
>> +
>> static struct tst_test test = {
>> .setup = setup,
>> + .cleanup = cleanup,
>> .needs_kconfigs = (const char *[]) {
>> "CONFIG_QFMT_V2",
>> NULL
>> @@ -185,11 +218,11 @@ static struct tst_test test = {
>> .test = verify_quotactl,
>> .dev_fs_type = "ext4",
>> .mntpoint = MNTPOINT,
>> - .mount_device = 1,
>> - .mnt_data = "usrquota",
>> + .needs_device = 1,
>> .needs_cmds = (const char *const []) {
>> "quotacheck",
>> NULL
>> },
>> .needs_root = 1,
>> + .test_variants = 2,
>> };
>> --
>> 2.23.0
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 03/11] syscalls/quotactl04: Remove useless quotactl mount options
2021-10-26 14:03 ` Cyril Hrubis
@ 2021-10-27 2:52 ` xuyang2018.jy
0 siblings, 0 replies; 15+ messages in thread
From: xuyang2018.jy @ 2021-10-27 2:52 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
Hi Cyril
> Hi!
>> When use -O quota options for mkfs.ext4, quota mount option
>> will be ignored[1]. So remove it.
>>
>> Also add docparse formatting.
>>
>> [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7c319d3
>>
>> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com>
>> ---
>> testcases/kernel/syscalls/quotactl/quotactl04.c | 17 ++++++++++++-----
>> 1 file changed, 12 insertions(+), 5 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
>> index fd3afc888..ca6a94263 100644
>> --- a/testcases/kernel/syscalls/quotactl/quotactl04.c
>> +++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
>> @@ -2,22 +2,33 @@
>> /*
>> * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
>> * Author: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
>> + */
>> +
>> +/*\
>> + * [Description]
>> *
>> * This testcase checks the basic flag of quotactl(2) for project quota on
>> * non-XFS filesystems.
>> *
>> * 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for project.
>> + *
>> * 2) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
>> * for project.
>> + *
>> * 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
>> * for project.
>> + *
>> * 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
>> * flag for project.
>> + *
>> * 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
>> * flag for project.
>> + *
>> * 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for project.
>> + *
>> * 7) quotactl(2) succeeds to get disk quota limit greater than or equal to
>> * ID with Q_GETNEXTQUOTA flag for project.
>> + *
>> * 8) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for project.
>> *
>> * Minimum e2fsprogs version required is 1.43.
>
> Here as well, the list should be changed to render properly in
> asciidoc.
Ok.
Best Regards
Yang Xu
>
>> @@ -34,10 +45,6 @@
>> #include "tst_safe_stdio.h"
>> #include "tst_test.h"
>>
>> -#ifndef QFMT_VFS_V1
>> -# define QFMT_VFS_V1 4
>> -#endif
>> -
>> #define FMTID QFMT_VFS_V1
>> #define MNTPOINT "mntpoint"
>> static int32_t fmt_id = FMTID;
>> @@ -141,7 +148,7 @@ static void setup(void)
>> tst_brk(TCONF, "Test needs mkfs.ext4>= 1.43 for quota,project option, test skipped");
>> pclose(f);
>> SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
>> - do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "quota");
>> + do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
>> }
>>
>> static void cleanup(void)
>> --
>> 2.23.0
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 04/11] syscalls/quotactl[3, 5, 7]: Add docparse formatting
2021-10-26 14:05 ` Cyril Hrubis
@ 2021-10-27 2:54 ` xuyang2018.jy
0 siblings, 0 replies; 15+ messages in thread
From: xuyang2018.jy @ 2021-10-27 2:54 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
Hi Cyril
> Hi!
>> -/*
>> - * Test Name: quotactl03
>> +/*\
>> + * [Description]
>> *
>> - * Description:
>> * quotactl(2) with XGETNEXTQUOTA looks for the next active quota for an user
>> * equal or higher to a given ID, in this test the ID is specified to a value
>> * close to UINT_MAX(max value of unsigned int). When reaching the upper limit
>> @@ -16,11 +15,11 @@
>> *
>> * This kernel bug of xfs has been fixed in:
>> *
>> - * commit 657bdfb7f5e68ca5e2ed009ab473c429b0d6af85
>> - * Author: Eric Sandeen<sandeen@redhat.com>
>> - * Date: Tue Jan 17 11:43:38 2017 -0800
>> + * commit 657bdfb7f5e68ca5e2ed009ab473c429b0d6af85
>> + * Author: Eric Sandeen<sandeen@redhat.com>
>> + * Date: Tue Jan 17 11:43:38 2017 -0800
>> *
>> - * xfs: don't wrap ID in xfs_dq_get_next_id
>> + * xfs: don't wrap ID in xfs_dq_get_next_id
>
> The commit hash of this fix should also go into the tags in the tst_test
> structure.
Oh, yes.
>
>> */
>>
>> #define _GNU_SOURCE
>> diff --git a/testcases/kernel/syscalls/quotactl/quotactl05.c b/testcases/kernel/syscalls/quotactl/quotactl05.c
>> index e811e47a4..fbc7f5924 100644
>> --- a/testcases/kernel/syscalls/quotactl/quotactl05.c
>> +++ b/testcases/kernel/syscalls/quotactl/quotactl05.c
>> @@ -2,19 +2,28 @@
>> /*
>> * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
>> * Author: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
>> + */
>> +
>> +/*\
>> + * [Description]
>> + *
>> + * This testcase checks basic flags of quotactl(2) for project on an XFS filesystem:
>> *
>> - * This testcase checks basic flags of quotactl(2) for project on an XFS file
>> - * system:
>> * 1) quotactl(2) succeeds to turn off xfs quota and get xfs quota off status
>> * for project.
>> + *
>> * 2) quotactl(2) succeeds to turn on xfs quota and get xfs quota on status
>> * for project.
>> + *
>> * 3) quotactl(2) succeeds to set and use Q_XGETQUOTA to get xfs disk quota
>> * limits for project.
>> + *
>> * 4) quotactl(2) succeeds to set and use Q_XGETNEXTQUOTA to get xfs disk
>> * quota limits Cgreater than or equal to ID for project.
>> + *
>> * 5) quotactl(2) succeeds to turn off xfs quota and get xfs quota off statv
>> * for project.
>> + *
>> * 6) quotactl(2) succeeds to turn on xfs quota and get xfs quota on statv
>> * for project.
>> */
>
> Here as well, the list should be fixed to render as a list.
Will do.
>
>> diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c
>> index db477589b..a55416f0e 100644
>> --- a/testcases/kernel/syscalls/quotactl/quotactl07.c
>> +++ b/testcases/kernel/syscalls/quotactl/quotactl07.c
>> @@ -2,6 +2,10 @@
>> /*
>> * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
>> * Author: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
>> + */
>> +
>> +/*\
>> + * [Description]
>> *
>> * This is a regresstion test for kernel commit 3dd4d40b4208
>> * ("xfs: Sanity check flags of Q_XQUOTARM call").
>> --
>> 2.23.0
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-10-27 2:54 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 13:09 [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Yang Xu
2021-10-18 13:09 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06:Also " Yang Xu
2021-10-20 8:51 ` xuyang2018.jy
2021-10-26 13:45 ` [LTP] [PATCH v1 02/11] syscalls/quotactl06???Also " Cyril Hrubis
2021-10-27 2:50 ` xuyang2018.jy
2021-10-18 13:09 ` [LTP] [PATCH v1 03/11] syscalls/quotactl04: Remove useless quotactl mount options Yang Xu
2021-10-26 14:03 ` Cyril Hrubis
2021-10-27 2:52 ` xuyang2018.jy
2021-10-18 13:09 ` [LTP] [PATCH v1 04/11] syscalls/quotactl[3, 5, 7]: Add docparse formatting Yang Xu
2021-10-26 14:05 ` Cyril Hrubis
2021-10-27 2:54 ` xuyang2018.jy
2021-10-18 13:09 ` [LTP] [PATCH v1 05/11] lapi/syscalls: Add syscall number for quotactl_fd Yang Xu
2021-10-26 14:09 ` Cyril Hrubis
2021-10-26 13:36 ` [LTP] [PATCH v1 01/11] syscalls/quotactl01: Also test with vfsv1 format Cyril Hrubis
2021-10-27 2:46 ` xuyang2018.jy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.