Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/cio: avoid duplicated 'ADD' uevents

The common I/O layer delays the ADD uevent for subchannels and
delegates generating this uevent to the individual subchannel
drivers. The io_subchannel driver will do so when the associated
ccw_device has been registered -- but unconditionally, so more
ADD uevents will be generated if a subchannel has been unbound
from the io_subchannel driver and later rebound.

To fix this, only generate the ADD event if uevents were still
suppressed for the device.

Fixes: fa1a8c23eb7d ("s390: cio: Delay uevents for subchannels")
Message-Id: <20200327124503.9794-2-cohuck@redhat.com>
Reported-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Cornelia Huck and committed by
Vasily Gorbik
05ce3e53 9c159bbc

+9 -4
+9 -4
drivers/s390/cio/device.c
··· 849 849 * Now we know this subchannel will stay, we can throw 850 850 * our delayed uevent. 851 851 */ 852 - dev_set_uevent_suppress(&sch->dev, 0); 853 - kobject_uevent(&sch->dev.kobj, KOBJ_ADD); 852 + if (dev_get_uevent_suppress(&sch->dev)) { 853 + dev_set_uevent_suppress(&sch->dev, 0); 854 + kobject_uevent(&sch->dev.kobj, KOBJ_ADD); 855 + } 854 856 /* make it known to the system */ 855 857 ret = ccw_device_add(cdev); 856 858 if (ret) { ··· 1060 1058 * Throw the delayed uevent for the subchannel, register 1061 1059 * the ccw_device and exit. 1062 1060 */ 1063 - dev_set_uevent_suppress(&sch->dev, 0); 1064 - kobject_uevent(&sch->dev.kobj, KOBJ_ADD); 1061 + if (dev_get_uevent_suppress(&sch->dev)) { 1062 + /* should always be the case for the console */ 1063 + dev_set_uevent_suppress(&sch->dev, 0); 1064 + kobject_uevent(&sch->dev.kobj, KOBJ_ADD); 1065 + } 1065 1066 cdev = sch_get_cdev(sch); 1066 1067 rc = ccw_device_add(cdev); 1067 1068 if (rc) {