debuggers.hg

changeset 20889:e1d61c5a008d

blktap: fix blktapctrl abort

On rebooting a hvm, the blktapctrl daemon has died.

gdb shows the following call trace:
(gdb) where
#0 0x00000039d1830155 in raise () from /lib64/libc.so.6
#1 0x00000039d1831bf0 in abort () from /lib64/libc.so.6
#2 0x00000039d186a38b in __libc_message () from /lib64/libc.so.6
#3 0x00000039d1871634 in _int_free () from /lib64/libc.so.6
#4 0x00000039d1874c5c in free () from /lib64/libc.so.6
#5 0x0000003320a01bdd in ueblktap_probe (h=3D0x6073b0,=20
w=<value optimized out>, bepath_im=<value optimized out>) at
xenbus.c:270
#6 0x0000003320a020e0 in xs_fire_next_watch (h=3D0x6073b0) at
xs_api.c:355
#7 0x0000000000401785 in main (argc=3D<value optimized out>,
argv=<value optimized out>) at blktapctrl.c:907

There is a case that "/local/domain/0/backend/tap/<dom_id>" exists but
"/local/domain/<dom_id>/vm" is not in the xenstore.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jan 22 11:00:45 2010 +0000 (2010-01-22)
parents 9c6ba538ce75
children ca0759a08057
files tools/blktap/lib/xenbus.c
line diff
     1.1 --- a/tools/blktap/lib/xenbus.c	Fri Jan 22 10:59:51 2010 +0000
     1.2 +++ b/tools/blktap/lib/xenbus.c	Fri Jan 22 11:00:45 2010 +0000
     1.3 @@ -232,8 +232,11 @@ static int check_sharing(struct xs_handl
     1.4  			ret = -1;
     1.5  			break;
     1.6  		}
     1.7 +		cur_dom_uuid = NULL;
     1.8  		xs_gather(h, path, "vm", NULL, &cur_dom_uuid, NULL);
     1.9  		free(path);
    1.10 +		if (!cur_dom_uuid)
    1.11 +			continue;
    1.12  
    1.13  		if (!strcmp(cur_dom_uuid, dom_uuid)) {
    1.14  			free(cur_dom_uuid);
    1.15 @@ -256,8 +259,11 @@ static int check_sharing(struct xs_handl
    1.16  				ret = -1;
    1.17  				break;
    1.18  			}
    1.19 +			params = NULL;
    1.20  			xs_gather(h, path, "params", NULL, &params, NULL);
    1.21  			free(path);
    1.22 +			if (!params)
    1.23 +				continue;
    1.24  
    1.25  			image_path[1] = get_image_path(params);
    1.26  			if (!strcmp(image_path[0], image_path[1])) {