Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 700

kernel-2.6.18-238.el5.src.rpm

Date: Thu, 21 Sep 2006 16:46:07 +0100
From: Alasdair G Kergon <agk@redhat.com>
Subject: [RHEL5 PATCH 09/30] dm snapshot: fix metadata error handling

Fix the error handling when store.read_metadata is called:
the error should be returned immediately.

Index: linux-2.6.18.noarch/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.18.noarch.orig/drivers/md/dm-snap.c
+++ linux-2.6.18.noarch/drivers/md/dm-snap.c
@@ -387,17 +387,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 set_chunk_size(struct dm_snapshot *s, const char *chunk_size_arg,
 			  char **error)
 {
@@ -528,7 +517,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 = "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 */