summaryrefslogtreecommitdiff
path: root/drivers/md/dm-snap.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-12-10 23:52:36 (GMT)
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 23:52:36 (GMT)
commitd2fdb776e08d4231d7e86a879cc663a93913c202 (patch)
tree92c892ecca2bd1c9d405ba4cdaa85ba26a190023 /drivers/md/dm-snap.c
parentd8ddb1cfff0070479c1f4a07c1d4a48ef8cb188e (diff)
downloadlinux-d2fdb776e08d4231d7e86a879cc663a93913c202.tar.xz
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/dm-snap.c')
-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 4c80e82..ee8eb28 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,
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);
@@ -1726,6 +1724,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) {