[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/17] gluster: Correctly propagate errors when volum
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 12/17] gluster: Correctly propagate errors when volume isn't accessible |
Date: |
Fri, 9 May 2014 21:03:32 +0200 |
From: Peter Krempa <address@hidden>
The docs for glfs_init suggest that the function sets errno on every
failure. In fact it doesn't. As other functions such as
qemu_gluster_open() in the gluster block code report their errors based
on this fact we need to make sure that errno is set on each failure.
This fixes a crash of qemu-img/qemu when a gluster brick isn't
accessible from given host while the server serving the volume
description is.
Thread 1 (Thread 0x7ffff7fba740 (LWP 203880)):
#0 0x00007ffff77673f8 in glfs_lseek () from /usr/lib64/libgfapi.so.0
#1 0x0000555555574a68 in qemu_gluster_getlength ()
#2 0x0000555555565742 in refresh_total_sectors ()
#3 0x000055555556914f in bdrv_open_common ()
#4 0x000055555556e8e8 in bdrv_open ()
#5 0x000055555556f02f in bdrv_open_image ()
#6 0x000055555556e5f6 in bdrv_open ()
#7 0x00005555555c5775 in bdrv_new_open ()
#8 0x00005555555c5b91 in img_info ()
#9 0x00007ffff62c9c05 in __libc_start_main () from /lib64/libc.so.6
#10 0x00005555555648ad in _start ()
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/gluster.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/block/gluster.c b/block/gluster.c
index 8836085..d0726ec 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -207,6 +207,11 @@ static struct glfs *qemu_gluster_init(GlusterConf *gconf,
const char *filename,
"volume=%s image=%s transport=%s", gconf->server,
gconf->port, gconf->volname, gconf->image,
gconf->transport);
+
+ /* glfs_init sometimes doesn't set errno although docs suggest that */
+ if (errno == 0)
+ errno = EINVAL;
+
goto out;
}
return glfs;
@@ -482,7 +487,7 @@ static int qemu_gluster_create(const char *filename,
glfs = qemu_gluster_init(gconf, filename, errp);
if (!glfs) {
- ret = -EINVAL;
+ ret = -errno;
goto out;
}
--
1.9.0
- Re: [Qemu-devel] [PULL 03/17] qemu-img: sort block formats in help message, (continued)
[Qemu-devel] [PULL 04/17] block/nfs: Check for NULL server part, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 06/17] qemu-img: Convert by cluster size if target is compressed, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 05/17] block/iscsi: bump year in copyright notice, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 07/17] vmdk: Implement .bdrv_write_compressed, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 08/17] vmdk: Implement .bdrv_get_info(), Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 09/17] qemu-iotests: Test converting to streamOptimized from small cluster size, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 10/17] block: Fix open flags with BDRV_O_SNAPSHOT, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 11/17] vl.c: remove init_clocks call from main, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 12/17] gluster: Correctly propagate errors when volume isn't accessible,
Stefan Hajnoczi <=
[Qemu-devel] [PULL 13/17] block/raw-posix: Try both FIEMAP and SEEK_HOLE, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 14/17] block: qemu-iotests - add common.qemu, for bash-controlled qemu tests, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 15/17] block: qemu-iotests - update 085 to use common.qemu, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 16/17] block: qemu-iotests - test for live migration, Stefan Hajnoczi, 2014/05/09
[Qemu-devel] [PULL 17/17] glib: fix g_poll early timeout on windows, Stefan Hajnoczi, 2014/05/09
Re: [Qemu-devel] [PULL 00/17] Block patches, Peter Maydell, 2014/05/13