diff mbox

[v5,11/13] dm snapshot: redirect accesses to origin if merging snap invalidated

Message ID 1259893434-10792-12-git-send-email-snitzer@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Alasdair Kergon
Headers show

Commit Message

Mike Snitzer Dec. 4, 2009, 2:23 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index c3578f5..257e2d1 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1573,11 +1573,9 @@  static int snapshot_merge_map(struct dm_target *ti, struct bio *bio,
 
 	down_write(&s->lock);
 
-	/* Full snapshots are not usable */
-	if (!s->valid) {
-		r = -EIO;
-		goto out_unlock;
-	}
+	/* Full merging snapshots are redirected to the origin */
+	if (!s->valid)
+		goto redirect_to_origin;
 
 	/* If the block is already remapped - use that */
 	e = dm_lookup_exception(&s->complete, chunk);
@@ -1600,6 +1598,7 @@  static int snapshot_merge_map(struct dm_target *ti, struct bio *bio,
 		goto out_unlock;
 	}
 
+ redirect_to_origin:
 	bio->bi_bdev = s->origin->bdev;
 
 	if (bio_rw(bio) == WRITE) {