]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
dm cache: fix resize crash if user doesn't reload cache table
authorMike Snitzer <snitzer@redhat.com>
Wed, 26 Sep 2018 00:56:02 +0000 (20:56 -0400)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:52:56 +0000 (19:52 -0600)
commitee3eb8902192071059aaf2833185fb15b7e1d6bd
tree1a033cc319406221ad56cddcea10cf9792552bea
parentfb2c91e7c7aa52ee8e3dac4c71b768d0dce49017
dm cache: fix resize crash if user doesn't reload cache table

BugLink: https://bugs.launchpad.net/bugs/1836426
commit 5d07384a666d4b2f781dc056bfeec2c27fbdf383 upstream.

A reload of the cache's DM table is needed during resize because
otherwise a crash will occur when attempting to access smq policy
entries associated with the portion of the cache that was recently
extended.

The reason is cache-size based data structures in the policy will not be
resized, the only way to safely extend the cache is to allow for a
proper cache policy initialization that occurs when the cache table is
loaded.  For example the smq policy's space_init(), init_allocator(),
calc_hotspot_params() must be sized based on the extended cache size.

The fix for this is to disallow cache resizes of this pattern:
1) suspend "cache" target's device
2) resize the fast device used for the cache
3) resume "cache" target's device

Instead, the last step must be a full reload of the cache's DM table.

Fixes: 66a636356 ("dm cache: add stochastic-multi-queue (smq) policy")
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/md/dm-cache-target.c