diff options
author | Milan Broz <mbroz@redhat.com> | 2011-11-11 15:11:08 +0000 |
---|---|---|
committer | Milan Broz <mbroz@redhat.com> | 2011-11-11 15:11:08 +0000 |
commit | 07113beea3c9ef6405fb66b4ae710553f59a45ca (patch) | |
tree | 7851b1461bb2e55c88662705ee85fb830d02dd76 /lib/activate | |
parent | 7891cead1174829900b1779d4dfaa6423883fb97 (diff) | |
download | lvm2-07113beea3c9ef6405fb66b4ae710553f59a45ca.tar.gz lvm2-07113beea3c9ef6405fb66b4ae710553f59a45ca.tar.xz lvm2-07113beea3c9ef6405fb66b4ae710553f59a45ca.zip |
Do not scan device if it is part of active multipath.
Add filter which tries to check if scanned device is part
of active multipath.
Firstly, only SCSI major number devices are handled in filter.
Then it checks if device has exactly one holder (in sysfs) and
if it is device-mapper device and DM-UUID is prefixed by "MPATH-".
If so, this device is filtered out.
The whole filter can be switched off by setting
mpath_component_detection in lvm.conf.
https://bugzilla.redhat.com/show_bug.cgi?id=597010
Signed-off-by: Milan Broz <mbroz@redhat.com>
Diffstat (limited to 'lib/activate')
-rw-r--r-- | lib/activate/activate.c | 27 | ||||
-rw-r--r-- | lib/activate/activate.h | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 2b44b192..37c10f58 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -147,6 +147,10 @@ int target_present(struct cmd_context *cmd, const char *target_name, { return 0; } +int dm_prefix_check(const char *sysfs_dir, int major, int minor, const char *prefix) +{ + return 0; +} int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, unsigned origin_only, struct lvinfo *info, int with_open_count, int with_read_ahead) { @@ -439,6 +443,29 @@ int target_version(const char *target_name, uint32_t *maj, return r; } +int dm_prefix_check(const char *sysfs_dir, int major, int minor, const char *prefix) +{ + struct dm_task *dmt; + const char *uuid; + int r; + + if (!(dmt = dm_task_create(DM_DEVICE_STATUS))) + return 0; + + if (!dm_task_set_minor(dmt, minor) || + !dm_task_set_major(dmt, major) || + !dm_task_run(dmt) || + !(uuid = dm_task_get_uuid(dmt))) { + dm_task_destroy(dmt); + return 0; + } + + r = strncasecmp(uuid, prefix, strlen(prefix)); + dm_task_destroy(dmt); + + return (r == 0) ? 1 : 0; +} + int module_present(struct cmd_context *cmd, const char *target_name) { int ret = 0; diff --git a/lib/activate/activate.h b/lib/activate/activate.h index 119211df..7de1703c 100644 --- a/lib/activate/activate.h +++ b/lib/activate/activate.h @@ -53,6 +53,7 @@ int target_present(struct cmd_context *cmd, const char *target_name, int use_modprobe); int target_version(const char *target_name, uint32_t *maj, uint32_t *min, uint32_t *patchlevel); +int dm_prefix_check(const char *sysfs_dir, int major, int minor, const char *prefix); int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg, struct dm_list *modules); int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv, |