Commit 3f2412dc85260e5aae7ebb03bf50d5b1407e3083

Authored by Mikulas Patocka
Committed by Alasdair G Kergon
1 parent f88fb98118

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>

Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff

drivers/md/dm-snap.c
... ... @@ -673,6 +673,11 @@
673 673 bio_list_init(&s->queued_bios);
674 674 INIT_WORK(&s->queued_bios_work, flush_queued_bios);
675 675  
  676 + if (!s->store->chunk_size) {
  677 + ti->error = "Chunk size not set";
  678 + goto bad_load_and_register;
  679 + }
  680 +
676 681 /* Add snapshot to the list of snapshots for this origin */
677 682 /* Exceptions aren't triggered till snapshot_resume() is called */
678 683 if (register_snapshot(s)) {