From: Jens Axboe <axboe@kernel.dk>
To: Dmitry Krivenok <krivenok.dmitry@gmail.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/1] null_blk: fix handling of BLKPREP_DEFER case
Date: Mon, 27 Apr 2015 11:25:14 -0600 [thread overview]
Message-ID: <553E70FA.1080302@kernel.dk> (raw)
In-Reply-To: <CAJN_NGbXH0A8i9OF5Y95hsgCqdrE-CU5dRBsa6iNTKQPz+g+oA@mail.gmail.com>
On 04/19/2015 12:19 PM, Dmitry Krivenok wrote:
> When we fail to allocate new cmd in null_rq_prep_fn we return BLKPREP_DEFER
> which is not handled properly. In single-queue mode of null_blk the following
> command hangs forever in io_schedule():
> $ dd if=/dev/nullb0 of=/dev/null bs=8M count=5000 iflag=direct
>
> The reason is that when 64 commands have been allocated, the 65th command
> allocation will fail due to missing free tag. The request, however, will be
> kept in the queue which will never be started again (unless you run another
> command that does I/O to /dev/nullb0).
>
> This small patch tries to solve the issue by stopping the queue when we
> detect that all tags were exhausted and starting it again when we free the tag.
>
> I've verified that the command mentioned above doesn't hang anymore and also
> made sure that null_blk with my change survives fio-based stress tests.
You are right, legacy request_fn mode has a bug there. I'd get rid of
the no_cmds bool, though. If we fail allocating a command in alloc_cmd()
and we're in NULL_Q_RQ mode, stop the queue. In free_cmd(), again if
we're in NULL_Q_RQ_MODE, check the stopped flag and start the queue if
it is set.
--
Jens Axboe
next prev parent reply other threads:[~2015-04-27 17:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-19 18:19 [PATCH 1/1] null_blk: fix handling of BLKPREP_DEFER case Dmitry Krivenok
2015-04-27 16:52 ` Dmitry Krivenok
2015-04-27 17:25 ` Jens Axboe [this message]
2015-04-27 17:36 ` Jens Axboe
2015-04-27 21:47 ` Dmitry Krivenok
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=553E70FA.1080302@kernel.dk \
--to=axboe@kernel.dk \
--cc=krivenok.dmitry@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox