Message ID | 1647401546-2898-1-git-send-email-xuyang2018.jy@fujitsu.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] syscalls/quotactl04: Use correct min_kver version check | expand |
Hi Xu, > 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. LGTM. Reviewed-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr
Hi, this should have been sent as two separate patches but otherwise: Reviewed-by: Martin Doucha <mdoucha@suse.cz> On 16. 03. 22 4:32, Yang Xu wrote: > 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,
> Hi, > this should have been sent as two separate patches but otherwise: Well, these are 2 actions, but I treated it as somehow atomic (the check is needed only after fixing .min_kver). I don't have strong opinion whether merged separated or as single commit. Kind regards, Petr
Hi Petr, Martin >> Hi, >> this should have been sent as two separate patches but otherwise: > Well, these are 2 actions, but I treated it as somehow atomic (the check is > needed only after fixing .min_kver). I don't have strong opinion whether merged > separated or as single commit. Yes, that is why I add these two actions in a single patch. Best Regards Yang Xu > > Kind regards, > Petr
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,
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(-)