Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm: don't report "detected capacity change" on device creation

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: f64d9b2eacb9 ("dm: use set_capacity_and_notify")
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Mikulas Patocka and committed by
Mike Snitzer
5424a0b8 2d669ceb

+4 -1
+4 -1
drivers/md/dm.c
··· 2036 2036 if (size != dm_get_size(md)) 2037 2037 memset(&md->geometry, 0, sizeof(md->geometry)); 2038 2038 2039 - set_capacity_and_notify(md->disk, size); 2039 + if (!get_capacity(md->disk)) 2040 + set_capacity(md->disk, size); 2041 + else 2042 + set_capacity_and_notify(md->disk, size); 2040 2043 2041 2044 dm_table_event_callback(t, event_callback, md); 2042 2045