diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-07-25 12:11:56 +0900 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-08-20 23:13:42 -0700 |
commit | 6f8d4455060dfb0e32dfb8e685b97caf4ed1be41 (patch) | |
tree | a0fad8fa5e8f4efc35784e22f3427e65e751e2e8 /fs/f2fs/data.c | |
parent | 853137cef46ccc490e6fd4b160a1c252d6459842 (diff) | |
download | linux-6f8d4455060dfb0e32dfb8e685b97caf4ed1be41.tar.bz2 |
f2fs: avoid fi->i_gc_rwsem[WRITE] lock in f2fs_gc
The f2fs_gc() called by f2fs_balance_fs() requires to be called outside of
fi->i_gc_rwsem[WRITE], since f2fs_gc() can try to grab it in a loop.
If it hits the miximum retrials in GC, let's give a chance to release
gc_mutex for a short time in order not to go into live lock in the worst
case.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index bdcb023506a7..e73ce11de02d 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2217,14 +2217,14 @@ static void f2fs_write_failed(struct address_space *mapping, loff_t to) loff_t i_size = i_size_read(inode); if (to > i_size) { - down_write(&F2FS_I(inode)->i_mmap_sem); down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); + down_write(&F2FS_I(inode)->i_mmap_sem); truncate_pagecache(inode, i_size); f2fs_truncate_blocks(inode, i_size, true); - up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); up_write(&F2FS_I(inode)->i_mmap_sem); + up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); } } |