From: Chris Lalancette <clalance@redhat.com> Date: Thu, 17 Jul 2008 17:28:45 +0200 Subject: [xen] don't try to recreate sysfs entries Message-id: 487F652D.8090904@redhat.com O-Subject: [RHEL5.3 PATCH 4/7]: Don't try to recreate sysfs entries v2 Bugzilla: 250104 RH-Acked-by: Stephen Tweedie <sct@redhat.com> RH-Acked-by: Bill Burns <bburns@redhat.com> RH-Acked-by: Don Dutile <ddutile@redhat.com> This patch makes sure that tap_update_blkif_status() does not fail to update statistics because it fails to re-create existing sysfs entries. From xen-3.1-testing.hg c/s 15078 diff --git a/drivers/xen/blktap/xenbus.c b/drivers/xen/blktap/xenbus.c index a9a9c2b..38dbcb3 100644 --- a/drivers/xen/blktap/xenbus.c +++ b/drivers/xen/blktap/xenbus.c @@ -161,7 +161,9 @@ int xentap_sysfs_addif(struct xenbus_device *dev) void xentap_sysfs_delif(struct xenbus_device *dev) { + struct backend_info *be = dev->dev.driver_data; sysfs_remove_group(&dev->dev.kobj, &tapstat_group); + be->group_added = 0; } static int blktap_remove(struct xenbus_device *dev) @@ -212,11 +214,13 @@ static void tap_update_blkif_status(blkif_t *blkif) return; } - err = xentap_sysfs_addif(blkif->be->dev); - if (err) { - xenbus_dev_fatal(blkif->be->dev, err, - "creating sysfs entries"); - return; + if (!blkif->be->group_added) { + err = xentap_sysfs_addif(blkif->be->dev); + if (err) { + xenbus_dev_fatal(blkif->be->dev, err, + "creating sysfs entries"); + return; + } } blkif->xenblkd = kthread_run(tap_blkif_schedule, blkif, name);