On Mon, Nov 1, 2021 at 2:52 PM Vishal Verma <vverma@xxxxxxxxxxxxxxxx> wrote: > > commit 021a24460dc2 ("block: add QUEUE_FLAG_NOWAIT") added support > for checking whether a given bdev supports handling of REQ_NOWAIT or not. > Since then commit 6abc49468eea ("dm: add support for REQ_NOWAIT and enable > it for linear target") added support for REQ_NOWAIT for dm. This uses > a similar approach to incorporate REQ_NOWAIT for md based bios. > > Signed-off-by: Vishal Verma <vverma@xxxxxxxxxxxxxxxx> > --- > drivers/md/md.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/md/md.c b/drivers/md/md.c > index 5111ed966947..51b2df32aed5 100644 > --- a/drivers/md/md.c > +++ b/drivers/md/md.c > @@ -419,6 +419,12 @@ void md_handle_request(struct mddev *mddev, struct bio *bio) > if (is_suspended(mddev, bio)) { > DEFINE_WAIT(__wait); > for (;;) { > + /* Bail out if REQ_NOWAIT is set for the bio */ > + if (bio->bi_opf & REQ_NOWAIT) { > + bio_wouldblock_error(bio); > + break; This doesn't look right to me. We already run bio_endio() in bio_wouldblock_error(), then we still feed the bio to make_request(). Did I misread the logic? Please also explain how this patch was tested. Thanks, Song > + } > + > prepare_to_wait(&mddev->sb_wait, &__wait, > TASK_UNINTERRUPTIBLE); > if (!is_suspended(mddev, bio)) [...]