Commit cdc2b4158405f1975f9d5205096f08430eda1c0e

Authored by Mike Snitzer
1 parent 2c945820ca

dm thin: synchronize the pool mode during suspend

Commit b5330655 ("dm thin: handle metadata failures more consistently")
increased potential for the pool's mode to be changed in response to
metadata operation failures.

When the pool mode is changed it isn't synchronized with the mode in
pool_features stored in the target's context (ti->private) that is used
as the basis for (re)establishing the pool mode during resume via
bind_control_target.

It is important that we synchronize the pool mode when it is changed
otherwise the pool may experience and unexpected mode transition on the
next resume (especially if there was no new table load).

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Joe Thornber <ejt@redhat.com>

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

drivers/md/dm-thin.c
... ... @@ -1402,6 +1402,7 @@
1402 1402 static void set_pool_mode(struct pool *pool, enum pool_mode new_mode)
1403 1403 {
1404 1404 int r;
  1405 + struct pool_c *pt = pool->ti->private;
1405 1406 enum pool_mode old_mode = pool->pf.mode;
1406 1407  
1407 1408 switch (new_mode) {
... ... @@ -1448,6 +1449,11 @@
1448 1449 }
1449 1450  
1450 1451 pool->pf.mode = new_mode;
  1452 + /*
  1453 + * The pool mode may have changed, sync it so bind_control_target()
  1454 + * doesn't cause an unexpected mode transition on resume.
  1455 + */
  1456 + pt->adjusted_pf.mode = new_mode;
1451 1457 }
1452 1458  
1453 1459 /*