From: "gordongong0350@gmail.com" <gordongong0350@gmail.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: "ian.jackson" <ian.jackson@eu.citrix.com>,
"ian.campbell" <ian.campbell@citrix.com>,
"stefano.stabellini" <stefano.stabellini@eu.citrix.com>
Subject: [tapdisk2][PATCH1/1] Fix vreq with error of -EBUSY fails 100 times too soon
Date: Fri, 28 Feb 2014 22:50:23 +0800 [thread overview]
Message-ID: <201402282250180185871@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 3386 bytes --]
Fix vreq with error of -EBUSY fails 100 times too soon, ?that?return EIO to td device layer. If this tddevice request is metadata of filesystem, the result is not good at all.
To reproduce it witch ?"./iozone -I -s 2G -r 512k -r 1m -r 2m -r 4m -i 0 -i 1 -f /data/iozone_test.tmp",the result is input/output error & iozone is stopped.
From ccc0ce3aede1f5c920036847ddb16b25969be7ba Mon Sep 17 00:00:00 2001From: Xiaodong Gong <gordongong0350@gmail.com>Date: Fri, 28 Feb 2014 03:01:19 -0500Subject: [PATCH] fix vreq with error of -EBUSY fails 100 times too soon,?return EIO to td device layer.
1) all free list is consumed by vreq in one or two block that? ?is seted in bat entry.2) vreq in fail queue, get a chance to run quickly, such as 90us.---?tools/blktap2/drivers/tapdisk-vbd.c | 17 ++++++++++++++---?tools/blktap2/drivers/tapdisk-vbd.h | ?1 +?2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/tools/blktap2/drivers/tapdisk-vbd.c b/tools/blktap2/drivers/tapdisk-vbd.cindex c665f27..529eb91 100644--- a/tools/blktap2/drivers/tapdisk-vbd.c+++ b/tools/blktap2/drivers/tapdisk-vbd.c@@ -1081,7 +1081,7 @@ tapdisk_vbd_check_state(td_vbd_t *vbd)? td_vbd_request_t *vreq, *tmp;?? tapdisk_vbd_for_each_request(vreq, tmp, &vbd->failed_requests)- if (vreq->num_retries >= TD_VBD_MAX_RETRIES)+ if (vreq->num_retries >= TD_VBD_MAX_RETRIES && vreq->busy_looping != 1 )? tapdisk_vbd_complete_vbd_request(vbd, vreq);?? if (!list_empty(&vbd->new_requests) ||@@ -1168,7 +1168,7 @@ tapdisk_vbd_complete_vbd_request(td_vbd_t *vbd, td_vbd_request_t *vreq)?{? if (!vreq->submitting && !vreq->secs_pending) {? if (vreq->status == BLKIF_RSP_ERROR &&- ?? ?vreq->num_retries < TD_VBD_MAX_RETRIES &&+ ?? ?(vreq->num_retries < TD_VBD_MAX_RETRIES || vreq->busy_looping == 1)&&? ?? ?!td_flag_test(vbd->state, TD_VBD_DEAD) &&? ?? ?!td_flag_test(vbd->state, TD_VBD_SHUTDOWN_REQUESTED))? tapdisk_vbd_move_request(vreq, &vbd->failed_requests);@@ -1450,17 +1450,28 @@ tapdisk_vbd_reissue_failed_requests(td_vbd_t *vbd)? gettimeofday(&now, NULL);?? tapdisk_vbd_for_each_request(vreq, tmp, &vbd->failed_requests) {+ uint64_t delta = 0;+? if (vreq->secs_pending)? continue;?? if (td_flag_test(vbd->state, TD_VBD_SHUTDOWN_REQUESTED))? goto fail;?+ if (vreq->num_retries > TD_VBD_MAX_RETRIES - 10) {+ delta = (now.tv_sec - vreq->last_try.tv_sec) * 1000000\+ + now.tv_usec - vreq->last_try.tv_usec;+ if (delta * vreq->num_retries < TD_VBD_RETRY_INTERVAL)+ vreq->busy_looping = 1;+ else+ vreq->busy_looping = 0;+ }+? if (vreq->error != -EBUSY &&? ?? ?now.tv_sec - vreq->last_try.tv_sec < TD_VBD_RETRY_INTERVAL)? continue;?- if (vreq->num_retries >= TD_VBD_MAX_RETRIES) {+ if (vreq->num_retries >= TD_VBD_MAX_RETRIES && vreq->busy_looping != 1) {? fail:? DBG(TLOG_INFO, "req %"PRIu64"retried %d times\n",? ?? ?vreq->req.id, vreq->num_retries);diff --git a/tools/blktap2/drivers/tapdisk-vbd.h b/tools/blktap2/drivers/tapdisk-vbd.hindex be084b2..9e5f5f6 100644--- a/tools/blktap2/drivers/tapdisk-vbd.h+++ b/tools/blktap2/drivers/tapdisk-vbd.h@@ -73,6 +73,7 @@ struct td_vbd_request {? int ? ? ? ? ? ? ? ? ? ? ? ? submitting;? int ? ? ? ? ? ? ? ? ? ? ? ? secs_pending;? int ? ? ? ? ? ? ? ? ? ? ? ? num_retries;+ int ? ? ? ? ? ? ? ? ? ? ? ? busy_looping;? struct timeval ? ? ? ? ? ? ?last_try;?? td_vbd_t ? ? ? ? ? ? ? ? ? *vbd;--?1.8.3.1
gordongong0350@gmail.com
[-- Attachment #1.2: Type: text/html, Size: 17498 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next reply other threads:[~2014-02-28 14:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 14:50 gordongong0350 [this message]
2014-03-11 11:10 ` [tapdisk2][PATCH1/1] Fix vreq with error of -EBUSY fails 100 times too soon Ian Campbell
2014-04-01 16:30 ` Gordon Gong
-- strict thread matches above, loose matches on Subject: below --
2014-02-28 12:37 gordongong0350
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=201402282250180185871@gmail.com \
--to=gordongong0350@gmail.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.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;
as well as URLs for NNTP newsgroup(s).