Skip to contentSkip to conversation

btrfs/035: update clone test to expect EOPNOTSUPP

PATCH In review David Disseldorp 2 participants 5 messages May 7, 2014 – May 8, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs/035: update clone test to expect EOPNOTSUPP

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.

---
 tests/btrfs/035     | 11 +++++++++++
 tests/btrfs/035.out |  5 +++++
 2 files changed, 16 insertions(+)
tests/btrfs/035 +11 -0
index 6808179..c9530f6 100755
@@ -57,21 +57,32 @@ 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
+# 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
+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
+# BUG: subsequent access attempts currently result in EIO...
+cat $SCRATCH_MNT/src
 
 status=0 ; exit
tests/btrfs/035.out +5 -0
index f86cadf..0ea2c4f 100644
@@ -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
Signature · 1 line
1.8.4.5
#1 lore raw
Quoted 7 lines · David Disseldorp

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.

Hi David,

Something different here, I didn't get EI on 3.15.0-rc4.

thanks,
-liubo

Quoted 59 lines
---
 tests/btrfs/035     | 11 +++++++++++
 tests/btrfs/035.out |  5 +++++
 2 files changed, 16 insertions(+)
tests/btrfs/035 +11 -0
index 6808179..c9530f6 100755
@@ -57,21 +57,32 @@ 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
+# 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
+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
+# BUG: subsequent access attempts currently result in EIO...
+cat $SCRATCH_MNT/src
 
 status=0 ; exit
tests/btrfs/035.out +5 -0
index f86cadf..0ea2c4f 100644
@@ -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
Signature · 1 line
1.8.4.5
#2 lore raw
Quoted 5 lines · Liu Bo
Quoted 4 lines · David Disseldorp

With kernel commit 00fdf13a2e9f313a044288aa59d3b8ec29ff904a, the first clone-range overwrite attempt now fails with EOPNOTSUPP, rather than tripping a Btrfs BUG_ON().

Quoted 7 lines
Quoted 3 lines

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

Hi David,

Something different here, I didn't get EI on 3.15.0-rc4.

s/EI/EIO/g

-liubo

Quoted 67 lines

thanks,
-liubo

Quoted 59 lines
---
 tests/btrfs/035     | 11 +++++++++++
 tests/btrfs/035.out |  5 +++++
 2 files changed, 16 insertions(+)
tests/btrfs/035 +11 -0
index 6808179..c9530f6 100755
@@ -57,21 +57,32 @@ 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
+# 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
+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
+# BUG: subsequent access attempts currently result in EIO...
+cat $SCRATCH_MNT/src
 
 status=0 ; exit
tests/btrfs/035.out +5 -0
index f86cadf..0ea2c4f 100644
@@ -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
Signature · 1 line
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Liu Bo

Hi liubo,

Quoted 1 line · Liu Bo

Something different here, I didn't get EIO on 3.15.0-rc4.

Strange, I'm able to consistently reproduce this on a vanilla v3.15-rc4-202-g30321c7 kernel.
Does that mean the updated test passes successfully for you?

Cheers, David

#4 lore raw
Quoted 9 lines · David Disseldorp

Hi liubo,

Quoted 1 line · Liu Bo

Something different here, I didn't get EIO on 3.15.0-rc4.

Strange, I'm able to consistently reproduce this on a vanilla v3.15-rc4-202-g30321c7 kernel.
Does that mean the updated test passes successfully for you?

(yeah I've reproduce that error as well)

The interesting thing is that if you do a _scratch_remount before 'cat $SCRATCH_MNT/src', it goes well, I'm looking into why...

-liubo

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs