Hi Ming, On Fri, Nov 12, 2021 at 1:47 PM Ming Lei <ming.lei@xxxxxxxxxx> wrote: > On Fri, Nov 12, 2021 at 09:44:41AM +0100, Christoph Hellwig wrote: > > On Fri, Nov 12, 2021 at 04:37:19PM +0800, Ming Lei wrote: > > > > can only be used for reads, and no fua can be set if the preallocating > > > > I/O didn't use fua, etc. > > > > > > > > What are the pitfalls of just chanigng cmd_flags? > > > > > > Then we need to check cmd_flags carefully, such as hctx->type has to > > > be same, flush & passthrough flags has to be same, that said all > > > ->cmd_flags used for allocating rqs have to be same with the following > > > bio->bi_opf. > > > > > > In usual cases, I guess all IOs submitted from same plug batch should be > > > same type. If not, we can switch to change cmd_flags. > > > > Jens: is this a limit fitting into your use cases? > > > > I guess as a quick fix this rejecting different flags is probably the > > best we can do for now, but I suspect we'll want to eventually relax > > them. > > rw mixed workload will be affected, so I think we need to switch to > change cmd_flags, how about the following patch? > > From 9ab77b7adee768272944c20b7cffc8abdb85a35b Mon Sep 17 00:00:00 2001 > From: Ming Lei <ming.lei@xxxxxxxxxx> > Date: Fri, 12 Nov 2021 08:14:38 +0800 > Subject: [PATCH] blk-mq: fix filesystem I/O request allocation > > submit_bio_checks() may update bio->bi_opf, so we have to initialize > blk_mq_alloc_data.cmd_flags with bio->bi_opf after submit_bio_checks() > returns when allocating new request. > > In case of using cached request, fallback to allocate new request if > cached rq isn't compatible with the incoming bio, otherwise change > rq->cmd_flags with incoming bio->bi_opf. > > Fixes: 900e080752025f00 ("block: move queue enter logic into blk_mq_submit_bio()") > Reported-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> > Cc: Christoph Hellwig <hch@xxxxxx> > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> Thanks, this alternative patch seems to work fine, too. Tested-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds