@@ -57,21 +57,31 @@ src_str="aaaaaaaaaa"
echo -n "$src_str" > $SCRATCH_MNT/src
$CLONER_PROG $SCRATCH_MNT/src $SCRATCH_MNT/src.clone1
+cat $SCRATCH_MNT/src.clone1
+echo
src_str="bbbbbbbbbbcccccccccc"
echo -n "$src_str" > $SCRATCH_MNT/src
$CLONER_PROG $SCRATCH_MNT/src $SCRATCH_MNT/src.clone2
+cat $SCRATCH_MNT/src.clone2
+echo
+# Prior to kernel commit 00fdf13a2e9f313a044288aa59d3b8ec29ff904a, this clone
+# resulted in a BUG_ON in __btrfs_drop_extents(). The kernel now returns EINVAL
+# 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
+echo
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
+cat $SCRATCH_MNT/src
status=0 ; exit
@@ -1,3 +1,8 @@
QA output created by 035
+aaaaaaaaaa
+bbbbbbbbbbcccccccccc
attempting ioctl (src.clone1 src)
+clone failed: Operation not supported
+bbbbbbbbbbcccccccccc
attempting ioctl (src.clone2 src)
+bbbbbbbbbbcccccccccc
With kernel commit 00fdf13a2e9f313a044288aa59d3b8ec29ff904a, the first clone-range overwrite attempt now fails with EOPNOTSUPP. FIXME: The second clone-range causes EIO on subsequent read attempts. Signed-off-by: David Disseldorp <ddiss@suse.de> --- tests/btrfs/035 | 10 ++++++++++ tests/btrfs/035.out | 5 +++++ 2 files changed, 15 insertions(+)