Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1012254

Summary: btrfs replace should print meaningful error message when dealing with RAID5/RAID6
Product: Red Hat Enterprise Linux 7 Reporter: Eryu Guan <eguan>
Component: btrfs-progsAssignee: fs-maint
Status: CLOSED CURRENTRELEASE QA Contact: Filesystem QE <fs-qe>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: esandeen, xuw
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-22 04:13:59 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:

Description Eryu Guan 2013-09-26 05:58:22 UTC
Description of problem:
btrfs replace cannot handle RAID5 and RAID6, it only gives out EINVAL, user has to check dmesg for the reason of EINVAL

# btrfs replace start -B /dev/loop2 /dev/loop3 /mnt/btrfs
ERROR: ioctl(DEV_REPLACE_START) failed on "/mnt/btrfs": Invalid argument, no error
# dmesg | tail -1
btrfs: dev_replace cannot yet handle RAID5/RAID6

btrfs should print the meaningful error reason to stderr. Not a big problem but kind of inconvenient.

Version-Release number of selected component (if applicable):
btrfs-progs-0.20.rc1.20130308git704a08c-1.el7

Current upstream btrfs-progs has this issue too, HEAD is
194aa4a btrfs-restore: deal with NULL returns from read_node_slot

How reproducible:
always

Steps to Reproduce:
1. mkfs -t btrfs -m raid5 -d raid5 /dev/loop[0-2]
2. mount /dev/loop0 /mnt/btrfs
3. btrfs replace start -B /dev/loop2 /dev/loop3

Actual results:
# btrfs replace start -B /dev/loop2 /dev/loop3 /mnt/btrfs
ERROR: ioctl(DEV_REPLACE_START) failed on "/mnt/btrfs": Invalid argument, no error
# dmesg | tail -1
btrfs: dev_replace cannot yet handle RAID5/RAID6

Expected results:
btrfs prints error and the reason to stderr

Additional info:

Comment 3 Eric Sandeen 2015-04-17 21:30:15 UTC
btrfs-progs 3.19.1 has been built for RHEL7.2; if possible, please retest this bug against that version to see if your problem has been resolved.

Thanks,
-Eric

Comment 4 XuWang 2015-04-22 03:39:04 UTC
Raid5/6 replaced is introduced since kernel-3.10.0-237, so only to this bug, it can be set to be virified.
And I also test it with the btrfs-progs test case "/btrfs-progs/Regression/bz1012254-support-replace-raid56", works fine. The result is lile below:

:: [ 11:29:55 ] :: [ WARNING ] :: POSIX mode detected and switched off
:: [ 11:29:55 ] :: [ WARNING ] :: Please fix your test to have /bin/bash shebang

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Setup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [  BEGIN   ] :: Running 'setup_devs'
:: [   PASS   ] :: Command 'setup_devs' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'mkdir -p /mnt/btrfs'
:: [   PASS   ] :: Command 'mkdir -p /mnt/btrfs' (Expected 0, got 0)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [  BEGIN   ] :: Running 'mkfs -t btrfs -f -m raid5 -d raid5 /dev/loop1 /dev/loop2 /dev/loop3'
btrfs-progs v3.19.1
See http://btrfs.wiki.kernel.org for more information.

Performing full device TRIM (1.00GiB) ...
Turning ON incompat feature 'extref': increased hardlink limit per file to 65536
Turning ON incompat feature 'raid56': raid56 extended format
Turning ON incompat feature 'skinny-metadata': reduced-size metadata extent refs
Performing full device TRIM (1.00GiB) ...
adding device /dev/loop2 id 2
Performing full device TRIM (1.00GiB) ...
adding device /dev/loop3 id 3
fs created label (null) on /dev/loop1
	nodesize 16384 leafsize 16384 sectorsize 4096 size 3.00GiB
:: [   PASS   ] :: Command 'mkfs -t btrfs -f -m raid5 -d raid5 /dev/loop1 /dev/loop2 /dev/loop3' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'mount /dev/loop1 /mnt/btrfs'
:: [   PASS   ] :: Command 'mount /dev/loop1 /mnt/btrfs' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'btrfs replace start -B -f /dev/loop1 /dev/loop0 /mnt/btrfs'
:: [   PASS   ] :: Command 'btrfs replace start -B -f /dev/loop1 /dev/loop0 /mnt/btrfs' (Expected 0, got 0)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Cleanup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [  BEGIN   ] :: Running 'cleanup'
:: [   PASS   ] :: Command 'cleanup' (Expected 0, got 0)

Comment 5 Eryu Guan 2015-04-22 04:13:59 UTC
btrfs supports replace raid5/6 now and no error message is needed from btrfs-progs, I think we can just close this bug now.