Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e27aebf authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

f2fs: fix to avoid potential deadlock



Using f2fs_trylock_op() in f2fs_write_compressed_pages() to avoid potential
deadlock like we did in f2fs_write_single_data_page().

Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 5063cb34
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -775,7 +775,6 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
		.encrypted_page = NULL,
		.compressed_page = NULL,
		.submitted = false,
		.need_lock = LOCK_RETRY,
		.io_type = io_type,
		.io_wbc = wbc,
		.encrypted = f2fs_encrypted_file(cc->inode),
@@ -788,9 +787,10 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
	loff_t psize;
	int i, err;

	set_new_dnode(&dn, cc->inode, NULL, NULL, 0);
	if (!f2fs_trylock_op(sbi))
		return -EAGAIN;

	f2fs_lock_op(sbi);
	set_new_dnode(&dn, cc->inode, NULL, NULL, 0);

	err = f2fs_get_dnode_of_data(&dn, start_idx, LOOKUP_NODE);
	if (err)