[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZpC9HxJnokkbjKAO@infradead.org>
Date: Thu, 11 Jul 2024 22:20:31 -0700
From: Christoph Hellwig <hch@...radead.org>
To: hexue <xue01.he@...sung.com>
Cc: axboe@...nel.dk, asml.silence@...il.com, io-uring@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] io_uring: Avoid polling configuration errors
On Thu, Jul 11, 2024 at 04:24:30PM +0800, hexue wrote:
> + if (!ctx->check_poll_queue) {
> + struct block_device *bdev;
> + struct request_queue *q;
> + struct inode *inode = req->file->f_inode;
> +
> + if (inode->i_rdev) {
> + bdev = blkdev_get_no_open(inode->i_rdev);
> + q = bdev->bd_queue;
> + if (!test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
> + pr_warn("the device does't configured with poll queues\n");
> + }
> + ctx->check_poll_queue = true;
> + }
This is wrong for multiple reasons. One is that we can't simply poke
into block device internals like this in a higher layer like io_uring.
Second blkdev_get_no_open is in no way available for use outside the
block layer. The fact that the even exist as separate helpers that
aren't entirely hidden is a decade old layering violation in blk-cgroup.
If you want to advertize this properly we'll need a flag in struct
file or something similar.
Powered by blists - more mailing lists