Correctly handle errors returned from read_metadata() Index: linux-2.6.16.i686/drivers/md/dm-snap.c =================================================================== --- linux-2.6.16.i686.orig/drivers/md/dm-snap.c 2006-04-14 11:31:15.000000000 -0400 +++ linux-2.6.16.i686/drivers/md/dm-snap.c 2006-04-14 11:43:45.000000000 -0400 @@ -386,17 +386,6 @@ static inline ulong round_up(ulong n, ul 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 check_chunk_size(struct dm_snapshot *s, const char *chunk_size_str, char **error) { @@ -530,7 +519,11 @@ static int snapshot_ctr(struct dm_target } /* 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 = "Error reading snapshot metadata"; + goto bad6; + } /* Add snapshot to the list of snapshots for this origin */ /* Exceptions aren't triggered till snapshot_resume() is called */