All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] syscalls/quotactl04: Use correct min_kver version check
@ 2022-03-16  3:32 Yang Xu
  2022-03-16  3:32 ` [LTP] [PATCH 2/2] syscalls/quotactl: Remove tst_require_quota_support Yang Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yang Xu @ 2022-03-16  3:32 UTC (permalink / raw)
  To: pvorel; +Cc: ltp, martin.doucha

Ext4 supports project quota since kernel 4.5 instead of 4.10.
Also Q_GETNEXTQUOTA is supported since kernel 4.6, so add
a check for this command like quotactl01 does.

Reported-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/quotactl/quotactl04.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
index fdd1c9b50..3eb6e4a34 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl04.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
@@ -47,6 +47,7 @@ static struct dqinfo res_qf;
 static int32_t fmt_buf;
 
 static struct if_nextdqblk res_ndq;
+static int getnextquota_nsup;
 
 static struct tcase {
 	int cmd;
@@ -125,6 +126,11 @@ static void setup(void)
 	SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
 	do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
 	fd = SAFE_OPEN(MNTPOINT, O_RDONLY);
+
+	TEST(do_quotactl(fd, QCMD(Q_GETNEXTQUOTA, PRJQUOTA), tst_device->dev,
+		test_id, (void *) &res_ndq));
+	if (TST_ERR == EINVAL || TST_ERR == ENOSYS)
+		getnextquota_nsup = 1;
 }
 
 static void cleanup(void)
@@ -145,6 +151,11 @@ static void verify_quota(unsigned int n)
 
 	tst_res(TINFO, "Test #%d: %s", n, tc->tname);
 
+	if (tc->cmd == QCMD(Q_GETNEXTQUOTA, PRJQUOTA) && getnextquota_nsup) {
+		tst_res(TCONF, "current system doesn't support this cmd");
+		return;
+	}
+
 	TST_EXP_PASS_SILENT(do_quotactl(fd, tc->cmd, tst_device->dev, *tc->id, tc->addr),
 			"do_quotactl to %s", tc->des);
 	if (!TST_PASS)
@@ -166,7 +177,7 @@ static struct tst_test test = {
 		"quota_v2",
 		NULL
 	},
-	.min_kver = "4.10", /* commit 689c958cbe6b (ext4: add project quota support) */
+	.min_kver = "4.5", /* commit 689c958cbe6b (ext4: add project quota support) */
 	.test = verify_quota,
 	.tcnt = ARRAY_SIZE(tcases),
 	.setup = setup,
-- 
2.23.0




-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2022-03-18  1:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-16  3:32 [LTP] [PATCH 1/2] syscalls/quotactl04: Use correct min_kver version check Yang Xu
2022-03-16  3:32 ` [LTP] [PATCH 2/2] syscalls/quotactl: Remove tst_require_quota_support Yang Xu
2022-03-17 14:01   ` Petr Vorel
2022-03-18  1:37     ` xuyang2018.jy
2022-03-17 11:03 ` [LTP] [PATCH 1/2] syscalls/quotactl04: Use correct min_kver version check Petr Vorel
2022-03-17 12:01 ` Martin Doucha
2022-03-17 13:49   ` Petr Vorel
2022-03-18  1:12     ` 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.