[PATCHv2 2/5] nvme: simplify passthrough bio cleanup

Keith Busch kbusch at kernel.org
Tue Apr 11 10:46:14 PDT 2023


On Mon, Apr 10, 2023 at 04:55:03PM +0530, Kanchan Joshi wrote:
> On Fri, Apr 07, 2023 at 12:16:33PM -0700, Keith Busch wrote:
> > +static void nvme_uring_bio_end_io(struct bio *bio)
> > +{
> > +	blk_rq_unmap_user(bio);
> > +}
> > +
> > static int nvme_map_user_request(struct request *req, u64 ubuffer,
> > 		unsigned bufflen, void __user *meta_buffer, unsigned meta_len,
> > 		u32 meta_seed, void **metap, struct io_uring_cmd *ioucmd,
> > @@ -204,6 +209,7 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer,
> > 		*metap = meta;
> > 	}
> > 
> > +	bio->bi_end_io = nvme_uring_bio_end_io;
> > 	return ret;
> > 
> > out_unmap:
> > @@ -249,8 +255,6 @@ static int nvme_submit_user_cmd(struct request_queue *q,
> > 	if (meta)
> > 		ret = nvme_finish_user_metadata(req, meta_buffer, meta,
> > 						meta_len, ret);
> > -	if (bio)
> > -		blk_rq_unmap_user(bio);
> 
> Is it safe to call blk_rq_unamp_user in irq context?

Doh! I boxed my thinking into the polling mode that completely neglected the
more common use case. Thanks, now back to the drawing board for me...



More information about the Linux-nvme mailing list