Re: [PATCH 6/5] kyber: avoid q->disk dereferences in trace points

From
Ming Lei <hidden>
Date
2021-10-14 12:57:26
Reply to
Christoph Hellwig, 2021-10-12
Hello Christoph,

On Tue, Oct 12, 2021 at 11:33:01AM +0200, Christoph Hellwig wrote:
q->disk becomes invalid after the gendisk is removed.  Work around this
by caching the dev_t for the tracepoints.  The real fix would be to
properly tear down the I/O schedulers with the gendisk, but that is
a much more invasive change.
Except for kyber, blkcg code refers q->disk too.

Such as blkg_dev_name() used in showing blk cgroup files, see
tg_print_limit(), but blkcg_exit_queue() is called in queue's release
handler, so q->disk can be referred when reading blkcg file of cgroup
fs from userspace after deleting gendisk.

I think it is fine to move blkcg_exit_queue() into del_gendisk(), but
bfq_exit_queue() is still run from queue's release handler, and bfq's
blkcg policy is deactivated there. That said the referring in reading
bfq's cgroup file still can come after deleting disk, especially kernel
panic could be caused when q->disk is cleared between the check and
calling to bdi_dev_name() in blkg_dev_name().


Thanks,
Ming
Thread (14 messages) 14 messages, 4 authors, last reply 2021-10-17
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help