Bug 1051985

Summary: btrfs-progs: btrfs scrub returns non-zero but reports no errors
Product: Red Hat Enterprise Linux 7 Reporter: Eryu Guan <eguan>
Component: btrfs-progsAssignee: fs-maint
Status: CLOSED DUPLICATE QA Contact: Filesystem QE <fs-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: esandeen, wangsl.fnst
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: btrfs-progs-3.16-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-15 23:13:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Bug fix for your problem none

Description Eryu Guan 2014-01-13 03:32:41 UTC
Description of problem:
After converting btrfs to raid5 or raid6 profile, btrfs scrub returns non-zero return value, but the output of scrub indicates no errors, dmesg shows no errors either.

Not sure it's a kernel issue or a btrfs-progs issue, take it as btrfs-progs though.

[root@ibm-p750e-02-lp1 profile-conversion]# mkfs -t btrfs -m raid0 -d raid0 -f -K /dev/loop{0..3}

WARNING! - Btrfs v3.12 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using

Turning ON incompat feature 'extref': increased hardlink limit per file to 65536
adding device /dev/loop1 id 2
adding device /dev/loop2 id 3
adding device /dev/loop3 id 4
fs created label (null) on /dev/loop0
        nodesize 65536 leafsize 65536 sectorsize 65536 size 4.00GiB
Btrfs v3.12
[root@ibm-p750e-02-lp1 profile-conversion]# mount /dev/loop0 /mnt/btrfs
[root@ibm-p750e-02-lp1 profile-conversion]# btrfs fi balance start -mconvert=raid5 -dconvert=raid5 /mnt/btrfs
Done, had to relocate 6 out of 6 chunks
[root@ibm-p750e-02-lp1 profile-conversion]# umount /mnt/btrfs
[root@ibm-p750e-02-lp1 profile-conversion]# mount /dev/loop0 /mnt/btrfs
[root@ibm-p750e-02-lp1 profile-conversion]# btrfs scrub start -B /mnt/btrfs
scrub done for 12e251f9-bc07-4fbd-a25a-a50679bc3545
        scrub started at Sun Jan 12 22:25:24 2014 and finished after 0 seconds
        total bytes scrubbed: 7.50MiB with 0 errors
[root@ibm-p750e-02-lp1 profile-conversion]# echo $?
3


Version-Release number of selected component (if applicable):
btrfs-progs-3.12-1.el7
kernel-3.10.0-64.el7

How reproducible:
always

Steps to Reproduce:
1. mkfs -t btrfs -m raid0 -d raid0 -f -K /dev/loop{0..3}
2. mount /dev/loop0 /mnt/btrfs
3. btrfs fi balance start -mconvert=raid5 -dconvert=raid6 /mnt/btrfs
4. btrfs scrub start -B /mnt/btrfs

Actual results:
btrfs scrub returns 3, but no error messages in stderr nor in dmesg

Expected results:
btrfs scrub returns 0 or show some error messages if there're really some errors

Additional info:

Comment 1 Eryu Guan 2014-03-03 09:24:15 UTC
1. mkfs -t btrfs -m raid0 -d raid0 -f -K /dev/loop{0..3}
2. mount /dev/loop0 /mnt/btrfs
3. btrfs fi balance start -mconvert=raid5 -dconvert=raid5 /mnt/btrfs
4. btrfs scrub start -B /mnt/btrfs

Still fails with btrfs-progs-3.12-4.el7

Comment 2 Wang Shilong 2014-03-22 07:19:37 UTC
Created attachment 877550 [details]
Bug fix for your problem

Comment 3 Wang Shilong 2014-03-22 07:22:37 UTC
(In reply to Wang Shilong from comment #2)
> Created attachment 877550 [details]
> Bug fix for your problem

This patch can be applied to btrfs-next, and it should can fix your problem, i'd like you can test it before i send this patch out to list.

Thanks for reporting.

Comment 5 Eric Sandeen 2014-07-17 02:59:59 UTC
Note, FJ has sent a patchset for this:

[PATCH 1/4] btrfs-progs: adjust the return values for scrub

Comment 6 Eric Sandeen 2014-10-15 23:13:31 UTC
Fixed in v3.16 with:
965cd86 btrfs-progs: adjust the return values for scrub

Closing this and others with NEXTRELEASE since it's part of a rebase, but if you prefer we can re-open, get all the acks, and add it to the errata.  I'm not sure if that's worth it, but if you want to, please let me know.

Thanks,
-Eric

Comment 7 Eric Sandeen 2014-10-15 23:18:14 UTC
Actually, probably better to dup to the rebase bug.

*** This bug has been marked as a duplicate of bug 1134981 ***