From: Liu Yuan <namei.unix@gmail.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Subject: [Qemu-devel] [PATCH] sheepdog: don't update inode when create_and_write fails
Date: Sat, 15 Dec 2012 17:52:54 +0800 [thread overview]
Message-ID: <1355565174-5121-1-git-send-email-namei.unix@gmail.com> (raw)
From: Liu Yuan <tailai.ly@taobao.com>
For the error case such as SD_RES_NO_SPACE, we shouldn't update the inode bitmap
to avoid the scenario that the object is allocated but wasn't created at the
server side. This will result in VM's IO error on the failed object.
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
---
block/sheepdog.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index a48f58c..ef9e653 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -697,6 +697,12 @@ static void coroutine_fn aio_read_response(void *opaque)
acb = aio_req->aiocb;
+ if (rsp.result != SD_RES_SUCCESS) {
+ acb->ret = -EIO;
+ error_report("%s", sd_strerror(rsp.result));
+ goto err;
+ }
+
switch (acb->aiocb_type) {
case AIOCB_WRITE_UDATA:
/* this coroutine context is no longer suitable for co_recv
@@ -736,11 +742,7 @@ static void coroutine_fn aio_read_response(void *opaque)
break;
}
- if (rsp.result != SD_RES_SUCCESS) {
- acb->ret = -EIO;
- error_report("%s", sd_strerror(rsp.result));
- }
-
+err:
free_aio_req(s, aio_req);
if (!acb->nr_pending) {
/*
--
1.7.9.5
next reply other threads:[~2012-12-15 9:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-15 9:52 Liu Yuan [this message]
2012-12-15 9:58 ` [Qemu-devel] [PATCH] sheepdog: don't update inode when create_and_write fails Liu Yuan
2012-12-15 9:59 ` [Qemu-devel] [PATCH Update] " Liu Yuan
2012-12-17 3:43 ` MORITA Kazutaka
2012-12-17 5:22 ` Liu Yuan
2012-12-17 5:57 ` MORITA Kazutaka
2012-12-17 6:17 ` [Qemu-devel] [PATCH v2 1/2] " Liu Yuan
2012-12-17 6:17 ` [Qemu-devel] [PATCH v2 2/2] sheepdog: pass oid directly to send_pending_req() Liu Yuan
2012-12-17 7:49 ` MORITA Kazutaka
2012-12-17 7:49 ` [Qemu-devel] [PATCH v2 1/2] sheepdog: don't update inode when create_and_write fails MORITA Kazutaka
2012-12-19 14:25 ` Stefan Hajnoczi
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=1355565174-5121-1-git-send-email-namei.unix@gmail.com \
--to=namei.unix@gmail.com \
--cc=kwolf@redhat.com \
--cc=morita.kazutaka@lab.ntt.co.jp \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).