Commit 5383ef3a929a1366e2ced45cd6d74be7aa2a2281

Authored by Joe Thornber
Committed by Mike Snitzer
1 parent 020cc3b5e2

dm thin: re-establish read-only state when switching to fail mode

If the thin-pool transitioned to fail mode and the thin-pool's table
were reloaded for some reason: the new table's default pool mode would
be read-write, though it will transition to fail mode during resume.

When the pool mode transitions directly from PM_WRITE to PM_FAIL we need
to re-establish the intermediate read-only state in both the metadata
and persistent-data block manager (as is usually done with the normal
pool mode transition sequence: PM_WRITE -> PM_READ_ONLY -> PM_FAIL).

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org

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

drivers/md/dm-thin.c
... ... @@ -1400,6 +1400,7 @@
1400 1400 case PM_FAIL:
1401 1401 DMERR("%s: switching pool to failure mode",
1402 1402 dm_device_name(pool->pool_md));
  1403 + dm_pool_metadata_read_only(pool->pmd);
1403 1404 pool->process_bio = process_bio_fail;
1404 1405 pool->process_discard = process_bio_fail;
1405 1406 pool->process_prepared_mapping = process_prepared_mapping_fail;