ia64/xen-unstable

changeset 19685:45447c0f7c6e

blktap: Revert parts of c/s 19349.

Caused blktapctrl pipes to be created with uninitialised variable in name.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 01 14:02:26 2009 +0100 (2009-06-01)
parents 46468a3b2d5f
children 50134a902c66
files tools/blktap/drivers/blktapctrl.c
line diff
     1.1 --- a/tools/blktap/drivers/blktapctrl.c	Sat May 30 13:25:32 2009 +0100
     1.2 +++ b/tools/blktap/drivers/blktapctrl.c	Mon Jun 01 14:02:26 2009 +0100
     1.3 @@ -659,6 +659,9 @@ static int blktapctrl_new_blkif(blkif_t 
     1.4  
     1.5  	DPRINTF("Received a poll for a new vbd\n");
     1.6  	if ( ((blk=blkif->info) != NULL) && (blk->params != NULL) ) {
     1.7 +		if (blktap_interface_create(ctlfd, &major, &minor, blkif) < 0)
     1.8 +			return -1;
     1.9 +
    1.10  		if (test_path(blk->params, &ptr, &type, &exist, &use_ioemu) != 0) {
    1.11                          DPRINTF("Error in blktap device string(%s).\n",
    1.12                                  blk->params);
    1.13 @@ -682,6 +685,10 @@ static int blktapctrl_new_blkif(blkif_t 
    1.14  			blkif->fds[WRITE] = exist->fds[WRITE];
    1.15  		}
    1.16  
    1.17 +		add_disktype(blkif, type);
    1.18 +		blkif->major = major;
    1.19 +		blkif->minor = minor;
    1.20 +
    1.21  		image = (image_t *)malloc(sizeof(image_t));
    1.22  		blkif->prv = (void *)image;
    1.23  		blkif->ops = &tapdisk_ops;
    1.24 @@ -705,18 +712,11 @@ static int blktapctrl_new_blkif(blkif_t 
    1.25  			goto fail;
    1.26  		}
    1.27  
    1.28 -		if (blktap_interface_create(ctlfd, &major, &minor, blkif) < 0)
    1.29 -			return -1;
    1.30 -
    1.31 -		blkif->major = major;
    1.32 -		blkif->minor = minor;
    1.33 -
    1.34 -		add_disktype(blkif, type);
    1.35 -
    1.36  	} else return -1;
    1.37  
    1.38  	return 0;
    1.39  fail:
    1.40 +	ioctl(ctlfd, BLKTAP_IOCTL_FREEINTF, minor);
    1.41  	return -EINVAL;
    1.42  }
    1.43