On Mon, Jan 24, 2022 at 02:05:55PM +0100, Christoph Hellwig wrote: > On Sat, Jan 22, 2022 at 07:10:46PM +0800, Ming Lei wrote: > > Passthrough request from userspace has one active block_device/disk > > associated, so they can be accounted via rq->q->disk. For other > > passthrough request, there may not be disk/block_device for the queue, > > since either the queue has not a disk or the disk may be deleted > > already. > > > > Add flag of BLK_MQ_REQ_USER_IO for only accounting passthrough request > > from userspace. > > Please explain why you want to change this. Please see the following code: /* passthrough requests can hold bios that do not have ->bi_bdev set */ if (rq->bio && rq->bio->bi_bdev) rq->part = rq->bio->bi_bdev; else if (rq->q->disk) rq->part = rq->q->disk->part0; q->disk can be cleared by disk_release() just when referring the above line, then NULL ptr reference is caused, and similar issue with any reference to rq->part for passthrough request sent not from userspace. > > Also this is missing I/O from /dev/sg, CDROM CDDA BPC reading, the tape > drivers and bsg-lib. Except for CDROM CDDA BPC reading, the others don't have gendisk associated, so they needn't such change. And it looks easy to do that for CDROM CDDA BPC reading. Thanks, Ming