stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm verity: fix unaligned block size
@ 2021-04-10 16:01 Jaegeuk Kim
  2021-04-10 18:35 ` Jaegeuk Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Jaegeuk Kim @ 2021-04-10 16:01 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman, Mike Snitzer, kernel-team
  Cc: Jaegeuk Kim, stable

From: Jaegeuk Kim <jaegeuk@google.com>

When f->roots is 2 and block size is 4096, it will gives unaligned block size
length in the scsi command like below. Let's allocate dm_bufio to set the block
size length to match IO chunk size.

E sd 0    : 0:0:0: [sda] tag#30 request not aligned to the logical block size
E blk_update_request: I/O error, dev sda, sector 10368424 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
E device-mapper: verity-fec: 254:8: FEC 9244672: parity read failed (block 18056): -5

Fixes: ce1cca17381f ("dm verity: fix FEC for RS roots unaligned to block size")
Cc: stable@vger.kernel.org
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
---
 drivers/md/dm-verity-fec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c
index 66f4c6398f67..656238131dd7 100644
--- a/drivers/md/dm-verity-fec.c
+++ b/drivers/md/dm-verity-fec.c
@@ -743,7 +743,7 @@ int verity_fec_ctr(struct dm_verity *v)
 	}
 
 	f->bufio = dm_bufio_client_create(f->dev->bdev,
-					  f->roots << SECTOR_SHIFT,
+					  1 << v->data_dev_block_bits,
 					  1, 0, NULL, NULL);
 	if (IS_ERR(f->bufio)) {
 		ti->error = "Cannot initialize FEC bufio client";
-- 
2.31.1.295.g9ea45b61b8-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dm verity: fix unaligned block size
  2021-04-10 16:01 [PATCH] dm verity: fix unaligned block size Jaegeuk Kim
@ 2021-04-10 18:35 ` Jaegeuk Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Jaegeuk Kim @ 2021-04-10 18:35 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman, Mike Snitzer, kernel-team; +Cc: stable

Sorry, this patch is totally wrong. Let me dig out more.

On 04/10, Jaegeuk Kim wrote:
> From: Jaegeuk Kim <jaegeuk@google.com>
> 
> When f->roots is 2 and block size is 4096, it will gives unaligned block size
> length in the scsi command like below. Let's allocate dm_bufio to set the block
> size length to match IO chunk size.
> 
> E sd 0    : 0:0:0: [sda] tag#30 request not aligned to the logical block size
> E blk_update_request: I/O error, dev sda, sector 10368424 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
> E device-mapper: verity-fec: 254:8: FEC 9244672: parity read failed (block 18056): -5
> 
> Fixes: ce1cca17381f ("dm verity: fix FEC for RS roots unaligned to block size")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
> ---
>  drivers/md/dm-verity-fec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c
> index 66f4c6398f67..656238131dd7 100644
> --- a/drivers/md/dm-verity-fec.c
> +++ b/drivers/md/dm-verity-fec.c
> @@ -743,7 +743,7 @@ int verity_fec_ctr(struct dm_verity *v)
>  	}
>  
>  	f->bufio = dm_bufio_client_create(f->dev->bdev,
> -					  f->roots << SECTOR_SHIFT,
> +					  1 << v->data_dev_block_bits,
>  					  1, 0, NULL, NULL);
>  	if (IS_ERR(f->bufio)) {
>  		ti->error = "Cannot initialize FEC bufio client";
> -- 
> 2.31.1.295.g9ea45b61b8-goog

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-10 18:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-10 16:01 [PATCH] dm verity: fix unaligned block size Jaegeuk Kim
2021-04-10 18:35 ` Jaegeuk Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).