]> sourceware.org Git - lvm2.git/commitdiff
Test dm_hash_insert() failures mem failures
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 28 Feb 2012 11:12:58 +0000 (11:12 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 28 Feb 2012 11:12:58 +0000 (11:12 +0000)
WHATS_NEW
lib/filters/filter-persistent.c
lib/metadata/metadata.c

index 315853da91cdbb79a4ee3ea99802f81bc6eec03b..a3f888548f1691791ad11ca61ceac3819da70a37 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.94 - 
 ====================================
+  Test dm_hash_insert() failures in filter-persistent.c and fid_add_mda().
   Ensure clvmd message is always \0 terminated after read.
   Better detection of missing dmeventd fifo connection (2.02.93).
   Add some close() and dev_close() error path backtraces.
index c7f4847370681616eb6bd4a66d88a7ae512db458..3705804858e0ce7515326357967266a5107a1786 100644 (file)
@@ -292,7 +292,10 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
        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 (!dm_hash_insert(pf->devices, sl->str, PF_GOOD_DEVICE)) {
+                                       log_error("Failed to hash device to filter.");
+                                       return 0;
+                               }
                if (!device_is_usable(dev)) {
                        log_debug("%s: Skipping unusable device", dev_name(dev));
                        return 0;
@@ -305,7 +308,10 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
                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);
+                       if (!dm_hash_insert(pf->devices, sl->str, l)) {
+                               log_error("Failed to hash alias to filter.");
+                               return 0;
+                       }
        }
 
        return (l == PF_BAD_DEVICE) ? 0 : 1;
index a34f2e86e5384030744d86d893c760010babc291..c4a428397f3e01070dac141ba79ba196f0c35bab 100644 (file)
@@ -4283,8 +4283,11 @@ int fid_add_mda(struct format_instance *fid, struct metadata_area *mda,
                                    full_key, sizeof(full_key)))
                return_0;
 
-       dm_hash_insert(fid->metadata_areas_index,
-                      full_key, mda);
+       if (!dm_hash_insert(fid->metadata_areas_index,
+                           full_key, mda)) {
+               log_error("Failed to hash mda.");
+               return 0;
+       }
 
        return 1;
 }
This page took 0.036212 seconds and 5 git commands to generate.