mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
pvscan: check sysfs dev entry before rescan
When pvscan --cache --major --minor command is issued from udev REMOVE event, it basically resulted into a whole device scan since the device was missing. So avoid such scan and first check via /sysfs (when available) if such device actually exists.
This commit is contained in:
parent
1260b86b2b
commit
32a6c11877
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.118 -
|
Version 2.02.118 -
|
||||||
=================================
|
=================================
|
||||||
|
Avoid rescan of all devices when requested pvscan for removed device.
|
||||||
Measure configuration timestamps with nanoseconds when available.
|
Measure configuration timestamps with nanoseconds when available.
|
||||||
Disable lvchange of major and minor of pool LVs.
|
Disable lvchange of major and minor of pool LVs.
|
||||||
Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
|
Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
|
||||||
|
@ -986,12 +986,31 @@ static struct device *_dev_cache_seek_devt(dev_t dev)
|
|||||||
*/
|
*/
|
||||||
struct device *dev_cache_get_by_devt(dev_t dev, struct dev_filter *f)
|
struct device *dev_cache_get_by_devt(dev_t dev, struct dev_filter *f)
|
||||||
{
|
{
|
||||||
|
char path[PATH_MAX];
|
||||||
|
const char *sysfs_dir;
|
||||||
|
struct stat info;
|
||||||
struct device *d = _dev_cache_seek_devt(dev);
|
struct device *d = _dev_cache_seek_devt(dev);
|
||||||
|
|
||||||
if (d && (d->flags & DEV_REGULAR))
|
if (d && (d->flags & DEV_REGULAR))
|
||||||
return d;
|
return d;
|
||||||
|
|
||||||
if (!d) {
|
if (!d) {
|
||||||
|
sysfs_dir = dm_sysfs_dir();
|
||||||
|
if (sysfs_dir && *sysfs_dir) {
|
||||||
|
/* First check if dev is sysfs to avoid useless scan */
|
||||||
|
if (dm_snprintf(path, sizeof(path), "%s/dev/block/%d:%d",
|
||||||
|
sysfs_dir, (int)MAJOR(dev), (int)MINOR(dev)) < 0) {
|
||||||
|
log_error("dm_snprintf partition failed.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lstat(path, &info)) {
|
||||||
|
log_debug("No sysfs entry for %d:%d.",
|
||||||
|
(int)MAJOR(dev), (int)MINOR(dev));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_full_scan(0);
|
_full_scan(0);
|
||||||
d = _dev_cache_seek_devt(dev);
|
d = _dev_cache_seek_devt(dev);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user