Message ID | 1639380414-24390-6-git-send-email-xuyang2018.jy@fujitsu.com |
---|---|
State | Superseded |
Headers | show |
Series | [v4,1/6] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem | expand |
Hi! > Also man-pages has error that Q_XQUOTARM was not introduced by kernel > 3.16. So use invalid type directly Have you send a patch to man-pages to get this fixed? Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Hi Cyril > Hi! >> Also man-pages has error that Q_XQUOTARM was not introduced by kernel >> 3.16. So use invalid type directly > > Have you send a patch to man-pages to get this fixed? Yes, but offical man-pages[1] hasn't updated for serval months. The updates is on alejandro-colomar(man-pages new co-maintainer) main branch[2][3]. This patch will get unexpect EINVAL error when kernel commit 40b52225e ("xfs: remove support for disabling quota accounting on a mounted file system")[4] was introduced. the unexpected EINVAL error position: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/xfs/xfs_qm_syscalls.c#n108 if we want to disable quota account feature before Q_XQUOTARM, we must need to remount with noquota like xfs maintainer does in xfstests xfs/220 [5]. So , I will modify this case as below: /* Include a valid quota type to avoid other EINVAL error */ static unsigned int invalid_type = XFS_GROUP_QUOTA << 1 | XFS_USER_QUOTA; static int mount_flag; static void verify_quota(void) { TEST(do_quotactl(fd, QCMD(Q_XQUOTARM, USRQUOTA), tst_device->dev, 0, (void *)&invalid_type)); if (TST_ERR == EINVAL) tst_res(TPASS, "Q_XQUOTARM has quota type check"); else tst_res(TFAIL, "Q_XQUOTARM doesn't have quota type check"); } static void setup(void) { quotactl_info(); /* ensure superblock has quota data, but not running */ SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "usrquota"); mount_flag = 1; SAFE_UMOUNT(MNTPOINT); mount_flag = 0; SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "noquota"); mount_flag = 1; fd = SAFE_OPEN(MNTPOINT, O_RDONLY); } static void cleanup(void) { if (fd > -1) SAFE_CLOSE(fd); if (mount_flag && tst_umount(MNTPOINT)) tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT); } static struct tst_test test = { .setup = setup, .cleanup = cleanup, .needs_root = 1, .needs_kconfigs = (const char *[]) { "CONFIG_XFS_QUOTA", NULL }, .test_all = verify_quota, .format_device = 1, .dev_fs_type = "xfs", .mntpoint = MNTPOINT, [1]https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/ [2]https://github.com/alejandro-colomar/man-pages/commit/38bccbcf4f51c5370a1060e6a80b90d68b0dcdc8 [3]https://github.com/alejandro-colomar/man-pages/commit/26f3978f04a1aeeb5397a5facebaef40a341afb6 [4]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=40b52225e58cd3adf9358146b4b39dccfbfe5892 [5]https://patchwork.kernel.org/project/fstests/patch/20220105195352.GM656707@magnolia/ I will send a v5 for this patchset and add TST_EXP* usage. Best Regards Yang Xu > > Reviewed-by: Cyril Hrubis<chrubis@suse.cz> >
diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c index 2992a6112..6e2079e0f 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl07.c +++ b/testcases/kernel/syscalls/quotactl/quotactl07.c @@ -16,21 +16,18 @@ #include <stdio.h> #include <sys/quota.h> #include "tst_test.h" -#include "lapi/quotactl.h" +#include "quotactl_syscall_var.h" #ifdef HAVE_XFS_XQM_H # include <xfs/xqm.h> -#define MNTPOINT "mntpoint" -static uint32_t qflag_acct = XFS_QUOTA_UDQ_ACCT; -static unsigned int valid_type = XFS_USER_QUOTA; /* Include a valid quota type to avoid other EINVAL error */ static unsigned int invalid_type = XFS_GROUP_QUOTA << 1 | XFS_USER_QUOTA; static void verify_quota(void) { - TEST(quotactl(QCMD(Q_XQUOTARM, USRQUOTA), tst_device->dev, 0, (void *)&invalid_type)); + TEST(do_quotactl(fd, QCMD(Q_XQUOTARM, USRQUOTA), tst_device->dev, 0, (void *)&invalid_type)); if (TST_ERR == EINVAL) tst_res(TPASS, "Q_XQUOTARM has quota type check"); else @@ -39,17 +36,19 @@ static void verify_quota(void) static void setup(void) { - TEST(quotactl(QCMD(Q_XQUOTAOFF, USRQUOTA), tst_device->dev, 0, (void *)&qflag_acct)); - if (TST_RET == -1) - tst_brk(TBROK | TTERRNO, "quotactl with Q_XQUOTAOFF failed"); + quotactl_info(); + fd = SAFE_OPEN(MNTPOINT, O_RDONLY); +} - TEST(quotactl(QCMD(Q_XQUOTARM, USRQUOTA), tst_device->dev, 0, (void *)&valid_type)); - if (TST_ERR == EINVAL) - tst_brk(TCONF, "current system doesn't support Q_XQUOTARM, skip it"); +static void cleanup(void) +{ + if (fd > -1) + SAFE_CLOSE(fd); } static struct tst_test test = { .setup = setup, + .cleanup = cleanup, .needs_root = 1, .needs_kconfigs = (const char *[]) { "CONFIG_XFS_QUOTA", @@ -60,6 +59,7 @@ static struct tst_test test = { .dev_fs_type = "xfs", .mnt_data = "usrquota", .mntpoint = MNTPOINT, + .test_variants = QUOTACTL_SYSCALL_VARIANTS, .tags = (const struct tst_tag[]) { {"linux-git", "3dd4d40b4208"}, {}
Also man-pages has error that Q_XQUOTARM was not introduced by kernel 3.16. So use invalid type directly Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> --- .../kernel/syscalls/quotactl/quotactl07.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)