Fix the error handling when store.read_metadata is called: the error should be
returned immediately.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
        return (n + size) & ~size;
 }
 
-static void read_snapshot_metadata(struct dm_snapshot *s)
-{
-       if (s->store.read_metadata(&s->store)) {
-               down_write(&s->lock);
-               s->valid = 0;
-               up_write(&s->lock);
-
-               dm_table_event(s->table);
-       }
-}
-
 static int set_chunk_size(struct dm_snapshot *s, const char *chunk_size_arg,
                          char **error)
 {
        }
 
        /* Metadata must only be loaded into one table at once */
-       read_snapshot_metadata(s);
+       r = s->store.read_metadata(&s->store);
+       if (r) {
+               ti->error = "Failed to read snapshot metadata";
+               goto bad6;
+       }
 
        /* Add snapshot to the list of snapshots for this origin */
        /* Exceptions aren't triggered till snapshot_resume() is called */