Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

f2fs: fix to avoid double unlock

On image that has verity and compression feature, if compressed pages
and non-compressed pages are mixed in one bio, we may double unlock
non-compressed page in below flow:

- f2fs_post_read_work
- f2fs_decompress_work
- f2fs_decompress_bio
- __read_end_io
- unlock_page
- fsverity_enqueue_verify_work
- f2fs_verity_work
- f2fs_verify_bio
- unlock_page

So it should skip handling non-compressed page in f2fs_decompress_work()
if verity is on.

Besides, add missing dec_page_count() in f2fs_verify_bio().

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Chao Yu and committed by
Jaegeuk Kim
74878565 7653b9d8

+3
+3
fs/f2fs/data.c
··· 139 139 f2fs_decompress_pages(bio, page, verity); 140 140 continue; 141 141 } 142 + if (verity) 143 + continue; 142 144 #endif 143 145 144 146 /* PG_error was set if any post_read step failed */ ··· 218 216 ClearPageUptodate(page); 219 217 ClearPageError(page); 220 218 unlock: 219 + dec_page_count(F2FS_P_SB(page), __read_io_type(page)); 221 220 unlock_page(page); 222 221 } 223 222 }