Bug 1248030 - bad .cache file prevents RHEV host from functioning after reboot
bad .cache file prevents RHEV host from functioning after reboot
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2 (Show other bugs)
6.6
All Linux
high Severity high
: rc
: ---
Assigned To: LVM and device-mapper development team
cluster-qe@redhat.com
: ZStream
Depends On: 1240507
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-29 09:14 EDT by Jaroslav Reznik
Modified: 2015-08-24 18:07 EDT (History)
11 users (show)

See Also:
Fixed In Version: lvm2-2.02.111-2.el6_6.5
Doc Type: Bug Fix
Doc Text:
Prior to this update, using the lvm utility when the persistent cache file was outdated caused devices that were stored in the persistent cache to unintentionally bypass logical volume manager (LVM) filters set in the LVM configuration. As a consequence, Red Hat Enterprise Virtualization hosts in some cases failed to start with an outdated cache file. This update fixes LVM's internal cache handling so that the filters are applied properly, and the described problem no longer occurs.
Story Points: ---
Clone Of: 1240507
Environment:
Last Closed: 2015-08-24 03:49:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jaroslav Reznik 2015-07-29 09:14:41 EDT
This bug has been copied from bug #1240507 and has been proposed
to be backported to 6.6 z-stream (EUS).
Comment 4 Peter Rajnoha 2015-07-30 07:04:33 EDT
I'm attaching complete reproducer here because it's very important to test this properly and avoid confusion by touching .cache file and hence changing timestamps (because timestamp comparison for lvm.conf file and .cache file matters a lot here for rescans and we could test completely different thing then!).

(remove existing .cache file to start with clean state)
# rm -f /etc/lvm/cache/.cache

(make sure filter is not set)
# lvm dumpconfig devices/filter
  Configuration node devices/filter not found

(create a PV on base device)
# pvcreate /dev/sda
  Physical volume "/dev/sda" successfully created

(get the PV UUID of just created PV)
# pvs -o name,uuid /dev/sda
  PV         PV UUID                               
  /dev/sda   T55Rb7-CWWS-7tSM-Wnq8-UZQs-4IPe-YMKbhO

# ...edit devices/filter setting in /etc/lvm/lvm.conf to reject all devices...

(make sure filter is set to reject all devices)
# lvm dumpconfig devices/filter
filter="r|.*|"

(get size of the base device...)
# blockdev --getsize /dev/sda
262144

(...and use the size to create dm mapping over the whole device - this simulates mpath for example)
# dmsetup create test --table "0 262144 linear /dev/sda 0"

(get the dm-X block device name for the mapping)
# dmsetup info -c -o name,blkdevname test
Name             BlkDevName      
test             dm-2 

(check the lvm-pv-uuid-* symlink points to the dm device we just created)
# ls -l /dev/disk/by-id/lvm-pv-uuid-T55Rb7-CWWS-7tSM-Wnq8-UZQs-4IPe-YMKbhO 
lrwxrwxrwx. 1 root root 10 Jul 30 12:49 /dev/disk/by-id/lvm-pv-uuid-T55Rb7-CWWS-7tSM-Wnq8-UZQs-4IPe-YMKbhO -> ../../dm-2

(call pvs to scan the state as it is now - that is with the dm mapping over the base device)
# pvs

(now remove the mapping)
# dmsetup remove test                        

(check the lvm-pv-uuid-* symlinks now points to the base device)
# ls -l /dev/disk/by-id/lvm-pv-uuid-T55Rb7-CWWS-7tSM-Wnq8-UZQs-4IPe-YMKbhO 
lrwxrwxrwx. 1 root root 9 Jul 30 12:50 /dev/disk/by-id/lvm-pv-uuid-T55Rb7-CWWS-7tSM-Wnq8-UZQs-4IPe-YMKbhO -> ../../sda

(call pvs now - recall that we have filter set to "reject all" and despite that pvs incorrectly displays the base device because it's confused by the outdated persistent cache - the .cache file and the bug we had in the cache handling code)
# pvs                   
  PV         VG   Fmt  Attr PSize   PFree  
  /dev/sda        lvm2 ---  128.00m 128.00m


When all works correctly with the fixed version, the last command shouldn't display anything as we reject all devices with the filter!
Comment 7 errata-xmlrpc 2015-08-24 03:49:55 EDT
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://rhn.redhat.com/errata/RHBA-2015-1655.html

Note You need to log in before you can comment on or make changes to this bug.