]> err.no Git - linux-2.6/commitdiff
[PATCH] device-mapper snapshots: Handle origin extension
authorAlasdair G Kergon <agk@redhat.com>
Tue, 12 Jul 2005 22:53:05 +0000 (15:53 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 12 Jul 2005 23:19:11 +0000 (16:19 -0700)
Handle writes to a snapshot-origin device that has been extended since the
snapshot was taken.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm-snap.c
drivers/md/dm-table.c

index 594d1f6b4789e7e864ae131987ebc078ed0bad23..ab54f99b7c3b27cfd40a023bae56f9e0ed0b0f18 100644 (file)
@@ -931,6 +931,10 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio)
                if (!snap->valid)
                        continue;
 
+               /* Nothing to do if writing beyond end of snapshot */
+               if (bio->bi_sector >= dm_table_get_size(snap->table))
+                       continue;
+
                down_write(&snap->lock);
 
                /*
index 18e9b9953fcd32489a208b273927616da7dd4627..a5a4c0ed8a143fb274d13dd3d9e56500d6fac098 100644 (file)
@@ -943,6 +943,7 @@ EXPORT_SYMBOL(dm_vcalloc);
 EXPORT_SYMBOL(dm_get_device);
 EXPORT_SYMBOL(dm_put_device);
 EXPORT_SYMBOL(dm_table_event);
+EXPORT_SYMBOL(dm_table_get_size);
 EXPORT_SYMBOL(dm_table_get_mode);
 EXPORT_SYMBOL(dm_table_put);
 EXPORT_SYMBOL(dm_table_get);