aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-12-10 18:52:36 -0500
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 18:52:36 -0500
commitd2fdb776e08d4231d7e86a879cc663a93913c202 (patch)
tree92c892ecca2bd1c9d405ba4cdaa85ba26a190023 /drivers/md
parentd8ddb1cfff0070479c1f4a07c1d4a48ef8cb188e (diff)
dm snapshot: use merge origin if snapshot invalid
If the snapshot we are merging became invalid (e.g. it ran out of space) redirect all I/O directly to the origin device. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-snap.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 4c80e82f941c..ee8eb283650d 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1699,11 +1699,9 @@ static int snapshot_merge_map(struct dm_target *ti, struct bio *bio,
1699 1699
1700 down_write(&s->lock); 1700 down_write(&s->lock);
1701 1701
1702 /* Full snapshots are not usable */ 1702 /* Full merging snapshots are redirected to the origin */
1703 if (!s->valid) { 1703 if (!s->valid)
1704 r = -EIO; 1704 goto redirect_to_origin;
1705 goto out_unlock;
1706 }
1707 1705
1708 /* If the block is already remapped - use that */ 1706 /* If the block is already remapped - use that */
1709 e = dm_lookup_exception(&s->complete, chunk); 1707 e = dm_lookup_exception(&s->complete, chunk);
@@ -1726,6 +1724,7 @@ static int snapshot_merge_map(struct dm_target *ti, struct bio *bio,
1726 goto out_unlock; 1724 goto out_unlock;
1727 } 1725 }
1728 1726
1727redirect_to_origin:
1729 bio->bi_bdev = s->origin->bdev; 1728 bio->bi_bdev = s->origin->bdev;
1730 1729
1731 if (bio_rw(bio) == WRITE) { 1730 if (bio_rw(bio) == WRITE) {