提交 5974d33c 编写于 作者: L Li Lingfeng 提交者: Yongqiang Liu

block: Fix kabi broken by "block: split .sysfs_lock into two locks"

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6HOKY
CVE: NA

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

commit 92567b1d6f5a ("block: split .sysfs_lock into two locks") introduce
new member 'sysfs_dir_lock' in struct request_queue, thus move it to
request_queue_wrapper to avoid kabi broken.

Fixes: 92567b1d6f5a ("block: split .sysfs_lock into two locks")
Signed-off-by: NLi Lingfeng <lilingfeng3@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 69683181
......@@ -1337,7 +1337,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id,
mutex_init(&q->blk_trace_mutex);
#endif
mutex_init(&q->sysfs_lock);
mutex_init(&q->sysfs_dir_lock);
mutex_init(&q_wrapper->sysfs_dir_lock);
spin_lock_init(&q->__queue_lock);
q->queue_lock = lock ? : &q->__queue_lock;
......
......@@ -283,7 +283,7 @@ void blk_mq_unregister_dev(struct device *dev, struct request_queue *q)
struct blk_mq_hw_ctx *hctx;
int i;
lockdep_assert_held(&q->sysfs_dir_lock);
lockdep_assert_held(&queue_to_wrapper(q)->sysfs_dir_lock);
queue_for_each_hw_ctx(q, hctx, i)
blk_mq_unregister_hctx(hctx);
......@@ -333,7 +333,7 @@ int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
int ret, i;
WARN_ON_ONCE(!q->kobj.parent);
lockdep_assert_held(&q->sysfs_dir_lock);
lockdep_assert_held(&queue_to_wrapper(q)->sysfs_dir_lock);
ret = kobject_add(q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
if (ret < 0)
......@@ -366,9 +366,9 @@ int blk_mq_register_dev(struct device *dev, struct request_queue *q)
{
int ret;
mutex_lock(&q->sysfs_dir_lock);
mutex_lock(&queue_to_wrapper(q)->sysfs_dir_lock);
ret = __blk_mq_register_dev(dev, q);
mutex_unlock(&q->sysfs_dir_lock);
mutex_unlock(&queue_to_wrapper(q)->sysfs_dir_lock);
return ret;
}
......@@ -379,7 +379,7 @@ void blk_mq_sysfs_unregister(struct request_queue *q)
struct blk_mq_hw_ctx *hctx;
int i;
mutex_lock(&q->sysfs_dir_lock);
mutex_lock(&queue_to_wrapper(q)->sysfs_dir_lock);
if (!q->mq_sysfs_init_done)
goto unlock;
......@@ -387,7 +387,7 @@ void blk_mq_sysfs_unregister(struct request_queue *q)
blk_mq_unregister_hctx(hctx);
unlock:
mutex_unlock(&q->sysfs_dir_lock);
mutex_unlock(&queue_to_wrapper(q)->sysfs_dir_lock);
}
int blk_mq_sysfs_register(struct request_queue *q)
......@@ -395,7 +395,7 @@ int blk_mq_sysfs_register(struct request_queue *q)
struct blk_mq_hw_ctx *hctx;
int i, ret = 0;
mutex_lock(&q->sysfs_dir_lock);
mutex_lock(&queue_to_wrapper(q)->sysfs_dir_lock);
if (!q->mq_sysfs_init_done)
goto unlock;
......@@ -406,7 +406,7 @@ int blk_mq_sysfs_register(struct request_queue *q)
}
unlock:
mutex_unlock(&q->sysfs_dir_lock);
mutex_unlock(&queue_to_wrapper(q)->sysfs_dir_lock);
return ret;
}
......@@ -946,7 +946,7 @@ int blk_register_queue(struct gendisk *disk)
if (ret)
return ret;
mutex_lock(&q->sysfs_dir_lock);
mutex_lock(&queue_to_wrapper(q)->sysfs_dir_lock);
ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
if (ret < 0) {
......@@ -964,7 +964,7 @@ int blk_register_queue(struct gendisk *disk)
ret = elv_register_queue(q, false);
if (ret) {
mutex_unlock(&q->sysfs_lock);
mutex_unlock(&q->sysfs_dir_lock);
mutex_unlock(&queue_to_wrapper(q)->sysfs_dir_lock);
kobject_del(&q->kobj);
blk_trace_remove_sysfs(dev);
kobject_put(&dev->kobj);
......@@ -986,7 +986,7 @@ int blk_register_queue(struct gendisk *disk)
ret = 0;
unlock:
mutex_unlock(&q->sysfs_dir_lock);
mutex_unlock(&queue_to_wrapper(q)->sysfs_dir_lock);
/*
* SCSI probing may synchronously create and destroy a lot of
......@@ -1036,7 +1036,7 @@ void blk_unregister_queue(struct gendisk *disk)
blk_queue_flag_clear(QUEUE_FLAG_REGISTERED, q);
mutex_unlock(&q->sysfs_lock);
mutex_lock(&q->sysfs_dir_lock);
mutex_lock(&queue_to_wrapper(q)->sysfs_dir_lock);
/*
* Remove the sysfs attributes before unregistering the queue data
* structures that can be modified through sysfs.
......@@ -1050,7 +1050,7 @@ void blk_unregister_queue(struct gendisk *disk)
if (q->request_fn || (q->mq_ops && q->elevator))
elv_unregister_queue(q);
mutex_unlock(&q->sysfs_lock);
mutex_unlock(&q->sysfs_dir_lock);
mutex_unlock(&queue_to_wrapper(q)->sysfs_dir_lock);
/* Now that we've deleted all child objects, we can delete the queue. */
kobject_uevent(&q->kobj, KOBJ_REMOVE);
......
......@@ -54,6 +54,7 @@ struct request_queue_wrapper {
struct cpumask dispatch_async_cpus;
int __percpu *last_dispatch_cpu;
#endif
struct mutex sysfs_dir_lock;
};
#define queue_to_wrapper(q) \
......
......@@ -655,7 +655,6 @@ struct request_queue {
struct delayed_work requeue_work;
struct mutex sysfs_lock;
struct mutex sysfs_dir_lock;
/*
* for reusing dead hctx instance in case of updating
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册