All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: fstests@vger.kernel.org, Nikolay Borisov <nborisov@suse.com>
Subject: [RFC PATCH] btrfs: Add test for received information deletion upon RO->RW switch
Date: Tue, 14 Sep 2021 14:52:19 +0300	[thread overview]
Message-ID: <20210914115219.95720-1-nborisov@suse.com> (raw)

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


                 reply	other threads:[~2021-09-14 11:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210914115219.95720-1-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.