f2fs: do not expose unwritten blocks to user by DIO
authorJaegeuk Kim <jaegeuk@kernel.org>
Fri, 12 Nov 2021 22:31:16 +0000 (14:31 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sat, 4 Dec 2021 18:53:33 +0000 (10:53 -0800)
commitd4dd19ec1ea0cf6532d65709325c42b1398614a8
tree399db103c398219451cf13c22ff3bf6639dd439d
parentb31bf0f96e71a2c81d2122c3fecdb91f8e215c20
f2fs: do not expose unwritten blocks to user by DIO

DIO preallocates physical blocks before writing data, but if an error occurrs
or power-cut happens, we can see block contents from the disk. This patch tries
to fix it by 1) turning to buffered writes for DIO into holes, 2) truncating
unwritten blocks from error or power-cut.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/inode.c