]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: core: Register sysfs attributes earlier
authorBart Van Assche <bvanassche@acm.org>
Tue, 12 Oct 2021 23:35:13 +0000 (16:35 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sun, 17 Oct 2021 01:45:52 +0000 (21:45 -0400)
commitd9214e2f6fa1ac2fa69f46552fdbaa70102efa14
treec59608ec54742e0aa884314dc72507390aad36eb
parent64e45e01dcd930ac743f974a497e22952636c6c3
scsi: core: Register sysfs attributes earlier

A quote from Documentation/driver-api/driver-model/device.rst:
"Word of warning:  While the kernel allows device_create_file() and
device_remove_file() to be called on a device at any time, userspace has
strict expectations on when attributes get created.  When a new device is
registered in the kernel, a uevent is generated to notify userspace (like
udev) that a new device is available.  If attributes are added after the
device is registered, then userspace won't get notified and userspace will
not know about the new attributes."

Hence register SCSI host sysfs attributes before the SCSI host shost_dev
uevent is emitted instead of after that event has been emitted.

Link: https://lore.kernel.org/r/20211012233558.4066756-2-bvanassche@acm.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hosts.c
drivers/scsi/scsi_priv.h
drivers/scsi/scsi_sysfs.c
include/scsi/scsi_device.h
include/scsi/scsi_host.h