OSDN Git Service

f2fs: Check write pointer consistency of non-open zones
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 28 Oct 2019 06:58:01 +0000 (15:58 +0900)
committer0ranko0P <ranko0p@outlook.com>
Tue, 24 Dec 2019 20:42:47 +0000 (04:42 +0800)
commit63ee10cd163b84778e99fb2764214177c57c74e4
tree725d9b081c34c412bef1bf0316915b9b85cd34c7
parentb563ca6ba38e95dc972be3ba6d2fe06336cc813c
f2fs: Check write pointer consistency of non-open zones

To catch f2fs bugs in write pointer handling code for zoned block
devices, check write pointers of non-open zones that current segments do
not point to. Do this check at mount time, after the fsync data recovery
and current segments' write pointer consistency fix. Check two items
comparing write pointers with valid block maps in SIT.

The first item is check for zones with no valid blocks. When there is no
valid blocks in a zone, the write pointer should be at the start of the
zone. If not, next write operation to the zone will cause unaligned write
error. If write pointer is not at the zone start, make mount fail and ask
users to run fsck.

The second item is check between the write pointer position and the last
valid block in the zone. It is unexpected that the last valid block
position is beyond the write pointer. In such a case, report as the bug.
Fix is not required for such zone, because the zone is not selected for
next write operation until the zone get discarded.

Also move a constant F2FS_REPORT_ZONE from super.c to f2fs.h to use it
in segment.c also.

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