Revert "s390: use device_remove_file_self() instead of device_schedule_callback()"

This reverts commit bdbb0a1376.

Tejun writes:
        I'm sorry but can you please revert the whole series?
        get_active() waiting while a node is deactivated has potential
        to lead to deadlock and that deactivate/reactivate interface is
        something fundamentally flawed and that cgroup will have to work
        with the remove_self() like everybody else.  IOW, I think the
        first posting was correct.

Cc: Tejun Heo <tj@kernel.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2014-01-13 13:55:05 -08:00
parent a30f82b7eb
commit ff483d55ba
4 changed files with 27 additions and 32 deletions

View File

@ -23,7 +23,6 @@ struct ccwgroup_device {
unsigned int count; unsigned int count;
struct device dev; struct device dev;
struct ccw_device *cdev[0]; struct ccw_device *cdev[0];
struct work_struct ungroup_work;
}; };
/** /**

View File

@ -48,27 +48,29 @@ static ssize_t show_pfgid(struct device *dev, struct device_attribute *attr,
} }
static DEVICE_ATTR(pfgid, S_IRUGO, show_pfgid, NULL); static DEVICE_ATTR(pfgid, S_IRUGO, show_pfgid, NULL);
static ssize_t store_recover(struct device *dev, struct device_attribute *attr, static void recover_callback(struct device *dev)
const char *buf, size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = get_zdev(pdev);
int ret; int ret;
if (!device_remove_file_self(dev, attr))
return count;
pci_stop_and_remove_bus_device(pdev); pci_stop_and_remove_bus_device(pdev);
ret = zpci_disable_device(zdev); ret = zpci_disable_device(zdev);
if (ret) if (ret)
return ret; return;
ret = zpci_enable_device(zdev); ret = zpci_enable_device(zdev);
if (ret) if (ret)
return ret; return;
pci_rescan_bus(zdev->bus); pci_rescan_bus(zdev->bus);
return count; }
static ssize_t store_recover(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
int rc = device_schedule_callback(dev, recover_callback);
return rc ? rc : count;
} }
static DEVICE_ATTR(recover, S_IWUSR, NULL, store_recover); static DEVICE_ATTR(recover, S_IWUSR, NULL, store_recover);

View File

@ -304,6 +304,12 @@ dcssblk_load_segment(char *name, struct segment_info **seg_info)
return rc; return rc;
} }
static void dcssblk_unregister_callback(struct device *dev)
{
device_unregister(dev);
put_device(dev);
}
/* /*
* device attribute for switching shared/nonshared (exclusive) * device attribute for switching shared/nonshared (exclusive)
* operation (show + store) * operation (show + store)
@ -391,13 +397,7 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch
blk_cleanup_queue(dev_info->dcssblk_queue); blk_cleanup_queue(dev_info->dcssblk_queue);
dev_info->gd->queue = NULL; dev_info->gd->queue = NULL;
put_disk(dev_info->gd); put_disk(dev_info->gd);
up_write(&dcssblk_devices_sem); rc = device_schedule_callback(dev, dcssblk_unregister_callback);
if (device_remove_file_self(dev, attr)) {
device_unregister(dev);
put_device(dev);
}
return rc;
out: out:
up_write(&dcssblk_devices_sem); up_write(&dcssblk_devices_sem);
return rc; return rc;

View File

@ -168,12 +168,14 @@ static ssize_t ccwgroup_online_show(struct device *dev,
* Provide an 'ungroup' attribute so the user can remove group devices no * Provide an 'ungroup' attribute so the user can remove group devices no
* longer needed or accidentially created. Saves memory :) * longer needed or accidentially created. Saves memory :)
*/ */
static void ccwgroup_ungroup(struct ccwgroup_device *gdev) static void ccwgroup_ungroup_callback(struct device *dev)
{ {
struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
mutex_lock(&gdev->reg_mutex); mutex_lock(&gdev->reg_mutex);
if (device_is_registered(&gdev->dev)) { if (device_is_registered(&gdev->dev)) {
__ccwgroup_remove_symlinks(gdev); __ccwgroup_remove_symlinks(gdev);
device_unregister(&gdev->dev); device_unregister(dev);
__ccwgroup_remove_cdev_refs(gdev); __ccwgroup_remove_cdev_refs(gdev);
} }
mutex_unlock(&gdev->reg_mutex); mutex_unlock(&gdev->reg_mutex);
@ -193,9 +195,10 @@ static ssize_t ccwgroup_ungroup_store(struct device *dev,
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
/* Note that we cannot unregister the device from one of its
if (device_remove_file_self(dev, attr)) * attribute methods, so we have to use this roundabout approach.
ccwgroup_ungroup(gdev); */
rc = device_schedule_callback(dev, ccwgroup_ungroup_callback);
out: out:
if (rc) { if (rc) {
if (rc != -EAGAIN) if (rc != -EAGAIN)
@ -221,14 +224,6 @@ static const struct attribute_group *ccwgroup_attr_groups[] = {
NULL, NULL,
}; };
static void ccwgroup_ungroup_workfn(struct work_struct *work)
{
struct ccwgroup_device *gdev =
container_of(work, struct ccwgroup_device, ungroup_work);
ccwgroup_ungroup(gdev);
}
static void ccwgroup_release(struct device *dev) static void ccwgroup_release(struct device *dev)
{ {
kfree(to_ccwgroupdev(dev)); kfree(to_ccwgroupdev(dev));
@ -328,7 +323,6 @@ int ccwgroup_create_dev(struct device *parent, struct ccwgroup_driver *gdrv,
atomic_set(&gdev->onoff, 0); atomic_set(&gdev->onoff, 0);
mutex_init(&gdev->reg_mutex); mutex_init(&gdev->reg_mutex);
mutex_lock(&gdev->reg_mutex); mutex_lock(&gdev->reg_mutex);
INIT_WORK(&gdev->ungroup_work, ccwgroup_ungroup_workfn);
gdev->count = num_devices; gdev->count = num_devices;
gdev->dev.bus = &ccwgroup_bus_type; gdev->dev.bus = &ccwgroup_bus_type;
gdev->dev.parent = parent; gdev->dev.parent = parent;
@ -410,10 +404,10 @@ EXPORT_SYMBOL(ccwgroup_create_dev);
static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action, static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action,
void *data) void *data)
{ {
struct ccwgroup_device *gdev = to_ccwgroupdev(data); struct device *dev = data;
if (action == BUS_NOTIFY_UNBIND_DRIVER) if (action == BUS_NOTIFY_UNBIND_DRIVER)
schedule_work(&gdev->ungroup_work); device_schedule_callback(dev, ccwgroup_ungroup_callback);
return NOTIFY_OK; return NOTIFY_OK;
} }