Unverified Commit 0aa0ca11 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!1345 dm: requeue IO if mapping table not yet

Merge Pull Request from: @ci-robot 
 
PR sync from: Li Lingfeng <lilingfeng3@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/2PV7QOUKZR3DCG46HYA5N3UC6X6ZZ3EU/ 
It's not proper to just abort IO when the map is not ready.
So revert this and requeue IO to keep consistent with the community.
And fix the deadlock introduced by the patch.

v1->v2:
  add patch 38d11da5 "dm: don't lock fs when the map is NULL in
process of resume"

Li Lingfeng (3):
  Revert "dm: make sure dm_table is binded before queue request"
  dm: don't lock fs when the map is NULL in process of resume
  dm: don't lock fs when the map is NULL during suspend or resume

Mike Snitzer (1):
  dm: requeue IO if mapping table not yet available


-- 
2.31.1
 
 
Link:https://gitee.com/openeuler/kernel/pulls/1345

 

Reviewed-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 07439c16 0ba9dcd9
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -503,11 +503,9 @@ static blk_status_t dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
		struct dm_table *map;

		map = dm_get_live_table(md, &srcu_idx);
		if (!map) {
			DMERR_LIMIT("%s: mapping table unavailable, erroring io",
				    dm_device_name(md));
		if (unlikely(!map)) {
			dm_put_live_table(md, srcu_idx);
			return BLK_STS_IOERR;
			return BLK_STS_RESOURCE;
		}
		ti = dm_table_find_target(map, 0);
		dm_put_live_table(md, srcu_idx);
+7 −8
Original line number Diff line number Diff line
@@ -1684,15 +1684,10 @@ static blk_qc_t dm_submit_bio(struct bio *bio)
	struct dm_table *map;

	map = dm_get_live_table(md, &srcu_idx);
	if (unlikely(!map)) {
		DMERR_LIMIT("%s: mapping table unavailable, erroring io",
			    dm_device_name(md));
		bio_io_error(bio);
		goto out;
	}

	/* If suspended, queue this IO for later */
	if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) {
	/* If suspended, or map not yet available, queue this IO for later */
	if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) ||
	    unlikely(!map)) {
		if (bio->bi_opf & REQ_NOWAIT)
			bio_wouldblock_error(bio);
		else if (bio->bi_opf & REQ_RAHEAD)
@@ -2609,6 +2604,10 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
	}

	map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock));
	if (!map) {
		/* avoid deadlock with fs/namespace.c:do_mount() */
		suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
	}

	r = __dm_suspend(md, map, suspend_flags, TASK_INTERRUPTIBLE, DMF_SUSPENDED);
	if (r)