[Top] [All Lists]

[PATCH] btrfs/035: update clone test to expect EOPNOTSUPP

To: xfs@xxxxxxxxxxx
Subject: [PATCH] btrfs/035: update clone test to expect EOPNOTSUPP
From: David Disseldorp <ddiss@xxxxxxx>
Date: Wed, 7 May 2014 14:33:18 +0200
Cc: linux-btrfs@xxxxxxxxxxxxxxx, bo.li.liu@xxxxxxxxxx, David Disseldorp <ddiss@xxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
With kernel commit 00fdf13a2e9f313a044288aa59d3b8ec29ff904a, the first
clone-range overwrite attempt now fails with EOPNOTSUPP, rather than
tripping a Btrfs BUG_ON().

This test now trips a new Btrfs bug, in which EIO is returned for
subsequent reads following the second clone range ioctl.

Signed-off-by: David Disseldorp <ddiss@xxxxxxx>
 tests/btrfs/035     | 11 +++++++++++
 tests/btrfs/035.out |  5 +++++
 2 files changed, 16 insertions(+)

diff --git a/tests/btrfs/035 b/tests/btrfs/035
index 6808179..c9530f6 100755
--- a/tests/btrfs/035
+++ b/tests/btrfs/035
@@ -57,21 +57,32 @@ src_str="aaaaaaaaaa"
 echo -n "$src_str" > $SCRATCH_MNT/src
+cat $SCRATCH_MNT/src.clone1
 echo -n "$src_str" > $SCRATCH_MNT/src
+cat $SCRATCH_MNT/src.clone2
+# Prior to kernel commit 00fdf13a2e9f313a044288aa59d3b8ec29ff904a, this clone
+# resulted in a BUG_ON in __btrfs_drop_extents(). The kernel now returns
+# EOPNOTSUPP up to userspace.
 snap_src_sz=`ls -lah $SCRATCH_MNT/src.clone1 | awk '{print $5}'`
 echo "attempting ioctl (src.clone1 src)"
 $CLONER_PROG -s 0 -d 0 -l ${snap_src_sz} \
        $SCRATCH_MNT/src.clone1 $SCRATCH_MNT/src
+cat $SCRATCH_MNT/src
 snap_src_sz=`ls -lah $SCRATCH_MNT/src.clone2 | awk '{print $5}'`
 echo "attempting ioctl (src.clone2 src)"
 $CLONER_PROG -s 0 -d 0 -l ${snap_src_sz} \
        $SCRATCH_MNT/src.clone2 $SCRATCH_MNT/src
+# BUG: subsequent access attempts currently result in EIO...
+cat $SCRATCH_MNT/src
 status=0 ; exit
diff --git a/tests/btrfs/035.out b/tests/btrfs/035.out
index f86cadf..0ea2c4f 100644
--- a/tests/btrfs/035.out
+++ b/tests/btrfs/035.out
@@ -1,3 +1,8 @@
 QA output created by 035
 attempting ioctl (src.clone1 src)
+clone failed: Operation not supported
 attempting ioctl (src.clone2 src)

<Prev in Thread] Current Thread [Next in Thread>