Re: PROBLEM: Recent raid10 block discard patchset causes filesystem corruption on fstrim

From: Song Liu
Date: Sun Dec 27 2020 - 17:07:43 EST


Hi Xiao,

On Thu, Dec 24, 2020 at 2:18 AM Xiao Ni <xni@xxxxxxxxxx> wrote:
>
>
>
[...]
>
> [ 789.709501] discard bio start : 70968, size : 191176
> [ 789.709507] first stripe index 69, start disk index 0, start disk
> offset 70968
> [ 789.709509] last stripe index 256, end disk index 0, end disk offset
> 262144
> [ 789.709511] disk 0, dev start : 70968, dev end : 262144
> [ 789.709515] disk 1, dev start : 70656, dev end : 262144
>
> For example, in this test case, it has 2 near copies. The
> start_disk_offset for the first disk is 70968.
> It should use the same offset address for second disk. But it uses the
> start address of this chunk.
> It discard more region. The patch in the attachment can fix this
> problem. It split the region that
> doesn't align with chunk size.
>
> There is another problem. The stripe size should be calculated
> differently for near layout and far layout.
>
> @Song, do you want me to use a separate patch for this fix, or fix this
> in the original patch?

Please fold in the changes in the original patches and resend the whole
set.

Thanks,
Song

>
> Merry Christmas
> Xiao
>