From patchwork Thu Jan 16 23:38:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13942711 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 2A2F61F91F5; Thu, 16 Jan 2025 23:38:59 +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=1737070740; cv=none; b=ofNbOdWeMD9QWO8pkw7XISENOby6gGw118GYPo2nxZbuzvsJK7nbxfD88SYKRCjOkZIQrAcei5dgIS/IPOP2UAo+3oajOtDS1vDhkJ6vaL+Bi5RHtjrA4YlYeuNNB/IxQUXNF1SH1zyM1QO1j4/G/tnkRfL2ckVKdiKwDlp7GZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070740; c=relaxed/simple; bh=peSi/GHN0RPSpl1UkVQg33PRopVZpluEL6RXKRLjTq8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tbBQYomy4w6zfx+H6dL149JZl135+f9+JsUDNfnjPandlJiuZVtLOqff8wYrDT5Vavv1gz+r4oWo7fozP+JGSmtjEATPSNlsTXDl2fKlHceCvCC47dY0qlM9TAnSQEL9zaurNmw+339gDKsc8PWhi3Ob6YXJxwxSRPwwvFtoFpA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ikHGW6Zi; 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="ikHGW6Zi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D59BC4CED6; Thu, 16 Jan 2025 23:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070739; bh=peSi/GHN0RPSpl1UkVQg33PRopVZpluEL6RXKRLjTq8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ikHGW6ZiFm5SPkRMUFokXQhGo+IsRDlEE5zEC84EAqk0IDwlwcgzV3cQ6tR9ZCSL0 QJlLwKDGiZe4nKdcGXwqA3cJSNY43L6obzZB2GDvqm7Hq3MzSTb2Y3ftGLYinAw8px l6cBS7pOl/1NGM5Rv0AHHb0Oku2uxi0exuVLa6KXYawmOwW5Iu73d4dU2Rl3hDDso5 PsUTWj+kQnODmJmHTHjCxzu4Aa3s7DXqcnPd81oslyFgHFs6Q8AQclLQOD2rejDdb8 Dvs4gbSukEDBDQ7HKrx8VERcIj86+s2c+Wmh6f4VixWSI6s+iiVogtSLIv4h+DMeS/ ceiaW/t17OBQA== Date: Thu, 16 Jan 2025 15:38:59 -0800 Subject: [PATCH 1/4] xfs: update tests for quota files in the metadir From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706976657.1929311.11925303799347881958.stgit@frogsfrogsfrogs> In-Reply-To: <173706976640.1929311.7118885570179440699.stgit@frogsfrogsfrogs> References: <173706976640.1929311.7118885570179440699.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Update fstests to handle quota files in the metadir. Signed-off-by: "Darrick J. Wong" --- common/xfs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/xfs b/common/xfs index aa635f8b4745fa..0f29d5c5a6b963 100644 --- a/common/xfs +++ b/common/xfs @@ -1973,6 +1973,24 @@ _scratch_xfs_find_metafile() return 0 fi ;; + "uquotino") + if _xfs_has_feature "$SCRATCH_DEV" metadir; then + echo "path -m /quota/user" + return 0 + fi + ;; + "gquotino") + if _xfs_has_feature "$SCRATCH_DEV" metadir; then + echo "path -m /quota/group" + return 0 + fi + ;; + "pquotino") + if _xfs_has_feature "$SCRATCH_DEV" metadir; then + echo "path -m /quota/project" + return 0 + fi + ;; esac sb_field="$(_scratch_xfs_get_sb_field "$metafile")" From patchwork Thu Jan 16 23:39:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13942712 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 BC5BC1F91FC; Thu, 16 Jan 2025 23:39:15 +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=1737070755; cv=none; b=F2ml+rqqGxXA+BZPLGp9/5C1xgjg2KZB5ouDqzNkIIkcedOzJn5Z8voMmQvzmJcNWFHzvQsDIbUvyBlwLnsROlmEUevCXE3sfFLnJPitT3Ai9nLBYCuMvdNjB8rgGGBFKK5jQUSr6t010ANdiuLjt3ChvSZE6vd/lEqF0pauQiw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070755; c=relaxed/simple; bh=pBGTiPERqBTZQGPZV4lr3zgi/bGwSg3uR8OeQo4YDKY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=I6bkBQNDlOfWtIZQBleVEvM+4ftyBJiRV1YmaJuAQ2e2f5B3tWhm2u4y79hncRQZLVT/69pisXQSr7zTuKndARPU6z82o4mtY65c2Yk7hsI2fL3lcD6znjObHWhOGYYvNkq8G3B29XKzZMImSNx20h9TNRAodwOPLanajVKNeOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IjEATV0g; 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="IjEATV0g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A82CC4CED6; Thu, 16 Jan 2025 23:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070755; bh=pBGTiPERqBTZQGPZV4lr3zgi/bGwSg3uR8OeQo4YDKY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=IjEATV0g6u8+l/KCXkW9RVGn2SWP/Y4cCR5GAreEy7NXjaDDFiRSpNs0xPTRkeHPU fdF+ktRQGDWTsN7gat6Sl6tL+Irj78w+Erq0H+F41RSKnYekERvTexw2qn9ns9gu21 5zoKxlovz9wfLuBlNPNQtFH8SmKCgkeXfCmMTNnlyG5j3g6M7zQcSahRVsl0RZfreW h8UU/B24NqVguXxj1EqOHDdiFYHM7Vr8AMXWQBfYLM5p7MjcQ0kUbvjuQAqfcSVz/Z 9mdK/DlChYweHy4jINmwzAyv/TyKZS4nPq1ahGkdTsIS7TzB72t/qbJVjwPbmD/m7r klof9zFHg03LQ== Date: Thu, 16 Jan 2025 15:39:14 -0800 Subject: [PATCH 2/4] xfs: test persistent quota flags From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706976671.1929311.1108481290786391808.stgit@frogsfrogsfrogs> In-Reply-To: <173706976640.1929311.7118885570179440699.stgit@frogsfrogsfrogs> References: <173706976640.1929311.7118885570179440699.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Test the persistent quota flags that come with the metadir feature. Signed-off-by: "Darrick J. Wong" --- tests/generic/563 | 8 ++- tests/xfs/1891 | 128 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1891.out | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 282 insertions(+), 1 deletion(-) create mode 100755 tests/xfs/1891 create mode 100644 tests/xfs/1891.out diff --git a/tests/generic/563 b/tests/generic/563 index 95a928fba5627e..89a71aa44938ea 100755 --- a/tests/generic/563 +++ b/tests/generic/563 @@ -96,7 +96,13 @@ smajor=$((0x`stat -L -c %t $loop_dev`)) sminor=$((0x`stat -L -c %T $loop_dev`)) _mkfs_dev $loop_dev >> $seqres.full 2>&1 -_mount $loop_dev $SCRATCH_MNT || _fail "mount failed" +if [ $FSTYP = "xfs" ]; then + # Writes to the quota file are captured in cgroup metrics on XFS, so + # we require that quota is not enabled at all. + _mount $loop_dev -o noquota $SCRATCH_MNT || _fail "mount failed" +else + _mount $loop_dev $SCRATCH_MNT || _fail "mount failed" +fi blksize=$(_get_block_size "$SCRATCH_MNT") diff --git a/tests/xfs/1891 b/tests/xfs/1891 new file mode 100755 index 00000000000000..7db94e0976527e --- /dev/null +++ b/tests/xfs/1891 @@ -0,0 +1,128 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024-2025 Oracle. All Rights Reserved. +# +# FS QA Test 1891 +# +# Functionality test for persistent quota accounting and enforcement flags in +# XFS when metadata directories are enabled. +# +. ./common/preamble +_begin_fstest auto quick quota + +. ./common/filter +. ./common/quota + +$MKFS_XFS_PROG 2>&1 | grep -q 'uquota' || \ + _notrun "mkfs does not support uquota option" + +_require_scratch +_require_xfs_quota + +filter_quota_state() { + sed -e 's/Inode: #[0-9]\+/Inode #XXX/g' \ + -e '/max warnings:/d' \ + -e '/Blocks grace time:/d' \ + -e '/Inodes grace time:/d' \ + | _filter_scratch +} + +qerase_mkfs_options() { + echo "$MKFS_OPTIONS" | sed \ + -e 's/uquota//g' \ + -e 's/gquota//g' \ + -e 's/pquota//g' \ + -e 's/uqnoenforce//g' \ + -e 's/gqnoenforce//g' \ + -e 's/pqnoenforce//g' \ + -e 's/,,*/,/g' +} + +confirm() { + echo "$MOUNT_OPTIONS" | grep -E -q '(qnoenforce|quota)' && \ + echo "saw quota mount options" + _scratch_mount + $XFS_QUOTA_PROG -x -c "state -ugp" $SCRATCH_MNT | filter_quota_state + _check_xfs_scratch_fs + _scratch_unmount +} + +ORIG_MOUNT_OPTIONS="$MOUNT_OPTIONS" +MKFS_OPTIONS="$(qerase_mkfs_options)" + +echo "Test 0: formatting a subset" +_scratch_mkfs -m uquota,gqnoenforce &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +confirm + +echo "Test 1: formatting" +_scratch_mkfs -m uquota,gquota,pquota &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +confirm + +echo "Test 2: only grpquota" +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option grpquota +confirm + +echo "Test 3: repair" +_scratch_xfs_repair &>> $seqres.full || echo "repair failed?" +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +confirm + +echo "Test 4: weird options" +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option pqnoenforce,uquota +confirm + +echo "Test 5: simple recovery" +_scratch_mkfs -m uquota,gquota,pquota &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +echo "$MOUNT_OPTIONS" | grep -E -q '(qnoenforce|quota)' && \ + echo "saw quota mount options" +_scratch_mount +$XFS_QUOTA_PROG -x -c "state -ugp" $SCRATCH_MNT | filter_quota_state +touch $SCRATCH_MNT/a +_scratch_shutdown -v -f >> $seqres.full +echo shutdown +_scratch_unmount +confirm + +echo "Test 6: simple recovery with mount options" +_scratch_mkfs -m uquota,gquota,pquota &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +echo "$MOUNT_OPTIONS" | grep -E -q '(qnoenforce|quota)' && \ + echo "saw quota mount options" +_scratch_mount +$XFS_QUOTA_PROG -x -c "state -ugp" $SCRATCH_MNT | filter_quota_state +touch $SCRATCH_MNT/a +_scratch_shutdown -v -f >> $seqres.full +echo shutdown +_scratch_unmount +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option gqnoenforce +confirm + +echo "Test 7: user quotaoff recovery" +_scratch_mkfs -m uquota,gquota,pquota &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +echo "$MOUNT_OPTIONS" | grep -E -q '(qnoenforce|quota)' && \ + echo "saw quota mount options" +_scratch_mount +$XFS_QUOTA_PROG -x -c "state -ugp" $SCRATCH_MNT | filter_quota_state +touch $SCRATCH_MNT/a +$XFS_QUOTA_PROG -x -c 'off -u' $SCRATCH_MNT +_scratch_shutdown -v -f >> $seqres.full +echo shutdown +_scratch_unmount +confirm + +# success, all done +status=0 +exit diff --git a/tests/xfs/1891.out b/tests/xfs/1891.out new file mode 100644 index 00000000000000..7e8894088042bb --- /dev/null +++ b/tests/xfs/1891.out @@ -0,0 +1,147 @@ +QA output created by 1891 +Test 0: formatting a subset +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode: N/A +Test 1: formatting +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Test 2: only grpquota +saw quota mount options +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Test 3: repair +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Test 4: weird options +saw quota mount options +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Test 5: simple recovery +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +shutdown +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Test 6: simple recovery with mount options +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +shutdown +saw quota mount options +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Test 7: user quotaoff recovery +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +shutdown +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) From patchwork Thu Jan 16 23:39:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13942731 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 60EC1241A02; Thu, 16 Jan 2025 23:39: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=1737070771; cv=none; b=purf3rIA6iWfvKFi/JtA/yfbcIrz6ECnV56M0P+6vVw3xSy3alR9slhtk36sdlHxZ4CHWR+LqMDuE1gIBQMfuAlVhAQ5pVbwimIIhffdj3MXT9vF9byUpWuyFF8KCFvSbNsm/Wv0CWScnDOCnbyzqoERFSq96puVSLempr0xrTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070771; c=relaxed/simple; bh=v0rTaWJCm8wqV+ua902nwh/+OI2d6hx3DxBHOWCRrCY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YRrSFeoAAQPMpQ2cs544WWnEE6fxyvKgoTRJxSSCai9p/52hCmtXDVoCcQKSte7yoclcUlBl6B0oNUN1CJL6Gagk92wBX4Ian8+pcTVriqmBrDuSHzkNETy4Pg4wM3gRp/tv5wb5HKrm9HMSgh6IJ2KGBh05M2oxMsxiVblnwpI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R9WS1SiG; 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="R9WS1SiG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD333C4CEDD; Thu, 16 Jan 2025 23:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070770; bh=v0rTaWJCm8wqV+ua902nwh/+OI2d6hx3DxBHOWCRrCY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=R9WS1SiGcqIEpWfzukqPeLW3eWx4xJ1Rntz2bLsyBCa4SxJd8KR8akQHQ9aUvbkWz ZZ8SGT6f22Snr+DCRACLIf+De2Cee0tuFrtqiBs5sdJHRwPMDsRKdOXgoMvBiI+OuU mqENbw+uJxrd8d/FIDEs0zHIj7EQ78BIjsqi7+uPEa72JSmJOS+WKjegnCKz/XgWXu pq/tt1H7uO2CKrkz9+sJr6hGb2pg2GKqrzy15sw31EjiiaERcKg/wYdH+wwn6PiWqk nb1o5VCIcsHhtqoVloYQFdvlEuZlHDjARohpFUtPKV3Eqgn7hNlu7gUme7dvYEELH5 cDtHi2vLzUP8A== Date: Thu, 16 Jan 2025 15:39:30 -0800 Subject: [PATCH 3/4] xfs: fix quota detection in fuzz tests From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706976685.1929311.7682369660125459200.stgit@frogsfrogsfrogs> In-Reply-To: <173706976640.1929311.7118885570179440699.stgit@frogsfrogsfrogs> References: <173706976640.1929311.7118885570179440699.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong With metadir, quota options persist until they are changed by mount options. Therefore, we can set the quota flags in MKFS_OPTIONS and needn't supply them in MOUNT_OPTIONS. Unfortunately, this means that we cannot grep the MOUNT_OPTIONS anymore; we must mount the fs and run src/feature to determine if quotas are enabled. Signed-off-by: "Darrick J. Wong" --- tests/xfs/425 | 5 ++++- tests/xfs/426 | 5 ++++- tests/xfs/427 | 5 ++++- tests/xfs/428 | 5 ++++- tests/xfs/429 | 5 ++++- tests/xfs/430 | 5 ++++- tests/xfs/487 | 5 ++++- tests/xfs/488 | 5 ++++- tests/xfs/489 | 5 ++++- tests/xfs/779 | 5 ++++- tests/xfs/780 | 5 ++++- tests/xfs/781 | 5 ++++- 12 files changed, 48 insertions(+), 12 deletions(-) diff --git a/tests/xfs/425 b/tests/xfs/425 index 7ad53f97a6940c..77f86bcc398312 100755 --- a/tests/xfs/425 +++ b/tests/xfs/425 @@ -23,7 +23,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'usrquota' || _notrun "user quota disabled" + +_scratch_mount +$here/src/feature -U $SCRATCH_DEV || _notrun "user quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/426 b/tests/xfs/426 index 53bfd0d637fcb5..80f572eb8068a2 100755 --- a/tests/xfs/426 +++ b/tests/xfs/426 @@ -23,7 +23,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'usrquota' || _notrun "user quota disabled" + +_scratch_mount +$here/src/feature -U $SCRATCH_DEV || _notrun "user quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/427 b/tests/xfs/427 index 38de1360af6262..48b8d5e935abfe 100755 --- a/tests/xfs/427 +++ b/tests/xfs/427 @@ -23,7 +23,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'grpquota' || _notrun "group quota disabled" + +_scratch_mount +$here/src/feature -G $SCRATCH_DEV || _notrun "group quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/428 b/tests/xfs/428 index e112ccf84646c1..f87f0a98bae3e9 100755 --- a/tests/xfs/428 +++ b/tests/xfs/428 @@ -23,7 +23,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'grpquota' || _notrun "group quota disabled" + +_scratch_mount +$here/src/feature -G $SCRATCH_DEV || _notrun "group quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/429 b/tests/xfs/429 index ded8c3944a2648..426e716aa079bf 100755 --- a/tests/xfs/429 +++ b/tests/xfs/429 @@ -23,7 +23,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'prjquota' || _notrun "project quota disabled" + +_scratch_mount +$here/src/feature -P $SCRATCH_DEV || _notrun "project quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/430 b/tests/xfs/430 index 3e6527851069a9..b3a2c6dd1a5f6a 100755 --- a/tests/xfs/430 +++ b/tests/xfs/430 @@ -23,7 +23,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'prjquota' || _notrun "project quota disabled" + +_scratch_mount +$here/src/feature -P $SCRATCH_DEV || _notrun "project quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/487 b/tests/xfs/487 index 0a5403a25dfd82..809a4c6fd621cd 100755 --- a/tests/xfs/487 +++ b/tests/xfs/487 @@ -24,7 +24,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'usrquota' || _notrun "user quota disabled" + +_scratch_mount +$here/src/feature -U $SCRATCH_DEV || _notrun "user quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/488 b/tests/xfs/488 index 0e67889f26f7a0..a8144c9ce39b91 100755 --- a/tests/xfs/488 +++ b/tests/xfs/488 @@ -24,7 +24,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'grpquota' || _notrun "group quota disabled" + +_scratch_mount +$here/src/feature -G $SCRATCH_DEV || _notrun "group quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/489 b/tests/xfs/489 index ef65525c224764..cb24b444bcc919 100755 --- a/tests/xfs/489 +++ b/tests/xfs/489 @@ -24,7 +24,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'prjquota' || _notrun "project quota disabled" + +_scratch_mount +$here/src/feature -P $SCRATCH_DEV || _notrun "project quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/779 b/tests/xfs/779 index acce522995c693..e1e44c1928c67b 100755 --- a/tests/xfs/779 +++ b/tests/xfs/779 @@ -25,7 +25,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'usrquota' || _notrun "user quota disabled" + +_scratch_mount +$here/src/feature -U $SCRATCH_DEV || _notrunn "user quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/780 b/tests/xfs/780 index efcbeb8e147353..ebd25f8a13bab4 100755 --- a/tests/xfs/780 +++ b/tests/xfs/780 @@ -25,7 +25,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'grpquota' || _notrun "group quota disabled" + +_scratch_mount +$here/src/feature -G $SCRATCH_DEV || _notrun "group quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids diff --git a/tests/xfs/781 b/tests/xfs/781 index 09d63bfeceb6e7..49920cd1215ec1 100755 --- a/tests/xfs/781 +++ b/tests/xfs/781 @@ -25,7 +25,10 @@ _require_quota echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -echo "${MOUNT_OPTIONS}" | grep -q 'prjquota' || _notrun "project quota disabled" + +_scratch_mount +$here/src/feature -P $SCRATCH_DEV || _notrun "project quota disabled" +_scratch_unmount _scratch_xfs_set_quota_fuzz_ids From patchwork Thu Jan 16 23:39:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13942732 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 D0EDF1DD0DC; Thu, 16 Jan 2025 23:39:46 +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=1737070786; cv=none; b=uXPLPWFA4rxa7MMgAyUC45jN2PbVBUzmajT84kP1GRkRbcOMACud5Phr6rBP/NF4IiU8d++7Lo6js4F4AAHlJti91hU3ZfHufbu8YtCUnoZY+WzI5ucRXkaFQ2RQ1lfn4Dethq0S1lOVtUfIXeNe942b42xZ4nFD2KhE1tOqj4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070786; c=relaxed/simple; bh=w6dIgeKRjwm3Vghr7v4q+97adtTn5YBPv0s5fU0jEf0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=brN3ysAVqEhgOh63HfQOzpZOQdlarXKO4rbSKZps/2KmwtqbftI6F7zRGHzvpwXSZn5K9vhT+huhLoc4LM6GaLvGLYHBPRzTL0McMpVS6peXoRMIrPgbsY9wLj4nrgjResypEH6p9n/OmOMGmcSwvIuS6Z72NhfVbdLnl9YGWTw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GRlHFQTn; 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="GRlHFQTn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6869FC4CED6; Thu, 16 Jan 2025 23:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070786; bh=w6dIgeKRjwm3Vghr7v4q+97adtTn5YBPv0s5fU0jEf0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=GRlHFQTnc5wwtviepwk4SkpH7/pth25C5jQ1jyO+pKnCPYN41rU89cycUc/pcuMoI H/gL7Cv5dSb0hFJ63nxHwqAqs3U1nSnX76meqw/gTJSEzd8x3lfktPxykvkSnErUGy Dk0adMZTvS4UbwCDXROWMLQWNVyL1gnisoYLUfqOwxlx2zRISP9TYz5utu3wFA9EDe yOhaZWU9EgH+b4MXPbbVAXiiJppoAQMM2KV40gZ7xNUd7ojn5n7R5EuAmOHmbgluKM GnBTHzIius6LcdbVQ2kaZwWV4dilE3cIM7aF+q3xNcWFztN4nhyXbOXwSoXQFjgl9B neE68l2RFaxTQ== Date: Thu, 16 Jan 2025 15:39:46 -0800 Subject: [PATCH 4/4] xfs: fix tests for persistent qflags From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706976698.1929311.10218997705149048736.stgit@frogsfrogsfrogs> In-Reply-To: <173706976640.1929311.7118885570179440699.stgit@frogsfrogsfrogs> References: <173706976640.1929311.7118885570179440699.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Fix the tests that now break with persistent quota flags. Signed-off-by: "Darrick J. Wong" --- common/quota | 1 + common/rc | 1 + common/xfs | 3 +++ tests/xfs/007 | 2 +- tests/xfs/096 | 1 + tests/xfs/096.out | 2 +- tests/xfs/106 | 2 +- tests/xfs/116 | 13 ++++++++++++- tests/xfs/116.cfg | 1 + tests/xfs/116.out.default | 0 tests/xfs/116.out.metadir | 3 +++ tests/xfs/152 | 2 +- tests/xfs/263 | 1 + tests/xfs/263.out | 2 +- 14 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 tests/xfs/116.cfg rename tests/xfs/{116.out => 116.out.default} (100%) create mode 100644 tests/xfs/116.out.metadir diff --git a/common/quota b/common/quota index 4dad9b79a27a7f..4ef0d4775067ee 100644 --- a/common/quota +++ b/common/quota @@ -312,6 +312,7 @@ _qmount_option() -e 's/grpjquota=[^, ]*/QUOTA/g' \ -e 's/\bpquota/QUOTA/g' \ -e 's/prjquota/QUOTA/g' \ + -e 's/noquota/QUOTA/g' \ -e 's/quota/QUOTA/g' \ -e 's/uqnoenforce/QUOTA/g' \ -e 's/gqnoenforce/QUOTA/g' \ diff --git a/common/rc b/common/rc index 25eb13ab2c5a48..824fc061e84a99 100644 --- a/common/rc +++ b/common/rc @@ -3721,6 +3721,7 @@ _get_os_name() _link_out_file_named() { test -n "$seqfull" || _fail "need to set seqfull" + test -r "$seqfull.cfg" || _fail "need $seqfull.cfg" local features=$2 local suffix=$(FEATURES="$features" perl -e ' diff --git a/common/xfs b/common/xfs index 0f29d5c5a6b963..32a048b15efc04 100644 --- a/common/xfs +++ b/common/xfs @@ -1710,6 +1710,9 @@ _xfs_filter_mkfs() print STDERR "ldev=\"$1\"\nlbsize=$2\nlblocks=$3\nlversion=$4\n"; print STDOUT "log =LDEV bsize=XXX blocks=XXX\n"; } + if (/^\s+=\s+exchange=(\d+)\s+metadir=(\d+)/) { + print STDERR "exchange=$1\nmetadir=$2\n\n"; + } if (/^\s+=\s+sectsz=(\d+)\s+sunit=(\d+) blks/) { print STDERR "logsectsz=$1\nlogsunit=$2\n\n"; } diff --git a/tests/xfs/007 b/tests/xfs/007 index e35a069f9bd5c5..4721bc832b3fe4 100755 --- a/tests/xfs/007 +++ b/tests/xfs/007 @@ -47,7 +47,7 @@ do_test() # This takes care of newer kernels where quotaoff clears the superblock # quota enforcement flags but doesn't shut down accounting. _scratch_unmount - _qmount_option "" + _qmount_option "noquota" _scratch_mount rm_commands=(-x -c "remove -$off_opts") diff --git a/tests/xfs/096 b/tests/xfs/096 index 57a05a8ffefbd1..f1f5d562d4fa18 100755 --- a/tests/xfs/096 +++ b/tests/xfs/096 @@ -28,6 +28,7 @@ function option_string() if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi; if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi; if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi; + if [ "$VAL" = "0" ]; then OPT=noquota; fi; echo $OPT } diff --git a/tests/xfs/096.out b/tests/xfs/096.out index 1deb7a8c302374..20f68d3870c4a0 100644 --- a/tests/xfs/096.out +++ b/tests/xfs/096.out @@ -1,5 +1,5 @@ QA output created by 096 -== Options: rw == +== Options: noquota == == Options: usrquota,rw == User quota state on SCRATCH_MNT (SCRATCH_DEV) Accounting: ON diff --git a/tests/xfs/106 b/tests/xfs/106 index 066efef1181b8a..10cbd1052bbc89 100755 --- a/tests/xfs/106 +++ b/tests/xfs/106 @@ -155,7 +155,7 @@ test_off() { echo "turning quota off by remounting" _scratch_unmount - _qmount_option "" + _qmount_option "noquota" _qmount } diff --git a/tests/xfs/116 b/tests/xfs/116 index c5e7508f8862ed..3ef6f5ddfdb2d6 100755 --- a/tests/xfs/116 +++ b/tests/xfs/116 @@ -23,7 +23,18 @@ _require_xfs_quota # Only mount with the quota options we specify below _qmount_option "defaults" -_scratch_mkfs >/dev/null 2>&1 +_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs >/dev/null +. $tmp.mkfs +cat $tmp.mkfs >> $seqres.full + +# link correct .out file, see $seqfull.cfg +seqfull=$0 +if [ "$metadir" = 1 ]; then + _link_out_file_named $seqfull.out "metadir" +else + _link_out_file_named $seqfull.out +fi + _scratch_mount "-o uquota" _scratch_unmount _scratch_xfs_db -r -c sb -c print | grep qflags diff --git a/tests/xfs/116.cfg b/tests/xfs/116.cfg new file mode 100644 index 00000000000000..571f542faef97d --- /dev/null +++ b/tests/xfs/116.cfg @@ -0,0 +1 @@ +metadir: metadir diff --git a/tests/xfs/116.out b/tests/xfs/116.out.default similarity index 100% rename from tests/xfs/116.out rename to tests/xfs/116.out.default diff --git a/tests/xfs/116.out.metadir b/tests/xfs/116.out.metadir new file mode 100644 index 00000000000000..3a58fb919b1e39 --- /dev/null +++ b/tests/xfs/116.out.metadir @@ -0,0 +1,3 @@ +QA output created by 116 +qflags = 0x7 +qflags = 0x7 diff --git a/tests/xfs/152 b/tests/xfs/152 index 6c052cbc9b31f5..94428b35d22a87 100755 --- a/tests/xfs/152 +++ b/tests/xfs/152 @@ -194,7 +194,7 @@ test_off() { echo "checking off command (type=$type)" _scratch_unmount - _qmount_option "" + _qmount_option "noquota" _qmount } diff --git a/tests/xfs/263 b/tests/xfs/263 index aedbc4795296d3..83ec8b959fa9de 100755 --- a/tests/xfs/263 +++ b/tests/xfs/263 @@ -27,6 +27,7 @@ function option_string() if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi; if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi; if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi; + if [ "$VAL" = "0" ]; then OPT=noquota; fi; echo $OPT } diff --git a/tests/xfs/263.out b/tests/xfs/263.out index 64c1a5876cfa24..8682eee2680728 100644 --- a/tests/xfs/263.out +++ b/tests/xfs/263.out @@ -1,5 +1,5 @@ QA output created by 263 -== Options: rw == +== Options: noquota == == Options: usrquota,rw == User quota state on SCRATCH_MNT (SCRATCH_DEV) Accounting: ON