[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [BLK] back: Only remove sysfs attributes if they were previously
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxxxx # Node ID c1119ff85f4e50d9071412d48f18e9d925773648 # Parent ffbdd113c74b396087fd000ea5e4e4d3a2c8f6be [BLK] back: Only remove sysfs attributes if they were previously added. Also check for errors during attribute creation. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff -r ffbdd113c74b -r c1119ff85f4e linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Fri Jun 30 14:15:12 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Fri Jun 30 14:30:43 2006 +0100 @@ -109,7 +109,7 @@ VBD_SHOW(mode, "%s\n", be->mode); int xenvbd_sysfs_addif(struct xenbus_device *dev) { - int error = 0; + int error; error = device_create_file(&dev->dev, &dev_attr_physical_device); if (error) @@ -157,7 +157,8 @@ static int blkback_remove(struct xenbus_ be->blkif = NULL; } - xenvbd_sysfs_delif(dev); + if (be->major || be->minor) + xenvbd_sysfs_delif(dev); kfree(be); dev->dev.driver_data = NULL; @@ -272,13 +273,18 @@ static void backend_changed(struct xenbu err = vbd_create(be->blkif, handle, major, minor, (NULL == strchr(be->mode, 'w'))); if (err) { - be->major = 0; - be->minor = 0; + be->major = be->minor = 0; xenbus_dev_fatal(dev, err, "creating vbd structure"); return; } - xenvbd_sysfs_addif(dev); + err = xenvbd_sysfs_addif(dev); + if (err) { + vbd_free(&be->blkif->vbd); + be->major = be->minor = 0; + xenbus_dev_fatal(dev, err, "creating sysfs entries"); + return; + } /* We're potentially connected now */ update_blkif_status(be->blkif); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |