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=1796036650; b=xNqsCu+ZSTzcxs8Gu/IB0Na2jv7PI8L7hMAXmkSkZnOTBACLSjGtNDRgGW3lyCa645O/ O6o6++uLR+pc/IZl0quK8hgsuw3Sy/IHoP2MgR+HOwyCqZ+JDD5SFtfUJYR/0SMpvtP+E beHOikG5Z92gQK+GuKWLwoSraaB85gXl7cK/VNjDWk8tV0CZXzPEfeL7fsvz76/11yhI1 sj1NhnvSouiGMoeKs3pmdPjOH09KbjZr5Drbud9P33u/pNouMMZNJFK1Z3/L1rqWvr+n/ k9xvbskWo8IVS1qFjx5o1hAzxrc6JwtfK1C2tRZx0CVlO8dKIciXaVfVD0cKxM/CZlQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796036650; 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=6/M+XGSchMaxNC8BnxKzrnysSYEAIxImaydXBVc7Ixo=; b=sCoyB9jWIbNpOSMhCHp7i1gyqeOo78lI/SIY3ZcOAsNFBO56+YuLBEU+5PHTOobAVRyb CHCkqgoEn+aqij1/s/l98JioC3ID87tt4ySU8OgGqPh7O8G9ffPhs4RdLdqZVlN4jzxza YKxgggwIctQPo2maACz9c41GHuRvSaiJpJPxnWw6oKjb+21srjigwDFEIlxWT5DzeFf7q MokRtTXYNewOGMcV4jh6ZXg2eZxWLNpjLhVKz5ItwaOWNFx7zaqtpNZHTYrF5BuoqfyL0 W6jpWp2Uf3Upyd0I1OZ2ofqM73C+tKx59nekTC9Wn4rutukg0+2lLC6kexU4Yng+GsQ== 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=B60Tclpk; 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 5B4F3606A32C; Mon, 30 Nov 2026 11:04:10 +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=B60Tclpk Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53F141F00927; Mon, 30 Nov 2026 11:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796036649; bh=6/M+XGSchMaxNC8BnxKzrnysSYEAIxImaydXBVc7Ixo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=B60TclpkP6dGu814WvAANzfqnYNjqECfuzIqCesDC70WqOEBNOJFDa5jNGg3s8Rfg 6K/g/a4cObqG7wJsbOR6/qoR7UKdpkf5FpOtzGb8HmY6vGJWqIqDNCnEaUEeXkB+ft +/l8ff2UoiDAq311/K8Hxh1kFKQuQiWc5zTLpyaI8MWHB7SAA3DSV5MH2He6fyGnYj mRetrR+WHzB8PW7bInmoW1nVm+qrf0ykE3Ub4OX4gc4+aCXOqJ+pr6ZmBtEFXRDwWu cRU4GfYqF3eQHEdi77aMlgaoL1LjksXDXYB/xUEl7GHMM4xfxvKN359nMGXSvZJ3AX 5IOJAnYV/oIMQ== 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 13/20] fstests: verify exportfs file handles on cloned filesystems Date: Mon, 30 Nov 2026 19:03:15 +0800 Message-ID: <20261130-f_fsid-v2-13-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 Ensure that exportfs can correctly decode file handles on a cloned filesystem across a mount cycle, by file handles generated on a cloned device remain valid after mount cycle. Reviewed-by: Zorro Lang Signed-off-by: Anand Jain --- tests/generic/905 | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/905.out | 2 ++ 2 files changed, 81 insertions(+) diff --git a/tests/generic/905 b/tests/generic/905 new file mode 100644 index 000000000000..d69c613110db --- /dev/null +++ b/tests/generic/905 @@ -0,0 +1,79 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2026 Anand Jain . All Rights Reserved. +# +# FS QA Test No. 905 +# Verify that file handles encoded on a cloned filesystem remain valid and +# resolvable via open_by_handle across a mount cycle and mount order swap. + +. ./common/preamble + +_begin_fstest auto quick exportfs tempfsid + +_require_test +_require_exportfs +_require_loop +_require_test_program "open_by_handle" + +_cleanup() +{ + cd / + rm -r -f $tmp.* + _unmount $mnt1 2>/dev/null + _unmount $mnt2 2>/dev/null + _destroy_cloned_loop_devs "${devs[@]}" 2> /dev/null +} + +# Create test dir and test files, encode file handles and store to tmp file +create_test_files() +{ + rm -rf $testdir + mkdir -p $testdir + $here/src/open_by_handle -cwp -o $tmp.handles_file $testdir $NUMFILES +} + +# Attempt to read and decode the saved file handles on the targeted mount point. +test_file_handles() +{ + local opt=$1 + local when=$2 + + echo test_file_handles after $when + $here/src/open_by_handle $opt -i $tmp.handles_file $mnt2 $NUMFILES +} + +rm -rf $TEST_DIR/$seq 2>/dev/null +mkdir -p $TEST_DIR/$seq +# Setup base loop device and its clone +devs=() +_create_cloned_loop_devs devs +mnt1=$TEST_DIR/$seq/mnt1 +mnt2=$TEST_DIR/$seq/mnt2 +mkdir -p $mnt1 +mkdir -p $mnt2 + +# Mount both identical UUID filesystems simultaneously +_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" + +NUMFILES=1 +testdir=$mnt2/testdir + +# Decode file handles of files/dir after cycle mount +create_test_files + +# Cycle mounts and reverse initialization sequence to check if +# file handle lookups are okay +_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" + +# Verify file handles can still be resolved post-mount-cycle +test_file_handles -rp "cycle mount" + +_exit 0 diff --git a/tests/generic/905.out b/tests/generic/905.out new file mode 100644 index 000000000000..234f5ec35863 --- /dev/null +++ b/tests/generic/905.out @@ -0,0 +1,2 @@ +QA output created by 905 +test_file_handles after cycle mount -- 2.43.0