1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-11-30 04:23:48 +03:00

filters: check for mpath before opening devs

Split out the partitioned device filter that needs to open the device
and move the multipath filter in front of it.

When a device is multipathed, sending I/O to the underlying paths may
cause problems, the most obvious being I/O errors visible to lvm if a
path is down.

Revert the incorrect <backtrace> messages added when a device doesn't
pass a filter.

Log each filter initialisation to show sequence.

Avoid duplicate 'Using $device' debug messages.
This commit is contained in:
Alasdair G Kergon
2013-08-13 23:26:58 +01:00
parent 0da72743ca
commit 80bcdb93ff
21 changed files with 159 additions and 227 deletions

View File

@@ -20,12 +20,6 @@
#include "lvm-string.h"
#include "activate.h"
#include "filter.h"
#include "filter-composite.h"
#include "filter-md.h"
#include "filter-mpath.h"
#include "filter-persistent.h"
#include "filter-regex.h"
#include "filter-sysfs.h"
#include "label.h"
#include "lvm-file.h"
#include "format-text.h"
@@ -35,7 +29,6 @@
#include "segtype.h"
#include "lvmcache.h"
#include "lvmetad.h"
#include "dev-cache.h"
#include "archiver.h"
#ifdef HAVE_LIBDL
@@ -824,7 +817,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
return 1;
}
#define MAX_FILTERS 5
#define MAX_FILTERS 6
static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
{
@@ -853,7 +846,6 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
if (!(cn = find_config_tree_node(cmd, devices_filter_CFG, NULL)))
log_very_verbose("devices/filter not found in config file: "
"no regex filter installed");
else if (!(filters[nr_filt] = regex_filter_create(cn->v))) {
log_error("Failed to create regex device filter");
goto bad;
@@ -867,6 +859,19 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
}
nr_filt++;
/* mpath component filter. Optional, non-critical. */
if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG, NULL)) {
if ((filters[nr_filt] = mpath_filter_create(cmd->dev_types)))
nr_filt++;
}
/* partitioned device filter. Required. */
if (!(filters[nr_filt] = partitioned_filter_create(cmd->dev_types))) {
log_error("Failed to create partitioned device filter");
goto bad;
}
nr_filt++;
/* md component filter. Optional, non-critical. */
if (find_config_tree_bool(cmd, devices_md_component_detection_CFG, NULL)) {
init_md_filtering(1);
@@ -874,12 +879,6 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
nr_filt++;
}
/* mpath component filter. Optional, non-critical. */
if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG, NULL)) {
if ((filters[nr_filt] = mpath_filter_create(cmd->dev_types)))
nr_filt++;
}
/* Only build a composite filter if we really need it. */
if (nr_filt == 1)
return filters[0];
@@ -888,6 +887,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
goto_bad;
return composite;
bad:
while (--nr_filt >= 0)
filters[nr_filt]->destroy(filters[nr_filt]);