Commit 89ddeb8c authored by Mike Snitzer's avatar Mike Snitzer Committed by Alasdair G Kergon

dm persistent data: use DMERR_LIMIT for errors

Nearly all of persistent-data is in the IO path so throttle error
messages with DMERR_LIMIT to limit the amount logged when
something has gone wrong.
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent a5bd968a
...@@ -429,17 +429,16 @@ static int dm_bm_validate_buffer(struct dm_block_manager *bm, ...@@ -429,17 +429,16 @@ static int dm_bm_validate_buffer(struct dm_block_manager *bm,
return 0; return 0;
r = v->check(v, (struct dm_block *) buf, dm_bufio_get_block_size(bm->bufio)); 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, DMERR_LIMIT("%s validator check failed for block %llu", v->name,
(unsigned long long) dm_bufio_get_block_number(buf)); (unsigned long long) dm_bufio_get_block_number(buf));
return r; return r;
} }
aux->validator = v; aux->validator = v;
} else { } else {
if (unlikely(aux->validator != v)) { if (unlikely(aux->validator != v)) {
DMERR("validator mismatch (old=%s vs new=%s) for block %llu", DMERR_LIMIT("validator mismatch (old=%s vs new=%s) for block %llu",
aux->validator->name, v ? v->name : "NULL", aux->validator->name, v ? v->name : "NULL",
(unsigned long long) (unsigned long long) dm_bufio_get_block_number(buf));
dm_bufio_get_block_number(buf));
return -EINVAL; return -EINVAL;
} }
} }
......
...@@ -45,7 +45,7 @@ static int node_check(struct dm_block_validator *v, ...@@ -45,7 +45,7 @@ static int node_check(struct dm_block_validator *v,
uint32_t flags; uint32_t flags;
if (dm_block_location(b) != le64_to_cpu(h->blocknr)) { if (dm_block_location(b) != le64_to_cpu(h->blocknr)) {
DMERR("node_check failed blocknr %llu wanted %llu", DMERR_LIMIT("node_check failed: blocknr %llu != wanted %llu",
le64_to_cpu(h->blocknr), dm_block_location(b)); le64_to_cpu(h->blocknr), dm_block_location(b));
return -ENOTBLK; return -ENOTBLK;
} }
...@@ -54,7 +54,7 @@ static int node_check(struct dm_block_validator *v, ...@@ -54,7 +54,7 @@ static int node_check(struct dm_block_validator *v,
block_size - sizeof(__le32), block_size - sizeof(__le32),
BTREE_CSUM_XOR)); BTREE_CSUM_XOR));
if (csum_disk != h->csum) { if (csum_disk != h->csum) {
DMERR("node_check failed csum %u wanted %u", DMERR_LIMIT("node_check failed: csum %u != wanted %u",
le32_to_cpu(csum_disk), le32_to_cpu(h->csum)); le32_to_cpu(csum_disk), le32_to_cpu(h->csum));
return -EILSEQ; return -EILSEQ;
} }
...@@ -63,12 +63,12 @@ static int node_check(struct dm_block_validator *v, ...@@ -63,12 +63,12 @@ static int node_check(struct dm_block_validator *v,
if (sizeof(struct node_header) + if (sizeof(struct node_header) +
(sizeof(__le64) + value_size) * le32_to_cpu(h->max_entries) > block_size) { (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; return -EILSEQ;
} }
if (le32_to_cpu(h->nr_entries) > le32_to_cpu(h->max_entries)) { 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; return -EILSEQ;
} }
...@@ -77,7 +77,7 @@ static int node_check(struct dm_block_validator *v, ...@@ -77,7 +77,7 @@ static int node_check(struct dm_block_validator *v,
*/ */
flags = le32_to_cpu(h->flags); flags = le32_to_cpu(h->flags);
if (!(flags & INTERNAL_NODE) && !(flags & LEAF_NODE)) { 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; return -EILSEQ;
} }
......
...@@ -39,7 +39,7 @@ static int index_check(struct dm_block_validator *v, ...@@ -39,7 +39,7 @@ static int index_check(struct dm_block_validator *v,
__le32 csum_disk; __le32 csum_disk;
if (dm_block_location(b) != le64_to_cpu(mi_le->blocknr)) { if (dm_block_location(b) != le64_to_cpu(mi_le->blocknr)) {
DMERR("index_check failed blocknr %llu wanted %llu", DMERR_LIMIT("index_check failed: blocknr %llu != wanted %llu",
le64_to_cpu(mi_le->blocknr), dm_block_location(b)); le64_to_cpu(mi_le->blocknr), dm_block_location(b));
return -ENOTBLK; return -ENOTBLK;
} }
...@@ -48,7 +48,7 @@ static int index_check(struct dm_block_validator *v, ...@@ -48,7 +48,7 @@ static int index_check(struct dm_block_validator *v,
block_size - sizeof(__le32), block_size - sizeof(__le32),
INDEX_CSUM_XOR)); INDEX_CSUM_XOR));
if (csum_disk != mi_le->csum) { if (csum_disk != mi_le->csum) {
DMERR("index_check failed csum %u wanted %u", DMERR_LIMIT("index_check failed: csum %u != wanted %u",
le32_to_cpu(csum_disk), le32_to_cpu(mi_le->csum)); le32_to_cpu(csum_disk), le32_to_cpu(mi_le->csum));
return -EILSEQ; return -EILSEQ;
} }
...@@ -89,7 +89,7 @@ static int bitmap_check(struct dm_block_validator *v, ...@@ -89,7 +89,7 @@ static int bitmap_check(struct dm_block_validator *v,
__le32 csum_disk; __le32 csum_disk;
if (dm_block_location(b) != le64_to_cpu(disk_header->blocknr)) { if (dm_block_location(b) != le64_to_cpu(disk_header->blocknr)) {
DMERR("bitmap check failed blocknr %llu wanted %llu", DMERR_LIMIT("bitmap check failed: blocknr %llu != wanted %llu",
le64_to_cpu(disk_header->blocknr), dm_block_location(b)); le64_to_cpu(disk_header->blocknr), dm_block_location(b));
return -ENOTBLK; return -ENOTBLK;
} }
...@@ -98,7 +98,7 @@ static int bitmap_check(struct dm_block_validator *v, ...@@ -98,7 +98,7 @@ static int bitmap_check(struct dm_block_validator *v,
block_size - sizeof(__le32), block_size - sizeof(__le32),
BITMAP_CSUM_XOR)); BITMAP_CSUM_XOR));
if (csum_disk != disk_header->csum) { if (csum_disk != disk_header->csum) {
DMERR("bitmap check failed csum %u wanted %u", DMERR_LIMIT("bitmap check failed: csum %u != wanted %u",
le32_to_cpu(csum_disk), le32_to_cpu(disk_header->csum)); le32_to_cpu(csum_disk), le32_to_cpu(disk_header->csum));
return -EILSEQ; return -EILSEQ;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment