fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] btrfs: Add test for received information deletion upon RO->RW switch
@ 2021-09-14 11:52 Nikolay Borisov
  0 siblings, 0 replies; only message in thread
From: Nikolay Borisov @ 2021-09-14 11:52 UTC (permalink / raw)
  To: linux-btrfs; +Cc: fstests, Nikolay Borisov

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---

Sending this now for initial review and completness' sake and once there is a
final decision that we are taking the route of removing this functionality
for users then it can be merged.


 tests/btrfs/248     | 47 +++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/248.out |  2 ++
 2 files changed, 49 insertions(+)
 create mode 100755 tests/btrfs/248
 create mode 100644 tests/btrfs/248.out

diff --git a/tests/btrfs/248 b/tests/btrfs/248
new file mode 100755
index 000000000000..13a2b92900ad
--- /dev/null
+++ b/tests/btrfs/248
@@ -0,0 +1,47 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021 SUSE Linux Products GmbH.  All Rights Reserved.
+#
+# FS QA Test 248
+#
+# Test that stransid/rtransid and received_uuid are being reset when a RO
+# snapshot is switched to RW.
+#
+. ./common/preamble
+_begin_fstest auto quick send subvol
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs btrfs
+_require_scratch
+
+_require_btrfs_command inspect-internal dump-tree
+_require_btrfs_command property
+
+_scratch_mkfs >> $seqres.full 2>&1
+_scratch_mount
+
+# Create a snapshot and send it, so that it has the necessary fields populated
+$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/ro-snap &>> $seqres.full
+$BTRFS_UTIL_PROG send $SCRATCH_MNT/ro-snap -f $SCRATCH_MNT/snap.send &>>$seqres.full
+$BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/ro-snap &>>$seqres.full
+$BTRFS_UTIL_PROG receive -f $SCRATCH_MNT/snap.send $SCRATCH_MNT 2>>$seqres.full
+
+# Flip the RO->RW switch and ensure that relevant fields are zeroed out
+$BTRFS_UTIL_PROG property set -ts $SCRATCH_MNT/ro-snap ro false
+
+$BTRFS_UTIL_PROG inspect-internal dump-tree -t1 $SCRATCH_DEV | $AWK_PROG '
+	/received_uuid/ {print "received_uuid present"}
+
+	/stransid/ {
+		if ($6 != 0) {print "send trans id not 0"}
+
+		if ($8 != 0) {print "received trans id not 0"}
+	}
+
+'
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/248.out b/tests/btrfs/248.out
new file mode 100644
index 000000000000..58af9173bea3
--- /dev/null
+++ b/tests/btrfs/248.out
@@ -0,0 +1,2 @@
+QA output created by 248
+Silence is golden
--
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-14 11:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 11:52 [RFC PATCH] btrfs: Add test for received information deletion upon RO->RW switch Nikolay Borisov

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).