OSDN Git Service

f2fs: avoid stucking GC due to atomic write
authorChao Yu <yuchao0@huawei.com>
Mon, 7 May 2018 12:28:54 +0000 (20:28 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 9 Jul 2018 00:46:45 +0000 (17:46 -0700)
commitb125dfb20d18db91eac671aa241346cd1e1c0106
tree5bfb1b174b2d5947191869d4c8f9be2bc63401cf
parent405909e7f53293a13c9a0fad5c81ce1472e9fd32
f2fs: avoid stucking GC due to atomic write

f2fs doesn't allow abuse on atomic write class interface, so except
limiting in-mem pages' total memory usage capacity, we need to limit
atomic-write usage as well when filesystem is seriously fragmented,
otherwise we may run into infinite loop during foreground GC because
target blocks in victim segment are belong to atomic opened file for
long time.

Now, we will detect failure due to atomic write in foreground GC, if
the count exceeds threshold, we will drop all atomic written data in
cache, by this, I expect it can keep our system running safely to
prevent Dos attack.

In addition, his patch adds to show GC skip information in debugfs,
now it just shows count of skipped caused by atomic write.

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