Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dm-verity-fec: log target_block instead of index_in_region

The log message for a FEC error or correction includes the data device
name and index_in_region as the context. Although the result of FEC
(for a particular dm-verity instance) is expected to be the same for a
given index_in_region, index_in_region does not uniquely identify the
actual target block that is being corrected. Since that value
(target_block) is likely more useful, log it instead.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

authored by

Eric Biggers and committed by
Mikulas Patocka
d0829329 71dab3b9

+14 -12
+14 -12
drivers/md/dm-verity-fec.c
··· 49 49 * the corrected bytes into fio->output starting from out_pos. 50 50 */ 51 51 static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_io *io, 52 - struct dm_verity_fec_io *fio, u64 index_in_region, 53 - int target_region, unsigned int out_pos, int neras) 52 + struct dm_verity_fec_io *fio, u64 target_block, 53 + unsigned int target_region, u64 index_in_region, 54 + unsigned int out_pos, int neras) 54 55 { 55 56 int r = 0, corrected = 0, res; 56 57 struct dm_buffer *buf; ··· 76 75 bio->bi_ioprio); 77 76 if (IS_ERR(par)) { 78 77 DMERR("%s: FEC %llu: parity read failed (block %llu): %ld", 79 - v->data_dev->name, index_in_region, parity_block, 78 + v->data_dev->name, target_block, parity_block, 80 79 PTR_ERR(par)); 81 80 return PTR_ERR(par); 82 81 } ··· 106 105 bio->bi_ioprio); 107 106 if (IS_ERR(par)) { 108 107 DMERR("%s: FEC %llu: parity read failed (block %llu): %ld", 109 - v->data_dev->name, index_in_region, 108 + v->data_dev->name, target_block, 110 109 parity_block, PTR_ERR(par)); 111 110 return PTR_ERR(par); 112 111 } ··· 132 131 133 132 if (r < 0 && neras) 134 133 DMERR_LIMIT("%s: FEC %llu: failed to correct: %d", 135 - v->data_dev->name, index_in_region, r); 134 + v->data_dev->name, target_block, r); 136 135 else if (r == 0 && corrected > 0) 137 136 DMWARN_LIMIT("%s: FEC %llu: corrected %d errors", 138 - v->data_dev->name, index_in_region, corrected); 137 + v->data_dev->name, target_block, corrected); 139 138 140 139 return r; 141 140 } ··· 158 157 * fits into buffers. Check for erasure locations if @neras is non-NULL. 159 158 */ 160 159 static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io, 161 - u64 index_in_region, unsigned int out_pos, int *neras) 160 + u64 target_block, u64 index_in_region, 161 + unsigned int out_pos, int *neras) 162 162 { 163 163 bool is_zero; 164 164 int i, j; ··· 203 201 bbuf = dm_bufio_read_with_ioprio(bufio, block, &buf, bio->bi_ioprio); 204 202 if (IS_ERR(bbuf)) { 205 203 DMWARN_LIMIT("%s: FEC %llu: read failed (%llu): %ld", 206 - v->data_dev->name, index_in_region, block, 204 + v->data_dev->name, target_block, block, 207 205 PTR_ERR(bbuf)); 208 206 209 207 /* assume the block is corrupted */ ··· 328 326 for (out_pos = 0; out_pos < v->fec->block_size;) { 329 327 fec_init_bufs(v, fio); 330 328 331 - r = fec_read_bufs(v, io, index_in_region, out_pos, 329 + r = fec_read_bufs(v, io, target_block, index_in_region, out_pos, 332 330 use_erasures ? &neras : NULL); 333 331 if (unlikely(r < 0)) 334 332 return r; 335 333 336 - r = fec_decode_bufs(v, io, fio, index_in_region, target_region, 337 - out_pos, neras); 334 + r = fec_decode_bufs(v, io, fio, target_block, target_region, 335 + index_in_region, out_pos, neras); 338 336 if (r < 0) 339 337 return r; 340 338 ··· 348 346 349 347 if (memcmp(io->tmp_digest, want_digest, v->digest_size)) { 350 348 DMERR_LIMIT("%s: FEC %llu: failed to correct (%d erasures)", 351 - v->data_dev->name, index_in_region, neras); 349 + v->data_dev->name, target_block, neras); 352 350 return -EILSEQ; 353 351 } 354 352