summaryrefslogtreecommitdiffstats
path: root/lib/filters/filter.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2007-01-25 21:22:30 +0000
committerAlasdair Kergon <agk@redhat.com>2007-01-25 21:22:30 +0000
commitf247a4e76ffa0c2af6e01aee9232f1657d945d95 (patch)
tree3ecba0d197a74fa6706d6e28c96bc33701742917 /lib/filters/filter.c
parent820810da6532a11ec981b624d920364f1136f52c (diff)
downloadlvm2-f247a4e76ffa0c2af6e01aee9232f1657d945d95.tar.gz
lvm2-f247a4e76ffa0c2af6e01aee9232f1657d945d95.tar.xz
lvm2-f247a4e76ffa0c2af6e01aee9232f1657d945d95.zip
Add devices/ignore_suspended_devices to ignore suspended dm devices.
Diffstat (limited to 'lib/filters/filter.c')
-rw-r--r--lib/filters/filter.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/filters/filter.c b/lib/filters/filter.c
index 2723b708..a121b095 100644
--- a/lib/filters/filter.c
+++ b/lib/filters/filter.c
@@ -19,6 +19,7 @@
#include "lvm-string.h"
#include "config.h"
#include "metadata.h"
+#include "activate.h"
#include <dirent.h>
#include <unistd.h>
@@ -37,6 +38,7 @@ typedef struct {
} device_info_t;
static int _md_major = -1;
+static int _device_mapper_major = -1;
int md_major(void)
{
@@ -90,6 +92,13 @@ static int _passes_lvm_type_device_filter(struct dev_filter *f,
return 0;
}
+ /* Skip suspended devices */
+ if (MAJOR(dev->dev) == _device_mapper_major &&
+ ignore_suspended_devices() && device_is_usable(dev->dev)) {
+ log_debug("%s: Skipping: Suspended dm device", name);
+ return 0;
+ }
+
/* Check it's accessible */
if (!dev_open_flags(dev, O_RDONLY, 0, 1)) {
log_debug("%s: Skipping: open failed", name);
@@ -182,10 +191,14 @@ static int _scan_proc_dev(const char *proc, const struct config_node *cn)
if (!strncmp("md", line + i, 2) && isspace(*(line + i + 2)))
_md_major = line_maj;
+ /* Look for device-mapper device */
+ /* FIXME Cope with multiple majors */
+ if (!strncmp("device-mapper", line + i, 13) && isspace(*(line + i + 13)))
+ _device_mapper_major = line_maj;
+
/* Go through the valid device names and if there is a
match store max number of partitions */
for (j = 0; device_info[j].name != NULL; j++) {
-
dev_len = strlen(device_info[j].name);
if (dev_len <= strlen(line + i) &&
!strncmp(device_info[j].name, line + i, dev_len) &&