<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From: Mikulas Patocka &lt;mpatocka@redhat.com&gt;

If we are creating snapshot with memory-stored exception store, fail if
the user didn't specify chunk size. Zero chunk size would probably crash
a lot of places in the rest of snapshot code.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Reviewed-by: Jonathan Brassow &lt;jbrassow@redhat.com&gt;
Reviewed-by: Mike Snitzer &lt;snitzer@redhat.com&gt;

---
 drivers/md/dm-snap.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: linux-2.6.31/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.31.orig/drivers/md/dm-snap.c
+++ linux-2.6.31/drivers/md/dm-snap.c
@@ -668,6 +668,11 @@ static int snapshot_ctr(struct dm_target
 	bio_list_init(&amp;s-&gt;queued_bios);
 	INIT_WORK(&amp;s-&gt;queued_bios_work, flush_queued_bios);
 
+	if (!s-&gt;store-&gt;chunk_size) {
+		ti-&gt;error = "Chunk size not set";
+		goto bad_load_and_register;
+	}
+
 	/* Add snapshot to the list of snapshots for this origin */
 	/* Exceptions aren't triggered till snapshot_resume() is called */
 	if (register_snapshot(s)) {
</pre></body></html>