From: Alasdair G Kergon Date: Tue, 12 Jul 2005 22:53:05 +0000 (-0700) Subject: [PATCH] device-mapper snapshots: Handle origin extension X-Git-Tag: v2.6.13-rc3~4 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5e404c10a98fc2979643476851e9cbdb1944812;p=linux-2.6 [PATCH] device-mapper snapshots: Handle origin extension Handle writes to a snapshot-origin device that has been extended since the snapshot was taken. Signed-off-by: Alasdair G Kergon Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 594d1f6b47..ab54f99b7c 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -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); /* diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 18e9b9953f..a5a4c0ed8a 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -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);