Skip to contentSkip to conversation

master - filter-mpath: fix primary device lookup failure for partition when processing mpath filter

PATCH Peter Rajnoha 1 participant 1 message Aug 8, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9738a02d3d56a3a30bd8b59838eae8f805ba3bcc
Commit:        9738a02d3d56a3a30bd8b59838eae8f805ba3bcc
Parent:        c52c9a1e316b6a92a2475dfe3ad2aac92edc80c0
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Fri Aug 8 10:49:19 2014 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Fri Aug 8 10:49:19 2014 +0200

filter-mpath: fix primary device lookup failure for partition when processing mpath filter

If using persistent filter and we're refreshing filters (just like we do for pvcreate now after commit 54685c20fc9dfb155a2e5bc9d8cf5f0aad944305), we can't rely on getting the primary device of the partition from the cache as such device could be already filtered by persistent filter and we get a device cache lookup failure for such device.

For example:

$ lvm dumpconfig --type diff
devices {
	obtain_device_list_from_udev=0
}

$lsblk /dev/sda

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  128M  0 disk
`-sda1   8:1    0  127M  0 part

$cat /etc/lvm/cache/.cache | grep sda

		"/dev/sda1",

$pvcreate /dev/sda1
dev_is_mpath: failed to get device for 8:1 Physical volume "/dev/sda1" successfully created

The problematic part of the code called dev_cache_get_by_devt to get the device for the device number supplied. Then the code used dev_name(dev) to get the name which is then used in check whether there's any mpath on top of this dev...

This patch uses sysfs to get the base name for the partition instead, hence avoiding the device cache which is a correct approach here.

---
 WHATS_NEW                  |    1 +
 lib/filters/filter-mpath.c |   53 +++++++++++++++++++++++++++++---------------
 2 files changed, 36 insertions(+), 18 deletions(-)
WHATS_NEW +1 -0
index 96ce8cb..28f7e36 100644
@@ -1,5 +1,6 @@
 Version 2.02.110 -
 ==================================
+  Fix primary device lookup failure for partition when processing mpath filter.
   If LV inactive and non-clustered, do not issue "Cannot deactivate" on -aln.
   Remove spurious "Skipping mirror LV" message on pvmove of clustered mirror.
 
lib/filters/filter-mpath.c +35 -18

79 lines not on this page · raw message