Commit d2fdb776e08d4231d7e86a879cc663a93913c202

Authored by Mikulas Patocka
Committed by Alasdair G Kergon
1 parent d8ddb1cfff

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>

Showing 1 changed file with 4 additions and 5 deletions Side-by-side Diff

drivers/md/dm-snap.c
... ... @@ -1699,11 +1699,9 @@
1699 1699  
1700 1700 down_write(&s->lock);
1701 1701  
1702   - /* Full snapshots are not usable */
1703   - if (!s->valid) {
1704   - r = -EIO;
1705   - goto out_unlock;
1706   - }
  1702 + /* Full merging snapshots are redirected to the origin */
  1703 + if (!s->valid)
  1704 + goto redirect_to_origin;
1707 1705  
1708 1706 /* If the block is already remapped - use that */
1709 1707 e = dm_lookup_exception(&s->complete, chunk);
... ... @@ -1726,6 +1724,7 @@
1726 1724 goto out_unlock;
1727 1725 }
1728 1726  
  1727 +redirect_to_origin:
1729 1728 bio->bi_bdev = s->origin->bdev;
1730 1729  
1731 1730 if (bio_rw(bio) == WRITE) {