[dm-devel] [PATCH] 2.4: dm-exception-store.c: Correct "enough-room-left" check
Kevin Corry
corryk at us.ibm.com
Tue Mar 25 14:09:01 UTC 2003
In persistent_prepare(), the "enough-room-left" check only verifies that the
start of the next-free chunk is within the cow device. If the cow device
is not an even multiple of the chunk-size, the snapshot code will eventually
try to write off the end of the cow device.
Check that the entire next-free chunk is within the cow device.
--- linux-2.4.20a/drivers/md/dm-exception-store.c 2003/02/26 14:50:56
+++ linux-2.4.20b/drivers/md/dm-exception-store.c 2003/03/25 19:02:24
@@ -449,7 +449,7 @@
sector_t size = get_dev_size(store->snap->cow->dev);
/* Is there enough room ? */
- if (size <= (ps->next_free * store->snap->chunk_size))
+ if (size < ((ps->next_free + 1) * store->snap->chunk_size))
return -ENOSPC;
e->new_chunk = ps->next_free;
More information about the dm-devel
mailing list