From patchwork Mon Nov 18 23:01:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879152 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B299C1E8846; Mon, 18 Nov 2024 23:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970899; cv=none; b=cpvzMJELhto2chfhGMxUaatXlFtDVCXhW1RtofbBMNWmxmioxqCAEF2nrMBPGXeb1Of/Ij4+xifpxFWJfZmAoa9q9soF9yAHK0G7E15UrBMF5UonhuoofZmKJ5p7xbSpntmi+HuK4p3L8nJ8apE6mcCso3bJ3y89SUYOcLmW29k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970899; c=relaxed/simple; bh=SQ8hEz0+P+LezKybCrG9BVBvg+dEV9Gmh832ak8B2d0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cW8KuJwStlhPsfr3IiILDtsLZAKvKJfZE4R6iDveHTPH/HDmKZN+Gs81GgmXM2J69aTSQX1ZWLX9iy19BPsTua74c5XBN34b9CeVJBbx6VDuLonnKGg64u7dZL6ZalpQTKiu/E9nWcn8xrElDYXSPSJzR75mTwNPM9TLA86Kes0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WIaXRvfy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WIaXRvfy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78B73C4CECC; Mon, 18 Nov 2024 23:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731970899; bh=SQ8hEz0+P+LezKybCrG9BVBvg+dEV9Gmh832ak8B2d0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=WIaXRvfyOkIDiaeMaSFqKi7t/+xjmTkRbH1colSnqac0DDaKdb0PBh3Q6wn6eFFOJ Q666EF9GxKSWhoNtkOgqtCzLaHybZcjg8gsmZfRlnBHoPx82HKBUAVpxdizUqiAPst rUYUx6M4pV6yW02H9u06dSF7Z6gaxZRo2PFXali5yqD8Kdw2n+21iDRoHOwuv7LdrJ zvGrVFKuLKc+PZcc+KHY2g5xKdigisRRXcfXh8w+pHRSMlFwP6n4B+ILXo+l9xR3pT Ux4Nf59xUqzDXsEUUMHsI6um1b1HvCJ+7ZgSV96QlMOb1+5yYJaIiFlA9Tc8zZOwFh dn7sd6kSmw0Sw== Date: Mon, 18 Nov 2024 15:01:38 -0800 Subject: [PATCH 01/12] generic/757: fix various bugs in this test From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064441.904310.18406008193922603782.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Fix this test so the check doesn't fail on XFS, and restrict runtime to 100 loops because otherwise this test takes many hours. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- tests/generic/757 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/generic/757 b/tests/generic/757 index 0ff5a8ac00182b..9d41975bde07bb 100755 --- a/tests/generic/757 +++ b/tests/generic/757 @@ -63,9 +63,14 @@ prev=$(_log_writes_mark_to_entry_number mkfs) cur=$(_log_writes_find_next_fua $prev) [ -z "$cur" ] && _fail "failed to locate next FUA write" -while [ ! -z "$cur" ]; do +for ((i = 0; i < 100; i++)); do _log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full + # xfs_repair won't run if the log is dirty + if [ $FSTYP = "xfs" ]; then + _scratch_mount + _scratch_unmount + fi _check_scratch_fs prev=$cur From patchwork Mon Nov 18 23:01:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879153 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87BA01E8846; Mon, 18 Nov 2024 23:01:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970915; cv=none; b=IgeScIQid+skby7nU2UahMcH/tCO5CRp/E7k8FUTA9BVs0r8/PGALDzLMU8+X4S+bC1eW670EB4hkopkHnu2t6ZE3miMLkB8IJVsqgcGYw35qc5rL3LrXdXCVuM5rQZt/gk+JEpPcw4gvK7PikwGnH6titrk0kA1CaZgMkJyfZk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970915; c=relaxed/simple; bh=o6zb0xaKvT1Phfnf+O/+8ow1anPAvLrsASAA2MUzl/I=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lymfQCkK7c96+0PcZYo7WpKM1kxbMqaX1q50t7exj7Wfum8gPwcsYlrcDfd5BppjvnbuP68FNZaysv7GuGQiq2ylxkaNIvYox3gylknEAPrw7eE4PsPeCkze/McmnX8c6WGquwFilxcoZFiwGekgYoGghwvS4jI0XMbzBZ9KvjY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WxmI30mI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WxmI30mI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25DA9C4CECC; Mon, 18 Nov 2024 23:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731970915; bh=o6zb0xaKvT1Phfnf+O/+8ow1anPAvLrsASAA2MUzl/I=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=WxmI30mIcyqB4lzwQ2iQt6tqkDqmI9jgYWTOV1IYymgn4/MxXkyKGtKkJq5Ny2Rhj CbypQK6wSQrTm/yGIdCEjKNy8EzESxgh0fLcfpH72TSj+kf7lX/7VOeUbHjzmq0AJe WB+3405tpNJ0H+r4hGl3nG5SUBo9TYTzfW/Pa55BdCvnJV/10oTGLr7IrHKfDOimqe 9Ozm9TkPFACQxMJeDUfEwOunHPZQV4h/QCMvQjx0I//dGhDjkXJcFx0UqjgULgC+fM h7FIPM/i7iMCAhpEQhDsy7GQuASf3k/gWxN42e6lPoXkRP/Qj3d6w5BLJ3zUxfwZGk M0ivoa+duOeTQ== Date: Mon, 18 Nov 2024 15:01:54 -0800 Subject: [PATCH 02/12] xfs/113: fix failure to corrupt the entire directory From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064456.904310.9904578922751677795.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong This test tries to corrupt the data blocks of a directory, but it doesn't take into account the fact that __populate_check_xfs_dir can remove enough entries to cause sparse holes in the directory. If that happens, this "file data block is unmapped" logic will cause the corruption loop to exit early. Then we can add to the directory, which causes the test to fail. Instead, create a list of mappable dir block offsets, and run 100 corruptions at a time to reduce the amount of time we spend initializing xfs_db. This fixes the regressions that I see with 32k/64k block sizes. Cc: # v2022.05.01 Fixes: c8e6dbc8812653 ("xfs: test directory metadata corruption checking and repair") Signed-off-by: Darrick J. Wong --- tests/xfs/113 | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/tests/xfs/113 b/tests/xfs/113 index 094ab71f2aefec..22ac8c3fd51b80 100755 --- a/tests/xfs/113 +++ b/tests/xfs/113 @@ -52,13 +52,34 @@ _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail echo "+ check dir" __populate_check_xfs_dir "${inode}" btree +dir_data_offsets() { + _scratch_xfs_db -c "inode ${inode}" -c 'bmap' | \ + awk -v leaf_lblk=$leaf_lblk \ + '{ + if ($3 >= leaf_lblk) + exit; + for (i = 0; i < $8; i++) + printf("%d\n", $3 + i); + }' +} + echo "+ corrupt dir" -loff=0 -while true; do - _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" | grep -q 'file data block is unmapped' && break - _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full - loff="$((loff + 1))" -done +subcommands=() +while read loff; do + # run 100 commands at a time + if [ "${#subcommands[@]}" -lt 600 ]; then + subcommands+=(-c "inode ${inode}") + subcommands+=(-c "dblock ${loff}") + subcommands+=(-c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}") + continue + fi + + _scratch_xfs_db -x "${subcommands[@]}" >> $seqres.full + subcommands=() +done < <(dir_data_offsets) +if [ "${#subcommands[@]}" -gt 0 ]; then + _scratch_xfs_db -x "${subcommands[@]}" >> $seqres.full +fi echo "+ mount image && modify dir" if _try_scratch_mount >> $seqres.full 2>&1; then From patchwork Mon Nov 18 23:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879154 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21E59153BE4; Mon, 18 Nov 2024 23:02:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970931; cv=none; b=Q369R7xSdvQKuNj3uxrC8eQx9xpO9QVMm5zpHN7XRDJHv6YAf/Wh1wlCvMO8u1E/VbIWrB3zzHMNEwXAW83nc6gZ6nt7q+ywTdst0c1XU5ZLDRt3VespbFUHTUu3PcK9CFYduaGyQ3nk6NRkWTb6z6+vRxW9HEmFJnsJZz7Z8ys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970931; c=relaxed/simple; bh=MtmzBT8p7QNVOATyVBMmzcCHOASFsa1q+9AR3/QhQUE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AvAL0kBhzdbMUDBjOWjNkJQQwttxJ4bca098TnzVB9Sj0wirFzhftT7J4EhCU+/S3qZWg8r4DjUb8e3r/zLoSGNlFcx7m11rqa2WcRWHm74C+kcHTRPnqIQY5hAS4teAv2HXlb7ZEVGB0H/3krbrE/ekNuWShzG5hlIgzV73fuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JkCDRu5D; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JkCDRu5D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B93AEC4CECC; Mon, 18 Nov 2024 23:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731970930; bh=MtmzBT8p7QNVOATyVBMmzcCHOASFsa1q+9AR3/QhQUE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=JkCDRu5DQR+u3s0kh0Lu03+Yws2sa2kDOiAzHdzJR6c2f3wOqAr52vHJz9aB2MVzu s8odsCniRvmFXRlhl5xR8J+C9a0DPOxpc60skr8+GcQDAN1Kxrp/e2mOXc8vPRL7z5 jgax78QoACJ7MkJm3Bti5g8kKI14uUXXiVVaszFtb3jYSiT/MwZ4CBayaL2RVayqHr w+Xc4cGnjSDcRzKvKNSOD/Y3OJGfmA4ZCbKwudp16K6Rp5MOqe+oQSdytpVsHzYjur Bs78BA7ZBHtwnzL+Q/BDZErBerIOnwWNABWqdoti30ceYa97oeZU9Embo/sVvha+ER Kiqf1iUqm2/uQ== Date: Mon, 18 Nov 2024 15:02:10 -0800 Subject: [PATCH 03/12] xfs/508: fix test for 64k blocksize From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064471.904310.2680927948887859905.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong It turns out that icreate transactions will try to reserve quite a bit of space on a 64k fsblock filesystem -- enough to handle the worst case parent directory expansion, a new inode chunk, and these days a parent pointer as well. This can work out to quite a bit of space: fsblock reservation 1k 172K 4k 368K 16k 1136K 64k 3650K Unfortunately, this test sets its block quota limits at 1-2MB, so we can't even create a child file. Bump the limits up by 10x so that this test will pass even if there's more metadata size creep in the future. Fixes: f769a923f576df ("xfs: project quota ineritance flag test") Signed-off-by: Darrick J. Wong --- tests/xfs/508 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/xfs/508 b/tests/xfs/508 index ee1a0371db7d6d..1bd13e98c9f641 100755 --- a/tests/xfs/508 +++ b/tests/xfs/508 @@ -44,7 +44,7 @@ do_quota_nospc() local exp=$2 echo "Write $file, expect $exp:" | _filter_scratch - $XFS_IO_PROG -t -f -c "pwrite 0 5m" $file 2>&1 >/dev/null | \ + $XFS_IO_PROG -t -f -c "pwrite 0 50m" $file 2>&1 >/dev/null | \ _filter_xfs_io_error rm -f $file } @@ -56,7 +56,7 @@ _require_prjquota $SCRATCH_DEV mkdir $SCRATCH_MNT/dir $QUOTA_CMD -x -c 'project -s test' $SCRATCH_MNT >>$seqres.full 2>&1 -$QUOTA_CMD -x -c 'limit -p bsoft=1m bhard=2m test' $SCRATCH_MNT +$QUOTA_CMD -x -c 'limit -p bsoft=10m bhard=20m test' $SCRATCH_MNT # test the Project inheritance bit is a directory only flag, and it's set on # directory by default. Expect no complain about "project inheritance flag is From patchwork Mon Nov 18 23:02:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879155 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDC071EABB2; Mon, 18 Nov 2024 23:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970948; cv=none; b=fLr/Ys72iIHOEObnuo+zjTQPxgHXqnXxOKMUYWCZ9lAk14Dk6Wx7kDgSUaw0oWUPcVYsT0fXe3s9lbyujymLjYQ+0fyPXfLAZo8VIXB6IbdflLOmTPcmG1nB0Qt7OrvgJmdwK7mBJsJhOmIvNTmuPvP5rrhPOGYEQC1RheydSXU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970948; c=relaxed/simple; bh=eCPHpoGFERLrQAUnyDxDDExsVtjBYVqQajl2kJkfIDE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LbJnUu7yqNj7sSVt2GgJ2t7nCgBbd/muqtIvbrVH1YJClfwkJvcwXzgRwq3cUMN4UKiAXnLA942koZQtdwRpBJ5IX2LDMSOwARg93614q2qbaTaA/dGUEmfsPVjHaSeZfegwOCZP0HJ/27gWCas5J5ynKCuh1QPNQtq56f1itfU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZEm9oOjo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZEm9oOjo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A048C4CECC; Mon, 18 Nov 2024 23:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731970946; bh=eCPHpoGFERLrQAUnyDxDDExsVtjBYVqQajl2kJkfIDE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ZEm9oOjoE7iVdA9bPhzyvYnfjyitiLCkb0DjK5JNO/rmAxrKq6hbLtmReuz6HlDrt vpF91TJd68s7HAMZ4ViXx+nOYDX9QgzOvlIiyileicLI3PSmEi126Wkp/4CsXel474 IBfaQ7J1NI9ZL2QMidJyEAZBSTRFSd5DQSDmIf9LIGJF4q138Fr8J5pkHecAv9HV0Q CCV0OBLePENzFowgaEWzn4CyKl9ot3VQOxYRT//roLXrR3iF/2ZH4KDAmJpxHW8fPZ YrwN8gC3EOJG3dasL2V7zqh+TjrlqQmEhb8KiMcDGrAHSSW65LECioa5/NVeqMgmAA pCOOBUt4ucIow== Date: Mon, 18 Nov 2024 15:02:25 -0800 Subject: [PATCH 04/12] common/rc: capture dmesg when oom kills happen From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064486.904310.6586845030340568290.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Capture the dmesg output if the OOM killer is invoked during fstests. Signed-off-by: Darrick J. Wong --- common/rc | 1 + 1 file changed, 1 insertion(+) diff --git a/common/rc b/common/rc index 2ee46e5101e168..70a0f1d1c6acd9 100644 --- a/common/rc +++ b/common/rc @@ -4538,6 +4538,7 @@ _check_dmesg() -e "INFO: possible circular locking dependency detected" \ -e "general protection fault:" \ -e "BUG .* remaining" \ + -e "oom-kill" \ -e "UBSAN:" \ $seqres.dmesg if [ $? -eq 0 ]; then From patchwork Mon Nov 18 23:02:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879156 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CA471E6DC2; Mon, 18 Nov 2024 23:02:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970962; cv=none; b=nwymCCKU0i9VJ0Dnc6kGbrs/RJl10BZZydAZ1DZsEqMKlyYRwfiUv5ZlqMKu/TF1bLwoPATo3yicHzpqAuA4biWbJ/IZjxBcIXeHKC9dCGgz0PcLLmf3zsPSHXTM8zTIBVhfvz/2rJQngAWnYgcFG12J8Y/Mw4e6L2AiNYXa2As= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970962; c=relaxed/simple; bh=+MawB7cwzzMb3BL0woY87nFbUmAX4umDudmAGod8v2k=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XNu6T8W2haWocAJCNpeVOsEAoVi98Wxsgxtptn0ebdB8PZU1DXgI8ZW1mobS/MEUfkulUBP+3QBXjiHxMT+6JS4EI5q5Gs/29uvGvF5Ut+4lj4NIHEQcYS7NXB7hRj4pnC+XA8pmSCNMard2QEUk5Y5qjeWtT2+KcMbS7rursNM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ugQuk9Lk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ugQuk9Lk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE8A5C4CECC; Mon, 18 Nov 2024 23:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731970961; bh=+MawB7cwzzMb3BL0woY87nFbUmAX4umDudmAGod8v2k=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ugQuk9LkpX83Ltrbu7ZpNdqpJgQ7SgbVTr1IV/Fx9neJ/+cheG1N7HNlrOFP6Yzq2 6b1YIhK/u16SpDQgTSUYgY1L20jwlwXqnSptJjaAGNSaK1EdZUqGT1aLQECP2IvNZ3 5GU+LMRNu48tOglcD+oM7ZOiXrBEIHulwxmQ8WOO9fx+HUe9sSMjqW1tgy102FP8+4 YrIZ1hVOTIQe4ulrwJjI7XnAFR2XExAPawiYKaYCC9lzr+VZl4SscdOdO8y5PxpRqO 5Ui5CmXGMc2rAiYEsxPcQ/BSAlrsCETCWICvRKeAE6APjkZexKlHmHoZWyhSrUPJ6k +OCIau6aBbMxw== Date: Mon, 18 Nov 2024 15:02:41 -0800 Subject: [PATCH 05/12] generic/562: handle ENOSPC while cloning gracefully From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064501.904310.1505759730439532159.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong This test creates a couple of patterned files on a tiny filesystem, fragments the free space, clones one patterned file to the other, and checks that the entire file was cloned. However, this test doesn't work on a 64k fsblock filesystem because we've used up all the free space reservation for the rmapbt, and that causes the FICLONE to error out with ENOSPC partway through. Hence we need to detect the ENOSPC and _notrun the test. That said, it turns out that XFS has been silently dropping error codes if we managed to make some progress cloning extents. That's ok if the operation has REMAP_FILE_CAN_SHORTEN like copy_file_range does, but FICLONE/FICLONERANGE do not permit partial results, so the dropped error codes is actually an error. Therefore, this testcase now becomes a regression test for the patch to fix that. Signed-off-by: Darrick J. Wong --- tests/generic/562 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/generic/562 b/tests/generic/562 index 91360c4154a6a2..62899945003513 100755 --- a/tests/generic/562 +++ b/tests/generic/562 @@ -15,6 +15,9 @@ _begin_fstest auto clone punch . ./common/filter . ./common/reflink +test "$FSTYP" = "xfs" && \ + _fixed_by_kernel_commit XXXXXXXXXX "xfs: don't drop errno values when we fail to ficlone the entire range" + _require_scratch_reflink _require_test_program "punch-alternating" _require_xfs_io_command "fpunch" @@ -48,8 +51,11 @@ while true; do done # Now clone file bar into file foo. This is supposed to succeed and not fail -# with ENOSPC for example. -_reflink $SCRATCH_MNT/bar $SCRATCH_MNT/foo >>$seqres.full +# with ENOSPC for example. However, XFS will sometimes run out of space. +_reflink $SCRATCH_MNT/bar $SCRATCH_MNT/foo >>$seqres.full 2> $tmp.err +cat $tmp.err +grep -q 'No space left on device' $tmp.err && \ + _notrun "ran out of space while cloning" # Unmount and mount the filesystem again to verify the operation was durably # persisted. From patchwork Mon Nov 18 23:02:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879157 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E285E1E7643; Mon, 18 Nov 2024 23:02:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970978; cv=none; b=qd1aDD0EpTe7CPi8VVOtiVFZ/m5/E+vxzYg2H50HO+7cHbobt/OI8R2ZGEbgP4Y9PU7FYOnK4Bwd31FULRKRshP2zqZka+sdA/2BVm4oiB6hZv4PBf7sYIE/kJgP4IyvXwqdHj6emboUOwPt9LLv2b5p2aNGZHgjm27MyL5ujs8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970978; c=relaxed/simple; bh=G+fQ8zAEbRNmHhLF948ul0JBfTLHgc9HOvlgGXrhgrk=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HESxa8x8rwT0cRefV0lMrUoTtWzTgQ8EmmhgpZYcF5RzuzAE7nFJv6HwRcTr8UdE/2c0ERXT99C1p4bCP3wOkHP/cT3KcLwivt54FnXuK/9YpVfBTfzQ+qQb8Twcg0xfPgHWFGTZXzB7A+uKXcmStO7UrLtv0jdcV1Wb1nKqjz0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cx/hNUSY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Cx/hNUSY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79F11C4CECC; Mon, 18 Nov 2024 23:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731970977; bh=G+fQ8zAEbRNmHhLF948ul0JBfTLHgc9HOvlgGXrhgrk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Cx/hNUSYz9XGrTgG2VuBIgyNihvBCXJjDLWrGfIdylHd4VbgH7yoMVuOt3z4XDNAb foR+TtJBAgFmUXxEUgZUCsOQRqQBdD/LCB+mFwsNMzFBsSXUcZMF3FtbfQtOilR1Nd 6vqjjCBaAhPGlwICUYmd622LW/oBMiXeBU6CD3tRjKTPXAX5XlaJJ8j/OlK8UTG2LH X0JBRhR90BzmwZOx3LR1zzJCeisbeYDFYFuS/MqRUtYK0AOj6rRBj/CDBazHMddiZi p3Lfeme/98K2GhWscJIcRRgn/cZypITuXRQ588E16dBmrQjjP7E0i4lcGpMddKpUV6 gsOy4odmSW3sw== Date: Mon, 18 Nov 2024 15:02:57 -0800 Subject: [PATCH 06/12] xfs/163: skip test if we can't shrink due to enospc issues From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064517.904310.3981739368234759783.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong If this test fails due to insufficient space, skip this test. This can happen if a realtime volume is enabled on the filesystem and we cannot shrink due to the rtbitmap. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- tests/xfs/163 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/xfs/163 b/tests/xfs/163 index 2bd94060222f96..75c3113dc2fd03 100755 --- a/tests/xfs/163 +++ b/tests/xfs/163 @@ -17,13 +17,20 @@ _begin_fstest auto quick growfs shrinkfs test_shrink() { - $XFS_GROWFS_PROG -D"$1" $SCRATCH_MNT >> $seqres.full 2>&1 + $XFS_GROWFS_PROG -D"$1" $SCRATCH_MNT &> $tmp.growfs ret=$? _scratch_unmount _check_scratch_fs _scratch_mount + # If we couldn't shrink the filesystem due to lack of space, we're + # done with this test. + [ $1 -ne $dblocks ] && \ + grep -q 'No space left on device' $tmp.growfs && \ + _notrun "Could not shrink due to lack of space" + cat $tmp.growfs >> $seqres.full + $XFS_INFO_PROG $SCRATCH_MNT 2>&1 | _filter_mkfs 2>$tmp.growfs >/dev/null . $tmp.growfs [ $ret -eq 0 -a $1 -eq $dblocks ] From patchwork Mon Nov 18 23:03:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879158 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4208E198837; Mon, 18 Nov 2024 23:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970993; cv=none; b=KowNR5Kr/pMTujqflZ+LM6MofFNNSE0wFKMUZJCGiIcPtrpOC93JQMiL1G0HFV6KAZPNJh+k9cY5nBpWwF28OF/jlhsOViXQNTDVHRWgjIK0cAIvP7e+o9WfoHVqAsHT9sEjQgAyx2FeJVZw04a+ZpPTrxEZTAAhCypUVZfJyT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731970993; c=relaxed/simple; bh=Tv0atNFyjK31N3BhYZ1AIjk+ekfRIL2S8dEGie9pqvQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UG2I3NX1Q/nJOvOzX11clBD1yDgwPdTk65d+C53e5CZFfw4XRGoPTL87y9Ff/E9p/4+/j77ZG3hZMMM8/Wcjmyu4XkgY5hWCCfsxlQ7jaCOSy0EJyY98s9WIOoVUzqLisv1xUo2Mxzyw73rg8RS1cv4Az7BJ7ToDON6rjArO4Pk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gx9xIB8O; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gx9xIB8O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 155F1C4CECF; Mon, 18 Nov 2024 23:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731970993; bh=Tv0atNFyjK31N3BhYZ1AIjk+ekfRIL2S8dEGie9pqvQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=gx9xIB8OzGzVPj7XriRS9EwJVG1iil350f4bo/qzDeduJeF+gkvDuIaqNx1tv9S6p ByRgfjds7Jjt/aX+6vcm9Hf0+waCoC+alQByDvIcf18jVchvvJSwvh2JaUZjeIHJ63 pHYRQXM1D9lnK0ZC5ZbzOQde61UtdYplLBMd5D8iMpPmo4MXY3f5I/u3Rg8I9L0Hbo kq19ZkLm/pYf7XMPMfvbFq5YgTzhOtxeVsxSSJVXKcBotNsbk61qgRhHvFJAvNJ/6v 0Gn1I+1Gvk+6DpUU/DvoINWtBf1iVW+kJvht1AloUTNRq09lAm7DzaEabyOo5iU/7S FxTD4zKJzc2MA== Date: Mon, 18 Nov 2024 15:03:12 -0800 Subject: [PATCH 07/12] xfs/009: allow logically contiguous preallocations From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064532.904310.16393171518805565423.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The new rtgroups feature implements a simplistic rotor to pick the rtgroup for an initial allocation to a file. This causes test failures if the preallocations are spread across two rtgroups, which happens if there are more subtests than rtgroups. One way to fix this would be to reset the rotor then each subtest starts allocating from rtgroup 0, but the only way to do that is to cycle the scratch mount, which is a bit gross. Instead, report logically contiguous mappings as a single mapping even if the physical space is not contiguous. Unfortunately, there's not enough context in the comments to know if the test actually was checking for physical contiguity? Or if this is just an exerciser of the old preallocation calls, and it's fine as long as the file ranges are mapped (or unmapped) as desired. Messing with some awk is a lot cheaper than umount/mount cycling. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- tests/xfs/009 | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/xfs/009 b/tests/xfs/009 index dde505f079f4f8..bb42ce32490df5 100755 --- a/tests/xfs/009 +++ b/tests/xfs/009 @@ -49,13 +49,26 @@ _filesize() _block_filter() { $AWK_PROG -v bsize="$bsize" ' + BEGIN { + br_pos = 0 + br_len = 0 + } + function dump_blockrange() { + if (br_len == 0) + return + printf(" [%d,%d]: BLOCKRANGE\n", br_pos, br_len) + br_pos = 0 + br_len = 0 + } /blocksize/ { + dump_blockrange() printf(" blocksize BSIZE\n") next } /CMD/ { + dump_blockrange() split($3, off, "=") offset = strtonum(off[2]) if (offset != -1) @@ -72,6 +85,7 @@ _block_filter() } /MAP/ { + dump_blockrange() split($2, off, "=") offset = strtonum(off[2]) if (offset != -1) @@ -90,6 +104,7 @@ _block_filter() } /TRUNCATE/ { + dump_blockrange() split($2, off, "=") offset = strtonum(off[2]) / bsize @@ -99,16 +114,28 @@ _block_filter() } /\[[0-9]+,[0-9]+\]:/ { - printf(" %s BLOCKRANGE\n", $1) + rangestr = gensub(/\[([0-9]+),([0-9]+)\]:/, "\\1,\\2", "g", $1); + split(rangestr, off, ",") + if (br_pos + br_len == off[1]) { + br_len += off[2]; + } else { + dump_blockrange() + br_pos = off[1]; + br_len = off[2]; + } next } { + dump_blockrange() print next } + END { + dump_blockrange() + } ' } From patchwork Mon Nov 18 23:03:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879159 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAB611E7647; Mon, 18 Nov 2024 23:03:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971009; cv=none; b=kAnk/lF0LHG623LUeXZA/UEYNmINtL9rQpSocyPUttyo4BU3ndhoE72MMvmwH5ZKBX8sf15kwRD4d5cY1JmHpZWa+tidOWSs14wDMnaVaIxdSjWQwpi8lYzkkJWDhOHI8V0jol1sb/t92UcXubyF1nJJ+AqV9KN8EZNTVmkyxkk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971009; c=relaxed/simple; bh=ZX22UqJx4AZelv6IirvzVkDKn9wmJ7KLKAv2Gn4JmMI=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eJGge7FT7o4FLT/FspshDQorDhuklRJ5cKmRQdMnb8XuyQgiMvNS3A/btXdwyT3u/fZk7U0Fy6lo1Pvzy2C36W0RNsEERungAY9ewfZNEyP349/U0v+GBayuW/pyRAb2WiVMuIFpa9o29sZzn4H5WXfE8BJNb1Ykvuqrgc2+v7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Iy/O0U5H; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Iy/O0U5H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B147BC4CECC; Mon, 18 Nov 2024 23:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731971008; bh=ZX22UqJx4AZelv6IirvzVkDKn9wmJ7KLKAv2Gn4JmMI=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Iy/O0U5HCbher8dw/NhhQxUxj9EhsL1iir6ZTb0yKgaBpdsg2U+tqYEPQuOZkZc4A 23p/dHGjN7n98jiw6Lrge617o71G/pqXCWCOsfwV83vcB8615K/q2cyF2Wu+0/c3/I N7xCuLBUCH0cmvHUllI3AyoxaVx37RiWDD2DrCciIOqxhVLxAE0dnpuIxfO9fYixZO KYB8FhlM1JSN8MjB8hD37vwHLWQZG8v372TucF77NSt44AteaCaWQ99S82y0qGwTEo DfilofP7w8syLYXcSGif6VaOxg90tMZT7Mn8yWlZ8S9C7LcOTcw1zCLR3qTY5qu8yZ YiTpY3EyvWwKA== Date: Mon, 18 Nov 2024 15:03:28 -0800 Subject: [PATCH 08/12] generic/251: use sentinel files to kill the fstrim loop From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064547.904310.14473736825696277411.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Apparently the subshell kill doesn't always take, and then the test runs for hours and hours because nothing stops it. Instead, use a sentinel file to detect when fstrim_loop should stop execing background fstrims. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- tests/generic/251 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/generic/251 b/tests/generic/251 index b432fb11937911..d59e91c3e0a33a 100755 --- a/tests/generic/251 +++ b/tests/generic/251 @@ -125,12 +125,15 @@ fstrim_loop() wait $fpid fi while [ $start -lt $fsize ] ; do + test -s $tmp.fstrim_loop || break $FSTRIM_PROG -m ${minlen}k -o ${start}k -l ${step}k $SCRATCH_MNT & fpid=$! wait $fpid start=$(( $start + $step )) done + test -s $tmp.fstrim_loop || break done + rm -f $tmp.fstrim_loop } function check_sums() { @@ -188,6 +191,7 @@ find -P . -xdev -type f -print0 | xargs -0 md5sum | sort -o $tmp/content.sums echo -n "Running the test: " pids="" +echo run > $tmp.fstrim_loop fstrim_loop & fstrim_pid=$! p=1 @@ -199,8 +203,10 @@ done echo "done." wait $pids -kill $fstrim_pid -wait $fstrim_pid +truncate -s 0 $tmp.fstrim_loop +while test -e $tmp.fstrim_loop; do + sleep 1 +done status=0 From patchwork Mon Nov 18 23:03:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879160 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA594153BE4; Mon, 18 Nov 2024 23:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971024; cv=none; b=aGb6YdgKoQH/TE+LkMSBfgmjqMqrIy7t0ni3jw/Erq2K0ED03cvCQy3LRboWX1YEf00LaAW2YvyEL3Vyp5qzsoIBa6PKiIU3/DO7c9LWC9M0Zch0/S8mlDiaXBuQFxaREramgQSlhDJMomKkWpeW7o4e6B5PST/Twz62iBdbimE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971024; c=relaxed/simple; bh=FqXto+XvEKJb19Mg6eHjG09gKuWcl9gRB9HoBxKkqIQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Bk9dslukrLBdHQLERzaWH/72qEr5IUFHOPYMcxPWn5o3ergRLIvuFO/yRFtbJnIqC6uBtqLuTp7YcqscsJ/ruwedCyT19B5FAOHVORw6TpCENUmb44mv1c1u/CowMH7EJ5tAHAvaZeSrKSl0z5zl5dSw/gLACMxKFJM8s8vL1VU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LM4am8jf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LM4am8jf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D717C4CECC; Mon, 18 Nov 2024 23:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731971024; bh=FqXto+XvEKJb19Mg6eHjG09gKuWcl9gRB9HoBxKkqIQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=LM4am8jfRp99jEua3iSb+L4A1uL1AwlB++tiQ5ADLEKlXRkS4TXht+1yv7vkW4l1E xdDmnlat3YeFJNaLerIq+Qm7DsIKw1+hLVWRy/q0P7zE116aHb9iCYEounnNyFEaLh m8ThhA/xzHnQ080nUqkuet8J0y50O2bvjFUnt8m6NockkB8s/acGsyYLgObHy41ix3 9NGM5G1vxUm05l/WBT8ZZcmhF2NQFD5yheQKvwilJN1uCvzHj5uVwdrXqpsB7y1JvC fqJG+6cb7LHlxKDmYJnLWG4LqHt+K5Gor9JNKXLa6Ffro+zLom6wmy5fbMAjY6mqvm yNBIW3iBfeaxA== Date: Mon, 18 Nov 2024 15:03:43 -0800 Subject: [PATCH 09/12] generic/251: constrain runtime via time/load/soak factors From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064562.904310.6083759089693476713.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong On my test fleet, this test can run for well in excess of 20 minutes: 613 generic/251 616 generic/251 624 generic/251 630 generic/251 634 generic/251 652 generic/251 675 generic/251 749 generic/251 777 generic/251 808 generic/251 832 generic/251 946 generic/251 1082 generic/251 1221 generic/251 1241 generic/251 1254 generic/251 1305 generic/251 1366 generic/251 1646 generic/251 1936 generic/251 1952 generic/251 2358 generic/251 4359 generic/251 5325 generic/251 34046 generic/251 because it hardcodes 20 threads and 10 copies. It's not great to have a test that results in a significant fraction of the total test runtime. Fix the looping and load on this test to use LOAD and TIME_FACTOR to scale up its operations, along with the usual SOAK_DURATION override. That brings the default runtime down to less than a minute. Signed-off-by: "Darrick J. Wong" --- tests/generic/251 | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/tests/generic/251 b/tests/generic/251 index d59e91c3e0a33a..b4ddda10cef403 100755 --- a/tests/generic/251 +++ b/tests/generic/251 @@ -15,7 +15,6 @@ _begin_fstest ioctl trim auto tmp=`mktemp -d` trap "_cleanup; exit \$status" 0 1 3 trap "_destroy; exit \$status" 2 15 -chpid=0 mypid=$$ # Import common functions. @@ -151,29 +150,28 @@ function check_sums() { function run_process() { local p=$1 - repeat=10 + if [ -n "$SOAK_DURATION" ]; then + local duration="$SOAK_DURATION" + else + local duration="$((30 * TIME_FACTOR))" + fi + local stopat="$(( $(date +%s) + duration))" - sleep $((5*$p))s & - export chpid=$! && wait $chpid &> /dev/null - chpid=0 - - while [ $repeat -gt 0 ]; do + sleep $((5*$p))s + while [ "$(date +%s)" -lt "$stopat" ]; do # Remove old directories. rm -rf $SCRATCH_MNT/$p - export chpid=$! && wait $chpid &> /dev/null # Copy content -> partition. mkdir $SCRATCH_MNT/$p cp -axT $content/ $SCRATCH_MNT/$p/ - export chpid=$! && wait $chpid &> /dev/null check_sums - repeat=$(( $repeat - 1 )) done } -nproc=20 +nproc=$((4 * LOAD_FACTOR)) # Copy $here to the scratch fs and make coipes of the replica. The fstests # output (and hence $seqres.full) could be in $here, so we need to snapshot @@ -194,11 +192,9 @@ pids="" echo run > $tmp.fstrim_loop fstrim_loop & fstrim_pid=$! -p=1 -while [ $p -le $nproc ]; do +for ((p = 1; p < nproc; p++)); do run_process $p & pids="$pids $!" - p=$(($p+1)) done echo "done." From patchwork Mon Nov 18 23:03:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879182 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D744153BE4; Mon, 18 Nov 2024 23:04:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971040; cv=none; b=tXT9HWGbujne4zeTONnO6M/53IHEtU2hMGg2Pn/qQzhswezfGwAHzdcLnzt/cgjo58NruvI29LiJgQq1k7MlX/rI/MRVyf6Dg6d5mr/B1LCc9IXKLKp4bUHuxUBppWMgn23jg+j8s3MkMan/kDqn2fZ7CwCkwG/S7rGDNw+dnrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971040; c=relaxed/simple; bh=aZ92cBGikadawS733SmHE9j0KKxvkfJZgfCH1/QFwe8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cYC0kcIVQpNG+SoY0HPcprR+n5ZEVRDdvpMvLATabu7fi2kEio8MNI0qCzdxDm5hFkgdZj9hjjaN0i48rATaL0n/Oanz6pawQsY+2gmc2J1G9vOSpq2Y6dNx57qz6Rv7FDsYSn6NxypJhlLTHKlbkwPyhhnN1ZFY8zlWLw3XBgA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hoLzsNDh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hoLzsNDh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C720C4CECC; Mon, 18 Nov 2024 23:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731971040; bh=aZ92cBGikadawS733SmHE9j0KKxvkfJZgfCH1/QFwe8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=hoLzsNDhM4diVoJRQeivGf4VXgcqzPGQUrfekIISOcKgPY0xv0+0dHCpam6aUrg6P RAQmlDOP0VbFfwh4gXZ9n7RHbknOGD8lJu3VXtt/x6JSfiGDnWD/4HGiE4Gq4xVN5U XqM+zmP1Iv8GTrE5qJx5zjc2nvomObs/JXvta1SD4lnAzVwtJ6UjYK8TOFxQzyiQvW km5ojjAK/kjA83rWhC1m+vaKrThxZ7xNo5XSEVnQZXbL7mwtoSjgSofFhP6XDNa60O djfDlQMlmVBaFabxXE+i5mp1JZUzQehdjMcbD2rozX/lTB5zYylmv15U5pWtXDRIWj AhOxnc3jyJwzg== Date: Mon, 18 Nov 2024 15:03:59 -0800 Subject: [PATCH 10/12] common/rc: _scratch_mkfs_sized supports extra arguments From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: zlang@kernel.org, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064578.904310.6385654630635505402.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Zorro Lang To give more arguments to _scratch_mkfs_sized, we generally do as: MKFS_OPTIONS="-L oldlabel $MKFS_OPTIONS" _scratch_mkfs_sized $fs_size to give "-L oldlabel" to it. But if _scratch_mkfs_sized fails, it will get rid of the whole MKFS_OPTIONS and try to mkfs again. Likes: ** mkfs failed with extra mkfs options added to "-L oldlabel -m rmapbt=1" by test 157 ** ** attempting to mkfs using only test 157 options: -d size=524288000 -b size=4096 ** But that's not the fault of "-L oldlabel". So for keeping the mkfs options ("-L oldlabel") we need, we'd better to let the scratch_mkfs_sized to support extra arguments, rather than using global MKFS_OPTIONS. Signed-off-by: Zorro Lang Reviewed-by: "Darrick J. Wong" [djwong: fix string quoting issues] Signed-off-by: "Darrick J. Wong" --- common/rc | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/common/rc b/common/rc index 70a0f1d1c6acd9..6acacbe4c88eea 100644 --- a/common/rc +++ b/common/rc @@ -1026,11 +1026,13 @@ _small_fs_size_mb() } # Create fs of certain size on scratch device -# _try_scratch_mkfs_sized [optional blocksize] +# _try_scratch_mkfs_sized [optional blocksize] [other options] _try_scratch_mkfs_sized() { local fssize=$1 - local blocksize=$2 + shift + local blocksize=$1 + shift local def_blksz local blocksize_opt local rt_ops @@ -1094,10 +1096,10 @@ _try_scratch_mkfs_sized() # don't override MKFS_OPTIONS that set a block size. echo $MKFS_OPTIONS |grep -E -q "b\s*size=" if [ $? -eq 0 ]; then - _try_scratch_mkfs_xfs -d size=$fssize $rt_ops + _try_scratch_mkfs_xfs -d size=$fssize $rt_ops "$@" else _try_scratch_mkfs_xfs -d size=$fssize $rt_ops \ - -b size=$blocksize + -b size=$blocksize "$@" fi ;; ext2|ext3|ext4) @@ -1108,7 +1110,7 @@ _try_scratch_mkfs_sized() _notrun "Could not make scratch logdev" MKFS_OPTIONS="$MKFS_OPTIONS -J device=$SCRATCH_LOGDEV" fi - ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks + ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize "$@" $SCRATCH_DEV $blocks ;; gfs2) # mkfs.gfs2 doesn't automatically shrink journal files on small @@ -1123,13 +1125,13 @@ _try_scratch_mkfs_sized() (( journal_size >= min_journal_size )) || journal_size=$min_journal_size MKFS_OPTIONS="-J $journal_size $MKFS_OPTIONS" fi - ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV $blocks + ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -O -b $blocksize "$@" $SCRATCH_DEV $blocks ;; ocfs2) - yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks + yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize "$@" $SCRATCH_DEV $blocks ;; udf) - $MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks + $MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize "$@" $SCRATCH_DEV $blocks ;; btrfs) local mixed_opt= @@ -1137,33 +1139,33 @@ _try_scratch_mkfs_sized() # the device is not zoned. Ref: btrfs-progs: btrfs_min_dev_size() (( fssize < $((256 * 1024 * 1024)) )) && ! _scratch_btrfs_is_zoned && mixed_opt='--mixed' - $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV + $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize "$@" $SCRATCH_DEV ;; jfs) - ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS $SCRATCH_DEV $blocks + ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS "$@" $SCRATCH_DEV $blocks ;; reiserfs) - ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks + ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS -b $blocksize "$@" $SCRATCH_DEV $blocks ;; reiser4) # mkfs.resier4 requires size in KB as input for creating filesystem - $MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize $SCRATCH_DEV \ + $MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize "$@" $SCRATCH_DEV \ `expr $fssize / 1024` ;; f2fs) # mkfs.f2fs requires # of sectors as an input for the size local sector_size=`blockdev --getss $SCRATCH_DEV` - $MKFS_F2FS_PROG $MKFS_OPTIONS $SCRATCH_DEV `expr $fssize / $sector_size` + $MKFS_F2FS_PROG $MKFS_OPTIONS "$@" $SCRATCH_DEV `expr $fssize / $sector_size` ;; tmpfs) local free_mem=`_free_memory_bytes` if [ "$free_mem" -lt "$fssize" ] ; then _notrun "Not enough memory ($free_mem) for tmpfs with $fssize bytes" fi - export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS" + export MOUNT_OPTIONS="-o size=$fssize "$@" $TMPFS_MOUNT_OPTIONS" ;; bcachefs) - $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize $blocksize_opt $SCRATCH_DEV + $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize $blocksize_opt "$@" $SCRATCH_DEV ;; *) _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized" @@ -1173,7 +1175,7 @@ _try_scratch_mkfs_sized() _scratch_mkfs_sized() { - _try_scratch_mkfs_sized $* || _notrun "_scratch_mkfs_sized failed with ($*)" + _try_scratch_mkfs_sized "$@" || _notrun "_scratch_mkfs_sized failed with ($*)" } # Emulate an N-data-disk stripe w/ various stripe units From patchwork Mon Nov 18 23:04:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879183 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DE111E5717; Mon, 18 Nov 2024 23:04:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971056; cv=none; b=LpymId+Wk0+IG4omQMVa9HPNH90DMVArr5Me7qAGJit+Nke25/UaIS3ouaOIf2lB6iyvGHq77Q9W0EJDvKN/+UkPV5nSVEzHtBkeTPg2/JNZcp7f3RRKH8zTb1ZpLLP33ftim+0YsFkPvQl32MnB/V+t+dfOzmr3ng2vtoiVPPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971056; c=relaxed/simple; bh=xoZYZcbhaXPVuUUb3eqxkHGXvjFqsgU9jp/QiJ6gyyE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TMo22zgyfAt/fMWOmsrh9hzW+mj3RAkXWpXRY2lS8TxLstWNvkPPZxQhxMMGDfT1Aav9vMdeun3U1Fi/5IIQxFfettmrFz8uMiFKIyylT04VsCobDJzlKL0yP7sF8psPh5/Yj7ofGKL7KieSeNaflUerDfLj6DenMjcjCruF2ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g2FOQzlT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g2FOQzlT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5B9BC4CECC; Mon, 18 Nov 2024 23:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731971055; bh=xoZYZcbhaXPVuUUb3eqxkHGXvjFqsgU9jp/QiJ6gyyE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=g2FOQzlTeJjyx2M0Or1wSK85u2mwu8X2kvEHltlBTCCYnNmXdZDwyY4CG5+IEmtk/ 2EYKrMisp+eLupNNdtdSFbfg0RHKFwNjrGkiVvlx7nec1pMrj1qEeAnjKMFdx6c69V SfWeVOCdV82RN8IMGvKxqLjg/mknvrxY25OYKqzlwIKqjefSK+g5K7eNzPKCdmigOl 5C/+Ng9dElGKrwhvroMrLcyhYunL8GaY4Qwe7xhW8eIGqP/UKCNdP3aOJ/0fd4ELKs 8d3+AggWAmVHPG4ChJxfJ7VdG219AMF6Pz1FKeq4jiiwG7mX91EYGN8n/Xx8RY7hRE fQmOMSfQxPUXQ== Date: Mon, 18 Nov 2024 15:04:15 -0800 Subject: [PATCH 11/12] xfs/157: do not drop necessary mkfs options From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: zlang@kernel.org, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064593.904310.9005954163451030743.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Zorro Lang To give the test option "-L oldlabel" to _scratch_mkfs_sized, xfs/157 does: MKFS_OPTIONS="-L oldlabel $MKFS_OPTIONS" _scratch_mkfs_sized $fs_size but the _scratch_mkfs_sized trys to keep the $fs_size, when mkfs fails with incompatible $MKFS_OPTIONS options, likes this: ** mkfs failed with extra mkfs options added to "-L oldlabel -m rmapbt=1" by test 157 ** ** attempting to mkfs using only test 157 options: -d size=524288000 -b size=4096 ** but the "-L oldlabel" is necessary, we shouldn't drop it. To avoid that, we give the "-L oldlabel" to _scratch_mkfs_sized through function parameters, not through global MKFS_OPTIONS. Signed-off-by: Zorro Lang Reviewed-by: "Darrick J. Wong" [djwong: fix more string quoting issues] Signed-off-by: "Darrick J. Wong" --- tests/xfs/157 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/xfs/157 b/tests/xfs/157 index 9b5badbaeb3c76..e102a5a10abe4b 100755 --- a/tests/xfs/157 +++ b/tests/xfs/157 @@ -66,8 +66,7 @@ scenario() { } check_label() { - MKFS_OPTIONS="-L oldlabel $MKFS_OPTIONS" _scratch_mkfs_sized $fs_size \ - >> $seqres.full + _scratch_mkfs_sized "$fs_size" "" -L oldlabel >> $seqres.full 2>&1 _scratch_xfs_db -c label _scratch_xfs_admin -L newlabel "$@" >> $seqres.full _scratch_xfs_db -c label From patchwork Mon Nov 18 23:04:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13879184 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90DF61E8825; Mon, 18 Nov 2024 23:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971071; cv=none; b=D+JIvBZkRuUUpW8JDv9DCMqfDV6sY8wj98ZcQFMEHvxTw6aMpSgUbQeUKjNDi0RVtK5luHhATZ7CoQ3S3D+mYh1Aa9KtrdRca3zQsraWj15VnG6GNrOeR4pR5KB2oiZt9BApdm20WuwFWaDAgmupptRyCvCbJ4bgYNDor7oLLBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731971071; c=relaxed/simple; bh=xDBnKYtPKRwk7HgznItCGQUs7M1arUlp40YnOffzAiQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d4ak4veZ1E/lXI/e88e3WOQgt7d40HD6efcKPOPq9GtBrsCHo4F/IqqXGmFF95SfJuVBI8glo0bo4sNHf0N4e8vkc9U5YNjV5GTewpIfe47Y+hTwMonrnPFdPekbme/iGQD9X769tTADp65UrrW4wpxOBpBk6N7cU+aFWJln3TM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mv0X0pLI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mv0X0pLI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 690B8C4CECC; Mon, 18 Nov 2024 23:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731971071; bh=xDBnKYtPKRwk7HgznItCGQUs7M1arUlp40YnOffzAiQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=mv0X0pLIbsh4rzRlBf/qbwYNhFzCAXJcRyibneJLWDZHfq0GrmG8NeGceR1HII3Vo UE/pmwNvaoDtQzbBF8p2wPUPFfX3aubt0BUWtJZ3RuHVYMHyi15CPErH63Uxo1ULTD VjZaWIf1/Ty0mMt4FAyV11OODraNjW9cpprDVLmmRF20FO1ukT1rPK8f6bzgJI9WZR 1I8P6M2/1pvLSJOaw+N7YCHYSKKe2dNBobHBmio6cwN2RQk9Q06pd6IZuuKZyDNBbS Jvkhca6B5CHrgK7sjwQdswmpIV7ajtB6+otwf00VtWAva/vwpCvWEJv01TWBFL9knZ bNZY/TohzE+lQ== Date: Mon, 18 Nov 2024 15:04:31 -0800 Subject: [PATCH 12/12] xfs/157: fix test failures when MKFS_OPTIONS has -L options From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173197064609.904310.7896567442225446738.stgit@frogsfrogsfrogs> In-Reply-To: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> References: <173197064408.904310.6784273927814845381.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Zorro reports that this test fails if the test runner set an -L (label) option in MKFS_OPTIONS. Fix the test to work around this with a bunch of horrid sed filtering magic. It's probably not *critical* to make this test test work with random labels, but it'd be nice not to lose them. Cc: # v2024.10.14 Fixes: 2f7e1b8a6f09b6 ("xfs/157,xfs/547,xfs/548: switch to using _scratch_mkfs_sized") Signed-off-by: Darrick J. Wong --- tests/xfs/157 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/xfs/157 b/tests/xfs/157 index e102a5a10abe4b..0c21786e389695 100755 --- a/tests/xfs/157 +++ b/tests/xfs/157 @@ -65,9 +65,34 @@ scenario() { SCRATCH_RTDEV=$orig_rtdev } +extract_mkfs_label() { + set -- $MKFS_OPTIONS + local in_l + + for arg in "$@"; do + if [ "$in_l" = "1" ]; then + echo "$arg" + return 0 + elif [ "$arg" = "-L" ]; then + in_l=1 + fi + done + return 1 +} + check_label() { - _scratch_mkfs_sized "$fs_size" "" -L oldlabel >> $seqres.full 2>&1 - _scratch_xfs_db -c label + local existing_label + local filter + + # Handle -L somelabel being set in MKFS_OPTIONS + if existing_label="$(extract_mkfs_label)"; then + filter=(sed -e "s|$existing_label|oldlabel|g") + _scratch_mkfs_sized $fs_size >> $seqres.full + else + filter=(cat) + _scratch_mkfs_sized "$fs_size" "" -L oldlabel >> $seqres.full 2>&1 + fi + _scratch_xfs_db -c label | "${filter[@]}" _scratch_xfs_admin -L newlabel "$@" >> $seqres.full _scratch_xfs_db -c label _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"