OSDN Git Service

f2fs: keep isize once block is reserved cross EOF
authorChao Yu <yuchao0@huawei.com>
Sun, 5 Nov 2017 13:53:30 +0000 (21:53 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 16 Nov 2017 06:02:32 +0000 (22:02 -0800)
commit5d4b6efcfd09ce00a2ef238ee333cdabcf1d87c6
tree07963f20c3d2758e9c8cd682a5870f3932eb2710
parent3c8f767e13741c5174909e39f238655c82be1c20
f2fs: keep isize once block is reserved cross EOF

Without FADVISE_KEEP_SIZE_BIT, we will try to recover file size
according to last non-hole block, so in fallocate(), we must set
FADVISE_KEEP_SIZE_BIT flag once we have preallocated block cross
EOF, instead of when all preallocation is success. Otherwise, file
size will be incorrect due to lack of this flag.

Simple testcase to reproduce this:

1. echo 2 > /sys/fs/f2fs/<device>/inject_type
2. echo 10 > /sys/fs/f2fs/<device>/inject_rate
3. run tests/generic/392
4. disable fault injection
5. do remount

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c