Commit a798ff17 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: fix to add missing iput() in gc_data_segment()

During gc_data_segment(), if inode state is abnormal, it missed to call
iput(), fix it.

Fixes: b73e5282 ("f2fs: reposition unlock_new_inode to prevent accessing invalid inode")
Fixes: 9056d648 ("f2fs: fix to do sanity check on inode type during garbage collection")
Signed-off-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent f2526c5c
...@@ -1554,10 +1554,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, ...@@ -1554,10 +1554,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
int err; int err;
inode = f2fs_iget(sb, dni.ino); inode = f2fs_iget(sb, dni.ino);
if (IS_ERR(inode) || is_bad_inode(inode) || if (IS_ERR(inode))
special_file(inode->i_mode))
continue; continue;
if (is_bad_inode(inode) ||
special_file(inode->i_mode)) {
iput(inode);
continue;
}
err = f2fs_gc_pinned_control(inode, gc_type, segno); err = f2fs_gc_pinned_control(inode, gc_type, segno);
if (err == -EAGAIN) { if (err == -EAGAIN) {
iput(inode); iput(inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment