mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dev-type: check for DEVLINKS udev db variable existence if udev_device_get_is_initialized fn is not present
Older udev versions (udev < v165), don't have the official udev_device_get_is_initialized function available to query for device initialization state in udev database. Also, devices don't have USEC_INITIALIZED udev db variable set - this is bound to the udev_device_get_is_initialized fn functionality. In this case, check for "DEVLINKS" variable instead - all block devices have at least one symlink set for the node (the "/dev/block/<major:minor>". This symlink is set by default basic udev rules provided by udev directly. We'll use this as an alternative for the check that initial udev processing for a device has already finished.
This commit is contained in:
parent
2e4821a847
commit
c8a14a29cd
@ -36,6 +36,9 @@
|
|||||||
#define DEV_EXT_UDEV_DEVTYPE "DEVTYPE"
|
#define DEV_EXT_UDEV_DEVTYPE "DEVTYPE"
|
||||||
#define DEV_EXT_UDEV_DEVTYPE_DISK "disk"
|
#define DEV_EXT_UDEV_DEVTYPE_DISK "disk"
|
||||||
|
|
||||||
|
/* the list of symlinks associated with device node */
|
||||||
|
#define DEV_EXT_UDEV_DEVLINKS "DEVLINKS"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DEV_EXT_UDEV_MPATH_DEVICE_PATH is set by multipath in udev db
|
* DEV_EXT_UDEV_MPATH_DEVICE_PATH is set by multipath in udev db
|
||||||
* with value either 0 or 1. The same functionality as
|
* with value either 0 or 1. The same functionality as
|
||||||
|
@ -1024,8 +1024,13 @@ int udev_dev_is_mpath_component(struct device *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED
|
||||||
if ((initialized = udev_device_get_is_initialized(udev_device)))
|
if ((initialized = udev_device_get_is_initialized(udev_device)))
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
if ((initialized = (udev_device_get_property_value(udev_device, DEV_EXT_UDEV_DEVLINKS) != NULL)))
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
log_debug("Device %s not initialized in udev database (%u/%u, %u microseconds).", dev_name(dev),
|
log_debug("Device %s not initialized in udev database (%u/%u, %u microseconds).", dev_name(dev),
|
||||||
i + 1, UDEV_DEV_IS_MPATH_COMPONENT_ITERATION_COUNT,
|
i + 1, UDEV_DEV_IS_MPATH_COMPONENT_ITERATION_COUNT,
|
||||||
|
Loading…
Reference in New Issue
Block a user