From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>,
stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 13/19] block/sheepdog: Propagate errors through get_sheep_fd()
Date: Fri, 16 May 2014 11:00:20 +0200 [thread overview]
Message-ID: <1400230826-18009-14-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1400230826-18009-1-git-send-email-armbru@redhat.com>
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
block/sheepdog.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index ff0aa89..b932d68 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -668,7 +668,7 @@ static void coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
enum AIOCBState aiocb_type);
static void coroutine_fn resend_aioreq(BDRVSheepdogState *s, AIOReq *aio_req);
static int reload_inode(BDRVSheepdogState *s, uint32_t snapid, const char *tag);
-static int get_sheep_fd(BDRVSheepdogState *s);
+static int get_sheep_fd(BDRVSheepdogState *s, Error **errp);
static void co_write_request(void *opaque);
static AIOReq *find_pending_req(BDRVSheepdogState *s, uint64_t oid)
@@ -705,6 +705,7 @@ static void coroutine_fn send_pending_req(BDRVSheepdogState *s, uint64_t oid)
static coroutine_fn void reconnect_to_sdog(void *opaque)
{
+ Error *local_err = NULL;
BDRVSheepdogState *s = opaque;
AIOReq *aio_req, *next;
@@ -719,9 +720,11 @@ static coroutine_fn void reconnect_to_sdog(void *opaque)
/* Try to reconnect the sheepdog server every one second. */
while (s->fd < 0) {
- s->fd = get_sheep_fd(s);
+ s->fd = get_sheep_fd(s, &local_err);
if (s->fd < 0) {
DPRINTF("Wait for connection to be established\n");
+ qerror_report_err(local_err);
+ error_free(local_err);
co_aio_sleep_ns(bdrv_get_aio_context(s->bs), QEMU_CLOCK_REALTIME,
1000000000ULL);
}
@@ -910,15 +913,12 @@ static void co_write_request(void *opaque)
* We cannot use this descriptor for other operations because
* the block driver may be on waiting response from the server.
*/
-static int get_sheep_fd(BDRVSheepdogState *s)
+static int get_sheep_fd(BDRVSheepdogState *s, Error **errp)
{
- Error *local_err = NULL;
int fd;
- fd = connect_to_sdog(s, &local_err);
+ fd = connect_to_sdog(s, errp);
if (fd < 0) {
- qerror_report_err(local_err);
- error_free(local_err);
return fd;
}
@@ -1415,8 +1415,10 @@ static int sd_open(BlockDriverState *bs, QDict *options, int flags,
if (ret < 0) {
goto out;
}
- s->fd = get_sheep_fd(s);
+ s->fd = get_sheep_fd(s, &local_err);
if (s->fd < 0) {
+ qerror_report_err(local_err);
+ error_free(local_err);
ret = s->fd;
goto out;
}
--
1.8.1.4
next prev parent reply other threads:[~2014-05-16 9:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 9:00 [Qemu-devel] [PATCH v2 00/19] block: Purge qerror_report() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 01/19] blockdev: Don't use qerror_report_err() in drive_init() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 02/19] blockdev: Don't use qerror_report() in do_drive_del() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 03/19] qemu-nbd: Don't use qerror_report() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 04/19] block/rbd: Propagate errors to open and create methods Markus Armbruster
2014-05-16 12:06 ` Eric Blake
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 05/19] block/ssh: Drop superfluous libssh2_session_last_errno() calls Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 06/19] block/ssh: Propagate errors through check_host_key() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 07/19] block/ssh: Propagate errors through authenticate() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 08/19] block/ssh: Propagate errors through connect_to_ssh() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 09/19] block/ssh: Propagate errors to open and create methods Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 10/19] block/vvfat: Propagate errors through enable_write_target() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 11/19] block/vvfat: Propagate errors through init_directories() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 12/19] block/sheepdog: Propagate errors through connect_to_sdog() Markus Armbruster
2014-05-16 9:00 ` Markus Armbruster [this message]
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 14/19] block/sheepdog: Propagate errors through sd_prealloc() Markus Armbruster
2014-05-16 13:05 ` Eric Blake
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 15/19] block/sheepdog: Propagate errors through do_sd_create() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 16/19] block/sheepdog: Propagate errors through find_vdi_name() Markus Armbruster
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 17/19] block/sheepdog: Propagate errors to open and create methods Markus Armbruster
2014-05-16 13:06 ` Eric Blake
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 18/19] block/sheepdog: Fix silent sd_open(), sd_create() failures Markus Armbruster
2014-05-16 13:06 ` Eric Blake
2014-05-16 9:00 ` [Qemu-devel] [PATCH v2 19/19] block/sheepdog: Don't use qerror_report() Markus Armbruster
2014-05-23 15:40 ` [Qemu-devel] [PATCH v2 00/19] block: Purge qerror_report() 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=1400230826-18009-14-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=morita.kazutaka@lab.ntt.co.jp \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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;
as well as URLs for NNTP newsgroup(s).