kernel-hacking-2024-linux-s.../block
Ming Lei 1db4909e76 blk-mq: not embed .mq_kobj and ctx->kobj into queue instance
Even though .mq_kobj, ctx->kobj and q->kobj share same lifetime
from block layer's view, actually they don't because userspace may
grab one kobject anytime via sysfs.

This patch fixes the issue by the following approach:

1) introduce 'struct blk_mq_ctxs' for holding .mq_kobj and managing
all ctxs

2) free all allocated ctxs and the 'blk_mq_ctxs' instance in release
handler of .mq_kobj

3) grab one ref of .mq_kobj before initializing each ctx->kobj, so that
.mq_kobj is always released after all ctxs are freed.

This patch fixes kernel panic issue during booting when DEBUG_KOBJECT_RELEASE
is enabled.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: "jianchao.wang" <jianchao.w.wang@oracle.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-11-21 05:57:56 -07:00
..
partitions
badblocks.c
bfq-cgroup.c block: remove the queue_lock indirection 2018-11-15 12:17:28 -07:00
bfq-iosched.c block: remove the queue_lock indirection 2018-11-15 12:17:28 -07:00
bfq-iosched.h block, bfq: improve asymmetric scenarios detection 2018-10-13 15:40:00 -06:00
bfq-wf2q.c block, bfq: fix asymmetric scenarios detection 2018-10-25 11:17:40 -06:00
bio-integrity.c
bio.c block: Remove bio->bi_ioc 2018-11-19 19:03:44 -07:00
blk-cgroup.c block: add queue_is_mq() helper 2018-11-16 08:34:06 -07:00
blk-core.c block: Initialize BIO I/O priority early 2018-11-19 19:03:50 -07:00
blk-exec.c block: remove dead elevator code 2018-11-07 13:42:32 -07:00
blk-flush.c block: add queue_is_mq() helper 2018-11-16 08:34:06 -07:00
blk-integrity.c
blk-ioc.c block: remove the queue_lock indirection 2018-11-15 12:17:28 -07:00
blk-iolatency.c block: remove the queue_lock indirection 2018-11-15 12:17:28 -07:00
blk-lib.c block: fix 32 bit overflow in __blkdev_issue_discard() 2018-11-14 08:17:18 -07:00
blk-map.c
blk-merge.c block: prevent merging of requests with different priorities 2018-11-19 19:03:49 -07:00
blk-mq-cpumap.c blk-mq: initial support for multiple queue maps 2018-11-07 13:45:00 -07:00
blk-mq-debugfs-zoned.c
blk-mq-debugfs.c block: remove QUEUE_FLAG_BYPASS and ->bypass 2018-11-15 12:13:15 -07:00
blk-mq-debugfs.h
blk-mq-pci.c blk-mq: initial support for multiple queue maps 2018-11-07 13:45:00 -07:00
blk-mq-rdma.c blk-mq: abstract out queue map 2018-11-07 13:44:59 -07:00
blk-mq-sched.c block: fix attempt to assign NULL io_context 2018-11-20 19:12:46 -07:00
blk-mq-sched.h block: Remove bio->bi_ioc 2018-11-19 19:03:44 -07:00
blk-mq-sysfs.c blk-mq: not embed .mq_kobj and ctx->kobj into queue instance 2018-11-21 05:57:56 -07:00
blk-mq-tag.c blk-mq-tag: document tag iteration helper return value 2018-11-08 11:09:50 -07:00
blk-mq-tag.h
blk-mq-virtio.c blk-mq: initial support for multiple queue maps 2018-11-07 13:45:00 -07:00
blk-mq.c blk-mq: not embed .mq_kobj and ctx->kobj into queue instance 2018-11-21 05:57:56 -07:00
blk-mq.h blk-mq: not embed .mq_kobj and ctx->kobj into queue instance 2018-11-21 05:57:56 -07:00
blk-pm.c block: remove the queue_lock indirection 2018-11-15 12:17:28 -07:00
blk-pm.h block: remove the queue_lock indirection 2018-11-15 12:17:28 -07:00
blk-rq-qos.c blk-rq-qos: inline check for q->rq_qos functions 2018-11-16 08:34:19 -07:00
blk-rq-qos.h blk-rq-qos: inline check for q->rq_qos functions 2018-11-16 08:34:19 -07:00
blk-settings.c block: use atomic bitops for ->queue_flags 2018-11-15 12:13:19 -07:00
blk-softirq.c block: remove a few unused exports 2018-11-15 12:13:25 -07:00
blk-stat.c block: remove a few unused exports 2018-11-15 12:13:25 -07:00
blk-stat.h
blk-sysfs.c block: add queue_is_mq() helper 2018-11-16 08:34:06 -07:00
blk-throttle.c block: add queue_is_mq() helper 2018-11-16 08:34:06 -07:00
blk-timeout.c block: don't hold the queue_lock over blk_abort_request 2018-11-15 12:13:18 -07:00
blk-wbt.c block: add queue_is_mq() helper 2018-11-16 08:34:06 -07:00
blk-wbt.h
blk-zoned.c block: add queue_is_mq() helper 2018-11-16 08:34:06 -07:00
blk.h block: Remove bio->bi_ioc 2018-11-19 19:03:44 -07:00
bounce.c block: copy ioprio in __bio_clone_fast() and bounce 2018-11-12 10:35:25 -07:00
bsg-lib.c bsg: move bsg-lib parts outside of request queue 2018-11-07 13:42:33 -07:00
bsg.c block: add queue_is_mq() helper 2018-11-16 08:34:06 -07:00
cmdline-parser.c
compat_ioctl.c
elevator.c block: add queue_is_mq() helper 2018-11-16 08:34:06 -07:00
genhd.c block: add queue_is_mq() helper 2018-11-16 08:34:06 -07:00
ioctl.c block: Introduce BLKGETNRZONES ioctl 2018-10-25 11:17:40 -06:00
ioprio.c
Kconfig blk-wbt: kill check for legacy queue type 2018-11-07 13:42:32 -07:00
Kconfig.iosched block: remove legacy IO schedulers 2018-11-07 13:42:32 -07:00
kyber-iosched.c blk-mq: allow software queue to map to multiple hardware queues 2018-11-07 13:44:59 -07:00
Makefile block: remove legacy IO schedulers 2018-11-07 13:42:32 -07:00
mq-deadline.c block: get rid of MQ scheduler ops union 2018-11-07 13:42:32 -07:00
opal_proto.h
partition-generic.c
scsi_ioctl.c
sed-opal.c
t10-pi.c