]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - fs/f2fs/segment.c
f2fs: Check write pointer consistency of open zones
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 9 Dec 2019 10:44:44 +0000 (19:44 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 15 Jan 2020 21:42:14 +0000 (13:42 -0800)
commitc426d99127b1ab797f4cc355b18d77288978b2f2
treea8f52ae265c516b33bc27c3a7e37b425ba639b42
parentdd973007bfefe62c81e84cb6ae0704c73b2b64c9
f2fs: Check write pointer consistency of open zones

On sudden f2fs shutdown, write pointers of zoned block devices can go
further but f2fs meta data keeps current segments at positions before the
write operations. After remounting the f2fs, this inconsistency causes
write operations not at write pointers and "Unaligned write command"
error is reported.

To avoid the error, compare current segments with write pointers of open
zones the current segments point to, during mount operation. If the write
pointer position is not aligned with the current segment position, assign
a new zone to the current segment. Also check the newly assigned zone has
write pointer at zone start. If not, reset write pointer of the zone.

Perform the consistency check during fsync recovery. Not to lose the
fsync data, do the check after fsync data gets restored and before
checkpoint commit which flushes data at current segment positions. Not to
cause conflict with kworker's dirfy data/node flush, do the fix within
SBI_POR_DOING protection.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/recovery.c
fs/f2fs/segment.c