On 06/16/2017 07:48 AM, Maurizio Lombardi wrote:
Dne 16.6.2017 v 14:40 Douglas Miller napsal(a):
I'd like to add that we are seeing this problem with singlepath installations and need to get this fixed upstream as soon as possible. RHEL new product contains this fix and is working for us, but we need to be able to offer other distros as well. I am currently running this patch on a custom-built Ubuntu 16.04.2 kernel and it is fixing the problem there.
What needs to be done to get this patch accepted?
Note that James proposed a different patch to fix this bug.
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 65fed71..ae89082 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -375,6 +375,7 @@ int enclosure_add_device(struct enclosure_device *edev, int component,
struct device *dev)
{
struct enclosure_component *cdev;
+ int err;
if (!edev || component >= edev->components)
return -EINVAL;
@@ -384,12 +385,15 @@ int enclosure_add_device(struct enclosure_device *edev, int component,
if (cdev->dev == dev)
return -EEXIST;
- if (cdev->dev)
+ if (cdev->dev) {
enclosure_remove_links(cdev);
-
- put_device(cdev->dev);
- cdev->dev = get_device(dev);
- return enclosure_add_links(cdev);
+ put_device(cdev->dev);
+ cdev->dev = NULL;
+ }
+ err = enclosure_add_links(cdev);
+ if (!err)
+ cdev->dev = get_device(dev);
+ return err;
}
EXPORT_SYMBOL_GPL(enclosure_add_device);
I will test this out. Thanks.