dm thin: re-establish read-only state when switching to fail mode
authorJoe Thornber <ejt@redhat.com>
Wed, 4 Dec 2013 21:30:01 +0000 (16:30 -0500)
committerMike Snitzer <snitzer@redhat.com>
Tue, 10 Dec 2013 21:35:12 +0000 (16:35 -0500)
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
drivers/md/dm-thin.c

index af79bae5ab748e12fdf5468bfa4ae0377000ac25..0d7852e2b275602d8a64b151781f4b3411f94c71 100644 (file)
@@ -1400,6 +1400,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode mode)
        case PM_FAIL:
                DMERR("%s: switching pool to failure mode",
                      dm_device_name(pool->pool_md));
+               dm_pool_metadata_read_only(pool->pmd);
                pool->process_bio = process_bio_fail;
                pool->process_discard = process_bio_fail;
                pool->process_prepared_mapping = process_prepared_mapping_fail;