Commit f16dba5d authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Mike Snitzer

dm snapshot: revert "fix a crash when an origin has no snapshots"

Commit 7ee06ddc ("dm snapshot: fix a
crash when an origin has no snapshots") introduced a regression in
snapshot merging - causing the lvm2 test lvcreate-cache-snapshot.sh
got stuck in an infinite loop.

Even though commit 7ee06ddc was marked
for stable@ the stable team was notified to _not_ backport it.

Fixes: 7ee06ddc ("dm snapshot: fix a crash when an origin has no snapshots")
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 0c1f3193
...@@ -855,11 +855,12 @@ static int dm_add_exception(void *context, chunk_t old, chunk_t new) ...@@ -855,11 +855,12 @@ static int dm_add_exception(void *context, chunk_t old, chunk_t new)
static uint32_t __minimum_chunk_size(struct origin *o) static uint32_t __minimum_chunk_size(struct origin *o)
{ {
struct dm_snapshot *snap; struct dm_snapshot *snap;
unsigned chunk_size = rounddown_pow_of_two(UINT_MAX); unsigned chunk_size = 0;
if (o) if (o)
list_for_each_entry(snap, &o->snapshots, list) list_for_each_entry(snap, &o->snapshots, list)
chunk_size = min(chunk_size, snap->store->chunk_size); chunk_size = min_not_zero(chunk_size,
snap->store->chunk_size);
return (uint32_t) chunk_size; return (uint32_t) chunk_size;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment