提交 d6fc2042 编写于 作者: M Mike Snitzer

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: NMike Snitzer <snitzer@redhat.com>
Acked-by: NJoe Thornber <ejt@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 4fa5971a
...@@ -1086,6 +1086,7 @@ static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block, ...@@ -1086,6 +1086,7 @@ static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block,
{ {
int r; int r;
dm_block_t data_block; dm_block_t data_block;
struct pool *pool = tc->pool;
r = alloc_data_block(tc, &data_block); r = alloc_data_block(tc, &data_block);
switch (r) { switch (r) {
...@@ -1095,13 +1096,14 @@ static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block, ...@@ -1095,13 +1096,14 @@ static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block,
break; break;
case -ENOSPC: case -ENOSPC:
no_space(tc->pool, cell); no_space(pool, cell);
break; break;
default: default:
DMERR_LIMIT("%s: alloc_data_block() failed: error = %d", DMERR_LIMIT("%s: alloc_data_block() failed: error = %d",
__func__, r); __func__, r);
cell_error(tc->pool, cell); set_pool_mode(pool, PM_READ_ONLY);
cell_error(pool, cell);
break; break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册