linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH] xfstests: btrfs/012: add a regression test for deleting ext2_saved
Date: Tue, 20 Oct 2015 19:34:06 +0800	[thread overview]
Message-ID: <1445340846-9774-1-git-send-email-bo.li.liu@oracle.com> (raw)

Btrfs now has changed to delete subvolume/snapshot asynchronously,
which means that after umount, if we've already deleted 'ext2_saved',
rollback can still be completed, which should not.

So this adds a regression test for this.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 tests/btrfs/012 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/btrfs/012 b/tests/btrfs/012
index d513759..b39dec0 100755
--- a/tests/btrfs/012
+++ b/tests/btrfs/012
@@ -112,6 +112,18 @@ diff -r /lib/modules/`uname -r`/ $SCRATCH_MNT/`uname -r`/ 2>&1 | grep -vw "sourc
 
 _scratch_unmount
 
+# Convert it to btrfs, mount it and delete "ext2_saved"
+$BTRFS_CONVERT_PROG $SCRATCH_DEV >> $seqres.full 2>&1 || \
+	_fail "btrfs-convert failed"
+_scratch_mount || _fail "Could not mount new btrfs fs"
+$BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/ext2_saved >> $seqres.full 2>&1 ||
+	_fail "failed to delete ext2_saved subvolume"
+_scratch_unmount
+
+# Now restore the ext4 device, expecting a failure
+$BTRFS_CONVERT_PROG -r $SCRATCH_DEV >> $seqres.full 2>&1
+[ $? -eq 1 ] || _fail "Failure is expected, but btrfs-convert returns with rollback complete"
+
 # success, all done
 status=0
 exit
-- 
1.8.2.1


             reply	other threads:[~2015-10-20 11:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20 11:34 Liu Bo [this message]
2015-10-22  7:12 ` [PATCH] xfstests: btrfs/012: add a regression test for deleting ext2_saved Eryu Guan

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=1445340846-9774-1-git-send-email-bo.li.liu@oracle.com \
    --to=bo.li.liu@oracle.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 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).