If we are merging invalidated snapshot, redirect all accesses to the origin device. Userspace code will remove the invalidated snapshot anyway after a few seconds, but during this period, the origin device must be active (it may for example contain root filesystem and having unbootable computer is not desirable). Signed-off-by: Mikulas Patocka Reviewed-by: Mike Snitzer --- drivers/md/dm-snap.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) Index: linux-2.6.31-fast-new-2/drivers/md/dm-snap.c =================================================================== --- linux-2.6.31-fast-new-2.orig/drivers/md/dm-snap.c 2009-10-16 21:48:45.000000000 +0200 +++ linux-2.6.31-fast-new-2/drivers/md/dm-snap.c 2009-10-16 21:48:48.000000000 +0200 @@ -1501,11 +1501,9 @@ static int snapshot_merge_map(struct dm_ 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); @@ -1529,6 +1527,7 @@ static int snapshot_merge_map(struct dm_ goto out_unlock; } + redirect_to_origin: bio->bi_bdev = s->origin->bdev; if (bio_rw(bio) == WRITE) {