From: Amir Goldstein <amir73il@gmail.com>
To: Zorro Lang <zlang@redhat.com>
Cc: Aleksa Sarai <cyphar@cyphar.com>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Chuck Lever <chuck.lever@oracle.com>,
Jeff Layton <jlayton@kernel.org>,
fstests@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/2] open_by_handle: add a test for connectable file handles
Date: Wed, 9 Apr 2025 13:52:20 +0200 [thread overview]
Message-ID: <20250409115220.1911467-3-amir73il@gmail.com> (raw)
In-Reply-To: <20250409115220.1911467-1-amir73il@gmail.com>
This is a variant of generic/477 with connectable file handles.
This test uses load and store of file handles from a temp file to test
decoding connectable file handles after cycle mount and after renames.
Decoding connectable file handles after being moved to a new parent
is expected to fail.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
tests/generic/777 | 79 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/777.out | 15 ++++++++
2 files changed, 94 insertions(+)
create mode 100755 tests/generic/777
create mode 100644 tests/generic/777.out
diff --git a/tests/generic/777 b/tests/generic/777
new file mode 100755
index 00000000..52a461c3
--- /dev/null
+++ b/tests/generic/777
@@ -0,0 +1,79 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2018-2025 CTERA Networks. All Rights Reserved.
+#
+# FS QA Test No. 777
+#
+# Check open by connectable file handle after cycle mount.
+#
+# This is a variant of test 477 with connectable file handles.
+# This test uses load and store of file handles from a temp file to test
+# decoding file handles after cycle mount and after directory renames.
+# Decoding connectable file handles after being moved to a new parent
+# is expected to fail.
+#
+. ./common/preamble
+_begin_fstest auto quick exportfs
+
+# Import common functions.
+. ./common/filter
+
+
+# Modify as appropriate.
+_require_test
+# Require connectable file handles support
+_require_open_by_handle -N
+
+NUMFILES=10
+testroot=$TEST_DIR/$seq-dir
+testdir=$testroot/testdir
+
+# Create test dir and test files, encode connectable file handles and store to tmp file
+create_test_files()
+{
+ rm -rf $testdir
+ mkdir -p $testdir
+ $here/src/open_by_handle -N -cwp -o $tmp.handles_file $testdir $NUMFILES
+}
+
+# Decode connectable file handles loaded from tmp file
+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 $TEST_DIR $NUMFILES
+}
+
+# Decode file handles of files/dir after cycle mount
+create_test_files
+_test_cycle_mount
+test_file_handles -rp "cycle mount"
+
+# Decode file handles of files/dir after rename of parent and cycle mount
+create_test_files $testdir
+rm -rf $testdir.renamed
+mv $testdir $testdir.renamed/
+_test_cycle_mount
+test_file_handles -rp "rename parent"
+
+# Decode file handles of files/dir after rename of grandparent and cycle mount
+create_test_files $testdir
+rm -rf $testroot.renamed
+mv $testroot $testroot.renamed/
+_test_cycle_mount
+test_file_handles -rp "rename grandparent"
+
+# Decode file handles of files/dir after move to new parent and cycle mount
+# This is expected to fail because the conectable file handle encodes the
+# old parent.
+create_test_files $testdir
+rm -rf $testdir.new
+mkdir -p $testdir.new
+mv $testdir/* $testdir.new/
+_test_cycle_mount
+test_file_handles -r "move to new parent" | _filter_test_dir
+
+status=0
+exit
diff --git a/tests/generic/777.out b/tests/generic/777.out
new file mode 100644
index 00000000..648c480c
--- /dev/null
+++ b/tests/generic/777.out
@@ -0,0 +1,15 @@
+QA output created by 777
+test_file_handles after cycle mount
+test_file_handles after rename parent
+test_file_handles after rename grandparent
+test_file_handles after move to new parent
+open_by_handle(TEST_DIR/file000000) returned 116 incorrectly on a linked file!
+open_by_handle(TEST_DIR/file000001) returned 116 incorrectly on a linked file!
+open_by_handle(TEST_DIR/file000002) returned 116 incorrectly on a linked file!
+open_by_handle(TEST_DIR/file000003) returned 116 incorrectly on a linked file!
+open_by_handle(TEST_DIR/file000004) returned 116 incorrectly on a linked file!
+open_by_handle(TEST_DIR/file000005) returned 116 incorrectly on a linked file!
+open_by_handle(TEST_DIR/file000006) returned 116 incorrectly on a linked file!
+open_by_handle(TEST_DIR/file000007) returned 116 incorrectly on a linked file!
+open_by_handle(TEST_DIR/file000008) returned 116 incorrectly on a linked file!
+open_by_handle(TEST_DIR/file000009) returned 116 incorrectly on a linked file!
--
2.34.1
next prev parent reply other threads:[~2025-04-09 11:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 11:52 [PATCH 0/2] Tests for AT_HANDLE_CONNECTABLE Amir Goldstein
2025-04-09 11:52 ` [PATCH 1/2] open_by_handle: add support for testing connectable file handles Amir Goldstein
2025-04-09 11:52 ` Amir Goldstein [this message]
2025-05-08 19:38 ` [PATCH 2/2] open_by_handle: add a test for " Zorro Lang
2025-05-08 20:38 ` Amir Goldstein
2025-05-09 16:57 ` Amir Goldstein
2025-05-06 21:08 ` [PATCH 0/2] Tests for AT_HANDLE_CONNECTABLE Amir Goldstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250409115220.1911467-3-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=cyphar@cyphar.com \
--cc=fstests@vger.kernel.org \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).