[RFC PATCH] btrfs: Add test for received information deletion upon RO->RW switch

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Signed-off-by: Nikolay Borisov <nborisov@xxxxxxxx>
---

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




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux