summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-10-17 00:18:16 +0200
committerAlasdair G Kergon <agk@redhat.com>2009-10-17 00:18:16 +0200
commit3f2412dc85260e5aae7ebb03bf50d5b1407e3083 (patch)
treec736dc9a52677e29b4dfeb3061da5111edbb9454 /drivers/md
parentdm: dec_pending needs locking to save error value (diff)
downloadlinux-3f2412dc85260e5aae7ebb03bf50d5b1407e3083.tar.xz
linux-3f2412dc85260e5aae7ebb03bf50d5b1407e3083.zip
dm snapshot: require non zero chunk size by end of ctr
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. Cc: stable@kernel.org Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Jonathan Brassow <jbrassow@redhat.com> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-snap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 53f4063f7ea4..9cb392b3e920 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -673,6 +673,11 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
bio_list_init(&s->queued_bios);
INIT_WORK(&s->queued_bios_work, flush_queued_bios);
+ if (!s->store->chunk_size) {
+ ti->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)) {