Re: [PATCH v2] f2fs: Fix direct IO handling

From: Chao Yu
Date: Tue Dec 03 2019 - 20:27:54 EST


On 2019/12/4 1:33, Jaegeuk Kim wrote:
> Thank you for checking the patch.
> I found some regressions in xfstests, so want to follow the Damien's one
> like below.
>
> Thanks,
>
> ===
>>From 9df6f09e3a09ed804aba4b56ff7cd9524c002e69 Mon Sep 17 00:00:00 2001
> From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
> Date: Tue, 26 Nov 2019 15:01:42 -0800
> Subject: [PATCH] f2fs: preallocate DIO blocks when forcing buffered_io
>
> The previous preallocation and DIO decision like below.
>
> allow_outplace_dio !allow_outplace_dio
> f2fs_force_buffered_io (*) No_Prealloc / Buffered_IO Prealloc / Buffered_IO
> !f2fs_force_buffered_io No_Prealloc / DIO Prealloc / DIO
>
> But, Javier reported Case (*) where zoned device bypassed preallocation but
> fell back to buffered writes in f2fs_direct_IO(), resulting in stale data
> being read.
>
> In order to fix the issue, actually we need to preallocate blocks whenever
> we fall back to buffered IO like this. No change is made in the other cases.
>
> allow_outplace_dio !allow_outplace_dio
> f2fs_force_buffered_io (*) Prealloc / Buffered_IO Prealloc / Buffered_IO
> !f2fs_force_buffered_io No_Prealloc / DIO Prealloc / DIO
>
> Reported-and-tested-by: Javier Gonzalez <javier@xxxxxxxxxxx>
> Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx>
> Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>

Reviewed-by: Chao Yu <yuchao0@xxxxxxxxxx>

Thanks,