diff options
author | Mike Snitzer <snitzer@redhat.com> | 2013-08-21 17:40:11 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2013-09-05 20:46:06 -0400 |
commit | d6fc204201ca7d019ab0eb5304d1e5c690ddedc8 (patch) | |
tree | 6efedcb54bc1452214541d68058160d508723510 /drivers/md/dm-thin.c | |
parent | 4fa5971a69ea1c427a23f2b8b4123f0f0d835861 (diff) | |
download | linux-d6fc204201ca7d019ab0eb5304d1e5c690ddedc8.tar.bz2 |
dm thin: set pool read-only if breaking_sharing fails block allocation
break_sharing() now handles an arbitrary alloc_data_block() error
the same way as provision_block(): marks pool read-only and errors the
cell.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-thin.c')
-rw-r--r-- | drivers/md/dm-thin.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index c151cbf80b10..3aff1c27e5b4 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -1086,6 +1086,7 @@ static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block, { int r; dm_block_t data_block; + struct pool *pool = tc->pool; r = alloc_data_block(tc, &data_block); switch (r) { @@ -1095,13 +1096,14 @@ static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block, break; case -ENOSPC: - no_space(tc->pool, cell); + no_space(pool, cell); break; default: DMERR_LIMIT("%s: alloc_data_block() failed: error = %d", __func__, r); - cell_error(tc->pool, cell); + set_pool_mode(pool, PM_READ_ONLY); + cell_error(pool, cell); break; } } |