linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfstests: btrfs/012: add a regression test for deleting ext2_saved
@ 2015-10-20 11:34 Liu Bo
  2015-10-22  7:12 ` Eryu Guan
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Bo @ 2015-10-20 11:34 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfstests: btrfs/012: add a regression test for deleting ext2_saved
  2015-10-20 11:34 [PATCH] xfstests: btrfs/012: add a regression test for deleting ext2_saved Liu Bo
@ 2015-10-22  7:12 ` Eryu Guan
  0 siblings, 0 replies; 2+ messages in thread
From: Eryu Guan @ 2015-10-22  7:12 UTC (permalink / raw)
  To: Liu Bo; +Cc: fstests, linux-btrfs

On Tue, Oct 20, 2015 at 07:34:06PM +0800, Liu Bo wrote:
> 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>

I'm not sure if this belongs to a new test, but given that this test
has very similar steps to existing tests, so I think that's fine.

Reviewed-by: Eryu Guan <eguan@redhat.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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-22  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20 11:34 [PATCH] xfstests: btrfs/012: add a regression test for deleting ext2_saved Liu Bo
2015-10-22  7:12 ` Eryu Guan

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