Commit d6fc204201ca7d019ab0eb5304d1e5c690ddedc8

Authored by Mike Snitzer
1 parent 4fa5971a69

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>

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

drivers/md/dm-thin.c
... ... @@ -1086,6 +1086,7 @@
1086 1086 {
1087 1087 int r;
1088 1088 dm_block_t data_block;
  1089 + struct pool *pool = tc->pool;
1089 1090  
1090 1091 r = alloc_data_block(tc, &data_block);
1091 1092 switch (r) {
1092 1093  
... ... @@ -1095,13 +1096,14 @@
1095 1096 break;
1096 1097  
1097 1098 case -ENOSPC:
1098   - no_space(tc->pool, cell);
  1099 + no_space(pool, cell);
1099 1100 break;
1100 1101  
1101 1102 default:
1102 1103 DMERR_LIMIT("%s: alloc_data_block() failed: error = %d",
1103 1104 __func__, r);
1104   - cell_error(tc->pool, cell);
  1105 + set_pool_mode(pool, PM_READ_ONLY);
  1106 + cell_error(pool, cell);
1105 1107 break;
1106 1108 }
1107 1109 }