From patchwork Wed Sep 1 12:43:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang Xu (Fujitsu)" X-Patchwork-Id: 12469471 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D74CC4320E for ; Wed, 1 Sep 2021 12:44:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AC9E610E6 for ; Wed, 1 Sep 2021 12:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344934AbhIAMpt (ORCPT ); Wed, 1 Sep 2021 08:45:49 -0400 Received: from mail1.bemta26.messagelabs.com ([85.158.142.4]:50455 "EHLO mail1.bemta26.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344932AbhIAMoI (ORCPT ); Wed, 1 Sep 2021 08:44:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1630500188; i=@fujitsu.com; bh=7t1cl61so5rXO3OHqWPlX0HlkbGnj9D+YuLcNFF8pFo=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=HhXTInUoJnA7L92+OMR0m6b+rRNj3ltzIdmg5FB+XYaLCj/xhOiySeh6k5ewfq85G EW3vjuEHozTl1bSSY63j64a4UR19dPPA4WMuzEipCq8nV7sty5hLqx+86muQnAKcFB N2qLAIR7QYxMNOqdH6lK7gmQAbDxt6CQR+Jjc27qLPb4vqS9zUVC8MgqViuTtMS/ui hUp40szi3bmN2WfSHv+AAViLiFRQ0CPmpVP6bozW2DPItFGEgqAYWhoQLKkz+LZRxu 2FMEcDnvWlnQ664vm3zTCkcY/6BVbk9xe9EWN3KsibIau6vRH5yXQt7DeihSFB+RyT A8/QZAGfIFfeA== Received: from [100.113.2.26] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-4.bemta.az-a.eu-central-1.aws.symcld.net id 8E/76-29868-C557F216; Wed, 01 Sep 2021 12:43:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCIsWRWlGSWpSXmKPExsViZ8MRohtTqp9 o0NgiY3G6ZS+7A6PH501yAYxRrJl5SfkVCawZM97fZS6Yqlex7dNNpgbGG6pdjFwcQgIdTBIP N09nhHB2M0p0rrvL0sXIycEmoCnxrHMBM4gtIiAr8X/GaiYQm1lAXWL5pF9gtrBAosSMY7vA6 lkEVCS+f/0GVs8r4CnRP38JO4gtIaAgMeXhe6i4oMTJmU9YIOZISBx88YIZokZR4lLHN0YIu0 Ji1qw2pgmMvLOQtMxC0rKAkWkVo2VSUWZ6RkluYmaOrqGBga6hobGuoa6RsZleYpVuol5qqW5 yal5JUSJQVi+xvFivuDI3OSdFLy+1ZBMjMMBSChnf7GD8+vqD3iFGSQ4mJVFelkj9RCG+pPyU yozE4oz4otKc1OJDjDIcHEoSvLsygHKCRanpqRVpmTnAYIdJS3DwKInwLikESvMWFyTmFmemQ 6ROMepy7Dw6bxGzEEtefl6qlDjvuhKgIgGQoozSPLgRsMi7xCgrJczLyMDAIMRTkFqUm1mCKv +KUZyDUUmYd3Yx0BSezLwSuE2vgI5gAjqC54cOyBEliQgpqQamhryfk2vSeOMy/n8NEek+mnd 4x44zq4X4T2wUnOY82ZxrvQD7ihKW5aqu0lz6jiq/Zd7IZJySF7BXZZxeJrT8Fc/1ym0ulVpa 1Rk67eaujC/SreqYzjSElc/j1Ftj7uPfU7DQuF1JSfnppx52blZunotlz072iXn61LKsYozLj hVPYOkT1vYW2mAs0fnklja7c06J/mfd5g+Cy1odz3QY5rJHKsvt3xyXMv1Da3v7JdHapzHLZJ 1/Mi1fHOsuZMTwtnZp+b79m19z8xUvVJzCNkFcsfhJz7m7V2YEne7I4PeUSg9wnTNbRW0pV/u E753/HsvrBU6Ui1v/Xec9S6GIQw23at32Q0z9J/mUWIozEg21mIuKEwFkIAtdNwMAAA== X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-6.tower-232.messagelabs.com!1630500188!4421!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.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32469 invoked from network); 1 Sep 2021 12:43:08 -0000 Received: from unknown (HELO mailhost3.uk.fujitsu.com) (62.60.8.84) by server-6.tower-232.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Sep 2021 12:43:08 -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 181Ch5a8026400 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Wed, 1 Sep 2021 13:43:08 +0100 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.23; Wed, 1 Sep 2021 13:43:03 +0100 From: Yang Xu To: CC: Yang Xu Subject: [PATCH v1 1/4] src/idmapped-mounts: Fix an error for the loop initialization declaration Date: Wed, 1 Sep 2021 20:43:23 +0800 Message-ID: <1630500206-15545-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) Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Signed-off-by: Yang Xu --- src/idmapped-mounts/idmapped-mounts.c | 30 +++++++++++++-------------- src/idmapped-mounts/utils.c | 3 ++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c index 40eb2cc6..e83f8b04 100644 --- a/src/idmapped-mounts/idmapped-mounts.c +++ b/src/idmapped-mounts/idmapped-mounts.c @@ -8838,6 +8838,7 @@ static int nested_userns(void) int fret = -1; int ret; pid_t pid; + unsigned int id; struct list *it, *next; struct userns_hierarchy hierarchy[] = { { .level = 1, .fd_userns = -EBADF, }, @@ -8979,7 +8980,7 @@ static int nested_userns(void) goto out; } - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { char file[256]; snprintf(file, sizeof(file), DIR1 "/" FILE1 "_%u", id); @@ -9067,7 +9068,7 @@ static int nested_userns(void) } /* Verify that ownership looks correct for callers in the init userns. */ - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { bool bret; unsigned int id_level1, id_level2, id_level3; char file[256]; @@ -9117,7 +9118,7 @@ static int nested_userns(void) if (!switch_userns(attr_level1.userns_fd, 0, 0, false)) die("failure: switch_userns"); - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { bool bret; unsigned int id_level1, id_level2, id_level3; char file[256]; @@ -9164,7 +9165,7 @@ static int nested_userns(void) if (!switch_userns(attr_level2.userns_fd, 0, 0, false)) die("failure: switch_userns"); - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { bool bret; unsigned int id_level2, id_level3; char file[256]; @@ -9210,7 +9211,7 @@ static int nested_userns(void) if (!switch_userns(attr_level3.userns_fd, 0, 0, false)) die("failure: switch_userns"); - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { bool bret; unsigned int id_level2, id_level3; char file[256]; @@ -9267,7 +9268,7 @@ static int nested_userns(void) if (setns(attr_level4.userns_fd, CLONE_NEWUSER)) die("failure: switch_userns"); - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { char file[256]; snprintf(file, sizeof(file), FILE1 "_%u", id); @@ -9300,7 +9301,7 @@ static int nested_userns(void) if (!switch_userns(attr_level1.userns_fd, 0, 0, false)) die("failure: switch_userns"); - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { bool bret; unsigned int id_level1, id_level2, id_level3, id_new; char file[256]; @@ -9355,7 +9356,7 @@ static int nested_userns(void) if (!switch_userns(attr_level2.userns_fd, 0, 0, false)) die("failure: switch_userns"); - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { bool bret; unsigned int id_level2, id_level3, id_new; char file[256]; @@ -9409,7 +9410,7 @@ static int nested_userns(void) if (!switch_userns(attr_level3.userns_fd, 0, 0, false)) die("failure: switch_userns"); - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { unsigned int id_new; char file[256]; @@ -9479,7 +9480,7 @@ static int nested_userns(void) if (setns(attr_level4.userns_fd, CLONE_NEWUSER)) die("failure: switch_userns"); - for (unsigned int id = 0; id <= id_file_range; id++) { + for (id = 0; id <= id_file_range; id++) { char file[256]; unsigned long id_new; @@ -9909,7 +9910,6 @@ static int append_stack(struct btrfs_iter *iter, uint64_t tree_id, size_t path_l if (iter->stack_len >= iter->stack_capacity) { size_t new_capacity = iter->stack_capacity * 2; struct btrfs_stack *new_search_stack; - new_search_stack = reallocarray(iter->search_stack, new_capacity, sizeof(*iter->search_stack)); if (!new_search_stack) @@ -12932,7 +12932,7 @@ out: */ static int btrfs_subvolume_lookup_user(void) { - int fret = -1; + int fret = -1, i; int dir1_fd = -EBADF, dir2_fd = -EBADF, mnt_fd = -EBADF, open_tree_fd = -EBADF, tree_fd = -EBADF, userns_fd = -EBADF; int subvolume_fds[BTRFS_SUBVOLUME_SUBVOL4_ID + 1]; @@ -12947,10 +12947,10 @@ static int btrfs_subvolume_lookup_user(void) if (!caps_supported()) return 0; - for (int i = 0; i < ARRAY_SIZE(subvolume_fds); i++) + for (i = 0; i < ARRAY_SIZE(subvolume_fds); i++) subvolume_fds[i] = -EBADF; - for (int i = 0; i < ARRAY_SIZE(subvolume_ids); i++) + for (i = 0; i < ARRAY_SIZE(subvolume_ids); i++) subvolume_ids[i] = -EINVAL; if (btrfs_create_subvolume(t_mnt_scratch_fd, BTRFS_SUBVOLUME_SUBVOL1)) { @@ -13312,7 +13312,7 @@ out: safe_close(open_tree_fd); safe_close(tree_fd); safe_close(userns_fd); - for (int i = 0; i < ARRAY_SIZE(subvolume_fds); i++) + for (i = 0; i < ARRAY_SIZE(subvolume_fds); i++) safe_close(subvolume_fds[i]); snprintf(t_buf, sizeof(t_buf), "%s/%s", t_mountpoint, BTRFS_SUBVOLUME_MNT); sys_umount2(t_buf, MNT_DETACH); diff --git a/src/idmapped-mounts/utils.c b/src/idmapped-mounts/utils.c index 6ffd6a23..c2afa8dc 100644 --- a/src/idmapped-mounts/utils.c +++ b/src/idmapped-mounts/utils.c @@ -140,11 +140,12 @@ static int map_ids_from_idmap(struct list *idmap, pid_t pid) int fill, left; char mapbuf[4096] = {}; bool had_entry = false; + idmap_type_t map_type, u_or_g; if (list_empty(idmap)) return 0; - for (idmap_type_t map_type = ID_TYPE_UID, u_or_g = 'u'; + for (map_type = ID_TYPE_UID, u_or_g = 'u'; map_type <= ID_TYPE_GID; map_type++, u_or_g = 'g') { char *pos = mapbuf; int ret; From patchwork Wed Sep 1 12:43:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang Xu (Fujitsu)" X-Patchwork-Id: 12469475 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F7AFC19F38 for ; Wed, 1 Sep 2021 12:44:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 360C661131 for ; Wed, 1 Sep 2021 12:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344382AbhIAMps (ORCPT ); Wed, 1 Sep 2021 08:45:48 -0400 Received: from mail1.bemta26.messagelabs.com ([85.158.142.112]:10178 "EHLO mail1.bemta26.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344934AbhIAMoI (ORCPT ); Wed, 1 Sep 2021 08:44:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1630500188; i=@fujitsu.com; bh=Xp2G3THIC+Nbq2CoiRpE9dupwCKKJwvwQi/RG4ZFfOQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l3SOfLvva8xxg566JuT4OaT5YiFcChUDFhYHWDC+WDvzaP9gImC34Fd1lxdLPBcyg T0Z1rgthtHt2ByM4Tkb7AW6Q8697LUQpSnmWtu1oXRauNRyi3KcEHqEbcufOl0dNGM oUmfgzcDwBFvyxWr6nzK6BfuVLIc2QoTU+sIFnnKV82G/2KAZktItw7NwJ7/3T7cjw qwqPZOk6D+FsBTNuHHLyw0zuyA9IYW/Jn5QnnbGduAcvbw8xHpzSJJZ7AbkRv1djPE /vSGpDFkGf2vVNMiuATmGvm0FYu6yUbJKwEAwE4PmvDlJJEv7R/25KbqPt9/QMF8ih g3A8VOFsfVTqA== Received: from [100.113.7.47] (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 64/E1-23595-C557F216; Wed, 01 Sep 2021 12:43:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsViZ8MRohtTqp9 o8OOlnMXplr3sDowenzfJBTBGsWbmJeVXJLBm3N/QxlSwU6Ri09XbzA2Mp4S6GLk4hAQ6mCQe 9n1nhXB2M0o8W/SHrYuRk4NNQFPiWecCZhBbREBW4v+M1UwgNrOAusTySb/AbGGBMInr8z+xg NgsAioS3RcfgMV5BTwlpu6eywhiSwgoSEx5+B5sDqeAl8TvVZfA6oWAaia+/QtVLyhxcuYTFo j5EhIHX7xghuhVlLjU8Q1qToXErFltTBMY+WchaZmFpGUBI9MqRsukosz0jJLcxMwcXUMDA11 DQ2NdcyDLVC+xSjdJL7VUNzk1r6QoESirl1herFdcmZuck6KXl1qyiREYkCmF7Jk7GCe/+aB3 iFGSg0lJlJclUj9RiC8pP6UyI7E4I76oNCe1+BCjDAeHkgTvrgygnGBRanpqRVpmDjA6YNISH DxKIrxLCoHSvMUFibnFmekQqVOMilLivOtKgBICIImM0jy4NlhEXmKUlRLmZWRgYBDiKUgtys 0sQZV/xSjOwagkzDu7GGgKT2ZeCdz0V0CLmYAW8/zQAVlckoiQkmpg0pR0kUzumLR/etklgR9 rT0n7Cy5S/hD9tulGOItr5cHrrQcs9mffFPOUMtiro5Y3Ucrx0DGXmKpXcjffl3ELPNVyWvZF yiz4yquPW/NmbG5dGPWbwSTodL+M/9QZ/epHrnbbJzwPnnCV8Um9Ys0j9tnNtVUFCrXNfV/vn Shbw/xR5tLj17ph8/U2JHpv5FaOfhjI4Rgp/GfdO37JmSs/8x/sWc5j+c5o+WQTI8faoAQxIe P1XWxOHGt8xIyPPvCNvrZvUVqRwBn/vxuvu8w+w2t81HzlXM51QTnh6+u7/6bf2HP7xmFPe4V 3DvP0hR8fqmE2SdX9xXy7JeOUxOsvC1xWfI90y3y8sfds0q5iJZbijERDLeai4kQA8hExt0MD AAA= X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-19.tower-245.messagelabs.com!1630500188!17231!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.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26118 invoked from network); 1 Sep 2021 12:43:08 -0000 Received: from unknown (HELO mailhost3.uk.fujitsu.com) (62.60.8.84) by server-19.tower-245.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Sep 2021 12:43:08 -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 181Ch5a9026400 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Wed, 1 Sep 2021 13:43:08 +0100 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.23; Wed, 1 Sep 2021 13:43:06 +0100 From: Yang Xu To: CC: Yang Xu Subject: [PATCH v1 2/4] configure.ac: Fix uncorrect detection because of linux/btrfs.h Date: Wed, 1 Sep 2021 20:43:24 +0800 Message-ID: <1630500206-15545-2-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1630500206-15545-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1630500206-15545-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) Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org On old distros, we can't detect some btrfs structs because of undeclared 'NULL' in btrfs_err_str function. This function has been removed after kernel commit 68598d2ea8863 ("btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h"). Fix this bug in xfstests layer by adding stddef.h because NULL is defined in stddef.h(it is in /usr/lib/gcc*/ directory). Signed-off-by: Yang Xu --- configure.ac | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 78e9d945..0b55455a 100644 --- a/configure.ac +++ b/configure.ac @@ -69,15 +69,39 @@ AC_PACKAGE_WANT_LIBBTRFSUTIL AC_HAVE_COPY_FILE_RANGE AC_CHECK_FUNCS([renameat2]) AC_CHECK_TYPES([struct mount_attr], [], [], [[#include ]]) -AC_CHECK_TYPES([struct btrfs_qgroup_limit], [], [], [[#include ]]) -AC_CHECK_TYPES([struct btrfs_qgroup_inherit], [], [], [[#include ]]) -AC_CHECK_TYPES([struct btrfs_ioctl_vol_args], [], [], [[#include ]]) -AC_CHECK_TYPES([struct btrfs_ioctl_vol_args_v2], [], [], [[#include ]]) -AC_CHECK_TYPES([struct btrfs_ioctl_ino_lookup_args], [], [], [[#include ]]) -AC_CHECK_TYPES([struct btrfs_ioctl_ino_lookup_user_args], [], [], [[#include ]]) -AC_CHECK_TYPES([struct btrfs_ioctl_get_subvol_rootref_args], [], [], [[#include ]]) +AC_CHECK_TYPES([struct btrfs_qgroup_limit], [], [], [[ +#include +#include +]]) +AC_CHECK_TYPES([struct btrfs_qgroup_inherit], [], [], [[ +#include +#include +]]) +AC_CHECK_TYPES([struct btrfs_ioctl_vol_args], [], [], [[ +#include +#include +]]) +AC_CHECK_TYPES([struct btrfs_ioctl_vol_args_v2], [], [], [[ +#include +#include +]]) +AC_CHECK_TYPES([struct btrfs_ioctl_ino_lookup_args], [], [], [[ +#include +#include +]]) +AC_CHECK_TYPES([struct btrfs_ioctl_ino_lookup_user_args], [], [], [[ +#include +#include +]]) +AC_CHECK_TYPES([struct btrfs_ioctl_get_subvol_rootref_args], [], [], [[ +#include +#include +]]) AC_CHECK_HEADERS([linux/btrfs.h linux/btrfs_tree.h]) -AC_CHECK_MEMBERS([struct btrfs_ioctl_vol_args_v2.subvolid], [], [], [[#include ]]) +AC_CHECK_MEMBERS([struct btrfs_ioctl_vol_args_v2.subvolid], [], [], [[ +#include +#include +]]) AC_CONFIG_HEADER(include/config.h) AC_CONFIG_FILES([include/builddefs]) From patchwork Wed Sep 1 12:43:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang Xu (Fujitsu)" X-Patchwork-Id: 12469473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 145AAC43216 for ; Wed, 1 Sep 2021 12:44:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F41CC61139 for ; Wed, 1 Sep 2021 12:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344965AbhIAMpu (ORCPT ); Wed, 1 Sep 2021 08:45:50 -0400 Received: from mail1.bemta26.messagelabs.com ([85.158.142.115]:55673 "EHLO mail1.bemta26.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345382AbhIAMoL (ORCPT ); Wed, 1 Sep 2021 08:44:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1630500193; i=@fujitsu.com; bh=Yx5DF4YGDi7GHKTl+nj08huotXTgNPVIvZNDMLDbKGI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oUCoi6E/K8luFe/xCialtC6QQsf6D9ckUkgg8njHF1j+JPHX1ZGcot4DkBheUmVz5 ahRtdp6vJiCJtuCBCmN7QyLUmXGtkstdipBXnqwjVE6qtg8ea7VijWrJsTCzlDB9QF ad2OGPtje7xD3PrsZ1PockjqGhuIHQzhp+EdZdSZGQaypr2dEmsUYNDJlqA0xDat+N ogFCPsjWduZXSd6WvKXbddRxKqvk9eU4M9Jw2OEiKja2V84m2Hw0he3ixJvYpQUO8u bSMD4ng/pRQ9w8z/keUuvELj0LApRWbCFikGNe8RUfEffE2IgRMtGItSvtAxUUryZp AhM3ki8Gf4HIQ== Received: from [100.113.7.47] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-4.bemta.az-b.eu-central-1.aws.symcld.net id F9/95-15923-1657F216; Wed, 01 Sep 2021 12:43:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsViZ8MRqptYqp9 ocOW9vMXplr3sDowenzfJBTBGsWbmJeVXJLBmXJr/hb2gWahi9aG3bA2MvfxdjFwcQgIdTBI3 dv5ng3B2M0rs7XzL2MXIycEmoCnxrHMBM4gtIiAr8X/GaiYQm1lAXWL5pF9gtrBAgkTr22NgN SwCKhJ7b+1gBbF5BTwlNr6/zAJiSwgoSEx5+B6shlPAS+L3qktgcSGgmolv/zJB1AtKnJz5hA VivoTEwRcvmCF6FSUudXxjhLArJGbNamOawMg/C0nLLCQtCxiZVjFaJhVlpmeU5CZm5ugaGhj oGhoa65rpGlqY6SVW6SbppZbqJqfmlRQlAmX1EsuL9Yorc5NzUvTyUks2MQIDMqWQbdcOxs+v P+gdYpTkYFIS5WWJ1E8U4kvKT6nMSCzOiC8qzUktPsQow8GhJMG7KwMoJ1iUmp5akZaZA4wOm LQEB4+SCO+SQqA0b3FBYm5xZjpE6hSjopQ477oSoIQASCKjNA+uDRaRlxhlpYR5GRkYGIR4Cl KLcjNLUOVfMYpzMCoJ884uBprCk5lXAjf9FdBiJqDFPD90QBaXJCKkpBqY8p4uVxbZqbDJxLb 8Dvf89kdXU5pfTZAoWJ8qlZf8W0H/8reweTtvmL7s+HqDUfWEqfoEl3jBBz8mnnwiJ5W6oMs4 d7OaGePmBeW+jI0WeeejgreE68a9LhOy+PGjefvs1+1vFmg4eWf92qixQJfp8z7WVW+PGgsHb fm5b57ExkM+U+z3z1QWPPo92HzS8T91vNtWb4o/omd1nFdU3Kh3G5f1VnGPrUWOtQXL/56JSe bt94xX2/5r9+dj7+J+HT3oY7hIe8XzjLu1f64f4RUvjP+98PK5lgXsU917pPXW27CcD6o+r3k hrvu5hiVrReFlx9oezxCxDUzTLh1U/p7gL75oY3TZ+eRtNz5Vc3c9UWIpzkg01GIuKk4EAJ2g j11DAwAA X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-10.tower-238.messagelabs.com!1630500193!163502!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.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28062 invoked from network); 1 Sep 2021 12:43:13 -0000 Received: from unknown (HELO mailhost4.uk.fujitsu.com) (62.60.8.85) by server-10.tower-238.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Sep 2021 12:43:13 -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 181ChAfS006407 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Wed, 1 Sep 2021 13:43:13 +0100 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.23; Wed, 1 Sep 2021 13:43:08 +0100 From: Yang Xu To: CC: Yang Xu Subject: [PATCH v1 3/4] src/idmapped-mounts/idmapped-mounts.c: Use renameat instead of renameat2 Date: Wed, 1 Sep 2021 20:43:25 +0800 Message-ID: <1630500206-15545-3-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1630500206-15545-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1630500206-15545-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) Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org We don't add fallback for renameat2, so it build failed on old kernel. So use renameat instead. Signed-off-by: Yang Xu --- src/idmapped-mounts/idmapped-mounts.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c index e83f8b04..4230cb48 100644 --- a/src/idmapped-mounts/idmapped-mounts.c +++ b/src/idmapped-mounts/idmapped-mounts.c @@ -10433,9 +10433,9 @@ static int btrfs_subvolumes_fsids_unmapped(void) } /* try to rename a subvolume */ - if (!renameat2(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd, - BTRFS_SUBVOLUME1_RENAME, 0)) { - log_stderr("failure: renameat2"); + if (!renameat(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd, + BTRFS_SUBVOLUME1_RENAME)) { + log_stderr("failure: renameat"); goto out; } if (errno != EOVERFLOW) { @@ -10552,9 +10552,9 @@ static int btrfs_subvolumes_fsids_unmapped_userns(void) die("failure: errno"); /* try to rename a subvolume */ - if (!renameat2(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd, - BTRFS_SUBVOLUME1_RENAME, 0)) - die("failure: renameat2"); + if (!renameat(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd, + BTRFS_SUBVOLUME1_RENAME)) + die("failure: renameat"); if (errno != EOVERFLOW) die("failure: errno"); @@ -10993,9 +10993,9 @@ static int btrfs_snapshots_fsids_unmapped(void) die("failure: errno"); /* try to rename a directory */ - if (!renameat2(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd, - BTRFS_SUBVOLUME1_RENAME, 0)) - die("failure: renameat2"); + if (!renameat(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd, + BTRFS_SUBVOLUME1_RENAME)) + die("failure: renameat"); if (errno != EOVERFLOW) die("failure: errno"); @@ -11174,9 +11174,9 @@ static int btrfs_snapshots_fsids_unmapped_userns(void) die("failure: errno"); /* try to rename a directory */ - if (!renameat2(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd, - BTRFS_SUBVOLUME1_RENAME, 0)) - die("failure: renameat2"); + if (!renameat(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd, + BTRFS_SUBVOLUME1_RENAME)) + die("failure: renameat"); if (errno != EOVERFLOW) die("failure: errno"); From patchwork Wed Sep 1 12:43:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang Xu (Fujitsu)" X-Patchwork-Id: 12469477 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 502F7C432BE for ; Wed, 1 Sep 2021 12:44:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DBF461131 for ; Wed, 1 Sep 2021 12:44:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345006AbhIAMpv (ORCPT ); Wed, 1 Sep 2021 08:45:51 -0400 Received: from mail1.bemta26.messagelabs.com ([85.158.142.1]:60054 "EHLO mail1.bemta26.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345383AbhIAMoL (ORCPT ); Wed, 1 Sep 2021 08:44:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1630500193; i=@fujitsu.com; bh=KL1ud68KQVVQydzZAupKAFJ9Dn+IiZslUE7Mgjoa0xw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rY1Bt+YF51Nf6vCpdMe7hZN6OXZ5jJxrKU9woassg032e7K+M/fAT3+d0dkQxoGn6 ABGbIfjR0nmXy8yLfYsDN0voK6Gi2sa5fRZxKrQwuoziyPoe6im9xhylYwc7iKBSh7 0ZBnnw9Vqoo+RG8aS7I+MjBDMcOnJSw8Wcg3b2p2I7wvSyDLygduMaIC+WE26n0k1Z UC+GzvkA8mSNKCqmbgo0/CIIt5pMWqZpS07pzEKpj8BYw8kucAmXUqDmG+V11Z9S8h ltJZGi3PUYcQeaDE1miAZnuYMlLkrJ1gg22PDWJ99OWZwFfFP4SVr1SA8Ds2d2jbp5 5aOwgvCQRXBuw== Received: from [100.113.2.26] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-1.bemta.az-a.eu-central-1.aws.symcld.net id 15/8F-24763-1657F216; Wed, 01 Sep 2021 12:43:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsViZ8MRqptYqp9 ocO+UgsXplr3sDowenzfJBTBGsWbmJeVXJLBmHDj3mKXgHXfFubO97A2Mi7i6GLk4hAQ6mCRW rJjJCuHsZpR43n+TqYuRk4NNQFPiWecCZhBbREBW4v+M1WBxZgF1ieWTfoHZwgIFEk/WnAWzW QRUJC5c3sIGYvMKeEq8u3EFzJYQUJCY8vA92BxOAS+J36susYDYQkA1E9/+ZYKoF5Q4OfMJC8 R8CYmDL14wQ/QqSlzq+MYIYVdIzJrVxjSBkX8WkpZZSFoWMDKtYrRMKspMzyjJTczM0TU0MNA 1NDTWNdQ1NDHSS6zSTdRLLdVNTs0rKUoEyuollhfrFVfmJuek6OWllmxiBAZkSiFj3w7GiW8+ 6B1ilORgUhLlZYnUTxTiS8pPqcxILM6ILyrNSS0+xCjDwaEkwbsrAygnWJSanlqRlpkDjA6Yt AQHj5II75JCoDRvcUFibnFmOkTqFKMux86j8xYxC7Hk5eelSonzrisBKhIAKcoozYMbAYvUS4 yyUsK8jAwMDEI8BalFuZklqPKvGMU5GJWEeWcXA03hycwrgdv0CugIJqAjeH7ogBxRkoiQkmp gkt/+vNOy6cIstVTf40cDom4GHmt38Sp0CN6QrbWx/uv31udc91vN7O6pdndIJB3RPLOjOSHu Huup5VquQfti3u5etZ7pwzfRJknt2ntLfrdI7lu0ZJ1C6PqWHas/m11eu5st4r73ogOymnO5j oVuWMR6dIeC5b7ruY4l8YXPmxXfT4iyXjVFJWbSfO8Hjy2W7L65+L5FzhTJ9sbGxXsaGs0EhL +aWjdMfvfk5XbfB67nVQ9pLPLNX2Bz1e+C6+HZutwbPnGc2Wda+utvoED/1R+HrvWIeu/S7Jd JWVm+rUbA41/Cv6UZfzbfm+N5j+/elQ+2XQoOGT65bz/cmOX1ceqs+mMXF9d+zs+Vf/q+8IkS S3FGoqEWc1FxIgAJkp/mTwMAAA== X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-5.tower-232.messagelabs.com!1630500193!46255!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.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28158 invoked from network); 1 Sep 2021 12:43:13 -0000 Received: from unknown (HELO mailhost4.uk.fujitsu.com) (62.60.8.85) by server-5.tower-232.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Sep 2021 12:43:13 -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 181ChAfT006407 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL) for ; Wed, 1 Sep 2021 13:43:13 +0100 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.23; Wed, 1 Sep 2021 13:43:11 +0100 From: Yang Xu To: CC: Yang Xu Subject: [PATCH v1 4/4] src/idmapped-mounts/idmapped-mounts.c: Fix build error because of undefined reallocarray Date: Wed, 1 Sep 2021 20:43:26 +0800 Message-ID: <1630500206-15545-4-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1630500206-15545-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1630500206-15545-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) Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org On old glibc, reallocarray was not introduced, so this case compiles failed. We should use reallocarray if glibc supports and use realloc if glibcs doesn't support reallocarray. Signed-off-by: Yang Xu --- configure.ac | 1 + src/idmapped-mounts/idmapped-mounts.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 0b55455a..6e5ab397 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,7 @@ AC_PACKAGE_WANT_LIBBTRFSUTIL AC_HAVE_COPY_FILE_RANGE AC_CHECK_FUNCS([renameat2]) +AC_CHECK_FUNCS([reallocarray]) AC_CHECK_TYPES([struct mount_attr], [], [], [[#include ]]) AC_CHECK_TYPES([struct btrfs_qgroup_limit], [], [], [[ #include diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c index 4230cb48..83b7c89a 100644 --- a/src/idmapped-mounts/idmapped-mounts.c +++ b/src/idmapped-mounts/idmapped-mounts.c @@ -9910,8 +9910,12 @@ static int append_stack(struct btrfs_iter *iter, uint64_t tree_id, size_t path_l if (iter->stack_len >= iter->stack_capacity) { size_t new_capacity = iter->stack_capacity * 2; struct btrfs_stack *new_search_stack; +#ifdef HAVE_REALLOCARRAY new_search_stack = reallocarray(iter->search_stack, new_capacity, sizeof(*iter->search_stack)); +#else + new_search_stack = realloc(iter->search_stack, new_capacity * sizeof(*iter->search_stack)); +#endif if (!new_search_stack) return -ENOMEM;