Re: [Qemu-devel] [PULL 12/17] gluster: Correctly propagate errors when volume isn't accessible

2014-05-14 Thread Stefan Hajnoczi
On Mon, May 12, 2014 at 10:07:07AM -0600, Eric Blake wrote:
 On 05/09/2014 01:03 PM, Stefan Hajnoczi wrote:
  From: Peter Krempa pkre...@redhat.com
  
  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 0x77fba740 (LWP 203880)):
   #0  0x777673f8 in glfs_lseek () from /usr/lib64/libgfapi.so.0
   #1  0x55574a68 in qemu_gluster_getlength ()
   #2  0x55565742 in refresh_total_sectors ()
   #3  0x5556914f in bdrv_open_common ()
   #4  0x5556e8e8 in bdrv_open ()
   #5  0x5556f02f in bdrv_open_image ()
   #6  0x5556e5f6 in bdrv_open ()
   #7  0x555c5775 in bdrv_new_open ()
   #8  0x555c5b91 in img_info ()
   #9  0x762c9c05 in __libc_start_main () from /lib64/libc.so.6
   #10 0x555648ad in _start ()
  
  Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
  ---
 
 Isn't this missing S-o-b from Peter?

Good catch.  Peter, can you send your Signed-off-by: please?

Stefan



Re: [Qemu-devel] [PULL 12/17] gluster: Correctly propagate errors when volume isn't accessible

2014-05-14 Thread Peter Krempa
On 05/14/14 14:36, Stefan Hajnoczi wrote:
 On Mon, May 12, 2014 at 10:07:07AM -0600, Eric Blake wrote:
 On 05/09/2014 01:03 PM, Stefan Hajnoczi wrote:
 From: Peter Krempa pkre...@redhat.com

 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 0x77fba740 (LWP 203880)):
  #0  0x777673f8 in glfs_lseek () from /usr/lib64/libgfapi.so.0
  #1  0x55574a68 in qemu_gluster_getlength ()
  #2  0x55565742 in refresh_total_sectors ()
  #3  0x5556914f in bdrv_open_common ()
  #4  0x5556e8e8 in bdrv_open ()
  #5  0x5556f02f in bdrv_open_image ()
  #6  0x5556e5f6 in bdrv_open ()
  #7  0x555c5775 in bdrv_new_open ()
  #8  0x555c5b91 in img_info ()
  #9  0x762c9c05 in __libc_start_main () from /lib64/libc.so.6
  #10 0x555648ad in _start ()

 Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
 ---

 Isn't this missing S-o-b from Peter?
 
 Good catch.  Peter, can you send your Signed-off-by: please?
 
 Stefan
 

As this patch was already pulled to master as:

commit 4557117d9eed8cadc360aec23b42fc39a7011864
Author: Peter Krempa pkre...@redhat.com
Date:   Fri May 9 12:08:10 2014 +0200

gluster: Correctly propagate errors when volume isn't accessible

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 0x77fba740 (LWP 203880)):
 #0  0x777673f8 in glfs_lseek () from /usr/lib64/libgfapi.so.0
 #1  0x55574a68 in qemu_gluster_getlength ()
 #2  0x55565742 in refresh_total_sectors ()
 #3  0x5556914f in bdrv_open_common ()
 #4  0x5556e8e8 in bdrv_open ()
 #5  0x5556f02f in bdrv_open_image ()
 #6  0x5556e5f6 in bdrv_open ()
 #7  0x555c5775 in bdrv_new_open ()
 #8  0x555c5b91 in img_info ()
 #9  0x762c9c05 in __libc_start_main () from /lib64/libc.so.6
 #10 0x555648ad in _start ()


Signed-off-by: Stefan Hajnoczi stefa...@redhat.com

I'm explicitly expressing my signoff here:

Signed-off-by: Peter Krempa pkre...@redhat.com

Sorry for the hassle.

Peter




signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PULL 12/17] gluster: Correctly propagate errors when volume isn't accessible

2014-05-12 Thread Eric Blake
On 05/09/2014 01:03 PM, Stefan Hajnoczi wrote:
 From: Peter Krempa pkre...@redhat.com
 
 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 0x77fba740 (LWP 203880)):
  #0  0x777673f8 in glfs_lseek () from /usr/lib64/libgfapi.so.0
  #1  0x55574a68 in qemu_gluster_getlength ()
  #2  0x55565742 in refresh_total_sectors ()
  #3  0x5556914f in bdrv_open_common ()
  #4  0x5556e8e8 in bdrv_open ()
  #5  0x5556f02f in bdrv_open_image ()
  #6  0x5556e5f6 in bdrv_open ()
  #7  0x555c5775 in bdrv_new_open ()
  #8  0x555c5b91 in img_info ()
  #9  0x762c9c05 in __libc_start_main () from /lib64/libc.so.6
  #10 0x555648ad in _start ()
 
 Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
 ---

Isn't this missing S-o-b from Peter?

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PULL 12/17] gluster: Correctly propagate errors when volume isn't accessible

2014-05-09 Thread Stefan Hajnoczi
From: Peter Krempa pkre...@redhat.com

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 0x77fba740 (LWP 203880)):
 #0  0x777673f8 in glfs_lseek () from /usr/lib64/libgfapi.so.0
 #1  0x55574a68 in qemu_gluster_getlength ()
 #2  0x55565742 in refresh_total_sectors ()
 #3  0x5556914f in bdrv_open_common ()
 #4  0x5556e8e8 in bdrv_open ()
 #5  0x5556f02f in bdrv_open_image ()
 #6  0x5556e5f6 in bdrv_open ()
 #7  0x555c5775 in bdrv_new_open ()
 #8  0x555c5b91 in img_info ()
 #9  0x762c9c05 in __libc_start_main () from /lib64/libc.so.6
 #10 0x555648ad in _start ()

Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
---
 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