f2fs: check if inmem_pages list is empty correctly
authorSheng Yong <shengyong1@huawei.com>
Tue, 17 Apr 2018 09:12:27 +0000 (17:12 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 28 Jun 2018 22:49:24 +0000 (15:49 -0700)
`cur' will never be NULL, we should check inmem_pages list instead.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c

index e22911f2a3783e09be5df3c7ff37ea5b9ae690c4..33d33db15d2f802e9c384da5d84c27abb0b6f244 100644 (file)
@@ -328,7 +328,7 @@ void drop_inmem_page(struct inode *inode, struct page *page)
                        break;
        }
 
-       f2fs_bug_on(sbi, !cur || cur->page != page);
+       f2fs_bug_on(sbi, list_empty(head) || cur->page != page);
        list_del(&cur->list);
        mutex_unlock(&fi->inmem_lock);