]> Git Repo - linux.git/commit - block/blk-mq-sysfs.c
blk-mq: not embed .mq_kobj and ctx->kobj into queue instance
authorMing Lei <[email protected]>
Tue, 20 Nov 2018 01:44:35 +0000 (09:44 +0800)
committerJens Axboe <[email protected]>
Wed, 21 Nov 2018 12:57:56 +0000 (05:57 -0700)
commit1db4909e76f64a85f4aaa187f0f683f5c85a471d
treeec08842eff41be0c4db21599a2a8954019335a30
parent0c62bff1fd633774756be6d88d71002cd37615e0
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 <[email protected]>
Cc: "jianchao.wang" <[email protected]>
Tested-by: Guenter Roeck <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
block/blk-mq-sysfs.c
block/blk-mq.c
block/blk-mq.h
include/linux/blkdev.h
This page took 0.057944 seconds and 4 git commands to generate.