From patchwork Tue Nov 9 10:52:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552912 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=PtNZFFVu; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPvZ6lYdz9s1l for ; Tue, 9 Nov 2021 21:52:42 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 50F6D3C07E2 for ; Tue, 9 Nov 2021 11:52:40 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 00B4D3C06DC for ; Tue, 9 Nov 2021 11:52:37 +0100 (CET) Received: from mail1.bemta26.messagelabs.com (mail1.bemta26.messagelabs.com [85.158.142.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 13D2F14044CF for ; Tue, 9 Nov 2021 11:52:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455155; i=@fujitsu.com; bh=HH7s/4rcQx7vJOrLrHsXyWp+Rv5DX2ULdyeYE8R/w4s=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=PtNZFFVuRftoYcarg/cwikx0q9sCTdVTRI5YoETgFHTexY8DaxCaCO7qc1JHLR6Va YjLzgyJZBAQtznOEkiYEdnwOQsQwr53cbXQ5fWSxtozkvh8N92KUNpGK71fREDoGnG YmwsnDDURskHWGT39fc/bQTSN19jmFCBCrlmUiWuTDaZXqIJ5KECyme4DyAxbqxOul PqsSRDsD0EpvknYg1dmQ+UzNReAGBNMqYCf9KgjVP7J+hYERa98jKNWsVecJKPdRO7 DgEbO22bYrbG93ggbb8AYxyGVXhHF6ypIe2XbY0JlIq6wSe+pX5uhyg1slsb3R/kfL /kIqIVNVe0b2A== Received: from [100.113.7.62] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-3.bemta.az-b.eu-central-1.aws.symcld.net id C6/CA-30139-3F25A816; Tue, 09 Nov 2021 10:52:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOIsWRWlGSWpSXmKPExsViZ8MRovspqCv RoKlTx2LF9x2MDowe+36vYw1gjGLNzEvKr0hgzVjQI1/QZl6xo+c9SwPjF90uRk4OIYFGJonN S3K7GLmA7N2MEuveHmMCSbAJaEo861zADGKLCEhIdDS8ZQexmQXUJZZP+gVWIyzgJXF0aR9Yn EVAReJKw2JWEJtXwEPiyptbYLaEgILElIfvmSHighInZz5hgZgjIXHwxQtmiBpFiUsd3xgh7A qJWbPamCYw8s5C0jILScsCRqZVjJZJRZnpGSW5iZk5uoYGBrqGhsa6ZrqGFmZ6iVW6SXqppbr JqXklRYlAWb3E8mK94src5JwUvbzUkk2MwPBKKWTbtYPx8+sPeocYJTmYlER5L4t1JQrxJeWn VGYkFmfEF5XmpBYfYpTh4FCS4E3wB8oJFqWmp1akZeYAQx0mLcHBoyTCq+cDlOYtLkjMLc5Mh 0idYlSUEudtDARKCIAkMkrz4Npg8XWJUVZKmJeRgYFBiKcgtSg3swRV/hWjOAejkjBvJcgUns y8Erjpr4AWMwEtPvilHWRxSSJCSqqBiU1NZvocgWMvrnHETzrx4tyOKafm/0654sTtUMYf2J+ dcGetj8qM2R9u616aOEPtcdFJD+mXfi85m1RmvUpqeXlvqsn3GfM41zbP7jtwxuUNu4Rz4SUn l78eNzgSluz/+KxOP1ByuvGFa4pTHq7fuuBR39Xu+iuzI12dmNdWh1ju7tY+I909S/rJErns3 atlLfd8bVALrX860T9rbcg99VUm/oI/ptyPbPAyDFQ9d+Hq6e2W3zVnOER/KEs4vPMal8oxh0 t798fwzNfw+xi7aPvieiPOV8wp4leDI7Lu3v5WmfJHyvnh+qgqdeWuaUc9tp5/zD/rcOWuq9d OXfAyPv819bBLTpSSp9tVY6GWzA9KLMUZiYZazEXFiQAhdXAOKgMAAA== X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-15.tower-248.messagelabs.com!1636455154!449538!1 X-Originating-IP: [62.60.8.84] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12457 invoked from network); 9 Nov 2021 10:52:34 -0000 Received: from unknown (HELO mailhost3.uk.fujitsu.com) (62.60.8.84) by server-15.tower-248.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:52:34 -0000 Received: from R01UKEXCASM126.r01.fujitsu.local ([10.183.43.178]) by mailhost3.uk.fujitsu.com (8.14.5/8.14.5) with ESMTP id 1A9AqQnb028555 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Tue, 9 Nov 2021 10:52:34 GMT Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:52:24 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:52:36 +0800 Message-ID: <1636455161-8278-1-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v3 01/12] syscalls/quotactl01: Also test with vfsv1 format X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "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. Also fix docparse formatting and move some code to lapi/quotactl.h or quotactl_var.h for reuse. Remove useless geteuid. Reviewed-by: Cyril Hrubis Signed-off-by: Yang Xu --- include/lapi/quotactl.h | 9 +++ .../kernel/syscalls/quotactl/quotactl01.c | 78 +++++++++---------- .../syscalls/quotactl/quotactl_fmt_var.h | 22 ++++++ 3 files changed, 70 insertions(+), 39 deletions(-) create mode 100644 testcases/kernel/syscalls/quotactl/quotactl_fmt_var.h diff --git a/include/lapi/quotactl.h b/include/lapi/quotactl.h index c1ec9d6e1..8e0315d03 100644 --- a/include/lapi/quotactl.h +++ b/include/lapi/quotactl.h @@ -8,6 +8,7 @@ #ifndef LAPI_QUOTACTL_H__ #define LAPI_QUOTACTL_H__ +#include "config.h" #include #ifdef HAVE_STRUCT_IF_NEXTDQBLK @@ -75,4 +76,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..1e0f5da70 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl01.c +++ b/testcases/kernel/syscalls/quotactl/quotactl01.c @@ -1,57 +1,47 @@ // 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 + * Author: Yang Xu + */ + +/*\ + * [Description] + * This testcases checks that quotactl(2) on ext4 filesystem succeeds to: * - * 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 - * 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. + * - turn on quota with Q_QUOTAON flag for user + * - set disk quota limits with Q_SETQUOTA flag for user + * - get disk quota limits with Q_GETQUOTA flag for user + * - set information about quotafile with Q_SETINFO flag for user + * - get information about quotafile with Q_GETINFO flag for user + * - get quota format with Q_GETFMT flag for user + * - update quota usages with Q_SYNC flag for user + * - get disk quota limit greater than or equal to ID with Q_GETNEXTQUOTA flag for user + * - turn off quota with Q_QUOTAOFF flag for user + * - turn on quota with Q_QUOTAON flag for group + * - set disk quota limits with Q_SETQUOTA flag for group + * - get disk quota limits with Q_GETQUOTA flag for group + * - set information about quotafile with Q_SETINFO flag for group + * - get information about quotafile with Q_GETINFO flag for group + * - get quota format with Q_GETFMT flag for group + * - update quota usages with Q_SYNC flag for group + * - get disk quota limit greater than or equal to ID with Q_GETNEXTQUOTA flag for group + * - turn off quota with Q_QUOTAOFF flag for group */ -#include "config.h" #include #include #include #include -#include "lapi/quotactl.h" #include "tst_test.h" +#include "quotactl_fmt_var.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 int32_t fmt_id; static int test_id; static char usrpath[] = USRPATH; static char grppath[] = GRPPATH; @@ -163,11 +153,13 @@ static struct tcase { static void setup(void) { - const char *const cmd[] = {"quotacheck", "-ugF", "vfsv0", MNTPOINT, NULL}; + const struct quotactl_fmt_variant *var = &fmt_variants[tst_variant]; + const char *const cmd[] = {"quotacheck", "-ugF", var->fmt_name, MNTPOINT, NULL}; + tst_res(TINFO, "quotactl() with %s format", var->fmt_name); SAFE_CMD(cmd, NULL, NULL); + fmt_id = var->fmt_id; - test_id = geteuid(); if (access(USRPATH, F_OK) == -1) tst_brk(TFAIL | TERRNO, "user quotafile didn't exist"); @@ -182,6 +174,12 @@ static void setup(void) getnextquota_nsup = 1; } +static void cleanup(void) +{ + SAFE_UNLINK(USRPATH); + SAFE_UNLINK(GRPPATH); +} + static void verify_quota(unsigned int n) { struct tcase *tc = &tcases[n]; @@ -231,4 +229,6 @@ static struct tst_test test = { NULL }, .setup = setup, + .cleanup = cleanup, + .test_variants = QUOTACTL_FMT_VARIANTS, }; diff --git a/testcases/kernel/syscalls/quotactl/quotactl_fmt_var.h b/testcases/kernel/syscalls/quotactl/quotactl_fmt_var.h new file mode 100644 index 000000000..cb9fa4625 --- /dev/null +++ b/testcases/kernel/syscalls/quotactl/quotactl_fmt_var.h @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ + +#ifndef LTP_QUOTACTL_FMT_VAR_H +#define LTP_QUOTACTL_FMT_VAR_H + +#include "lapi/quotactl.h" + +#define QUOTACTL_FMT_VARIANTS 2 + +static struct quotactl_fmt_variant { + int32_t fmt_id; + const char *fmt_name; +} fmt_variants[] = { + {.fmt_id = QFMT_VFS_V0, .fmt_name = "vfsv0"}, + {.fmt_id = QFMT_VFS_V1, .fmt_name = "vfsv1"} +}; + +#endif /* LAPI_QUOTACTL_FMT_VAR_H__ */ From patchwork Tue Nov 9 10:52:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=Capk/say; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPvp2sBbz9s1l for ; Tue, 9 Nov 2021 21:52:54 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B3D813C08B2 for ; Tue, 9 Nov 2021 11:52:51 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 2F9143C06DC for ; Tue, 9 Nov 2021 11:52:37 +0100 (CET) Received: from mail1.bemta25.messagelabs.com (mail1.bemta25.messagelabs.com [195.245.230.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 28CF014052D5 for ; Tue, 9 Nov 2021 11:52:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455155; i=@fujitsu.com; bh=X5FSiFYVsKpcAx6hLzL2a/Cnuhg1yecwE0sQpM6grkQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Capk/sayxSJKHpVNL5tEBGTFJQpEGZLidwqUd2SiUEIIo6B/htmLkcuIP4mHwI6WJ lQtfhsWxU2PnDQvfxb26ITPxx3ahe8AbyAuqvOEH8zM4WDMtrkbYbBQ/qdwmB13ZF4 wWtJh1NL/bZZ/63Xurqil+jhnIdpne0NRSkA0BdGhB2HiDHFb74gxna9OiAJyM8itY 9RCTmJ4lJCi81qmOWKSreL88FRAAVLN/Z7t4Crd0cr7sZmU2QOKF6KZD1yPmfAc+Tj mdqJa1tgPTW6Z6N+T1ZQcMv3WV/BbNuewYfC0gV+5sOnDNTi2q97HxN9LZsmXi0UkV twkT7ahtmZFXA== Received: from [100.112.193.107] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta.az-a.eu-west-1.aws.symcld.net id 1E/FC-19641-3F25A816; Tue, 09 Nov 2021 10:52:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLIsWRWlGSWpSXmKPExsViZ8MRovspqCv RYMdpHYsV33cwOjB67Pu9jjWAMYo1My8pvyKBNWN341zGggMGFV2/jzE2MH5V72Lk4hASaGSS eDX9HEsXIyeQs5tRYv0xCRCbTUBT4lnnAmYQW0RAQqKj4S07iM0soC6xfNIvJhBbWMBLYu3Dy 2A1LAIqEm+nLWUEsXkFPCSm7DnLCmJLCChITHn4HqiGg4NTwFPi70dXiFUeEjuef4YqF5Q4Of MJC8R4CYmDL14wQ7QqSlzq+MYIYVdIzJrVxjSBkX8WkpZZSFoWMDKtYjRPKspMzyjJTczM0TU 0MNA1NDTSNbQ01TUx00us0k3USy3VLU8tLtE11EssL9YrrsxNzknRy0st2cQIDMWUgsN6Oxgn vPmgd4hRkoNJSZT3slhXohBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3gR/oJxgUWp6akVaZg4wL mDSEhw8SiK8ej5Aad7igsTc4sx0iNQpRkUpcd7GQKCEAEgiozQPrg0Wi5cYZaWEeRkZGBiEeA pSi3IzS1DlXzGKczAqCfNWgkzhycwrgZv+CmgxE9Dig1/aQRaXJCKkpBqYimuEDjGH7tgvtNd izoVbJupdzHX6Sff4Tx2z1UsoYGF5ruaQFjwt44HBAfNEuSzdSy9dyrN4q1/lR/rUW9//HMz6 K1+Oy+p4tr36FP79kudLBN2yZ3yJ/Ht+mt7GkO9PLe9Mcet2bxU4UeH3Y79jxR+94ij9p1Gpd VETsra6FTXvD4qNCf38N7M1uvznbp6C9PM/03+12ar8VP+lePDFpNiAUDnNMC0Rz6Mz4svEPd 3/sj/U5s/fv+rKdcELt87J1H45c/mbtTT7g2VFts92M7k7/Lh+1L4+8MCazK7MhKlBj6+kK0Y +qlBvVzU3XnFrboDv46bl+QH/M3UNbjRcKPnzOPq+X9TsUovJ1UosxRmJhlrMRcWJAEfIag1A AwAA X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-5.tower-265.messagelabs.com!1636455154!76699!1 X-Originating-IP: [62.60.8.84] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28410 invoked from network); 9 Nov 2021 10:52:34 -0000 Received: from unknown (HELO mailhost3.uk.fujitsu.com) (62.60.8.84) by server-5.tower-265.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:52:34 -0000 Received: from R01UKEXCASM126.r01.fujitsu.local ([10.183.43.178]) by mailhost3.uk.fujitsu.com (8.14.5/8.14.5) with ESMTP id 1A9AqQne028555 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Tue, 9 Nov 2021 10:52:34 GMT Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:52:31 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:52:37 +0800 Message-ID: <1636455161-8278-2-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636455161-8278-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1636455161-8278-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v3 02/12] syscalls/quotactl06: Also test with vfsv1 format X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Add a linux tag and fix docparse formatting. Also remove useless geteuid. Reviewed-by: Cyril Hrubis Signed-off-by: Yang Xu --- .../kernel/syscalls/quotactl/quotactl06.c | 89 ++++++++++++------- 1 file changed, 56 insertions(+), 33 deletions(-) diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c index a10d1ca07..21a86ad1e 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl06.c +++ b/testcases/kernel/syscalls/quotactl/quotactl06.c @@ -1,41 +1,49 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu + * Copyright (c) 2019-2021 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ + +/*\ + * [Description] + * + * Tests basic error handling of the quotactl syscall with visible quota files + * (cover two formats, vfsv0 and vfsv1): + * + * - EACCES when cmd is Q_QUOTAON and addr existed but not a regular file + * - ENOENT when the file specified by special or addr does not exist + * - EBUSTY when cmd is Q_QUOTAON and another Q_QUOTAON had already been performed + * - EFAULT when addr or special is invalid + * - EINVAL when cmd or type is invalid + * - ENOTBLK when special is not a block device + * - ESRCH when no disk quota is found for the indicated user and quotas have not been + * turned on for this fs + * - ESRCH when cmd is Q_QUOTAON, but the quota format was not found + * - ESRCH when cmd is Q_GETNEXTQUOTA, but there is no ID greater than or equal to id that + * has an active quota + * - ERANGE when cmd is Q_SETQUOTA, but the specified limits are out of the range allowed + * by the quota format + * - EPERM when the caller lacked the required privilege (CAP_SYS_ADMIN) for the specified + * operation + * + * For ERANGE error, the vfsv0 and vfsv1 format's maximum quota limit setting have been + * fixed since the following kernel patch: + * + * commit 7e08da50cf706151f324349f9235ebd311226997 + * Author: Jan Kara + * Date: Wed Mar 4 14:42:02 2015 +0100 * - * 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. + * quota: Fix maximum quota limit settings */ #include #include #include "tst_test.h" -#include "lapi/quotactl.h" +#include "quotactl_fmt_var.h" #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,9 +51,9 @@ 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_invalid = 1; static int test_id; static int getnextquota_nsup; @@ -105,7 +113,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 +143,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 +158,15 @@ static void verify_quotactl(unsigned int n) static void setup(void) { - const char *const cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL}; unsigned int i; + const struct quotactl_fmt_variant *var = &fmt_variants[tst_variant]; + const char *const cmd[] = {"quotacheck", "-ugF", var->fmt_name, MNTPOINT, NULL}; + tst_res(TINFO, "quotactl() with %s format", var->fmt_name); SAFE_CMD(cmd, NULL, NULL); + fmt_id = var->fmt_id; + /* vfsv0 block limit 2^42, vfsv1 block limit 2^63 - 1 */ + set_dqmax.dqb_bsoftlimit = tst_variant ? 0x20000000000000 : 0x100000000; if (access(USRPATH, F_OK) == -1) tst_brk(TFAIL | TERRNO, "user quotafile didn't exist"); @@ -161,8 +174,6 @@ static void setup(void) tst_require_quota_support(tst_device->dev, fmt_id, usrpath); SAFE_MKDIR(TESTDIR1, 0666); - test_id = geteuid(); - test_invalid = test_id + 1; TEST(quotactl(QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev, test_id, (void *) &res_ndq)); @@ -175,8 +186,15 @@ static void setup(void) } } +static void cleanup(void) +{ + SAFE_UNLINK(USRPATH); + SAFE_RMDIR(TESTDIR1); +} + static struct tst_test test = { .setup = setup, + .cleanup = cleanup, .needs_kconfigs = (const char *[]) { "CONFIG_QFMT_V2", NULL @@ -192,4 +210,9 @@ static struct tst_test test = { NULL }, .needs_root = 1, + .test_variants = QUOTACTL_FMT_VARIANTS, + .tags = (const struct tst_tag[]) { + {"linux-git", "7e08da50cf70"}, + {} + } }; From patchwork Tue Nov 9 10:52:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552914 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=wzEg1XH3; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPw24hhgz9s1l for ; Tue, 9 Nov 2021 21:53:06 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 00AAB3C07C5 for ; Tue, 9 Nov 2021 11:53:04 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 2FF383C08C9 for ; Tue, 9 Nov 2021 11:52:42 +0100 (CET) Received: from mail3.bemta25.messagelabs.com (mail3.bemta25.messagelabs.com [195.245.230.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 5CF0F14125F0 for ; Tue, 9 Nov 2021 11:52:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455160; i=@fujitsu.com; bh=N9Y1CJo/1Q9LYoAyYU9UoZaW8eSM61VgVerXnA5u4vo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=wzEg1XH3Pm2pZ+cM9NTYOn5jbAQoaziLthoej8UeYMj7Lm6+KshytLOJDDb/7FBXz WVTicAtKCo7+3zNQ4JWWC8/jmxXEDqAEHIV/EVKiXiiXh4Cgte+uR/8M8pQ7NzPnJq bcuO7EO+IMRXOvgW+3cxSBgtkWxNsRFy3NQMgKPMvi29Ro4ALOf7tKvaAYzBdnNHod 3Oxkg5EDzhBpq33F6ZzSv7/XvZTaoSaCV2Jlx6RRmk1NUx4gcU9ScWNGgwRyvGkIa7 ZhFI3rRoWbHrg/sXjTZQXRf55i4HjsYs/EE5Wil7WMrfZGUs2LVfFBSmjAeUbONrhy KriARygZ1kxUQ== Received: from [100.112.196.47] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-5.bemta.az-b.eu-west-1.aws.symcld.net id 1E/12-05453-8F25A816; Tue, 09 Nov 2021 10:52:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsViZ8MRqvsjqCv RYPJeZosV33cwOjB67Pu9jjWAMYo1My8pvyKBNWPG5iuMBbs5Kh6+X8zSwHiMvYuRi0NIoJFJ Yt+OGcwQzm5GiWWbrjB1MXJysAloSjzrXMAMYosISEh0NLxlB7GZBdQllk/6BVYjLOAlceJZP 0sXIwcHi4CKxLHNaSBhXgEPid/7/4GVSAgoSEx5+J4ZpIRTwFPi70dXkLAQUMmO558ZIcoFJU 7OfMICMV1C4uCLF8wQrYoSlzq+MULYFRKzZrUxTWDkn4WkZRaSlgWMTKsYzZOKMtMzSnITM3N 0DQ0MdA0NjXQNLc11zQz0Eqt0k/RSS3XLU4tLdA31EsuL9Yorc5NzUvTyUks2MQJDMaXgqM0O xg+vP+gdYpTkYFIS5b0s1pUoxJeUn1KZkVicEV9UmpNafIhRhoNDSYI3wR8oJ1iUmp5akZaZA 4wLmLQEB4+SCK+eD1Cat7ggMbc4Mx0idYpRl+Pdz8WLmIVY8vLzUqXEeRsDgYoEQIoySvPgRs Bi9BKjrJQwLyMDA4MQT0FqUW5mCar8K0ZxDkYlYd5KkCk8mXklcJteAR3BBHTEwS/tIEeUJCK kpBqY1F82/Zz//cKzwMcH2Psj2TccePO5U+XfwSlhlt8vBU08yMT9W+3wwUcyzTdqEm92SZ3J 1Pnx5tif6t2VixblcF3c9UjlivzB1esfTPNQdp4sfnqd87fM+ABRfnOfi8rtp/bOWF7iZB+9b 0NxSNvydR/mPD/2wPXK/YMGT63XGIaKKfwQX/HW4XJ33jvFL3eY3m+XOj6PtWzBvpOqP24VTp Or76vgb7qrfePJuYRc+Rzjw+fPMfPOzl/mcW/Jh3rt01J+JlbuIpGx1fuWXSyZ9TFJ6HvWMm/ h++LBMqb25jaSyZwyHjkVSluuJUenBUyVeJJQskOxKqj89o5AKb1J3SwHXh6yKLuTuz6DyenM PyWW4oxEQy3mouJEADS4lqBMAwAA X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-7.tower-285.messagelabs.com!1636455159!9223!1 X-Originating-IP: [62.60.8.85] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2419 invoked from network); 9 Nov 2021 10:52:40 -0000 Received: from unknown (HELO mailhost4.uk.fujitsu.com) (62.60.8.85) by server-7.tower-285.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:52:40 -0000 Received: from R01UKEXCASM126.r01.fujitsu.local ([10.183.43.178]) by mailhost4.uk.fujitsu.com (8.14.5/8.14.5) with ESMTP id 1A9Aqd9w017913 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Tue, 9 Nov 2021 10:52:39 GMT Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:52:37 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:52:38 +0800 Message-ID: <1636455161-8278-3-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636455161-8278-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1636455161-8278-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v3 03/12] syscalls/quotactl04: Remove useless mount option X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" When use -O quota options for mkfs.ext4, quota mount option will be ignored since 3.5 kernel[1]. Since the Oldest tested kernel version is 3.10, we can remove mount option directly. [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7c319d3 Signed-off-by: Yang Xu Reviewed-by: Cyril Hrubis --- testcases/kernel/syscalls/quotactl/quotactl04.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c index fd3afc888..f3e2cf3a5 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl04.c +++ b/testcases/kernel/syscalls/quotactl/quotactl04.c @@ -141,7 +141,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) From patchwork Tue Nov 9 10:52:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=blif8XCs; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPwH2v7Tz9s1l for ; Tue, 9 Nov 2021 21:53:19 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6368F3C07B7 for ; Tue, 9 Nov 2021 11:53:16 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 02C113C0918 for ; Tue, 9 Nov 2021 11:53:02 +0100 (CET) Received: from mail1.bemta26.messagelabs.com (mail1.bemta26.messagelabs.com [85.158.142.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id D83CD1001583 for ; Tue, 9 Nov 2021 11:53:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455181; i=@fujitsu.com; bh=4Csno799F725ITPeNEyfdNtAiUMSI7QO/RizCcLxohI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=blif8XCsKEL2teGPx4igE7huqNZU0MjAES+Io2k6ysBgsgzDM9PuaJBtxs5gcNXm0 cFx7jEabqnwuJ0FngLqjTxWfHH2IcCeZ/FHTRWkquf6LHeM1U/HPPalm76oW7S/szL m8q2KwIwiRH7EsiXQdXfgnV7PNi5YYK2VOS7pMqWiWLh5hAF+7eLEUs7kH3dsFsKI0 8rXp/YORZxzvSOzLDu+929yrjR2a6/Zc5QoUeoIl3S/n14qnucAXlOh4bgqHCwxuBr PtKhtKLYj2A7ztgZQ3Bl4xjcClFqfSmLiBMxHE07Vj645Xr3QMt48tRHUj+4E2O0GU PpvpfpKysd+1w== Received: from [100.113.7.62] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-3.bemta.az-b.eu-central-1.aws.symcld.net id DD/BB-30139-D035A816; Tue, 09 Nov 2021 10:53:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKIsWRWlGSWpSXmKPExsViZ8ORqMsT3JV ocGe6tsWK7zsYHRg99v1exxrAGMWamZeUX5HAmtH2YCJbwZ2gis3r7jM1ME506WLk4hASOMso sfvNbWYIZyeTxLqvm1khnN2MEpd757J1MXJysAloSjzrXMAMYosISEh0NLxlB7GZBdQllk/6x QRiCws4S8w61AoWZxFQkbhxeBdYL6+Ah8TszafBaiQEFCSmPHwPNIeDg1PAU+LvR1eQsBBQyY 7nnxkhygUlTs58wgIxXkLi4IsXzBCtihKXOr4xQtgVErNmtUGNVJO4em4T8wRGwVlI2mchaV/ AyLSK0TKpKDM9oyQ3MTNH19DAQNfQ0FjXVNfIxFAvsUo3SS+1VDc5Na+kKBEoq5dYXqxXXJmb nJOil5dasokRGMIphawfdzAeev1B7xCjJAeTkijvZbGuRCG+pPyUyozE4oz4otKc1OJDjDIcH EoSvAn+QDnBotT01Iq0zBxgPMGkJTh4lER49XyA0rzFBYm5xZnpEKlTjLocl6/PW8QsxJKXn5 cqJc7bGAhUJABSlFGaBzcCFtuXGGWlhHkZGRgYhHgKUotyM0tQ5V8xinMwKgnzVoJM4cnMK4H b9AroCCagIw5+aQc5oiQRISXVwBQ1u7Tw+c+lQZZMQcEaPm0JHvv+/nMo7D/4YMFfSxd+kSPt Cn3mZzdNqC2oFHtx0dab947yv01ttY3Mh5UmPT21+tyD0CMGKtEdTq83KVx7tkDaTjZV5ohwc tqzgu/lZlvlS3dJ1Z1XzGUs7mObZ3totr1ZvL7SKcNDYfskO51iZf4c3lhQOHnJ9Gft6rd0/c xdZS/O2lh0MO3PK5tF5e9rfzknt171uBmwgmeydli64zOBxEMaEbd/Hq20Z7RTCdidWHM4cFf 3pZA+00Mbp89QrcqxPZXCljj71Z6PU2yKjmyckGy4wdPS/7OxQ7bdjg8s9w6klGanxQQ8aQ36 scSn3HRTScUm210dIjtElFiKMxINtZiLihMBr9KzVmgDAAA= X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-6.tower-245.messagelabs.com!1636455180!378562!1 X-Originating-IP: [62.60.8.97] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7717 invoked from network); 9 Nov 2021 10:53:00 -0000 Received: from unknown (HELO n03ukasimr01.n03.fujitsu.local) (62.60.8.97) by server-6.tower-245.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:53:00 -0000 Received: from n03ukasimr01.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTP id 3145A100242 for ; Tue, 9 Nov 2021 10:53:00 +0000 (GMT) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTPS id 241A9100234 for ; Tue, 9 Nov 2021 10:53:00 +0000 (GMT) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:52:45 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:52:39 +0800 Message-ID: <1636455161-8278-4-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636455161-8278-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1636455161-8278-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v3 04/12] syscalls/quotactl:Add docparse formatting X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Also remove useless header files and add linux git in test structure. Signed-off-by: Yang Xu Reviewed-by: Cyril Hrubis --- .../kernel/syscalls/quotactl/quotactl02.c | 54 ++++++------------- .../kernel/syscalls/quotactl/quotactl02.h | 3 +- .../kernel/syscalls/quotactl/quotactl03.c | 17 +++--- .../kernel/syscalls/quotactl/quotactl04.c | 39 ++++++-------- .../kernel/syscalls/quotactl/quotactl05.c | 32 +++++------ .../kernel/syscalls/quotactl/quotactl07.c | 9 ++-- 6 files changed, 65 insertions(+), 89 deletions(-) diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.c b/testcases/kernel/syscalls/quotactl/quotactl02.c index ad81ee7e5..55a6a8906 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl02.c +++ b/testcases/kernel/syscalls/quotactl/quotactl02.c @@ -1,50 +1,28 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Copyright (c) 2013-2019 FUJITSU LIMITED. All rights reserved + * Copyright (c) 2013-2021 FUJITSU LIMITED. All rights reserved * Author: DAN LI - * Author: Yang Xu + * Author: Yang Xu */ /*\ * [Description] * - * This testcase checks basic flags of quotactl(2) for an XFS file system: + * This testcases checks that quotactl(2) on xfs filesystem succeeds to: * - * 1. quotactl(2) succeeds to turn off xfs quota and get xfs quota off status - * for user. - * - * 2. quotactl(2) succeeds to turn on xfs quota and get xfs quota on status - * for user. - * - * 3. quotactl(2) succeeds to set and use Q_XGETQUOTA to get xfs disk quota - * limits for user. - * - * 4. quotactl(2) succeeds to set and use Q_XGETNEXTQUOTA to get xfs disk - * quota limits greater than or equal to ID for user. - * - * 5. quotactl(2) succeeds to turn off xfs quota and get xfs quota off statv - * for user. - * - * 6. quotactl(2) succeeds to turn on xfs quota and get xfs quota on statv - * for user. - * - * 7. quotactl(2) succeeds to turn off xfs quota and get xfs quota off status - * for group. - * - * 8. quotactl(2) succeeds to turn on xfs quota and get xfs quota on status - * for group. - * - * 9. quotactl(2) succeeds to set and use Q_XGETQUOTA to get xfs disk quota - * limits for group. - * - * 10. quotactl(2) succeeds to set and use Q_XGETNEXTQUOTA to get xfs disk - * quota limits for group. - * - * 11. quotactl(2) succeeds to turn off xfs quota and get xfs quota off statv - * for group. - * - * 12. quotactl(2) succeeds to turn on xfs quota and get xfs quota on statv - * for group. + * - turn off xfs quota and get xfs quota off status for user + * - turn on xfs quota and get xfs quota on status for user + * - set and use Q_XGETQUOTA to get xfs disk quota limits for user + * - set and use Q_XGETNEXTQUOTA to get xfs disk quota limits greater than or + * equal to ID for user + * - turn off xfs quota and get xfs quota off statv for user + * - turn on xfs quota and get xfs quota on statv for user + * - turn off xfs quota and get xfs quota off status for group + * - turn on xfs quota and get xfs quota on status for group + * - set and use Q_XGETQUOTA to get xfs disk quota limits for group + * - set and use Q_XGETNEXTQUOTA to get xfs disk quota limits for group + * - turn off xfs quota and get xfs quota off statv for group + * - turn on xfs quota and get xfs quota on statv for gorup */ #include "quotactl02.h" diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.h b/testcases/kernel/syscalls/quotactl/quotactl02.h index 37f3d7eb7..3351fb578 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl02.h +++ b/testcases/kernel/syscalls/quotactl/quotactl02.h @@ -1,14 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu + * Author: Yang Xu */ #ifndef QUOTACTL02_H #define QUOTACTL02_H #define _GNU_SOURCE -#include "config.h" #include #include #include diff --git a/testcases/kernel/syscalls/quotactl/quotactl03.c b/testcases/kernel/syscalls/quotactl/quotactl03.c index 3ec931727..e0e4bf5b2 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl03.c +++ b/testcases/kernel/syscalls/quotactl/quotactl03.c @@ -4,10 +4,9 @@ * Author: Xiao Yang */ -/* - * 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 - * Date: Tue Jan 17 11:43:38 2017 -0800 + * commit 657bdfb7f5e68ca5e2ed009ab473c429b0d6af85 + * Author: Eric Sandeen + * 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 @@ -75,6 +74,10 @@ static struct tst_test test = { .dev_fs_type = "xfs", .mntpoint = mntpoint, .mnt_data = "usrquota", + .tags = (const struct tst_tag[]) { + {"linux-git", "657bdfb7f5e6"}, + {} + } }; #else diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c index f3e2cf3a5..dab61cf4d 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl04.c +++ b/testcases/kernel/syscalls/quotactl/quotactl04.c @@ -1,24 +1,22 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu + * Copyright (c) 2019-2021 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ + +/*\ + * [Description] * - * This testcase checks the basic flag of quotactl(2) for project quota on - * non-XFS filesystems. + * This testcase checks that quotactl(2) on ext4 filesystem succeeds to: * - * 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. + * - turn on quota with Q_QUOTAON flag for project + * - set disk quota limits with Q_SETQUOTA flag for project + * - get disk quota limits with Q_GETQUOTA flag for project + * - set information about quotafile with Q_SETINFO flag for project + * - get information about quotafile with Q_GETINFO flag for project + * - get quota format with Q_GETFMT flag for project + * - get disk quota limit greater than or equal to ID with Q_GETNEXTQUOTA flag for project + * - turn off quota with Q_QUOTAOFF flag for project * * Minimum e2fsprogs version required is 1.43. */ @@ -29,14 +27,9 @@ #include #include #include -#include "config.h" -#include "lapi/quotactl.h" #include "tst_safe_stdio.h" #include "tst_test.h" - -#ifndef QFMT_VFS_V1 -# define QFMT_VFS_V1 4 -#endif +#include "lapi/quotactl.h" #define FMTID QFMT_VFS_V1 #define MNTPOINT "mntpoint" diff --git a/testcases/kernel/syscalls/quotactl/quotactl05.c b/testcases/kernel/syscalls/quotactl/quotactl05.c index e811e47a4..15a6c1e67 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl05.c +++ b/testcases/kernel/syscalls/quotactl/quotactl05.c @@ -1,23 +1,23 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu + * Copyright (c) 2019-2021 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ + +/*\ + * [Description] * - * 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. + * This testcases checks that quotactl(2) on xfs filesystem succeeds to: + * + * - turn off xfs quota and get xfs quota off status for project + * - turn on xfs quota and get xfs quota on status for project + * - set and use Q_XGETQUOTA to get xfs disk quota limits for project + * - set and use Q_XGETNEXTQUOTA to get xfs disk quota limits greater than or + * equal to ID for project + * - turn off xfs quota and get xfs quota off statv for project + * - turn on xfs quota and get xfs quota on statvfor project */ + #include "quotactl02.h" #if defined(HAVE_XFS_XQM_H) diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c index db477589b..2992a6112 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl07.c +++ b/testcases/kernel/syscalls/quotactl/quotactl07.c @@ -1,19 +1,22 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu + * Author: Yang Xu + */ + +/*\ + * [Description] * * This is a regresstion test for kernel commit 3dd4d40b4208 * ("xfs: Sanity check flags of Q_XQUOTARM call"). */ -#include "config.h" #include #include #include #include -#include "lapi/quotactl.h" #include "tst_test.h" +#include "lapi/quotactl.h" #ifdef HAVE_XFS_XQM_H # include From patchwork Tue Nov 9 10:52:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552916 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=lovNCnNA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPwT5hbZz9s1l for ; Tue, 9 Nov 2021 21:53:29 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 392843C08C9 for ; Tue, 9 Nov 2021 11:53:27 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id B1F6F3C08C7 for ; Tue, 9 Nov 2021 11:53:03 +0100 (CET) Received: from mail1.bemta26.messagelabs.com (mail1.bemta26.messagelabs.com [85.158.142.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 860991001199 for ; Tue, 9 Nov 2021 11:53:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455181; i=@fujitsu.com; bh=+ugbAx3cIgORdBmzRf9qTdjAfpfT2UvToV9PIGVVgrQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lovNCnNAC+E6bp7jT7o93fFl5Z++bbjTK59K1KNc6kk/aBctqhPXLnEIyIy24aRO4 Xc9iI0YPsG972RueuCqVI1V7/kJmCstVNJ3s6a/qwr6LL4rWQSspq2kCmb2/VzeRkt fy2Xmex3Xr+4X/KBGpsbCWazQOlOhpCxtIhg1Ogno6fEfQpNRhvhU/G28DDNYxYBoK 2s1pNOYcwzKb3lHUwC6LQcQERusNTuuwcfzH9KeatkM5q1vZm/hzaOduL0vqN2U9Sz gQu7PdSQEnXB4JTNwkF90peDZdjBwOfKjf74DCnbWk5uM8o7NEWsjoiUSbimt4+kpR BH3qMC/J6hjVA== Received: from [100.113.7.62] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-3.bemta.az-b.eu-central-1.aws.symcld.net id 7D/BB-30139-D035A816; Tue, 09 Nov 2021 10:53:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJIsWRWlGSWpSXmKPExsViZ8ORqMsT3JV ocP+klsWK7zsYHRg99v1exxrAGMWamZeUX5HAmrF/P0/BV/2KbQ86WRsY72p1MXJxCAmcZZTo ePeTtYuRE8jZySRxvM0CIrGbUeLZ5IOMIAk2AU2JZ50LmEFsEQEJiY6Gt+wgNrOAusTySb+YQ GxhAW+Ju10rwOIsAioSO889YwOxeQU8JOY9XMUCYksIKEhMefgeaA4HB6eAp8Tfj64Qez0kdj z/zAhRLihxcuYTFojxEhIHX7xghmhVlLjU8Y0Rwq6QmDWrjQnCVpO4em4T8wRGwVlI2mchaV/ AyLSK0TKpKDM9oyQ3MTNH19DAQNfQ0FjXTNfIxEAvsUo3SS+1VDc5Na+kKBEoq5dYXqxXXJmb nJOil5dasokRGL4phWwfdjBOefNB7xCjJAeTkijvZbGuRCG+pPyUyozE4oz4otKc1OJDjDIcH EoSvAn+QDnBotT01Iq0zBxgLMGkJTh4lER49XyA0rzFBYm5xZnpEKlTjMYcl6/PW8TM8e7n4k XMQix5+XmpUuK8jYFApQIgpRmleXCDYDF+iVFWSpiXkYGBQYinILUoN7MEVf4VozgHo5IwbyX IFJ7MvBK4fa+ATmECOuXgl3aQU0oSEVJSDUyzlBo2WyQbnf3W52cbziIvt2KP5MaTwkYKG5+r uZ7llWLve2W8Kjac8bfbC0m1BhaBFZp+Vvmvyh/1tr+6XBT6t7jp6qLt3xVNj7yY2bcpoOVJe EhcR29+D5PhrVv+fD7b1y6f21X/bZP3vjsHTq6feu5Z+eeIm19jpz5lelrBn3Swc5H48+DERx /+P8lOvcm3/uqpq23rsvNVV9m84a9svTxXfJ6xb9BDsR03U49EOC7Qv7Jl7+I7ogUxSW4e2UV L9x7L+cK1/7XFJovPnDOsmu+ci/zEPvt2XdPR5Ale6ypbW2Map39cyTVzzqb+q5+Pyh3n6X20 f93L3PwP7te63m/8capHgsffvOF8fmCVEktxRqKhFnNRcSIAidcKF2wDAAA= X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-14.tower-245.messagelabs.com!1636455180!378731!1 X-Originating-IP: [62.60.8.97] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14353 invoked from network); 9 Nov 2021 10:53:00 -0000 Received: from unknown (HELO n03ukasimr01.n03.fujitsu.local) (62.60.8.97) by server-14.tower-245.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:53:00 -0000 Received: from n03ukasimr01.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTP id 332A7100241 for ; Tue, 9 Nov 2021 10:53:00 +0000 (GMT) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTPS id 269C1100231 for ; Tue, 9 Nov 2021 10:53:00 +0000 (GMT) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:52:49 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:52:40 +0800 Message-ID: <1636455161-8278-5-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636455161-8278-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1636455161-8278-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v3 05/12] lapi/syscalls: Add syscall number for quotactl_fd X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "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 Reviewed-by: Cyril Hrubis --- 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 From patchwork Tue Nov 9 10:54:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552918 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=JSoNUHQ/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPy817VRz9s1l for ; Tue, 9 Nov 2021 21:54:56 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D50753C08C9 for ; Tue, 9 Nov 2021 11:54:53 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 268793C0890 for ; Tue, 9 Nov 2021 11:54:44 +0100 (CET) Received: from mail1.bemta25.messagelabs.com (mail1.bemta25.messagelabs.com [195.245.230.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 71DE1100024A for ; Tue, 9 Nov 2021 11:54:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455279; i=@fujitsu.com; bh=JXamCGTOVyRfKDFzMMVQap0M56vaZ4b9CrcskUTnBuY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=JSoNUHQ/wmEkDOyfUZ1+I0kNaCMvwHVDFnT9NPovBKFIfgmgO73bwuuRGQaGFtir+ /Vy6pXCnDHXfTIpEF5NYfROBnKVbUIoLhxprNR9McO7uoLMr/8mS9Mg8p2KJRZjGVe 7K1oKeUrAM6PXxEYt7+3XZ9DPMaDI5+jbYDPxXI/9KmrFiul1TjoJrF0/JS6SYrBXQ K9Zs2E0HN+4fQEUbWcwk/6cNNOiA1I2xNZEHUPMR3kBCaQ7gBaec6wbaE/NzC5ziPh 6I+TkUbgXk9gXzdQWoxUkB0o5DW0xfdhwLN9wK57DhoYxnXrpHkPDuxlPvPCa86E+B O67el4OKvZtqw== Received: from [100.112.193.107] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta.az-a.eu-west-1.aws.symcld.net id DD/F1-19641-F635A816; Tue, 09 Nov 2021 10:54:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPIsWRWlGSWpSXmKPExsViZ8ORqJsf3JV osOkqm8WK7zsYHRg99v1exxrAGMWamZeUX5HAmjFv5Qf2ggNcFZfPz2FrYHzM0cXIxSEkcJZR 4sO3ZywQzk4miQsTHkA5uxkl9vZtYu9i5ORgE9CUeNa5gBnEFhGQkOhoeAsWZxZQl1g+6RcTi C0s4C5xbu0csDiLgIrE7qblbF2MHBy8Ah4SGyZJgIQlBBQkpjx8DzaGV0BQ4uTMJywQYyQkDr 54wQxRoyhxqeMbI4RdITFrVhsThK0mcfXcJuYJjPyzkLTPQtK+gJFpFaN5UlFmekZJbmJmjq6 hgYGuoaGRrqGlia6ZmV5ilW6iXmqpbnlqcYmuoV5iebFecWVuck6KXl5qySZGYDimFBxy2sH4 /vUHvUOMkhxMSqK8l8W6EoX4kvJTKjMSizPii0pzUosPMcpwcChJ8Cb4A+UEi1LTUyvSMnOAs QGTluDgURLh1fMBSvMWFyTmFmemQ6ROMSpKifOmBAElBEASGaV5cG2weLzEKCslzMvIwMAgxF OQWpSbWYIq/4pRnINRSZj3UyDQFJ7MvBK46a+AFjMBLT74pR1kcUkiQkqqgcnF/gLTxnUO+/W 2JJSpSBlqxBkcX79XlvP020L7IvfVmbor5gobLjOK0Vu6bAJnKFvPE33Lve/0lh5tFZ2wpefn fb/ox21anHunHZh9yPK3g/GF++HHoi68v2u0a/rqXIOLKlzdRfPmym9d5rOrNPvQ8c8Ht2usr Pjy7LvzF+blrwo6DLamprULOjV2F2/jjLfLUCzZ4lFSnGujOf2ZrNoW62y1r19NTtaqFezetY zNzcz97Ql2A0WxQ1s1vu13aazeUW+6boVAJVNYfavLM44rInp1z30XXzuYUSCx+Om7x5p/Jwd 8tJQ8waa0euXnvmV5jkusPJ4m7lcTLbp/InirRL7vInnpRfusz6sI+imxFGckGmoxFxUnAgBF gQBlQgMAAA== X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-15.tower-265.messagelabs.com!1636455278!576297!1 X-Originating-IP: [62.60.8.97] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24828 invoked from network); 9 Nov 2021 10:54:39 -0000 Received: from unknown (HELO n03ukasimr01.n03.fujitsu.local) (62.60.8.97) by server-15.tower-265.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:54:39 -0000 Received: from n03ukasimr01.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTP id 970A910024B for ; Tue, 9 Nov 2021 10:54:38 +0000 (GMT) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTPS id 8A70B100238 for ; Tue, 9 Nov 2021 10:54:38 +0000 (GMT) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:54:29 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:54:42 +0800 Message-ID: <1636455285-8372-1-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v3 06/12] lapi/quotactl.h: Add fallback for quotactl_fd X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Reviewed-by: Cyril Hrubis Signed-off-by: Yang Xu --- configure.ac | 1 + include/lapi/quotactl.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5bf3c52ec..859aa9857 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,7 @@ AC_CHECK_FUNCS_ONCE([ \ profil \ pwritev \ pwritev2 \ + quotactl_fd \ rand_r \ readlinkat \ recvmmsg \ diff --git a/include/lapi/quotactl.h b/include/lapi/quotactl.h index 8e0315d03..739a85616 100644 --- a/include/lapi/quotactl.h +++ b/include/lapi/quotactl.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Copyright (c) 2017-2019 Fujitsu Ltd. + * Copyright (c) 2017-2021 FUJITSU LIMITED. All rights reserved * Author: Xiao Yang - * Author: Yang Xu + * Author: Yang Xu */ #ifndef LAPI_QUOTACTL_H__ @@ -10,6 +10,14 @@ #include "config.h" #include +#include "lapi/syscalls.h" + +#ifndef HAVE_QUOTACTL_FD +static inline int quotactl_fd(int fd, int cmd, int id, caddr_t addr) +{ + return tst_syscall(__NR_quotactl_fd, fd, cmd, id, addr); +} +#endif #ifdef HAVE_STRUCT_IF_NEXTDQBLK # include From patchwork Tue Nov 9 10:54:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552917 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=nTS3Eg2C; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPxx4gyFz9s1l for ; Tue, 9 Nov 2021 21:54:45 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4B82E3C07C6 for ; Tue, 9 Nov 2021 11:54:43 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 7CBBF3C06DC for ; Tue, 9 Nov 2021 11:54:41 +0100 (CET) Received: from mail1.bemta34.messagelabs.com (mail1.bemta34.messagelabs.com [195.245.231.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 9A33D10006D0 for ; Tue, 9 Nov 2021 11:54:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455279; i=@fujitsu.com; bh=Gz/ASBTAe7RKswUMVKG9crFoh2DTqNTzQPRtFHHOHtw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nTS3Eg2CI7FfvTf6FXG5oWAs9A09DAqHDlGUFd5bFL9ke69l3E+8ccYXwofdDmvQp +2dQI2rvMcapyplQpIm9zcrcahybovACEBKFStft/jBedXnO2DiDuCQ4t+07B8Q0Bd YsH6IwGkmO1Qx+sk4Q4r0rShFAvXNNkGCd1NE6i+2mkMeMk3GL9Bzwy+8OhC/8aApb /GUqvojPCxK33WMOgoKVj4s1dmNLhnldqAMyLPzP7PCtBXwXH/oBDiZ3r7T6h8s/r0 q2xLbKhRJ0UWK5FzwbzAXOkghJ0ZPBDuQVIFLIkceo9JNLIoLgSNKHUoPtuOkAsVI3 kMwAUN+O9U8wA== Received: from [100.115.35.109] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-3.bemta.az-a.eu-west-2.aws.ess.symcld.net id 3E/76-01854-F635A816; Tue, 09 Nov 2021 10:54:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLIsWRWlGSWpSXmKPExsViZ8ORqJsf3JV o0P6P12LF9x2MDowe+36vYw1gjGLNzEvKr0hgzeg5MZOlYFtAxZEmvQbGzy5djFwcQgJnGSWW 9S9mhnB2Mklc+vqbCcLZzShx7+4v1i5GTg42AU2JZ50LmEFsEQEJiY6Gt+wgNrOAusTySb+YQ GxhgSSJhmlz2UBsFgEViVt7d4D18gp4SEx68wWsRkJAQWLKw/dgczgFPCX2XvjPAmILAdXcmn YSql5Q4uTMJywQ8yUkDr54wQzRqyhxqeMbI4RdITFrVhvUTDWJq+c2MU9gFJyFpH0WkvYFjEy rGK2TijLTM0pyEzNzdA0NDHQNDU11jc10Dc0t9BKrdBP1Ukt1y1OLS3SN9BLLi/VSi4v1iitz k3NS9PJSSzYxAsM4pVhl0w7GH5e+6R1ilORgUhLlvSzWlSjEl5SfUpmRWJwRX1Sak1p8iFGGg 0NJgjfBHygnWJSanlqRlpkDjCmYtAQHj5IIr54PUJq3uCAxtzgzHSJ1itGYY+fReYuYOd79XL yIWYglLz8vVUqc93UgUKkASGlGaR7cIFisX2KUlRLmZWRgYBDiKUgtys0sQZV/xSjOwagkzPs JZApPZl4J3L5XQKcwAZ1y8Es7yCkliQgpqQam1Ob492LHJ9wTY4g42Cr399uynMp7jE+fLLXa wbFOboGNg9ez1PK+dU5Bm97msr6+yih6rpzjh414jFm5npC2bE2qQvYnlmNH+ngt+NNeHcvnZ mk6+LL6Nf+BzLpkm2k6f+Ys5tsXL3dVKmrDpe/TZx5Ynh35u+jpilx71eiz3z5IKPtvmefaOz 0vXu44f0uyO/8Pj83Cf2Y9uzDRcI+s4KFks2/sEpO3pSi06e06fvLWDGYhC66973bHlOioRBz MlF3J8o719YMPPzvZXqoby+vda5yx26StxVNJf0l+ysR/3IV7NgvkHu3TaT4XeLvt7fmdLy+v CVH+5iARVs0+89ahpX97Q8Jj1mhMLLioxFKckWioxVxUnAgARS4QWnADAAA= X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-15.tower-565.messagelabs.com!1636455279!345450!1 X-Originating-IP: [62.60.8.97] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29012 invoked from network); 9 Nov 2021 10:54:39 -0000 Received: from unknown (HELO n03ukasimr01.n03.fujitsu.local) (62.60.8.97) by server-15.tower-565.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:54:39 -0000 Received: from n03ukasimr01.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTP id C28D2100234 for ; Tue, 9 Nov 2021 10:54:38 +0000 (GMT) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTPS id A356D10024A for ; Tue, 9 Nov 2021 10:54:38 +0000 (GMT) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:54:34 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:54:43 +0800 Message-ID: <1636455285-8372-2-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636455285-8372-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1636455285-8372-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v3 07/12] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" It uses two variants(quotactl and quotactl_fd). The difference for quotactl01 is that we don't use quotacheck command and quota info hidden in filesystem. It also needs mkfs.ext4 supports quota feature. This feature is disabled[1] before e2fsprog 1.42 when not specifying a --enable-quota option in compile-time and e2fsprog 1.43 remove this disable[2]. So we should limit the e2fsprog to 1.43. The e2fsprog version check will move to ltp lib when this patchset is merged. [1]https://ext4.wiki.kernel.org/index.php/Quota [2]https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?h=v1.43&id=9e8fcd6e Signed-off-by: Yang Xu --- runtest/syscalls | 1 + testcases/kernel/syscalls/quotactl/.gitignore | 1 + .../kernel/syscalls/quotactl/quotactl08.c | 233 ++++++++++++++++++ .../syscalls/quotactl/quotactl_syscall_var.h | 32 +++ 4 files changed, 267 insertions(+) create mode 100644 testcases/kernel/syscalls/quotactl/quotactl08.c create mode 100644 testcases/kernel/syscalls/quotactl/quotactl_syscall_var.h diff --git a/runtest/syscalls b/runtest/syscalls index 1e6d46744..583455629 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1071,6 +1071,7 @@ quotactl04 quotactl04 quotactl05 quotactl05 quotactl06 quotactl06 quotactl07 quotactl07 +quotactl08 quotactl08 read01 read01 read02 read02 diff --git a/testcases/kernel/syscalls/quotactl/.gitignore b/testcases/kernel/syscalls/quotactl/.gitignore index 8d2ef94d9..dab9b3420 100644 --- a/testcases/kernel/syscalls/quotactl/.gitignore +++ b/testcases/kernel/syscalls/quotactl/.gitignore @@ -5,3 +5,4 @@ /quotactl05 /quotactl06 /quotactl07 +/quotactl08 diff --git a/testcases/kernel/syscalls/quotactl/quotactl08.c b/testcases/kernel/syscalls/quotactl/quotactl08.c new file mode 100644 index 000000000..c4a226c51 --- /dev/null +++ b/testcases/kernel/syscalls/quotactl/quotactl08.c @@ -0,0 +1,233 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved + * Author: Yang Xu + */ + +/*\ + * [Description] + * This testcases checks that quotactl(2) on ext4 filesystem succeeds to: + * + * - turn on quota with Q_QUOTAON flag for user + * - set disk quota limits with Q_SETQUOTA flag for user + * - get disk quota limits with Q_GETQUOTA flag for user + * - set information about quotafile with Q_SETINFO flag for user + * - get information about quotafile with Q_GETINFO flag for user + * - get quota format with Q_GETFMT flag for user + * - update quota usages with Q_SYNC flag for user + * - get disk quota limit greater than or equal to ID with Q_GETNEXTQUOTA flag for user + * - turn off quota with Q_QUOTAOFF flag for user + * - turn on quota with Q_QUOTAON flag for group + * - set disk quota limits with Q_SETQUOTA flag for group + * - get disk quota limits with Q_GETQUOTA flag for group + * - set information about quotafile with Q_SETINFO flag for group + * - get information about quotafile with Q_GETINFO flag for group + * - get quota format with Q_GETFMT flag for group + * - update quota usages with Q_SYNC flag for group + * - get disk quota limit greater than or equal to ID with Q_GETNEXTQUOTA flag for group + * - turn off quota with Q_QUOTAOFF flag for group + * + * It is similar to quotactl01.c, only two difference + * - use new quotactl_fd syscalls if supports + * - quota file hidden in filesystem + * + * Minimum e2fsprogs version required is 1.43. + */ + +#include +#include +#include +#include +#include "tst_test.h" +#include "quotactl_syscall_var.h" +#include "tst_safe_stdio.h" + +static int32_t fmt_id = QFMT_VFS_V1; +static int test_id, mount_flag; +static struct dqblk set_dq = { + .dqb_bsoftlimit = 100, + .dqb_valid = QIF_BLIMITS +}; +static struct dqblk res_dq; + +static struct dqinfo set_qf = { + .dqi_bgrace = 80, + .dqi_valid = IIF_BGRACE +}; +static struct dqinfo res_qf; +static int32_t fmt_buf; +static int getnextquota_nsup; + +static struct if_nextdqblk res_ndq; + +static struct tcase { + int cmd; + int *id; + void *addr; + void *set_data; + void *res_data; + int sz; + char *des; + char *tname; +} tcases[] = { + {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, NULL, + NULL, NULL, 0, "turn on quota for user", + "QCMD(Q_QUOTAON, USRQUOTA)"}, + + {QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dq, + NULL, NULL, 0, "set disk quota limit for user", + "QCMD(Q_SETQUOTA, USRQUOTA)"}, + + {QCMD(Q_GETQUOTA, USRQUOTA), &test_id, &res_dq, + &set_dq.dqb_bsoftlimit, &res_dq.dqb_bsoftlimit, + sizeof(res_dq.dqb_bsoftlimit), "get disk quota limit for user", + "QCMD(Q_GETQUOTA, USRQUOTA)"}, + + {QCMD(Q_SETINFO, USRQUOTA), &test_id, &set_qf, + NULL, NULL, 0, "set information about quotafile for user", + "QCMD(Q_SETINFO, USRQUOTA)"}, + + {QCMD(Q_GETINFO, USRQUOTA), &test_id, &res_qf, + &set_qf.dqi_bgrace, &res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace), + "get information about quotafile for user", + "QCMD(Q_GETINFO, USRQUOTA)"}, + + {QCMD(Q_GETFMT, USRQUOTA), &test_id, &fmt_buf, + &fmt_id, &fmt_buf, sizeof(fmt_buf), + "get quota format for user", + "QCMD(Q_GETFMT, USRQUOTA)"}, + + {QCMD(Q_SYNC, USRQUOTA), &test_id, &res_dq, + NULL, NULL, 0, "update quota usages for user", + "QCMD(Q_SYNC, USRQUOTA)"}, + + {QCMD(Q_GETNEXTQUOTA, USRQUOTA), &test_id, &res_ndq, + &test_id, &res_ndq.dqb_id, sizeof(res_ndq.dqb_id), + "get next disk quota limit for user", + "QCMD(Q_GETNEXTQUOTA, USRQUOTA)"}, + + {QCMD(Q_QUOTAOFF, USRQUOTA), &test_id, NULL, + NULL, NULL, 0, "turn off quota for user", + "QCMD(Q_QUOTAOFF, USRQUOTA)"}, + + {QCMD(Q_QUOTAON, GRPQUOTA), &fmt_id, NULL, + NULL, NULL, 0, "turn on quota for group", + "QCMD(Q_QUOTAON, GRPQUOTA)"}, + + {QCMD(Q_SETQUOTA, GRPQUOTA), &test_id, &set_dq, + NULL, NULL, 0, "set disk quota limit for group", + "QCMD(Q_SETQUOTA, GRPQUOTA)"}, + + {QCMD(Q_GETQUOTA, GRPQUOTA), &test_id, &res_dq, &set_dq.dqb_bsoftlimit, + &res_dq.dqb_bsoftlimit, sizeof(res_dq.dqb_bsoftlimit), + "set disk quota limit for group", + "QCMD(Q_GETQUOTA, GRPQUOTA)"}, + + {QCMD(Q_SETINFO, GRPQUOTA), &test_id, &set_qf, + NULL, NULL, 0, "set information about quotafile for group", + "QCMD(Q_SETINFO, GRPQUOTA)"}, + + {QCMD(Q_GETINFO, GRPQUOTA), &test_id, &res_qf, &set_qf.dqi_bgrace, + &res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace), + "get information about quotafile for group", + "QCMD(Q_GETINFO, GRPQUOTA)"}, + + {QCMD(Q_GETFMT, GRPQUOTA), &test_id, &fmt_buf, + &fmt_id, &fmt_buf, sizeof(fmt_buf), "get quota format for group", + "QCMD(Q_GETFMT, GRPQUOTA)"}, + + {QCMD(Q_SYNC, GRPQUOTA), &test_id, &res_dq, + NULL, NULL, 0, "update quota usages for group", + "QCMD(Q_SYNC, GRPQUOTA)"}, + + {QCMD(Q_GETNEXTQUOTA, GRPQUOTA), &test_id, &res_ndq, + &test_id, &res_ndq.dqb_id, sizeof(res_ndq.dqb_id), + "get next disk quota limit for group", + "QCMD(Q_GETNEXTQUOTA, GRPQUOTA)"}, + + {QCMD(Q_QUOTAOFF, GRPQUOTA), &test_id, NULL, + NULL, NULL, 0, "turn off quota for group", + "QCMD(Q_QUOTAOFF, GRPQUOTA)"}, +}; + +static void setup(void) +{ + FILE *f; + const char *const fs_opts[] = { "-O quota", NULL}; + int rc, major, minor, patch; + + quotactl_info(); + f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r"); + rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch); + if (rc != 3) + tst_res(TWARN, "Unable parse version number"); + else if (major * 10000 + minor * 100 + patch < 14300) + tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for quota option, test skipped"); + pclose(f); + + SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL); + SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL); + mount_flag = 1; + + fd = SAFE_OPEN(MNTPOINT, O_RDONLY); + TEST(do_quotactl(fd, QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev, + 0, (void *) &res_ndq)); + if (TST_ERR == EINVAL || TST_ERR == ENOSYS) + getnextquota_nsup = 1; +} + +static void cleanup(void) +{ + if (fd > -1) + SAFE_CLOSE(fd); + 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]; + + res_dq.dqb_bsoftlimit = 0; + res_qf.dqi_igrace = 0; + fmt_buf = 0; + res_ndq.dqb_id = -1; + + tst_res(TINFO, "Test #%d: %s", n, tc->tname); + if ((tc->cmd == QCMD(Q_GETNEXTQUOTA, USRQUOTA) || + tc->cmd == QCMD(Q_GETNEXTQUOTA, GRPQUOTA)) && + getnextquota_nsup) { + tst_res(TCONF, "current system doesn't support this cmd"); + return; + } + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, *tc->id, tc->addr)); + if (TST_RET == -1) { + tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des); + return; + } + + if (memcmp(tc->res_data, tc->set_data, tc->sz)) { + tst_res(TFAIL, "quotactl failed to %s", tc->des); + tst_res_hexd(TINFO, tc->res_data, tc->sz, "retval: "); + tst_res_hexd(TINFO, tc->set_data, tc->sz, "expected: "); + return; + } + + tst_res(TPASS, "quotactl succeeded to %s", tc->des); +} + +static struct tst_test test = { + .needs_root = 1, + .needs_kconfigs = (const char *[]) { + "CONFIG_QFMT_V2", + NULL + }, + .test = verify_quota, + .tcnt = ARRAY_SIZE(tcases), + .mntpoint = MNTPOINT, + .dev_fs_type = "ext4", + .needs_device = 1, + .setup = setup, + .cleanup = cleanup, + .test_variants = QUOTACTL_SYSCALL_VARIANTS, +}; diff --git a/testcases/kernel/syscalls/quotactl/quotactl_syscall_var.h b/testcases/kernel/syscalls/quotactl/quotactl_syscall_var.h new file mode 100644 index 000000000..3d1a2c8f5 --- /dev/null +++ b/testcases/kernel/syscalls/quotactl/quotactl_syscall_var.h @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ + +#ifndef LTP_QUOTACTL_SYSCALL_VAR_H +#define LTP_QUOTACTL_SYSCALL_VAR_H + +#include "lapi/quotactl.h" + +#define QUOTACTL_SYSCALL_VARIANTS 2 +#define MNTPOINT "mntpoint" + +static int fd = -1; + +static int do_quotactl(int fd, int cmd, const char *special, int id, caddr_t addr) +{ + if (tst_variant == 0) + return quotactl(cmd, special, id, addr); + return quotactl_fd(fd, cmd, id, addr); +} + +static void quotactl_info(void) +{ + if (tst_variant == 0) + tst_res(TINFO, "Test quotactl()"); + else + tst_res(TINFO, "Test quotactl_fd()"); +} + +#endif /* LTP_QUOTACTL_SYSCALL_VAR_H */ From patchwork Tue Nov 9 10:54:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552920 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=BnSQls3K; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPyh0Wk6z9s1l for ; Tue, 9 Nov 2021 21:55:23 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B58633C07B8 for ; Tue, 9 Nov 2021 11:55:21 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 71E2A3C07BA for ; Tue, 9 Nov 2021 11:55:09 +0100 (CET) Received: from mail1.bemta26.messagelabs.com (mail1.bemta26.messagelabs.com [85.158.142.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 283181A014B5 for ; Tue, 9 Nov 2021 11:55:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455308; i=@fujitsu.com; bh=WabrcnmiGqZzKqL5V1EwfJNGB2ozxT2qRWIRcSWfFyU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BnSQls3Kbf2D7R5f1VgTo+bz6NrgfXLt2cYJAZrGfAKoelIes1QasSVSHf6/ujr/X FA/Smp4DvM3uJ/NvC1DkSoe98qQo5rOe0jRWsxPBe/0E7jg/x0ihELMEoDMCOSl4lI ARHWuGiOmnvjOUzOJRh/xH0iSeWqtzeaOPR4vj/fMfwmFa4qOzfulMKW3xX2RRMlAX w+DrO/GT1+4biOjE4OBE11yWky7lm2W4wbYBnzjXiLSYBZD49Q784Mbvv00W0JdACI Bw3IviSHHYsjxipriA5H+wPJCSJfIUAe6OdAIX89zEEFIXdg9YbgX7keBuiOFK3kd+ 1GgZzS4Lmsldg== Received: from [100.113.7.62] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-3.bemta.az-b.eu-central-1.aws.symcld.net id 7A/B0-30139-C835A816; Tue, 09 Nov 2021 10:55:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJIsWRWlGSWpSXmKPExsViZ8MxSbc7uCv R4Oh8K4sV33cwOjB67Pu9jjWAMYo1My8pvyKBNePtzCnsBY/0KrYtsm5gvKHexcjFISRwllHi 3ZZ37BDOTiaJg0c/MEM4uxklNm06wNLFyMnBJqAp8axzATOILSIgIdHR8JYdxGYWUJdYPukXE 4gtLOArsf3CBMYuRg4OFgEViZObdUDCvAIeEl/vNbGB2BICChJTHr4HG8Mp4Cmx98J/sPFCQD W3pp1khagXlDg58wkLxHgJiYMvXjBD9CpKXOr4xghhV0jMmtXGBGGrSVw9t4l5AqPgLCTts5C 0L2BkWsVokVSUmZ5RkpuYmaNraGCga2horGsGZOklVukm6aWW6ian5pUUJQIl9RLLi/WKK3OT c1L08lJLNjECwzelkI1rB+PT1x/0DjFKcjApifJeFutKFOJLyk+pzEgszogvKs1JLT7EKMPBo STBm+APlBMsSk1PrUjLzAHGEkxagoNHSYRXzwcozVtckJhbnJkOkTrFaMxx+fq8RcwcfzYsWc QsxJKXn5cqJc6bEgRUKgBSmlGaBzcIFuOXGGWlhHkZGRgYhHgKUotyM0tQ5V8xinMwKgnzfgo EmsKTmVcCt+8V0ClMQKcc/NIOckpJIkJKqoFp/TG/jS//zq5b/P6x1VexHffW5M9RWdh6Xy/u 2RWWRZ4/CsrsPO2XHqu7fnUDz/X0WTa7Dyy3evaseO2p/W5vPild1rLO3/3T6CuvtYH3RpH9d Vf7zouuyNaXz87wnJ7H+/REUmr0q9XuApdubo6ZVztphXXUzMxjTyOF059t4JWaYBDU9yD5yY u9fHMOHlslLKNX4+7lN5dl91nRM2Xv2bukjQM/fPDcEJtXt2D/9Wm9DPENN6svym+9pPhm+ak Z5z547GPUertcYWW/vbRdX6jSMa2W7s9ZfW5N8l8O7DXins/kGpQypcjzZ8e2BecXTNr59dZD 3XdTy5xrUj+9YOy8uCLvfkVi86/5txWOBiixFGckGmoxFxUnAgCa+JKPbAMAAA== X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-17.tower-238.messagelabs.com!1636455307!632292!1 X-Originating-IP: [62.60.8.146] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3098 invoked from network); 9 Nov 2021 10:55:07 -0000 Received: from unknown (HELO n03ukasimr02.n03.fujitsu.local) (62.60.8.146) by server-17.tower-238.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:55:07 -0000 Received: from n03ukasimr02.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTP id 75928100465 for ; Tue, 9 Nov 2021 10:55:07 +0000 (GMT) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTPS id 688BE100359 for ; Tue, 9 Nov 2021 10:55:07 +0000 (GMT) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:54:45 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:54:44 +0800 Message-ID: <1636455285-8372-3-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636455285-8372-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1636455285-8372-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH v3 08/12] syscalls/quotactl02, 5: Add quotactl_fd test variant X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Also remove useless geteuid. Signed-off-by: Yang Xu --- testcases/kernel/syscalls/quotactl/quotactl02.c | 15 ++++++++++++--- testcases/kernel/syscalls/quotactl/quotactl02.h | 17 ++++++++--------- testcases/kernel/syscalls/quotactl/quotactl05.c | 15 ++++++++++++--- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.c b/testcases/kernel/syscalls/quotactl/quotactl02.c index 55a6a8906..56fa23b9d 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl02.c +++ b/testcases/kernel/syscalls/quotactl/quotactl02.c @@ -99,11 +99,18 @@ static struct t_case { static void setup(void) { - test_id = geteuid(); + quotactl_info(); + fd = SAFE_OPEN(MNTPOINT, O_RDONLY); check_support_cmd(USRQUOTA); check_support_cmd(GRPQUOTA); } +static void cleanup(void) +{ + if (fd > -1) + SAFE_CLOSE(fd); +} + static void verify_quota(unsigned int n) { struct t_case *tc = &tcases[n]; @@ -122,7 +129,7 @@ static void verify_quota(unsigned int n) return; } - TEST(quotactl(tc->cmd, tst_device->dev, test_id, tc->addr)); + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, test_id, tc->addr)); if (TST_RET == -1) { tst_res(TFAIL | TTERRNO, "quotactl() failed to %s", tc->des); return; @@ -144,9 +151,11 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .mount_device = 1, .dev_fs_type = "xfs", - .mntpoint = mntpoint, + .mntpoint = MNTPOINT, .mnt_data = "usrquota,grpquota", .setup = setup, + .cleanup = cleanup, + .test_variants = QUOTACTL_SYSCALL_VARIANTS, }; #else TST_TEST_TCONF("System doesn't have "); diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.h b/testcases/kernel/syscalls/quotactl/quotactl02.h index 3351fb578..145ce7039 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl02.h +++ b/testcases/kernel/syscalls/quotactl/quotactl02.h @@ -12,7 +12,7 @@ #include #include #include "tst_test.h" -#include "lapi/quotactl.h" +#include "quotactl_syscall_var.h" #ifdef HAVE_XFS_XQM_H # include @@ -24,7 +24,6 @@ static struct fs_disk_quota set_dquota = { static uint32_t test_id; static int x_getnextquota_nsup; static int x_getstatv_nsup; -static const char mntpoint[] = "mnt_point"; void check_support_cmd(int quotatype) { @@ -36,12 +35,12 @@ void check_support_cmd(int quotatype) x_getnextquota_nsup = 0; x_getstatv_nsup = 0; - TEST(quotactl(QCMD(Q_XGETNEXTQUOTA, quotatype), tst_device->dev, + TEST(do_quotactl(fd, QCMD(Q_XGETNEXTQUOTA, quotatype), tst_device->dev, test_id, (void *) &resfs_dquota)); if (TST_ERR == EINVAL || TST_ERR == ENOSYS) x_getnextquota_nsup = 1; - TEST(quotactl(QCMD(Q_XGETQSTATV, quotatype), tst_device->dev, test_id, + TEST(do_quotactl(fd, QCMD(Q_XGETQSTATV, quotatype), tst_device->dev, test_id, (void *) &resfs_qstatv)); if (TST_ERR == EINVAL || TST_ERR == ENOSYS) x_getstatv_nsup = 1; @@ -52,7 +51,7 @@ void check_qoff(int subcmd, char *desp, int flag) int res; struct fs_quota_stat res_qstat; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstat); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_qstat); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs quota off status"); @@ -72,7 +71,7 @@ void check_qon(int subcmd, char *desp, int flag) int res; struct fs_quota_stat res_qstat; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstat); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_qstat); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs quota on status"); @@ -94,7 +93,7 @@ void check_qoffv(int subcmd, char *desp, int flag) .qs_version = FS_QSTATV_VERSION1, }; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstatv); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_qstatv); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs quota off stav"); @@ -116,7 +115,7 @@ void check_qonv(int subcmd, char *desp, int flag) .qs_version = FS_QSTATV_VERSION1 }; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstatv); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_qstatv); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs quota on statv"); @@ -138,7 +137,7 @@ void check_qlim(int subcmd, char *desp) res_dquota.d_rtb_softlimit = 0; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_dquota); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_dquota); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs disk quota limits"); diff --git a/testcases/kernel/syscalls/quotactl/quotactl05.c b/testcases/kernel/syscalls/quotactl/quotactl05.c index 15a6c1e67..e56e191df 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl05.c +++ b/testcases/kernel/syscalls/quotactl/quotactl05.c @@ -62,10 +62,17 @@ static struct t_case { static void setup(void) { - test_id = geteuid(); + quotactl_info(); + fd = SAFE_OPEN(MNTPOINT, O_RDONLY); check_support_cmd(PRJQUOTA); } +static void cleanup(void) +{ + if (fd > -1) + SAFE_CLOSE(fd); +} + static void verify_quota(unsigned int n) { struct t_case *tc = &tcases[n]; @@ -85,7 +92,7 @@ static void verify_quota(unsigned int n) return; } - TEST(quotactl(tc->cmd, tst_device->dev, test_id, tc->addr)); + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, test_id, tc->addr)); if (TST_RET == -1) { tst_res(TFAIL | TTERRNO, "quotactl() failed to %s", tc->des); return; @@ -107,9 +114,11 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .mount_device = 1, .dev_fs_type = "xfs", - .mntpoint = mntpoint, + .mntpoint = MNTPOINT, .mnt_data = "prjquota", .setup = setup, + .cleanup = cleanup, + .test_variants = QUOTACTL_SYSCALL_VARIANTS, }; #else From patchwork Tue Nov 9 10:54:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552919 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=lRLiJH4B; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPyT4J7hz9s1l for ; Tue, 9 Nov 2021 21:55:13 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 745513C07BC for ; Tue, 9 Nov 2021 11:55:11 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id A40D33C04C2 for ; Tue, 9 Nov 2021 11:55:09 +0100 (CET) Received: from mail1.bemta34.messagelabs.com (mail1.bemta34.messagelabs.com [195.245.231.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 10FD914125F0 for ; Tue, 9 Nov 2021 11:55:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455308; i=@fujitsu.com; bh=yaHU5Y+z6tuguFfJNAPUvA5YK4UBE2aOgVuTE58SOIY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lRLiJH4BKjNFDNgOG/xsdpwxQ/dFmQJZ4K7IvD1dfte3x50Zx73B9rH/7vmEX+rtI 31LcALPxuVJBuaQJ93Qty6dqIoNOFEWZumVinbfoZZZ+SO0QDQ12/CypvS6VSULrBb i12kgjG+QvxM0KQnNLYjL2fXViuPBIKDgthfVDhliArYheMHpRfsP+Rnm1pCv6OyYm fkcmuWCpWYbF6FbWjb6WUJnG2/rdiG6MAT7Fo8C7iuXe/2AYJJl33QKQbSy2wKFlcp dvPbX7eurlxVxCWetaa0FQU03yauV1U1f0cjkiPb+4MUTzwXjEx5W6ogFCprIZQvNY RvQYesaWWr37A== Received: from [100.115.35.109] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-4.bemta.az-a.eu-west-2.aws.ess.symcld.net id 24/8D-02703-C835A816; Tue, 09 Nov 2021 10:55:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOIsWRWlGSWpSXmKPExsViZ8MxSbc7uCv R4FWfucWK7zsYHRg99v1exxrAGMWamZeUX5HAmnFoxXT2gqP8Fbf3tDM2MM7h7WLk4hASOMso sWnuQ/YuRk4gZyeTRO8CD4jEbkaJy1+6wRJsApoSzzoXMIPYIgISEh0Nb8HizALqEssn/WICs YUFvCU233zOAmKzCKhIHJv2gxXE5hXwkPi+cQIjiC0hoCAx5eF7sDmcAp4Sey/8Z4FY7CFxa9 pJqHpBiZMzn7BAzJeQOPjiBTNEr6LEpY5vUHMqJGbNamOCsNUkrp7bxDyBUXAWkvZZSNoXMDK tYrROKspMzyjJTczM0TU0MNA1NDTVNTbVNTQ30kus0k3USy3VLU8tLtEFcsuL9VKLi/WKK3OT c1L08lJLNjECwzilWHnNDsb2y9/0DjFKcjApifJeFutKFOJLyk+pzEgszogvKs1JLT7EKMPBo STBm+APlBMsSk1PrUjLzAHGFExagoNHSYRXzwcozVtckJhbnJkOkTrFqMtx+fq8RcxCLHn5ea lS4rwpQUBFAiBFGaV5cCNg8X2JUVZKmJeRgYFBiKcgtSg3swRV/hWjOAejkjDvp0CgKTyZeSV wm14BHcEEdMTBL+0gR5QkIqSkGpjqW/8HH/0bynZsoWakVFONjK6P+8x1fa47p+2U/lUhYcRj 5vi/UbZUe3VZIZvEVJUzml+vP78RN9/lXeWJ8ot7f510/pTAf+NKUaKBUtznVS6yybzK4aYnD PzDPJnTAm/W/A93mfHVbNb50y9kH33lClDhvPIyLu7S7ufLdZ+e9vDtyTFf1blA9/ceoVN/F3 zvlcide1NC47Dj/EX23ieurP+SpR916O+VV4d9dwb+U9KdlGw56ZfOEn222O8LWpaK93Q++dR 77KTyW4U6HttHu6Qnd7cfeHTkzacz26fY3livfmD6o/QHrtsN3BV0n6XOiNWN5vwpFLFWnfuK Zs4G5tLzR29esJbtWWFQFnJAiaU4I9FQi7moOBEAILAYPWoDAAA= X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-22.tower-565.messagelabs.com!1636455307!345344!1 X-Originating-IP: [62.60.8.146] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31597 invoked from network); 9 Nov 2021 10:55:07 -0000 Received: from unknown (HELO n03ukasimr02.n03.fujitsu.local) (62.60.8.146) by server-22.tower-565.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:55:07 -0000 Received: from n03ukasimr02.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTP id 7DB3510046B for ; Tue, 9 Nov 2021 10:55:07 +0000 (GMT) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTPS id 6F852100460 for ; Tue, 9 Nov 2021 10:55:07 +0000 (GMT) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:54:50 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:54:45 +0800 Message-ID: <1636455285-8372-4-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636455285-8372-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1636455285-8372-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v3 09/12] syscalls/quotactl03: Add quotactl_fd test variant X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Also remove dupcliated header file. Signed-off-by: Yang Xu --- .../kernel/syscalls/quotactl/quotactl03.c | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/testcases/kernel/syscalls/quotactl/quotactl03.c b/testcases/kernel/syscalls/quotactl/quotactl03.c index e0e4bf5b2..22f5496b6 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl03.c +++ b/testcases/kernel/syscalls/quotactl/quotactl03.c @@ -23,19 +23,17 @@ */ #define _GNU_SOURCE -#include "config.h" #include #include #include #include #include "tst_test.h" -#include "lapi/quotactl.h" +#include "quotactl_syscall_var.h" #ifdef HAVE_XFS_XQM_H # include -static const char mntpoint[] = "mnt_point"; static uint32_t test_id = 0xfffffffc; static void verify_quota(void) @@ -44,7 +42,7 @@ static void verify_quota(void) res_dquota.d_id = 1; - TEST(quotactl(QCMD(Q_XGETNEXTQUOTA, USRQUOTA), tst_device->dev, + TEST(do_quotactl(fd, QCMD(Q_XGETNEXTQUOTA, USRQUOTA), tst_device->dev, test_id, (void *)&res_dquota)); if (TST_RET != -1) { tst_res(TFAIL, "quotactl() found the next active ID: %u unexpectedly", @@ -63,7 +61,21 @@ static void verify_quota(void) tst_res(TPASS, "quotactl() failed with ENOENT as expected"); } +static void setup(void) +{ + quotactl_info(); + fd = SAFE_OPEN(MNTPOINT, O_RDONLY); +} + +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", @@ -72,8 +84,9 @@ static struct tst_test test = { .test_all = verify_quota, .mount_device = 1, .dev_fs_type = "xfs", - .mntpoint = mntpoint, + .mntpoint = MNTPOINT, .mnt_data = "usrquota", + .test_variants = QUOTACTL_SYSCALL_VARIANTS, .tags = (const struct tst_tag[]) { {"linux-git", "657bdfb7f5e6"}, {} From patchwork Tue Nov 9 10:56:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552921 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=rI8c7amN; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpPzp0cVvz9s1l for ; Tue, 9 Nov 2021 21:56:22 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0E14F3C07BA for ; Tue, 9 Nov 2021 11:56:20 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 3BC1B3C04C2 for ; Tue, 9 Nov 2021 11:56:18 +0100 (CET) Received: from mail1.bemta34.messagelabs.com (mail1.bemta34.messagelabs.com [195.245.231.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id CA0DB60157B for ; Tue, 9 Nov 2021 11:56:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455377; i=@fujitsu.com; bh=Kp5lnxM2KN10+a+vDkQlUl4mV37rg0OH7iOsGvdqsJI=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=rI8c7amNaOu3BnKwC5G5FAlU15GCRnjz/ldEOHecLkwpZO8XRyUlJKabgfwFygUfo vTD3ffXDJmlRvg/1QEBpB+2yrt8pXLbAgpQ4bW733RXZSiyBWyRkSk0QalSB1lZmDu 8OeBTMT4bfuh5u7B9No/WQHUerXinru2U4TQcWZMS3yAsHewAj96esjns6z3TupyOE KQaJ30LP17ODEUbB/Hdw/LEMa5EDpnszBuiuPhVSePo55AI6PnuOcAR1asqso/iw8l xiVtSEv1H5MrINoAWFGsdVL4ZV3Gup2JxmoDLvu7b8wyCWv780tcrg8gRDmUibCjiK fCCT/J5jiE3iQ== Received: from [100.115.36.144] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-4.bemta.az-a.eu-west-2.aws.ess.symcld.net id 99/C0-02703-1D35A816; Tue, 09 Nov 2021 10:56:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJIsWRWlGSWpSXmKPExsViZ8MxRfdCcFe iwYZDOhYrvu9gdGD02Pd7HWsAYxRrZl5SfkUCa8aBlvnMBT0CFY93fWZtYLzL28XIxSEk0Mgk cfD+c2YIZzejROfft+xdjJwcbAKaEs86FzCD2CICEhIdDRBxZgF1ieWTfjGB2MIC3hI3vv5h6 2Lk4GARUJH4NI0DJMwr4CHxYs9hsHIJAQWJKQ/fM0PEBSVOznzCAjFGQuLgixfMEDWKEpc6vj FC2BUSs2a1MU1g5J2FpGUWkpYFjEyrGK2SijLTM0pyEzNzdA0NDHQNDU11jc10zU31Eqt0E/V SS3XLU4tLdI30EsuL9VKLi/WKK3OTc1L08lJLNjECQyylWMV7B2Pj5W96hxglOZiURHkvi3Ul CvEl5adUZiQWZ8QXleakFh9ilOHgUJLgTfAHygkWpaanVqRl5gDDHSYtwcGjJMKr5wOU5i0uS MwtzkyHSJ1iVJQS500JAkoIgCQySvPg2mAxdolRVkqYl5GBgUGIpyC1KDezBFX+FaM4B6OSMO +nQKApPJl5JXDTXwEtZgJafPBLO8jikkSElFQDU9mcf2bfm5/JLrV6nVIv7eq4QCNMXmj1u9s 72gXXZV2+OyPavJqXY4PB4+Vr9z/0i372zCdS5Hd53q0uq5a1X/nvcLWGHJ9t4W3EtfvFlU1r Z+1m5HYW2fVv5eVDW92482L3/GSYJ+he4dF/64mt+alV//g1JhyL2FaZpl0pLSrpf3vBU/E9x m8uRlbwCN302rfrjfWrAxZuIceFPm/aO2HDlrh1hY6+e5RsO9OVtj9PufgiguH6P673oQqu1R d5F7Hviy8sN3Tjdj+REfB0pcGS109NPn3NfK2kciv3NO923o9HGtTytize25uwbu1mxkuqzRd rfkw1fXdux73j3nvkXjgFM/Ascz1u+FTqhK4SS3FGoqEWc1FxIgC8Pc2XLAMAAA== X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-20.tower-548.messagelabs.com!1636455376!345176!1 X-Originating-IP: [62.60.8.148] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15056 invoked from network); 9 Nov 2021 10:56:16 -0000 Received: from unknown (HELO mailhost1.uk.fujitsu.com) (62.60.8.148) by server-20.tower-548.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:56:16 -0000 Received: from R01UKEXCASM126.r01.fujitsu.local ([10.183.43.178]) by mailhost1.uk.fujitsu.com (8.14.5/8.14.5) with ESMTP id 1A9AuGmE018878 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Tue, 9 Nov 2021 10:56:16 GMT Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:56:14 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:56:34 +0800 Message-ID: <1636455396-8508-1-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v3 10/12] syscalls/quotactl04: Add quotactl_fd test variant X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Also remove useless geteuid. Signed-off-by: Yang Xu --- testcases/kernel/syscalls/quotactl/quotactl04.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c index dab61cf4d..f71016967 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl04.c +++ b/testcases/kernel/syscalls/quotactl/quotactl04.c @@ -29,10 +29,10 @@ #include #include "tst_safe_stdio.h" #include "tst_test.h" -#include "lapi/quotactl.h" +#include "quotactl_syscall_var.h" #define FMTID QFMT_VFS_V1 -#define MNTPOINT "mntpoint" + static int32_t fmt_id = FMTID; static int test_id, mount_flag; static struct dqblk set_dq = { @@ -125,7 +125,7 @@ static void setup(void) const char *const fs_opts[] = {"-I 256", "-O quota,project", NULL}; int rc, major, minor, patch; - test_id = geteuid(); + quotactl_info(); f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r"); rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch); if (rc != 3) @@ -135,10 +135,13 @@ static void setup(void) 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, NULL); + 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); } @@ -153,7 +156,7 @@ static void verify_quota(unsigned int n) tst_res(TINFO, "Test #%d: %s", n, tc->tname); - TEST(quotactl(tc->cmd, tst_device->dev, *tc->id, tc->addr)); + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, *tc->id, tc->addr)); if (TST_RET == -1) { tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des); return; @@ -183,6 +186,7 @@ static struct tst_test test = { .needs_device = 1, .dev_fs_type = "ext4", .mntpoint = MNTPOINT, + .test_variants = QUOTACTL_SYSCALL_VARIANTS, .needs_cmds = (const char *[]) { "mkfs.ext4", NULL From patchwork Tue Nov 9 10:56:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552922 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=cjU0dCMI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpQ0G3cTXz9s1l for ; Tue, 9 Nov 2021 21:56:46 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 15E9D3C07BC for ; Tue, 9 Nov 2021 11:56:44 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id A64FC3C04C2 for ; Tue, 9 Nov 2021 11:56:41 +0100 (CET) Received: from mail1.bemta26.messagelabs.com (mail1.bemta26.messagelabs.com [85.158.142.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 1FFB210006D0 for ; Tue, 9 Nov 2021 11:56:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455400; i=@fujitsu.com; bh=cs5nHesJVslNwXsMjbOHaqqVXPEvkz7MGo1bhGYPI0U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cjU0dCMI84jDxHPEDctjTW16NZ9f/dNdJAh/eX7IrPhWTfZZgLM5DVdxz+S8Dn/15 n2bNdm2VX+kWxIDvNPMyFKw2HQKIVeYtl2ULhZgJgmuaQ7cjiCtJnlH1MJqBoAR9Wz /mNpQWmhDrYRCBRU6QChm1G2b+gLnWAVZG5gqrg+H0XTvRr9p74ojAVp5fd3lVbMQS CYCRfi2CK9OW5EKUieUy1aV/bgH8OhHGVUNuNmh54EJm3qbWzTcxgzNDdlad/KsIQ5 rHv7AqgNR8cGeBhXciNWFyQHW0Rh7YCl46ZvDgjksvGDSO5V8r969px/8IpQsSdDHl PLCRTsl7o/S4g== Received: from [100.113.7.62] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-5.bemta.az-b.eu-central-1.aws.symcld.net id DF/83-25178-8E35A816; Tue, 09 Nov 2021 10:56:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKIsWRWlGSWpSXmKPExsViZ8MxSfdFcFe iwYl7zBYrvu9gdGD02Pd7HWsAYxRrZl5SfkUCa8bETzfYC94ZVMzYfZixgbFVs4uRi0NI4Cyj xOHjx9khnJ1MEv1nr0M5uxkl3vevYu5i5ORgE9CUeNa5AMwWEZCQ6Gh4yw5iMwuoSyyf9IsJx BYWiJM4+WsvWA2LgIrElsX72UBsXgEPieW3zoPFJQQUJKY8fA9kc3BwCnhKrLpSDhIWAipZ+7 aRGaJcUOLkzCcsEOMlJA6+eAHVqihxqeMbI4RdITFrVhsThK0mcfXcJuYJjIKzkLTPQtK+gJF pFaNlUlFmekZJbmJmjq6hgYGuoaGxromuobGBXmKVbpJeaqlucmpeSVEiUFYvsbxYr7gyNzkn RS8vtWQTIzCEUwpZmnYw/n71Qe8QoyQHk5Io72WxrkQhvqT8lMqMxOKM+KLSnNTiQ4wyHBxKE rwJ/kA5waLU9NSKtMwcYDzBpCU4eJREePV8gNK8xQWJucWZ6RCpU4y6HM2Tlm9nFmLJy89LlR LnTQkCKhIAKcoozYMbAYvtS4yyUsK8jAwMDEI8BalFuZklqPKvGMU5GJWEeT8FAk3hycwrgdv 0CugIJqAjDn5pBzmiJBEhJdXAlONXl69yWqSTo9emKv86w9YljXoGudc6bwTemzhf7NS9nTPe zAp/FTfZ7eNUt6TN1QE/27y4FhfI94jJ1FxYViOxxKU7VPrT/+9bGu5MFK6om2ziosfPmyDUn RurFrZ3dol7ZrCq0/6fUS9Fp3yTYwz8Fq0Z9FLIQLyr5vW8vEkqj5lKuc0apLfX/XjA7hcod+ /8wT9rhbME/2h2JXvJbLn97/mdy/sNOM85pu5MiSncvfK1tVfnyvDaw6LM786dT+X4fPtY6rs r5Vo6ky+o/J8ke/j3lUNsUS88aq/ZdZnVvNy0rnbDwV973vs9Wfxa5ZKqhpTrT0HLgLXGH5bt K2zesm7as9rNXbZzbk/tUGIpzkg01GIuKk4EAJtmh7ZoAwAA X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-17.tower-238.messagelabs.com!1636455399!632422!1 X-Originating-IP: [62.60.8.146] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8763 invoked from network); 9 Nov 2021 10:56:40 -0000 Received: from unknown (HELO n03ukasimr02.n03.fujitsu.local) (62.60.8.146) by server-17.tower-238.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:56:40 -0000 Received: from n03ukasimr02.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTP id 8669D100466 for ; Tue, 9 Nov 2021 10:56:39 +0000 (GMT) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTPS id 799D8100359 for ; Tue, 9 Nov 2021 10:56:39 +0000 (GMT) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:56:17 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:56:35 +0800 Message-ID: <1636455396-8508-2-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636455396-8508-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1636455396-8508-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v3 11/12] syscalls/quotactl09: Test error when quota info hidden in filesystem X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" This case is similar to quotactl06 but only two differences 1) use quotactl and quotactl_fd syscalls without visible quota file 2) remove some error for addr argument Signed-off-by: Yang Xu --- runtest/syscalls | 1 + testcases/kernel/syscalls/quotactl/.gitignore | 1 + .../kernel/syscalls/quotactl/quotactl09.c | 187 ++++++++++++++++++ 3 files changed, 189 insertions(+) create mode 100644 testcases/kernel/syscalls/quotactl/quotactl09.c diff --git a/runtest/syscalls b/runtest/syscalls index 583455629..dafbc5808 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1072,6 +1072,7 @@ quotactl05 quotactl05 quotactl06 quotactl06 quotactl07 quotactl07 quotactl08 quotactl08 +quotactl09 quotactl09 read01 read01 read02 read02 diff --git a/testcases/kernel/syscalls/quotactl/.gitignore b/testcases/kernel/syscalls/quotactl/.gitignore index dab9b3420..94de2c8f2 100644 --- a/testcases/kernel/syscalls/quotactl/.gitignore +++ b/testcases/kernel/syscalls/quotactl/.gitignore @@ -6,3 +6,4 @@ /quotactl06 /quotactl07 /quotactl08 +/quotactl09 diff --git a/testcases/kernel/syscalls/quotactl/quotactl09.c b/testcases/kernel/syscalls/quotactl/quotactl09.c new file mode 100644 index 000000000..51c00d807 --- /dev/null +++ b/testcases/kernel/syscalls/quotactl/quotactl09.c @@ -0,0 +1,187 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ + +/*\ + * [Description] + * + * Tests basic error handling of the quotactl syscall without visible quota files + * (use quotactl and quotactl_fd syscall): + * + * - EFAULT when addr or special is invalid + * - EINVAL when cmd or type is invalid + * - ENOTBLK when special is not a block device + * - ERANGE when cmd is Q_SETQUOTA, but the specified limits are out of the range + * allowed by the quota format + * - EPERM when the caller lacked the required privilege (CAP_SYS_ADMIN) for the + * specified operation + * + * Minimum e2fsprogs version required is 1.43. + */ + +#include +#include +#include "tst_test.h" +#include "tst_capability.h" +#include "quotactl_syscall_var.h" +#include "tst_safe_stdio.h" + +#define OPTION_INVALID 999 + +static int32_t fmt_id = QFMT_VFS_V1; +static int test_id, mount_flag; +static int getnextquota_nsup; + +static struct if_nextdqblk res_ndq; + +static struct dqblk set_dqmax = { + .dqb_bsoftlimit = 0x7fffffffffffffffLL, /* 2^63-1 */ + .dqb_valid = QIF_BLIMITS +}; + +struct tst_cap dropadmin = { + .action = TST_CAP_DROP, + .id = CAP_SYS_ADMIN, + .name = "CAP_SYS_ADMIN", +}; + +struct tst_cap needadmin = { + .action = TST_CAP_REQ, + .id = CAP_SYS_ADMIN, + .name = "CAP_SYS_ADMIN", +}; + +static struct tcase { + int cmd; + int *id; + void *addr; + int exp_err; + int on_flag; +} tcases[] = { + {QCMD(Q_SETQUOTA, USRQUOTA), &fmt_id, NULL, EFAULT, 1}, + {QCMD(OPTION_INVALID, USRQUOTA), &fmt_id, NULL, EINVAL, 0}, + {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, NULL, ENOTBLK, 0}, + {QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dqmax, ERANGE, 1}, + {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, NULL, EPERM, 0}, +}; + +static void verify_quotactl(unsigned int n) +{ + struct tcase *tc = &tcases[n]; + int quota_on = 0; + int drop_flag = 0; + + if (tc->cmd == QCMD(Q_GETNEXTQUOTA, USRQUOTA) && getnextquota_nsup) { + tst_res(TCONF, "current system doesn't support Q_GETNEXTQUOTA"); + return; + } + + if (tc->on_flag) { + TEST(do_quotactl(fd, QCMD(Q_QUOTAON, USRQUOTA), tst_device->dev, + fmt_id, NULL)); + if (TST_RET == -1) + tst_brk(TBROK, + "quotactl with Q_QUOTAON returned %ld", TST_RET); + quota_on = 1; + } + + if (tc->exp_err == EPERM) { + tst_cap_action(&dropadmin); + drop_flag = 1; + } + + if (tst_variant) { + if (tc->exp_err == ENOTBLK) { + tst_res(TCONF, "quotactl_fd() doesn't have this error, skip"); + return; + } + } + if (tc->exp_err == ENOTBLK) + TEST(do_quotactl(fd, tc->cmd, "/dev/null", *tc->id, tc->addr)); + else + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, *tc->id, tc->addr)); + + if (TST_RET == -1) { + if (tc->exp_err == TST_ERR) { + tst_res(TPASS | TTERRNO, "quotactl failed as expected"); + } else { + tst_res(TFAIL | TTERRNO, + "quotactl failed unexpectedly; expected %s, but got", + tst_strerrno(tc->exp_err)); + } + } else { + tst_res(TFAIL, "quotactl returned wrong value: %ld", TST_RET); + } + + if (quota_on) { + TEST(do_quotactl(fd, QCMD(Q_QUOTAOFF, USRQUOTA), tst_device->dev, + fmt_id, NULL)); + if (TST_RET == -1) + tst_brk(TBROK, + "quotactl with Q_QUOTAOFF returned %ld", TST_RET); + quota_on = 0; + } + + if (drop_flag) { + tst_cap_action(&needadmin); + drop_flag = 0; + } +} + +static void setup(void) +{ + unsigned int i; + FILE *f; + const char *const fs_opts[] = { "-O quota", NULL}; + int rc, major, minor, patch; + + quotactl_info(); + f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r"); + rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch); + if (rc != 3) + tst_res(TWARN, "Unable parse version number"); + else if (major * 10000 + minor * 100 + patch < 14300) + tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for quota option, test skipped"); + pclose(f); + + SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL); + SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL); + mount_flag = 1; + + fd = SAFE_OPEN(MNTPOINT, O_RDONLY); + TEST(do_quotactl(fd, QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev, + test_id, (void *) &res_ndq)); + if (TST_ERR == EINVAL || TST_ERR == ENOSYS) + getnextquota_nsup = 1; + + for (i = 0; i < ARRAY_SIZE(tcases); i++) { + if (!tcases[i].addr) + tcases[i].addr = tst_get_bad_addr(NULL); + } +} + +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_kconfigs = (const char *[]) { + "CONFIG_QFMT_V2", + NULL + }, + .tcnt = ARRAY_SIZE(tcases), + .test = verify_quotactl, + .dev_fs_type = "ext4", + .mntpoint = MNTPOINT, + .needs_device = 1, + .needs_root = 1, + .test_variants = QUOTACTL_SYSCALL_VARIANTS, +}; From patchwork Tue Nov 9 10:56:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1552923 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fujitsu.com header.i=@fujitsu.com header.a=rsa-sha256 header.s=170520fj header.b=nQqJOLXR; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HpQ0T6LkGz9s1l for ; Tue, 9 Nov 2021 21:56:57 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B8B623C07BB for ; Tue, 9 Nov 2021 11:56:54 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id D798F3C04C2 for ; Tue, 9 Nov 2021 11:56:41 +0100 (CET) Received: from mail1.bemta26.messagelabs.com (mail1.bemta26.messagelabs.com [85.158.142.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 16200141CE88 for ; Tue, 9 Nov 2021 11:56:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1636455400; i=@fujitsu.com; bh=GTJLdBdzMFycruBhH99e1Ug3gj9CaY1DgXchgFaWneg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nQqJOLXRZm6sYsW4tMEyfVhersRB5rc4UczIQUlPJcRzrSfZO7v7BDDmLaJZ3Gy3i q49xVV4Zmt6rF+IuwFXwHt2QNKMDscTJLNU7z6Ge8KoD8kVrjdv0nfAPPKOrMvTOlo 4DlKvWlsFY4QkMvt67jvMdYIblqaE321AjYBFKKN35I9dh2GYYCpjH/yPtuQzLiepq eZ0r4FoLLll8isM0Xwoswf8DoF6zW4d8Hr2Mo5QY61eB7SEMg5B12PvMqu9kGzs+Hi tz8eY87FGgn4a+9lHH+gR7dTMjDAm2E/eZuPrHC+0/tz0d0BfZQc05AGhft4M7AwEP PF7GSMdkugf4A== Received: from [100.113.7.62] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-1.bemta.az-b.eu-central-1.aws.symcld.net id 5C/50-01506-8E35A816; Tue, 09 Nov 2021 10:56:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMIsWRWlGSWpSXmKPExsViZ8MxSfdFcFe iwYy7jBYrvu9gdGD02Pd7HWsAYxRrZl5SfkUCa8aMUy+YCv4JVmye1MPcwLiZv4uRi0NI4Cyj xNtNu9kgnJ1MEht/3GaEcHYzSkzd0snUxcjJwSagKfGscwEziC0iICHR0fCWHcRmFlCXWD7pF 1ANB4ewgLfEvL81IGEWARWJP1OXsICEeQU8JPb1GoCEJQQUJKY8fM8MEuYU8JRYdaUcJCwEVL H2bSPYcF4BQYmTM5+wQAyXkDj44gUzRKuixKWOb4wQdoXErFltTBC2msTVc5uYJzAKzkLSPgt J+wJGplWMlklFmekZJbmJmTm6hgYGuoaGxrpmuoYWZnqJVbpJeqmlusmpeSVFiUBZvcTyYr3i ytzknBS9vNSSTYzA8E0pZNu1g/Hz6w96hxglOZiURHkvi3UlCvEl5adUZiQWZ8QXleakFh9il OHgUJLgTfAHygkWpaanVqRl5gBjCSYtwcGjJMKr5wOU5i0uSMwtzkyHSJ1i1OW4fH3eImYhlr z8vFQpcd6UIKAiAZCijNI8uBGwuL7EKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZj3UyDQFJ7 MvBK4Ta+AjmACOuLgl3aQI0oSEVJSDUzOZnHtLEmhSw5cjNjVVJF75nVtzKxuzbg1LvUdl55c 2f6sWfY159k9daLa5fKbBQoeXN5id2WSkeMu7/xwU7nOsIAt0/jKDDgfT7nzyMF26u058lZT2 z9KvP/2xVl+zX22v6qnW2fc2OnxqvVia8H8js76NYcaXzdPfs901GlBXv9swbd5TMwV15kn68 wPXe1QxlGc9OjlowNPhI5pak/h4pjP8v2pmb5h6fyH7PLHsubuKZxQd/en50onHaOVe16bT5v 7pLDh2qM3Sovdha7tKVk0s6bxaFLeizbVu5dO1ZnefbQveo7Eho6/b5dvLzrQdzxcKyJgK+NJ YS8uqV9NhcknrPef4/9svf3MZktNJZbijERDLeai4kQA7QyLJ2YDAAA= X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-10.tower-248.messagelabs.com!1636455399!394843!1 X-Originating-IP: [62.60.8.146] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.81.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2281 invoked from network); 9 Nov 2021 10:56:40 -0000 Received: from unknown (HELO n03ukasimr02.n03.fujitsu.local) (62.60.8.146) by server-10.tower-248.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Nov 2021 10:56:40 -0000 Received: from n03ukasimr02.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTP id 899EC10046D for ; Tue, 9 Nov 2021 10:56:39 +0000 (GMT) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTPS id 7CC5D100456 for ; Tue, 9 Nov 2021 10:56:39 +0000 (GMT) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.24; Tue, 9 Nov 2021 10:56:20 +0000 From: Yang Xu To: Date: Tue, 9 Nov 2021 18:56:36 +0800 Message-ID: <1636455396-8508-3-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636455396-8508-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1636455396-8508-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v3 12/12] syscalls/quotactl07: Add quotactl_fd test variant X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 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 --- .../kernel/syscalls/quotactl/quotactl07.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) 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 #include #include "tst_test.h" -#include "lapi/quotactl.h" +#include "quotactl_syscall_var.h" #ifdef HAVE_XFS_XQM_H # include -#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"}, {}