ia64/xen-unstable

changeset 14066:f62a052384a5

[BLKTAP] fix sysfs cleanup on error case
Signed-off-by: Jake Wires <jwires@xensource.com>
author Jake Wires <jwires@xensource.com>
date Wed Feb 21 18:38:11 2007 -0800 (2007-02-21)
parents eb190b1faa52
children 202eb735b425 0a970a431bbc
files linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Wed Feb 21 20:30:37 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Wed Feb 21 18:38:11 2007 -0800
     1.3 @@ -47,6 +47,7 @@ struct backend_info
     1.4  	blkif_t *blkif;
     1.5  	struct xenbus_watch backend_watch;
     1.6  	int xenbus_id;
     1.7 +	int group_added;
     1.8  };
     1.9  
    1.10  
    1.11 @@ -150,7 +151,12 @@ static struct attribute_group tapstat_gr
    1.12  
    1.13  int xentap_sysfs_addif(struct xenbus_device *dev)
    1.14  {
    1.15 -	return sysfs_create_group(&dev->dev.kobj, &tapstat_group);
    1.16 +	int err;
    1.17 +	struct backend_info *be = dev->dev.driver_data;
    1.18 +	err = sysfs_create_group(&dev->dev.kobj, &tapstat_group);
    1.19 +	if (!err)
    1.20 +		be->group_added = 1;
    1.21 +	return err;
    1.22  }
    1.23  
    1.24  void xentap_sysfs_delif(struct xenbus_device *dev)
    1.25 @@ -174,7 +180,8 @@ static int blktap_remove(struct xenbus_d
    1.26  		tap_blkif_free(be->blkif);
    1.27  		be->blkif = NULL;
    1.28  	}
    1.29 -	xentap_sysfs_delif(be->dev);
    1.30 +	if (be->group_added)
    1.31 +		xentap_sysfs_delif(be->dev);
    1.32  	kfree(be);
    1.33  	dev->dev.driver_data = NULL;
    1.34  	return 0;