提交 7ef9f5f9 编写于 作者: Z zhengbin 提交者: Xie XiuQi

blk-mq: optimize code in store_state_field

euler inclusion
category: bugfix
bugzilla: 12808
CVE: NA

---------------------------

blk_mq_run_hw_queues should be in mutex_lock(&sdev->state_mutex),
the pattern is used in __scsi_remove_device() already.
Signed-off-by: Nzhengbin <zhengbin13@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b0dba04a
...@@ -770,16 +770,10 @@ store_state_field(struct device *dev, struct device_attribute *attr, ...@@ -770,16 +770,10 @@ store_state_field(struct device *dev, struct device_attribute *attr,
*/ */
if ((ret == 0) && (state == SDEV_RUNNING) && if ((ret == 0) && (state == SDEV_RUNNING) &&
(sdev->request_queue->mq_ops != NULL)) (sdev->request_queue->mq_ops != NULL))
goto out_run_hw_queue; blk_mq_run_hw_queues(sdev->request_queue, true);
mutex_unlock(&sdev->state_mutex); mutex_unlock(&sdev->state_mutex);
return ret == 0 ? count : -EINVAL; return ret == 0 ? count : -EINVAL;
out_run_hw_queue:
mutex_unlock(&sdev->state_mutex);
blk_mq_run_hw_queues(sdev->request_queue, true);
return count;
} }
static ssize_t static ssize_t
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册