]> sourceware.org Git - lvm2.git/commitdiff
Always pass unsuspended dm devices through persistent filter to other filters.
authorAlasdair Kergon <agk@redhat.com>
Fri, 2 Jul 2010 02:09:57 +0000 (02:09 +0000)
committerAlasdair Kergon <agk@redhat.com>
Fri, 2 Jul 2010 02:09:57 +0000 (02:09 +0000)
Move test for suspended dm devices ahead of other filters.

WHATS_NEW
doc/example.conf.in
lib/commands/toolcontext.c
lib/filters/filter-persistent.c
lib/filters/filter.c
lib/filters/filter.h

index 735f885ac92b66ed2c079d1a9c2f67dae6f55751..28dbbae0f1fda38776e73b0157a4805d710131c3 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
 Version 2.02.70 - 
 ================================
+  Always pass unsuspended dm devices through persistent filter to other filters.
+  Move test for suspended dm devices ahead of other filters.
   Fix another segfault in clvmd -R if no response from daemon received. (2.02.68)
   Remove superfluous suspended device counter from clvmd.
   Fix lvm shell crash when input is entirely whitespace.
index d5af3159327a9df460c7eabae49f32d7b79afe6e..850b7e23ee8209eeed7b7290f80b37d26b4e7426 100644 (file)
@@ -457,13 +457,15 @@ activation {
     # pvmetadatacopies = 1
 
     # Default number of copies of metadata to maintain for each VG.
-    # If set to a non-zero value, LVM automatically manages the PV
-    # 'metadataignore' flags (see pvchange) to achieve the requested
-    # copies of metadata.  You may set a value larger than the
-    # the sum of all metadata areas on all physical volumes.  This value
-    # can be overridden on the command line of various commands. The
-    # default value of 0 indicates that LVM should not automatically
-    # manage the 'metadataignore' flags.
+    # If set to a non-zero value, LVM automatically chooses which of
+    # the available metadata areas to use to achieve the requested
+    # number of copies of the VG metadata.  If you set a value larger
+    # than the the total number of metadata areas available then
+    # metadata is stored in them all.
+    # The default value of 0 ("unmanaged") disables this automatic
+    # management and allows you to control which metadata areas
+    # are used at the individual PV level using 'pvchange
+    # --metadataignore y/n'.
 
     # vgmetadatacopies = 0
 
index 7c5e37943b4876f2fd9605b947f9708c5a9aa771..788236dacb5fd9f8760cddc10f507bf3f9897d26 100644 (file)
@@ -24,6 +24,7 @@
 #include "filter-md.h"
 #include "filter-persistent.h"
 #include "filter-regex.h"
+#include "filter-suspended.h"
 #include "filter-sysfs.h"
 #include "label.h"
 #include "lvm-file.h"
index 6574d6983fb9c15b4fedce23149f59abc25c5f75..5a016f84de1968b97772c02e60a7a3566f74d912 100644 (file)
 #include "lib.h"
 #include "config.h"
 #include "dev-cache.h"
+#include "filter.h"
 #include "filter-persistent.h"
 #include "lvm-file.h"
 #include "lvm-string.h"
+#include "activate.h"
 
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -266,15 +268,31 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
        void *l = dm_hash_lookup(pf->devices, dev_name(dev));
        struct str_list *sl;
 
+       /* Cached BAD? */
+       if (l == PF_BAD_DEVICE) {
+               log_debug("%s: Skipping (cached)", dev_name(dev));
+               return 0;
+       }
+
+        /* Test dm devices every time, so cache them as GOOD. */
+       if (MAJOR(dev->dev) == dm_major()) {
+               if (!l)
+                       dm_list_iterate_items(sl, &dev->aliases)
+                               dm_hash_insert(pf->devices, sl->str, PF_GOOD_DEVICE);
+               if (ignore_suspended_devices() && !device_is_usable(dev)) {
+                       log_debug("%s: Skipping (suspended/internal)", dev_name(dev));
+                       return 0;
+               }
+               return pf->real->passes_filter(pf->real, dev);
+       }
+
+       /* Uncached */
        if (!l) {
-               l = pf->real->passes_filter(pf->real, dev) ?
-                   PF_GOOD_DEVICE : PF_BAD_DEVICE;
+               l = pf->real->passes_filter(pf->real, dev) ?  PF_GOOD_DEVICE : PF_BAD_DEVICE;
 
                dm_list_iterate_items(sl, &dev->aliases)
                        dm_hash_insert(pf->devices, sl->str, l);
-
-       } else if (l == PF_BAD_DEVICE)
-                       log_debug("%s: Skipping (cached)", dev_name(dev));
+       }
 
        return (l == PF_BAD_DEVICE) ? 0 : 1;
 }
index 889cb0db93c34b38a06364ed5aab8400fa556e59..eafa72608a615089a266ccaf782df93ececd9a2f 100644 (file)
@@ -42,6 +42,11 @@ static int _blkext_major = -1;
 static int _drbd_major = -1;
 static int _device_mapper_major = -1;
 
+int dm_major(void)
+{
+       return _device_mapper_major;
+}
+
 int md_major(void)
 {
        return _md_major;
@@ -130,14 +135,6 @@ static int _passes_lvm_type_device_filter(struct dev_filter *f __attribute((unus
                return 0;
        }
 
-       /* FIXME Always check 'layer' regardless of ignore_suspended_devices */
-       /* Skip suspended devices */
-       if (MAJOR(dev->dev) == _device_mapper_major &&
-           ignore_suspended_devices() && !device_is_usable(dev)) {
-               log_debug("%s: Skipping: Suspended or internal 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);
index 4da33252847f451ccb4afa03c3f9d218486ca6fa..07611f9eb167080cd9dcac6fb48f6ee16a1f59e3 100644 (file)
@@ -35,6 +35,7 @@ struct dev_filter *lvm_type_filter_create(const char *proc,
 
 void lvm_type_filter_destroy(struct dev_filter *f);
 
+int dm_major(void);
 int md_major(void);
 int blkext_major(void);
 int max_partitions(int major);
This page took 0.041227 seconds and 5 git commands to generate.