From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796036657; b=wm9TXQ7R8p3K3nBZ+Gtde7EF6HwKcoU47sPpEQvJTD6OTpNJgFsmIDj7KFU9vzPPry2f pMd4hqNHs7vYH+PtvGbB+NV24vlnrJNuO4/Rwglu/22+6lcKWTJyjPDE29lXT/jJV1R2w Z9vlzRxVwfAPA7kIwX2KTk4hlsuK7CM+UYGxoUe5xLBQdDxN8/zQppcalNdwXXXyaHLNv sec4PYyzDG/Xod5bDf7ptNetAGpBhdNFs53mM8HlMBJd6W3l3KZZCKa0A+ijhrpUvF7vn WqfI0eTjOdEZu8fm/oZl7zHbujautvjosnvBCSie2Kvoa7+PMrWtutKgBLshnuK8kFg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796036657; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=oA+A/L2KTcjhSqtyHN+l2YSXGLk9nDGKqVc2r0YbiiY=; b=0Qrz22iddG4U3pvWeQaz+uPCJwj5ihZu+sVf5++Vsw2JaM6XRm1X52LtlO0ZuX9y/KQU TQ1fY7MquArSxH6VIaFTnFODp/Jg7AZ8e2eGitnVyfzybMDmneuwAupIeTmDB+GjueU+a xIDybpZOVDQ/9nYLtrdecigZQWoD0WWOIbGTqYBKxiFR4Rmx+QDk4z/qBXTOKGiRzPXgU KZ0fNojFPzfyBzMEsQ7ZRl5POKXZuYh3+EJyQcEaryZi8v1lLabB33Pl0NeVAYKZq5nyG H51YKwuICnosTZoNH1vGmXA1VjovKm95RjF4d7mcD39c5T8+w3tcpgzofyCS+bixAGQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HHjwh5Z5; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F7C2606A33C; Mon, 30 Nov 2026 11:04:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HHjwh5Z5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9746E1F00919; Mon, 30 Nov 2026 11:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796036657; bh=oA+A/L2KTcjhSqtyHN+l2YSXGLk9nDGKqVc2r0YbiiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HHjwh5Z5A/754d8CipPQlB0B1CarI57k3obmJJQ9htuwcXDgGMf0BtnxGnbqVIsGa /B13z+FlU0DLw1YYwSfsaNLureuVNaUQxrFA2kjglzIoSvlv0g8BWhEScf0f4gESQE J9SVNlXmC6yeaLONiQF1PwKkvLSCimF2hK75xAS6C8hdzgI1KCjlK04LanpGrl/IBt E6845FM1Jkpm89s+PSxFY/wCgrCyhq06AuY/9JnkwAkZaPP9WmB3Xx+fsiJcsMlJSk elQJMuVfwEwksYV20FN1WKV10ddXbzxEcxQ2falsFxmz0b6O91le6c4C4cQCUjRkwx 426cljSkIOGmA== From: Anand Jain To: fstests@vger.kernel.org Cc: zlang@kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH v2 16/20] fstests: test UUID consistency for clones with metadata_uuid Date: Mon, 30 Nov 2026 19:03:18 +0800 Message-ID: <20261130-f_fsid-v2-16-c11fd1a5eaeb@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130-f_fsid-v2-0-c11fd1a5eaeb@kernel.org> References: <20261130-f_fsid-v2-0-c11fd1a5eaeb@kernel.org> X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Btrfs and xfs uses the metadata_uuid superblock feature to change the on-disk UUID without rewriting every block header. This patch adds a sanity check to ensure UUID consistency when a filesystem with metadata_uuid enabled is cloned. Signed-off-by: Anand Jain --- tests/generic/906 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/906.out | 6 +++++ 2 files changed, 80 insertions(+) diff --git a/tests/generic/906 b/tests/generic/906 new file mode 100644 index 000000000000..66cdc1f23168 --- /dev/null +++ b/tests/generic/906 @@ -0,0 +1,74 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2026 Anand Jain . All Rights Reserved. +# +# FS QA Test No. 906 +# +# Verify that the cloned filesystem UUID remains consistent, even when the +# `metadata_uuid` feature is enabled. +# + +. ./common/preamble +. ./common/filter + +_begin_fstest auto quick mount tempfsid + +_require_test +_require_loop +_require_metadata_uuid + +_cleanup() +{ + cd / + rm -r -f $tmp.* + _unmount $mnt1 $mnt2 2>/dev/null + _destroy_cloned_loop_devs "${devs[@]}" 2> /dev/null +} + +filter_pool() +{ + sed -e "s|${devs[0]}|DEV1|g" -e "s|${mnt1}|MNT1|g" \ + -e "s|${devs[1]}|DEV2|g" -e "s|${mnt2}|MNT2|g" | _filter_spaces +} + +rm -rf $TEST_DIR/$seq 2>/dev/null +mkdir -p $TEST_DIR/$seq +# Create base loop device and its clone, applying the metadata_uuid tuning +# callback to the base filesystem before the copy occurs. +devs=() +_create_cloned_loop_devs devs _change_metadata_uuid +mnt1=$TEST_DIR/$seq/mnt1 +mnt2=$TEST_DIR/$seq/mnt2 +mkdir -p $mnt1 +mkdir -p $mnt2 + +# Get the uuid from the source device +fsuuid=$(blkid -s UUID -o value ${devs[0]}) + +# Mount both clone and baseline +_mount $(_common_dev_mount_options) $(_clone_mount_options) ${devs[0]} $mnt1 || \ + _fail "Failed to mount dev1" +_mount $(_common_dev_mount_options) $(_clone_mount_options) ${devs[1]} $mnt2 || \ + _fail "Failed to mount dev2" + +findmnt -o SOURCE,TARGET,UUID "${devs[0]}" | tail -n +2 | \ + sed -e "s/${fsuuid}/FSUUID/g" | filter_pool +findmnt -o SOURCE,TARGET,UUID "${devs[1]}" | tail -n +2 | \ + sed -e "s/${fsuuid}/FSUUID/g" | filter_pool + +# Cycle mounts and reverse the initialization order to ensure UUID tracking +# doesn't mismatch or flip when metadata_uuid optimization is active. +echo "**** mount cycle ****" +_unmount $mnt1 +_unmount $mnt2 +_mount $(_common_dev_mount_options) $(_clone_mount_options) ${devs[1]} $mnt2 || \ + _fail "Failed to mount dev2" +_mount $(_common_dev_mount_options) $(_clone_mount_options) ${devs[0]} $mnt1 || \ + _fail "Failed to mount dev1" + +findmnt -o SOURCE,TARGET,UUID "${devs[0]}" | tail -n +2 | \ + sed -e "s/${fsuuid}/FSUUID/g" | filter_pool +findmnt -o SOURCE,TARGET,UUID "${devs[1]}" | tail -n +2 | \ + sed -e "s/${fsuuid}/FSUUID/g" | filter_pool + +_exit 0 diff --git a/tests/generic/906.out b/tests/generic/906.out new file mode 100644 index 000000000000..b484c86d8e7f --- /dev/null +++ b/tests/generic/906.out @@ -0,0 +1,6 @@ +QA output created by 906 +DEV1 MNT1 FSUUID +DEV2 MNT2 FSUUID +**** mount cycle **** +DEV1 MNT1 FSUUID +DEV2 MNT2 FSUUID -- 2.43.0