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 1422219

Summary: MDs with named arrays can sometimes show incorrect size data preventing some recovery options
Product: Red Hat Enterprise Linux 7 Reporter: Robert LeBlanc <robert>
Component: mdadmAssignee: XiaoNi <xni>
Status: CLOSED ERRATA QA Contact: guazhang <guazhang>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.3CC: dledford, jshortt, robert, xni
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mdadm-4.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 12:49:07 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:
Bug Depends On:    
Bug Blocks: 1353018    

Description Robert LeBlanc 2017-02-14 19:03:31 UTC
Description of problem:
When using named arrays, sometimes the sizes will be incorrect. It seems that the Array Size is always correct, but the Used Dev Size may be unknown or the wrong size.

# mdadm --detail /dev/md_root
/dev/md_root:
        Version : 1.0
  Creation Time : Wed Sep  7 15:58:30 2016
     Raid Level : raid1
     Array Size : 5368708928 (5120.00 GiB 5497.56 GB)
  Used Dev Size : unknown
   Raid Devices : 2
  Total Devices : 1
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Tue Feb 14 11:48:21 2017
          State : clean, degraded
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           Name : 10.91.0.11-volume
           UUID : 2ea91e32:59b7806d:956803c6:00c410eb
         Events : 4255763

    Number   Major   Minor   RaidDevice State
       0       8       16        0      active sync   /dev/sdb
       2       0        0        2      removed

Compiling mdadm from git works correctly. The commit that resolves the problem is c07566f14c89f42b5908bd36d1857d327d1bcc41.

The same commands with this patch:

# ./mdadm --detail /dev/md_root                                                                                                                                               
/dev/md_root:
        Version : 1.0
  Creation Time : Wed Sep  7 15:58:30 2016
     Raid Level : raid1
     Array Size : 5368708928 (5120.00 GiB 5497.56 GB)
  Used Dev Size : 5368708928 (5120.00 GiB 5497.56 GB)
   Raid Devices : 2
  Total Devices : 1
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Tue Feb 14 11:53:22 2017
          State : clean, degraded
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           Name : 10.91.0.11-volume
           UUID : 2ea91e32:59b7806d:956803c6:00c410eb
         Events : 4255837

    Number   Major   Minor   RaidDevice State
       0       8       16        0      active sync   /dev/sdb
       -       0        0        1      removed

The bug prevents re-adding members into the array if they are failed.

# mdadm /dev/md_root --re-add /dev/sdf
mdadm: /dev/sdf not large enough to join array

With the patch:

# ./mdadm /dev/md_root --re-add /dev/sdf
mdadm: re-added /dev/sdf


Version-Release number of selected component (if applicable):


How reproducible:
I haven't been able to figure out what exactly triggers the issue.

Steps to Reproduce:
1. Create a named array
2. Fail and remove a device
3. Re-add the device

Comment 2 XiaoNi 2017-02-21 03:07:44 UTC
Hi Robert

You mean the one patch c07566f14c89f42b5908bd36d1857d327d1bcc41 resolves the two problems you mentioned?

Thanks
Xiao

Comment 3 Robert LeBlanc 2017-02-21 23:05:02 UTC
Replicate on a 20 GB KVM with a fresh minimal CentOS 7.3 install and mdadm version:
mdadm - v3.4 - 28th January 2016

echo "CREATE names=yes" >> /etc/mdadm.conf
# It seems that large disks have a problem
truncate --size 5T /root/test{1,2}.img
losetup /dev/loop11 /root/test1.img
losetup /dev/loop12 /root/test2.img
mdadm --create /dev/md/test --level=1 --raid-devices=2 --bitmap=internal --run --assume-clean /dev/loop1{1,2}
# Notice that "Used Dev Size" is 'unknown'
mdadm --detail /dev/md_test
# Remove and try to readd the disk
mdadm /dev/md_test -f /dev/loop12 -r /dev/loop12
# It won't be able to find a suitable disk for the array (no output)
mdadm /dev/md_test --re-add missing
# Tell it to add /dev/loop12 and get "mdadm: /dev/loop12 not large enough to join array"
mdadm /dev/md_test --re-add /dev/loop12

