Return-Path: Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:26511 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726959AbgC0MpY (ORCPT ); Fri, 27 Mar 2020 08:45:24 -0400 From: Cornelia Huck Subject: [PATCH 1/2] s390/cio: avoid duplicated 'ADD' uevents Date: Fri, 27 Mar 2020 13:45:02 +0100 Message-Id: <20200327124503.9794-2-cohuck@redhat.com> In-Reply-To: <20200327124503.9794-1-cohuck@redhat.com> References: <20200327124503.9794-1-cohuck@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-s390-owner@vger.kernel.org List-ID: To: linux-s390@vger.kernel.org Cc: Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Peter Oberparleiter , Eric Farman , Halil Pasic , Boris Fiuczynski , Cornelia Huck 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. Reported-by: Boris Fiuczynski Fixes: fa1a8c23eb7d ("s390: cio: Delay uevents for subchannels") Signed-off-by: Cornelia Huck --- drivers/s390/cio/device.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 0c6245fc7706..983f9c9e08de 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -849,8 +849,10 @@ static void io_subchannel_register(struct ccw_device= *cdev) * Now we know this subchannel will stay, we can throw * our delayed uevent. */ - dev_set_uevent_suppress(&sch->dev, 0); - kobject_uevent(&sch->dev.kobj, KOBJ_ADD); + if (dev_get_uevent_suppress(&sch->dev)) { + dev_set_uevent_suppress(&sch->dev, 0); + kobject_uevent(&sch->dev.kobj, KOBJ_ADD); + } /* make it known to the system */ ret =3D ccw_device_add(cdev); if (ret) { @@ -1058,8 +1060,11 @@ static int io_subchannel_probe(struct subchannel *= sch) * Throw the delayed uevent for the subchannel, register * the ccw_device and exit. */ - dev_set_uevent_suppress(&sch->dev, 0); - kobject_uevent(&sch->dev.kobj, KOBJ_ADD); + if (dev_get_uevent_suppress(&sch->dev)) { + /* should always be the case for the console */ + dev_set_uevent_suppress(&sch->dev, 0); + kobject_uevent(&sch->dev.kobj, KOBJ_ADD); + } cdev =3D sch_get_cdev(sch); rc =3D ccw_device_add(cdev); if (rc) { --=20 2.21.1