Can Guo c7b34f96e4 block: pm: Fix possible unbalanced nr_pending
When someone calls blk_get_request() and blk_put_request() without invoking
blk_execute_rq() in between, nr_pending will be unbalanced. Fix this by
adding a flag, namely the RQF_PM_ADDED, to track the usage of nr_pending,
so that blk_pm_put_request() won't touch nr_pending if the flag is not set.
Extra care should be given to blk_pm_requeue_request(), because blk-flush.c
inserts flush requests into queue without calling blk_pm_add_request(), if
the flush requests get requeued by LLD, blk_pm_requeue_request() should
anyways decrease nr_pending in this situation to keep it balanced.

Change-Id: I7baa2049ac532e4fd22a0ce358133ba88266a314
Signed-off-by: Ziqi Chen <ziqichen@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:41 +05:30
..