Re: [PATCH v3 4/4] block/badblocks: fix the bug of reverse order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 22, 2023 at 01:20:52AM +0800, linan666@xxxxxxxxxxxxxxx wrote:
> From: Li Nan <linan122@xxxxxxxxxx>
> 
> Order of badblocks will be reversed if we set a large area at once. 'hi'
> remains unchanged while adding continuous badblocks is wrong, the next
> setting is greater than 'hi', it should be added to the next position.
> Let 'hi' +1 each cycle.

The commitlog needs more work. 
> 
>   # echo 0 2048 > bad_blocks
>   # cat bad_blocks
>     1536 512
>     1024 512
>     512 512
>     0 512

Is the above before or after this patch is applied?

> 
> Fixes: 9e0e252a048b ("badblocks: Add core badblock management code")
> Signed-off-by: Li Nan <linan122@xxxxxxxxxx>
> ---
>  block/badblocks.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/block/badblocks.c b/block/badblocks.c
> index 2c2ef8284a3f..3b816690b940 100644
> --- a/block/badblocks.c
> +++ b/block/badblocks.c
> @@ -301,6 +301,7 @@ int badblocks_set(struct badblocks *bb, sector_t s, int sectors,
>  			p[hi] = BB_MAKE(s, this_sectors, acknowledged);
>  			sectors -= this_sectors;
>  			s += this_sectors;
> +			hi++;
>  			changed = true;
>  		}
>  	}
> -- 
> 2.39.2
> 



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux