Unverified Commit 5ab0cca4 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!996 [sync] PR-990: ubi: Fix deadlock caused by recursively holding work_sem

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/990 
 
PR sync from:  ZhaoLong Wang <wangzhaolong1@huawei.com>
 https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/thread/3EWABXFSAAORW3LZWZCYAYWH3W3EEKZU/ 
Fix deadlock caused by recursively holding work_sem

Lee Jones (1):
  mtd: ubi: wl: Fix a couple of kernel-doc issues

ZhaoLong Wang (1):
  ubi: Fix deadlock caused by recursively holding work_sem


-- 
2.39.2
 
 
Link:https://gitee.com/openeuler/kernel/pulls/996

 

Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 58d4723f eeeb7a1e
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -575,6 +575,7 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
 * @vol_id: the volume ID that last used this PEB
 * @lnum: the last used logical eraseblock number for the PEB
 * @torture: if the physical eraseblock has to be tortured
 * @nested: denotes whether the work_sem is already held
 *
 * This function returns zero in case of success and a %-ENOMEM in case of
 * failure.
@@ -1066,8 +1067,6 @@ static int ensure_wear_leveling(struct ubi_device *ubi, int nested)
 * __erase_worker - physical eraseblock erase worker function.
 * @ubi: UBI device description object
 * @wl_wrk: the work object
 * @shutdown: non-zero if the worker has to free memory and exit
 * because the WL sub-system is shutting down
 *
 * This function erases a physical eraseblock and perform torture testing if
 * needed. It also takes care about marking the physical eraseblock bad if
@@ -1122,7 +1121,7 @@ static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk)
		int err1;

		/* Re-schedule the LEB for erasure */
		err1 = schedule_erase(ubi, e, vol_id, lnum, 0, false);
		err1 = schedule_erase(ubi, e, vol_id, lnum, 0, true);
		if (err1) {
			spin_lock(&ubi->wl_lock);
			wl_entry_destroy(ubi, e);