From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: ming.lei@redhat.com
Cc: linux-block@vger.kernel.org,
Gabriel Krisman Bertazi <krisman@collabora.com>
Subject: [PATCH ubdsrv] tgt_null: Return number of sectors read/written
Date: Tue, 21 Jun 2022 18:48:39 -0400 [thread overview]
Message-ID: <20220621224839.76007-1-krisman@collabora.com> (raw)
Hi Ming,
I wrote this against your devel-v3 branch. I'm wondering if you plan to
send a new version of the kernel patch soon? From the latest
discussions, I don't think there were major issues found on review. :)
I hope people don't mind I cc'd linux-block about this userspace code.
Please, let me know if I shouldn't do that.
-- >8 --
The number of sectors read/written is used to verify forward progress of
the request inside the kernel. If we return 0 here, the kernel
understands that as an IO failure (see first check in ubd_complete_rq),
and will reissue the request, causing an infinite loop of unfullfilled
requests. This can be reproduced with:
ubdsrv/ubd add -t null -n0 -q1 -d1
dd if=/dev/vda of=/dev/ubdb0 count=1 bs=4k
The approach minics nullblk, which returns the total IO size.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
tgt_null.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tgt_null.c b/tgt_null.c
index 85636c405f0c..61850a2cd046 100644
--- a/tgt_null.c
+++ b/tgt_null.c
@@ -20,7 +20,9 @@ static int null_init_tgt(struct ubdsrv_tgt_info *tgt, int type, int argc,
static int null_handle_io_async(struct ubdsrv_queue *q, struct ubd_io *io,
int tag)
{
- ubdsrv_mark_io_done(io, 0);
+ const struct ubdsrv_io_desc *iod = ubdsrv_get_iod(q, tag);
+
+ ubdsrv_mark_io_done(io, iod->nr_sectors << 9);
return 0;
}
--
2.36.1
next reply other threads:[~2022-06-21 22:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 22:48 Gabriel Krisman Bertazi [this message]
2022-06-22 0:19 ` [PATCH ubdsrv] tgt_null: Return number of sectors read/written Ming Lei
2022-06-22 16:23 ` Gabriel Krisman Bertazi
2022-06-27 7:46 ` Ming Lei
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=20220621224839.76007-1-krisman@collabora.com \
--to=krisman@collabora.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
/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