Skip to content

Commit

Permalink
dm: don't report "detected capacity change" on device creation
Browse files Browse the repository at this point in the history
When a DM device is first created it doesn't yet have an established
capacity, therefore the use of set_capacity_and_notify() should be
conditional given the potential for needless pr_info "detected
capacity change" noise even if capacity is 0.

One could argue that the pr_info() in set_capacity_and_notify() is
misplaced, but that position is not held uniformly.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: f64d9b2 ("dm: use set_capacity_and_notify")
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Mikulas Patocka authored and Mike Snitzer committed Mar 22, 2021
1 parent 2d669ce commit 5424a0b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,10 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
if (size != dm_get_size(md))
memset(&md->geometry, 0, sizeof(md->geometry));

set_capacity_and_notify(md->disk, size);
if (!get_capacity(md->disk))
set_capacity(md->disk, size);
else
set_capacity_and_notify(md->disk, size);

dm_table_event_callback(t, event_callback, md);

Expand Down

0 comments on commit 5424a0b

Please sign in to comment.