]> sourceware.org Git - lvm2.git/commitdiff
Check for refresh_filter failure
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 11 Oct 2011 09:09:00 +0000 (09:09 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 11 Oct 2011 09:09:00 +0000 (09:09 +0000)
Properly detect if the filters were refreshed properly.

(May needs few more fixes ??)

Filter refresh may fail because it may be out of free file descriptors
when clvmd gets overloaded.

WHATS_NEW
lib/cache/lvmcache.c
lib/commands/toolcontext.c
lib/metadata/metadata.c

index 8df7e090693380c8482a400f19254c03ac632656..ddc9cb839c1928807b92bf61191e5fac4013b1ac 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Add check for access through NULL pointer when refresh_filter() fails.
   Use pthread condition for SINGLENODE lock implementation.
   Improve backtrace reporting for some dev_manager_ functions.
   Change message severity to log_warn when symlink creation fails.
index 6fdd976adc3d214e669d48857b36ef5077cdf406..c02ec7b96127a93225c6b4e7b7190c3b8121a50b 100644 (file)
@@ -597,12 +597,10 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan)
                goto out;
        }
 
-       if (full_scan == 2 && !cmd->filter->use_count && !refresh_filters(cmd)) {
-               log_error("refresh filters failed");
-               goto out;
-       }
+       if (full_scan == 2 && (cmd->filter && !cmd->filter->use_count) && !refresh_filters(cmd))
+               goto_out;
 
-       if (!(iter = dev_iter_create(cmd->filter, (full_scan == 2) ? 1 : 0))) {
+       if (!cmd->filter || !(iter = dev_iter_create(cmd->filter, (full_scan == 2) ? 1 : 0))) {
                log_error("dev_iter creation failed");
                goto out;
        }
index 6c554b20e90ae886aaf7e112cc4a6ff03a5323e6..db5ef030be903070d09149788f60df8f776707ad 100644 (file)
@@ -786,7 +786,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
        cmd->dump_filter = 0;
 
        if (!(f3 = _init_filter_components(cmd)))
-               return 0;
+               return_0;
 
        init_ignore_suspended_devices(find_config_tree_int(cmd,
            "devices/ignore_suspended_devices", DEFAULT_IGNORE_SUSPENDED_DEVICES));
@@ -1402,7 +1402,8 @@ int refresh_filters(struct cmd_context *cmd)
                cmd->filter = NULL;
        }
 
-       r = _init_filters(cmd, 0);
+       if (!(r = _init_filters(cmd, 0)))
+                stack;
 
        /*
         * During repair code must not reset suspended flag.
index e9894c5b91a805d56d0960bf397493266e82a4f6..2d53d572ebd9564e691838452a5c22c6b8bb73bd 100644 (file)
@@ -1373,7 +1373,9 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name,
        /* Is there an md superblock here? */
        /* FIXME: still possible issues here - rescan cache? */
        if (!dev && md_filtering()) {
-               refresh_filters(cmd);
+               if (!refresh_filters(cmd))
+                       goto_bad;
+
                init_md_filtering(0);
                dev = dev_cache_get(name, cmd->filter);
                init_md_filtering(1);
This page took 0.073517 seconds and 5 git commands to generate.