Comment 4 XiaoNi 2017-02-24 09:01:24 UTC
Sorry, my comment was private. So maybe you can't see my comment. I set it public now for comment 2. 

Thanks
Xiao

Comment 5 Robert LeBlanc 2017-02-24 16:52:06 UTC
Xiao, I was really confused about what info was needed and just thought my lack of knowledge with how Bugzilla works was the reason for that. Comment 2 does clear up what is needed.

I don't believe that the array is reporting an incorrect size like I mentioned before. I is only reporting 'unknown'. I believe that with --examine, I overlooked that some values are reported in kilobytes and others in number of sectors making me think that the reported size was twice the real size.

If I remember my conversation with Neil Brown, mdadm can not find the /sys device to query which would lead to an unknown value and not an incorrect value.

Commit c07566f14c89f42b5908bd36d1857d327d1bcc41 is the only commit needed to resolve this bug.

Comment 6 XiaoNi 2017-02-26 08:59:41 UTC
I just want to confirm whether the commit can resolve your problem or not. I'm doing rebase upstream 4.0. The patch c07566f14c89f42b5908bd36d1857d327d1bcc41 is included in upstream 4.0. 

So this bug can be fixed after the rebase.

Thanks
Xiao

Comment 7 Robert LeBlanc 2017-02-27 18:55:51 UTC
Yes c07566f14c89f42b5908bd36d1857d327d1bcc41 fixes my problem completely.

Comment 9 guazhang@redhat.com 2017-04-17 05:58:06 UTC
Hello
the bug have been fixed on mdadm-4.0-1.el7, so i will move it to "verified"

[root@storageqe-24 ~]# rpm -qa |grep mdadm
mdadm-3.4-14.el7_3.1.x86_64

[root@storageqe-24 ~]# mdadm -D /dev/md_test 
/dev/md_test:
        Version : 1.2
  Creation Time : Mon Apr 17 01:47:44 2017
     Raid Level : raid1
     Array Size : 5368578048 (5119.88 GiB 5497.42 GB)
  Used Dev Size : unknown
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Mon Apr 17 01:47:44 2017
          State : clean 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : test
           UUID : 848f5293:1ccc8904:b2859ad0:aa70dadf
         Events : 0

    Number   Major   Minor   RaidDevice State
       0       7       11        0      active sync   /dev/loop11
       1       7       12        1      active sync   /dev/loop12
[root@storageqe-24 ~]# 
[root@storageqe-24 ~]# mdadm /dev/md_test -f /dev/loop12 -r /dev/loop12
mdadm: set /dev/loop12 faulty in /dev/md_test
mdadm: hot removed /dev/loop12 from /dev/md_test
[root@storageqe-24 ~]# mdadm /dev/md_test --re-add /dev/loop12
mdadm: /dev/loop12 not large enough to join array



[root@storageqe-24 ~]# mdadm -V
mdadm - v4.0 - 2017-01-09
[root@storageqe-24 ~]# mdadm -D /dev/md_test 
/dev/md_test:
        Version : 1.2
  Creation Time : Mon Apr 17 01:54:21 2017
     Raid Level : raid1
     Array Size : 5368578048 (5119.88 GiB 5497.42 GB)
  Used Dev Size : 5368578048 (5119.88 GiB 5497.42 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Mon Apr 17 01:54:21 2017
          State : clean 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : test
           UUID : f785a66c:38567882:9491b606:d2370270
         Events : 0

    Number   Major   Minor   RaidDevice State
       0       7       11        0      active sync   /dev/loop11
       1       7       12        1      active sync   /dev/loop12
[root@storageqe-24 ~]# mdadm /dev/md_test -f /dev/loop12 -r /dev/loop12
mdadm: set /dev/loop12 faulty in /dev/md_test
mdadm: hot removed /dev/loop12 from /dev/md_test
[root@storageqe-24 ~]# mdadm /dev/md_test --re-add /dev/loop12
mdadm: re-added /dev/loop12



thanks
Guazhang

Comment 10 errata-xmlrpc 2017-08-01 12:49:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2264