dm block manager: reinstate context for which block failed a validator check
PATCH 1/3 dm block manager: reinstate context for which block failed a validator check
This was mistakenly eliminated when the block manager was converted to use dm-bufio. Restore it because it is useful if/when the validator check fails.
Signed-off-by Mike Snitzer <[email protected]>
--- drivers/md/persistent-data/dm-block-manager.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/md/persistent-data/dm-block-manager.c +4 -1
@@ -428,8 +428,11 @@ static int dm_bm_validate_buffer(struct dm_block_manager *bm,if (!v)return 0 ; r = v->check (v, (struct dm_block *) buf,dm_bufio_get_block_size (bm->bufio)); -if (unlikely (r)) +if (unlikely (r)) { +DMERR ("%s validator check failed for block %llu" , v->name, + (unsigned long long )dm_bufio_get_block_number (buf));return r; + } aux->validator = v; }else {if (unlikely (aux->validator != v)) {
Signature · 1 line
1.7.4.4
PATCH 2/3 persistent data: log errors using DMERR_LIMIT instead of DMERR
Nearly all of persistent-data is in the IO path and as such it should throttle the errors that is logs.
Signed-off-by Mike Snitzer <[email protected]>
--- drivers/md/persistent-data/dm-block-manager.c | 11 +++++------ drivers/md/persistent-data/dm-btree-spine.c | 14 +++++++------- drivers/md/persistent-data/dm-space-map-common.c | 16 ++++++++-------- 3 files changed, 20 insertions(+), 21 deletions(-)
drivers/md/persistent-data/dm-block-manager.c +5 -6
@@ -429,17 +429,16 @@ static int dm_bm_validate_buffer(struct dm_block_manager *bm,return 0 ; r = v->check (v, (struct dm_block *) buf,dm_bufio_get_block_size (bm->bufio));if (unlikely (r)) { -DMERR ("%s validator check failed for block %llu" , v->name, - (unsigned long long )dm_bufio_get_block_number (buf)); +DMERR_LIMIT ("%s validator check failed for block %llu" , v->name, + (unsigned long long )dm_bufio_get_block_number (buf));return r; } aux->validator = v; }else {if (unlikely (aux->validator != v)) { -DMERR ("validator mismatch (old=%s vs new=%s) for block %llu" , - aux->validator->name, v ? v->name :"NULL" , - (unsigned long long ) -dm_bufio_get_block_number (buf)); +DMERR_LIMIT ("validator mismatch (old=%s vs new=%s) for block %llu" , + aux->validator->name, v ? v->name :"NULL" , + (unsigned long long )dm_bufio_get_block_number (buf));return -EINVAL ; } }
drivers/md/persistent-data/dm-btree-spine.c +7 -7
@@ -45,8 +45,8 @@ static int node_check(struct dm_block_validator *v,uint32_t flags;if (dm_block_location (b) !=le64_to_cpu (h->blocknr)) { -DMERR ("node_check failed blocknr %llu wanted %llu" , -le64_to_cpu (h->blocknr),dm_block_location (b)); +DMERR_LIMIT ("node_check failed blocknr %llu wanted %llu" , +le64_to_cpu (h->blocknr),dm_block_location (b));return -ENOTBLK ; }
@@ -54,8 +54,8 @@ static int node_check(struct dm_block_validator *v, block_size -sizeof (__le32), BTREE_CSUM_XOR));if (csum_disk != h->csum) { -DMERR ("node_check failed csum %u wanted %u" , -le32_to_cpu (csum_disk),le32_to_cpu (h->csum)); +DMERR_LIMIT ("node_check failed csum %u wanted %u" , +le32_to_cpu (csum_disk),le32_to_cpu (h->csum));return -EILSEQ ; }
@@ -63,12 +63,12 @@ static int node_check(struct dm_block_validator *v,if (sizeof (struct node_header ) + (sizeof (__le64) + value_size) *le32_to_cpu (h->max_entries) > block_size) { -DMERR ("node_check failed: max_entries too large" ); +DMERR_LIMIT ("node_check failed: max_entries too large" );return -EILSEQ ; }if (le32_to_cpu (h->nr_entries) >le32_to_cpu (h->max_entries)) { -DMERR ("node_check failed, too many entries" ); +DMERR_LIMIT ("node_check failed, too many entries" );return -EILSEQ ; }
@@ -77,7 +77,7 @@ static int node_check(struct dm_block_validator *v,*/ flags =le32_to_cpu (h->flags);if (!(flags &INTERNAL_NODE ) && !(flags &LEAF_NODE )) { -DMERR ("node_check failed, node is neither INTERNAL or LEAF" ); +DMERR_LIMIT ("node_check failed, node is neither INTERNAL or LEAF" );return -EILSEQ ; }
drivers/md/persistent-data/dm-space-map-common.c +8 -8
@@ -39,8 +39,8 @@ static int index_check(struct dm_block_validator *v,__le32 csum_disk;if (dm_block_location (b) !=le64_to_cpu (mi_le->blocknr)) { -DMERR ("index_check failed blocknr %llu wanted %llu" , -le64_to_cpu (mi_le->blocknr),dm_block_location (b)); +DMERR_LIMIT ("index_check failed blocknr %llu wanted %llu" , +le64_to_cpu (mi_le->blocknr),dm_block_location (b));return -ENOTBLK ; }
@@ -48,8 +48,8 @@ static int index_check(struct dm_block_validator *v, block_size -sizeof (__le32), INDEX_CSUM_XOR));if (csum_disk != mi_le->csum) { -DMERR ("index_check failed csum %u wanted %u" , -le32_to_cpu (csum_disk),le32_to_cpu (mi_le->csum)); +DMERR_LIMIT ("index_check failed csum %u wanted %u" , +le32_to_cpu (csum_disk),le32_to_cpu (mi_le->csum));return -EILSEQ ; }
@@ -89,8 +89,8 @@ static int bitmap_check(struct dm_block_validator *v,__le32 csum_disk;if (dm_block_location (b) !=le64_to_cpu (disk_header->blocknr)) { -DMERR ("bitmap check failed blocknr %llu wanted %llu" , -le64_to_cpu (disk_header->blocknr),dm_block_location (b)); +DMERR_LIMIT ("bitmap check failed blocknr %llu wanted %llu" , +le64_to_cpu (disk_header->blocknr),dm_block_location (b));return -ENOTBLK ; }
@@ -98,8 +98,8 @@ static int bitmap_check(struct dm_block_validator *v, block_size -sizeof (__le32), BITMAP_CSUM_XOR));if (csum_disk != disk_header->csum) { -DMERR ("bitmap check failed csum %u wanted %u" , -le32_to_cpu (csum_disk),le32_to_cpu (disk_header->csum)); +DMERR_LIMIT ("bitmap check failed csum %u wanted %u" , +le32_to_cpu (csum_disk),le32_to_cpu (disk_header->csum));return -EILSEQ ; }
Signature · 1 line
1.7.4.4
PATCH 3/3 dm thin: log errors using DMERR_LIMIT instead of DMERR
In reply to Mike SnitzerThrottle all errors logged from the IO path.
Signed-off-by Mike Snitzer <[email protected]>
--- drivers/md/dm-thin.c | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-)
drivers/md/dm-thin.c +15 -10
@@ -561,7 +561,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m)*/ r =dm_thin_insert_block (tc->td, m->virt_block, m->data_block);if (r) { -DMERR ("dm_thin_insert_block() failed" ); +DMERR_LIMIT ("dm_thin_insert_block() failed" );dm_cell_error (m->cell); goto out; }
@@ -614,7 +614,7 @@ static void process_prepared_discard(struct dm_thin_new_mapping *m) r =dm_thin_remove_block (tc->td, m->virt_block);if (r) -DMERR ("dm_thin_remove_block() failed" ); +DMERR_LIMIT ("dm_thin_remove_block() failed" );process_prepared_discard_passdown (m); }
@@ -727,7 +727,7 @@ static void schedule_copy(struct thin_c *tc, dm_block_t virt_block, 0, copy_complete, m);if (r <0 ) {mempool_free (m, pool->mapping_pool); -DMERR ("dm_kcopyd_copy() failed" ); +DMERR_LIMIT ("dm_kcopyd_copy() failed" );dm_cell_error (cell); } }
@@ -792,7 +792,7 @@ static void schedule_zero(struct thin_c *tc, dm_block_t virt_block, r =dm_kcopyd_zero (pool->copier,1 , &to,0 , copy_complete, m);if (r <0 ) {mempool_free (m, pool->mapping_pool); -DMERR ("dm_kcopyd_zero() failed" ); +DMERR_LIMIT ("dm_kcopyd_zero() failed" );dm_cell_error (cell); } }
@@ -804,7 +804,7 @@ static int commit(struct pool *pool) r =dm_pool_commit_metadata (pool->pmd);if (r) -DMERR ("commit failed, error = %d" , r); +DMERR_LIMIT ("commit failed, error = %d" , r);return r; }
@@ -985,7 +985,8 @@ static void process_discard(struct thin_c *tc, struct bio *bio)break ;default : -DMERR ("discard: find block unexpectedly returned %d" , r); +DMERR_LIMIT ("%s: dm_thin_find_block() failed, error = %d" , + __func__, r);dm_cell_release_singleton (cell, bio);bio_io_error (bio);break ;
@@ -1012,7 +1013,8 @@ static void break_sharing(struct thin_c *tc, struct bio *bio, dm_block_t block,break ;default : -DMERR ("%s: alloc_data_block() failed, error = %d" , __func__, r); +DMERR_LIMIT ("%s: alloc_data_block() failed, error = %d" , + __func__, r);dm_cell_error (cell);break ; }
@@ -1085,7 +1087,8 @@ static void provision_block(struct thin_c *tc, struct bio *bio, dm_block_t blockbreak ;default : -DMERR ("%s: alloc_data_block() failed, error = %d" , __func__, r); +DMERR_LIMIT ("%s: alloc_data_block() failed, error = %d" , + __func__, r);set_pool_mode (tc->pool,PM_READ_ONLY );dm_cell_error (cell);break ;
@@ -1137,7 +1140,8 @@ static void process_bio(struct thin_c *tc, struct bio *bio)break ;default : -DMERR ("dm_thin_find_block() failed, error = %d" , r); +DMERR_LIMIT ("%s: dm_thin_find_block() failed, error = %d" , + __func__, r);dm_cell_release_singleton (cell, bio);bio_io_error (bio);break ;
@@ -1176,7 +1180,8 @@ static void process_bio_read_only(struct thin_c *tc, struct bio *bio)break ;default : -DMERR ("dm_thin_find_block() failed, error = %d" , r); +DMERR_LIMIT ("%s: dm_thin_find_block() failed, error = %d" , + __func__, r);bio_io_error (bio);break ; }
Signature · 1 line
1.7.4.4