From patchwork Thu Jan 11 14:24:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13517490 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E377F3D569; Thu, 11 Jan 2024 14:24:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="blMSWCQk" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=ZeMD8HB6t4Vd1uhsa9VGEdXcdw/mvJBqEnJQy1BLsyg=; b=blMSWCQkTk8ZCJqoKHLv957Gpy hzec4br5QU0w0o1hd1WHCRwdSkbpjq5LyHR67TfmiH4aW1C5fkF+OPx0fYEQzwa1i19qhMnFJYxnx C86JPTSCksIOYOJO4fVr4zU4CNYSpBvA9ntMecKeWq+XlIyr72uk6D66oALNXFET7+XlCSPVU5sRH crjA0vrC1G8hpIWdjw0VJfb6FYNhl3V6oZBNU1KW91TdtF/4IIJgEYdu8TAZ5S7O364MiyOMNTD7n HWuDalXgUpT7CKFnNPoy/KHrgcyBW8DrC4cbN2qjv84eNxVB0tbT1jyBBC/q+lI/1faIORWpx2kIK SwpZCplQ==; Received: from [2001:4bb8:191:2f6b:63ff:a340:8ed1:7cd5] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rNvyj-000HGK-0h; Thu, 11 Jan 2024 14:24:18 +0000 From: Christoph Hellwig To: zlang@redhat.com Cc: djwong@kernel.org, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH 1/3] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub Date: Thu, 11 Jan 2024 15:24:05 +0100 Message-Id: <20240111142407.2163578-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240111142407.2163578-1-hch@lst.de> References: <20240111142407.2163578-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Add a sanity check that the passed in mount point is actually mounted to guard against actually calling _supports_xfs_scrub before $SCRATCH_MNT is mounted. Signed-off-by: Christoph Hellwig --- common/xfs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/xfs b/common/xfs index f53b33fc5..9db998837 100644 --- a/common/xfs +++ b/common/xfs @@ -649,6 +649,8 @@ _supports_xfs_scrub() test "$FSTYP" = "xfs" || return 1 test -x "$XFS_SCRUB_PROG" || return 1 + mountpoint $mountpoint >/dev/null || echo "$mountpoint is not mounted" + # Probe for kernel support... $XFS_IO_PROG -c 'help scrub' 2>&1 | grep -q 'types are:.*probe' || return 1 $XFS_IO_PROG -c "scrub probe" "$mountpoint" 2>&1 | grep -q "Inappropriate ioctl" && return 1 From patchwork Thu Jan 11 14:24:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13517491 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 45A383D3B1; Thu, 11 Jan 2024 14:24:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="L8kZfYm4" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Iv9Bu0mE44RTz03zKEPAkNev9dNgiwi5T8VvNCAgyYk=; b=L8kZfYm4T3cUy+EF8oXIhruVrx Y3QVzvJKk/6zotUnGwjzfPJyM3jnD8/KumMdIG8Hf1RfN1lP5CZuqXS5HVnyTo6iCGNB2vfNHjcxY 2n4VwcXxKeynvJr6zpe5YQxtmXV6Z7KTGER2EoWhygxVlZpYezY3vsLmyHiwNIyc0RgJdpmpypVFS e7QCwA4T80HV06q/J5a3MdeEd0+RaVRvVAWGDTBqNtpm4IGksoA3QEHOulptyY3um3uvWqk7cKCKN VzK/Bk+4Op9NhjGZ86y3LgmVy9j/hppB545bUNFBoRHkl7Bf+nLKCfPgYPwmjkuL3tHpFMSoEpyuL GNA17UBQ==; Received: from [2001:4bb8:191:2f6b:63ff:a340:8ed1:7cd5] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rNvyo-000HGT-0u; Thu, 11 Jan 2024 14:24:23 +0000 From: Christoph Hellwig To: zlang@redhat.com Cc: djwong@kernel.org, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH 2/3] xfs: add a _scratch_require_xfs_scrub helper Date: Thu, 11 Jan 2024 15:24:06 +0100 Message-Id: <20240111142407.2163578-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240111142407.2163578-1-hch@lst.de> References: <20240111142407.2163578-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Add a helper to call _supports_xfs_scrub with $SCRATCH_MNT and $SCRATCH_DEV. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- common/xfs | 7 +++++++ tests/xfs/556 | 2 +- tests/xfs/716 | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common/xfs b/common/xfs index 9db998837..bfe979dbb 100644 --- a/common/xfs +++ b/common/xfs @@ -661,6 +661,13 @@ _supports_xfs_scrub() return 0 } +# Does the scratch file system support scrub? +_scratch_require_xfs_scrub() +{ + _supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || \ + _notrun "Scrub not supported" +} + # Save a snapshot of a corrupt xfs filesystem for later debugging. _xfs_metadump() { local metadump="$1" diff --git a/tests/xfs/556 b/tests/xfs/556 index 061d8d572..6be993273 100755 --- a/tests/xfs/556 +++ b/tests/xfs/556 @@ -40,7 +40,7 @@ _scratch_mkfs >> $seqres.full _dmerror_init _dmerror_mount >> $seqres.full 2>&1 -_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported" +_scratch_require_xfs_scrub # Write a file with 4 file blocks worth of data victim=$SCRATCH_MNT/a diff --git a/tests/xfs/716 b/tests/xfs/716 index 930a0ecbb..4cfb27f18 100755 --- a/tests/xfs/716 +++ b/tests/xfs/716 @@ -31,7 +31,7 @@ _require_test_program "punch-alternating" _scratch_mkfs > $tmp.mkfs _scratch_mount -_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported" +_scratch_require_xfs_scrub # Force data device extents so that we can create a file with the exact bmbt # that we need regardless of rt configuration. From patchwork Thu Jan 11 14:24:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13517492 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CD9C63E49B; Thu, 11 Jan 2024 14:24:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="trtCMAtf" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=MMsxL+lG0fd4vltJu5jNvm/dso6+vr/5nljjlH4LhFk=; b=trtCMAtfxb4yKgu1hhe0SI55Jg cgwADwZkwmdU1JT5/sLovQJR0vNR3JNXpqnTJ9yZ9HZf0HCNhY5PiZsBWh5OgYXpp0ezMB/NDV9qY cZ33O11yYOU0qo3tC2ARDpPRwRL20xq67VZcvDtA2vT+2Y9JsnOSDp6a1CxMaVnXPX6Bb3hSRxt04 WIpYDtEH/kEYmZcfDJHDID99Eeq02RjvTl1+dS0RD7dQ65c9JYvFNlKOeBN72X88qx1zk7n21FYML j8AU2e6dhcnzqlrohfKJbpINMNJ/7cQAFow4H4zg8C5VYErA83/vYUcEX2q3KKwZ6r2/mZOI19jCs 5vnTpdOA==; Received: from [2001:4bb8:191:2f6b:63ff:a340:8ed1:7cd5] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rNvyt-000HHu-1U; Thu, 11 Jan 2024 14:24:28 +0000 From: Christoph Hellwig To: zlang@redhat.com Cc: djwong@kernel.org, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH 3/3] xfs/262: call _scratch_require_xfs_scrub Date: Thu, 11 Jan 2024 15:24:07 +0100 Message-Id: <20240111142407.2163578-4-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240111142407.2163578-1-hch@lst.de> References: <20240111142407.2163578-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Call _scratch_require_xfs_scrub so that the test is _notrun on kernels without online scrub support. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- tests/xfs/262 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/xfs/262 b/tests/xfs/262 index b28a6c88b..0d1fd779d 100755 --- a/tests/xfs/262 +++ b/tests/xfs/262 @@ -29,6 +29,9 @@ _require_xfs_io_error_injection "force_repair" echo "Format and populate" _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount + +_scratch_require_xfs_scrub + cp $XFS_SCRUB_PROG $SCRATCH_MNT/xfs_scrub $LDD_PROG $XFS_SCRUB_PROG | sed -e '/\//!d;/linux-gate/d;/=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/};s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' | while read lib; do cp $lib $SCRATCH_MNT/