]> Pileus Git - ~andy/linux/blobdiff - drivers/md/dm-exception-store.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[~andy/linux] / drivers / md / dm-exception-store.c
index 8c25c2ff724a9f3366fa00d4ad0fe2eb781d6fbd..5bbce29f143ac45f6d358a9b26217b3d30ee1ccd 100644 (file)
@@ -449,7 +449,7 @@ static void persistent_destroy(struct exception_store *store)
 
 static int persistent_read_metadata(struct exception_store *store)
 {
-       int r, new_snapshot;
+       int r, uninitialized_var(new_snapshot);
        struct pstore *ps = get_info(store);
 
        /*
@@ -489,17 +489,18 @@ static int persistent_read_metadata(struct exception_store *store)
                /*
                 * Sanity checks.
                 */
-               if (!ps->valid) {
-                       DMWARN("snapshot is marked invalid");
-                       return -EINVAL;
-               }
-
                if (ps->version != SNAPSHOT_DISK_VERSION) {
                        DMWARN("unable to handle snapshot disk version %d",
                               ps->version);
                        return -EINVAL;
                }
 
+               /*
+                * Metadata are valid, but snapshot is invalidated
+                */
+               if (!ps->valid)
+                       return 1;
+
                /*
                 * Read the metadata.
                 */
@@ -622,6 +623,7 @@ int dm_create_persistent(struct exception_store *store)
 
        ps->metadata_wq = create_singlethread_workqueue("ksnaphd");
        if (!ps->metadata_wq) {
+               kfree(ps);
                DMERR("couldn't start header metadata update thread");
                return -ENOMEM;
        }