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.
When using MD RAID devices as PVs on top of which LVM logical volumes are defined and while lvmetad is enabled at the same time (global/use_lvmetad=1 lvm.conf setting), the accompanying logical volume autoactivation that is used together with lvmetad could cause dangling incomplete device-mapper devices representing logical volumes to be left in the system. This also kept the system in inconsistent state where the logical volumes could not be activated any further without manual cleanup of the dangling device-mapper devices. This was caused by triggering the LVM autoactivation at improper time during MD RAID array setup or deactivation. When the MD RAID array is not yet set up completely or it is being deactivated, the autoactivation of LVM logical volumes on top of it fails. This has been fixed and the LVM logical volume is autoactivated at proper time only when the MD RAID device is ready for use.
[0] raw/~ # mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sda /dev/sdb
mdadm: /dev/sda appears to be part of a raid array:
level=raid1 devices=2 ctime=Thu Aug 22 12:15:05 2013
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
mdadm: /dev/sdb appears to be part of a raid array:
level=raid1 devices=2 ctime=Thu Aug 22 12:15:05 2013
mdadm: size set to 130944K
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[0] raw/~ # pvcreate /dev/md0
Physical volume "/dev/md0" successfully created
[0] raw/~ # vgcreate vg /dev/md0
Volume group "vg" successfully created
[0] raw/~ # lvcreate -l1 vg
Logical volume "lvol0" created
[0] raw/~ # dmsetup info -c -o name,attr
Name Stat
fedora_raw-swap L--w
fedora_raw-root L--w
[0] raw/~ # vgchange -ay vg
1 logical volume(s) in volume group "vg" now active
[0] raw/~ # dmsetup info -c -o name,attr
Name Stat
fedora_raw-swap L--w
vg-lvol0 L--w
fedora_raw-root L--w
[0] raw/~ # vgchange -an vg
0 logical volume(s) in volume group "vg" now active
[0] raw/~ # dmsetup info -c -o name,attr
Name Stat
fedora_raw-swap L--w
fedora_raw-root L--w
[0] raw/~ # mdadm -S /dev/md0
mdadm: stopped /dev/md0
[0] raw/~ # dmsetup info -c -o name,attr
Name Stat
fedora_raw-swap L--w
vg-lvol0 ---w
fedora_raw-root L--w
And assosciated log from dmesg after mdadm -S:
[ 5046.297812] md: md0 still in use.
[ 5046.333193] device-mapper: table: 253:2: linear: dm-linear: Device lookup failed
[ 5046.336647] device-mapper: ioctl: error adding target to table
[ 5046.500320] md0: detected capacity change from 134086656 to 0
[ 5046.503839] md: md0 stopped.
[ 5046.505986] md: unbind<sdb>
[ 5046.506862] md: export_rdev(sdb)
[ 5046.507715] md: unbind<sda>
[ 5046.510534] md: export_rdev(sda)
And udev log after mdadm -S:
[1] raw/~ # udevadm monitor --kernel
monitor will print the received events for:
KERNEL - the kernel uevent
KERNEL[5046.296878] change /devices/virtual/block/md0 (block)
KERNEL[5046.330424] add /devices/virtual/bdi/253:2 (bdi)
KERNEL[5046.331208] add /devices/virtual/block/dm-2 (block)
KERNEL[5046.511436] change /devices/virtual/block/md0 (block)
KERNEL[5046.511777] change /devices/virtual/block/md0 (block)
KERNEL[5046.512331] remove /devices/virtual/bdi/9:0 (bdi)
KERNEL[5046.512496] remove /devices/virtual/block/md0 (block)
So there's a CHANGE event followed by REMOVE event when stopping the MD array. The CHANGE event for md0 causes the autoactivation to trigger. At the time the LVM on MD is autoactivated, the MD itself is removed. That explains why we end up with the vg-lvol0 created, but not loaded - the MD underneath is already gone when trying to load the table:
[ 5046.333193] device-mapper: table: 253:2: linear: dm-linear: Device lookup failed
So what we need is to filter out that CHANGE even that's just before REMOVE... That's going to be a little bit harde since the CHANGE even before REMOVE is exactly the same as the CHANGE event that notifies about MD array activation (there's no variable we could make a comparison with).is lvmdump I hope)
--- Additional comment from Peter Rajnoha on 2013-09-11 13:42:32 CEST ---
This patch should fix the issues reported:
https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=8d1d83504dcf9c86ad42d34d3bd0b201d7bab8f6
The bug #1002144 is also an incarnation of this bug - incorrect MD handling while trying to scan the PVs to update lvmetad and running autoactivation at improper time.
Could not reproduce this problem with lvm2-2.02.100-5.el6.x86_64
Both with a running system and commands as stated above, and with a reboot. Everything worked, no read-only occurences (with use_lvmetad=1 and lvm2-lvmetad on).
Marking this concrete case as VERIFIED.
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.
http://rhn.redhat.com/errata/RHBA-2013-1704.html
[0] raw/~ # mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sda /dev/sdb mdadm: /dev/sda appears to be part of a raid array: level=raid1 devices=2 ctime=Thu Aug 22 12:15:05 2013 mdadm: Note: this array has metadata at the start and may not be suitable as a boot device. If you plan to store '/boot' on this device please ensure that your boot-loader understands md/v1.x metadata, or use --metadata=0.90 mdadm: /dev/sdb appears to be part of a raid array: level=raid1 devices=2 ctime=Thu Aug 22 12:15:05 2013 mdadm: size set to 130944K Continue creating array? y mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md0 started. [0] raw/~ # pvcreate /dev/md0 Physical volume "/dev/md0" successfully created [0] raw/~ # vgcreate vg /dev/md0 Volume group "vg" successfully created [0] raw/~ # lvcreate -l1 vg Logical volume "lvol0" created [0] raw/~ # dmsetup info -c -o name,attr Name Stat fedora_raw-swap L--w fedora_raw-root L--w [0] raw/~ # vgchange -ay vg 1 logical volume(s) in volume group "vg" now active [0] raw/~ # dmsetup info -c -o name,attr Name Stat fedora_raw-swap L--w vg-lvol0 L--w fedora_raw-root L--w [0] raw/~ # vgchange -an vg 0 logical volume(s) in volume group "vg" now active [0] raw/~ # dmsetup info -c -o name,attr Name Stat fedora_raw-swap L--w fedora_raw-root L--w [0] raw/~ # mdadm -S /dev/md0 mdadm: stopped /dev/md0 [0] raw/~ # dmsetup info -c -o name,attr Name Stat fedora_raw-swap L--w vg-lvol0 ---w fedora_raw-root L--w And assosciated log from dmesg after mdadm -S: [ 5046.297812] md: md0 still in use. [ 5046.333193] device-mapper: table: 253:2: linear: dm-linear: Device lookup failed [ 5046.336647] device-mapper: ioctl: error adding target to table [ 5046.500320] md0: detected capacity change from 134086656 to 0 [ 5046.503839] md: md0 stopped. [ 5046.505986] md: unbind<sdb> [ 5046.506862] md: export_rdev(sdb) [ 5046.507715] md: unbind<sda> [ 5046.510534] md: export_rdev(sda) And udev log after mdadm -S: [1] raw/~ # udevadm monitor --kernel monitor will print the received events for: KERNEL - the kernel uevent KERNEL[5046.296878] change /devices/virtual/block/md0 (block) KERNEL[5046.330424] add /devices/virtual/bdi/253:2 (bdi) KERNEL[5046.331208] add /devices/virtual/block/dm-2 (block) KERNEL[5046.511436] change /devices/virtual/block/md0 (block) KERNEL[5046.511777] change /devices/virtual/block/md0 (block) KERNEL[5046.512331] remove /devices/virtual/bdi/9:0 (bdi) KERNEL[5046.512496] remove /devices/virtual/block/md0 (block) So there's a CHANGE event followed by REMOVE event when stopping the MD array. The CHANGE event for md0 causes the autoactivation to trigger. At the time the LVM on MD is autoactivated, the MD itself is removed. That explains why we end up with the vg-lvol0 created, but not loaded - the MD underneath is already gone when trying to load the table: [ 5046.333193] device-mapper: table: 253:2: linear: dm-linear: Device lookup failed So what we need is to filter out that CHANGE even that's just before REMOVE... That's going to be a little bit harde since the CHANGE even before REMOVE is exactly the same as the CHANGE event that notifies about MD array activation (there's no variable we could make a comparison with).is lvmdump I hope) --- Additional comment from Peter Rajnoha on 2013-09-11 13:42:32 CEST --- This patch should fix the issues reported: https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=8d1d83504dcf9c86ad42d34d3bd0b201d7bab8f6