diff mbox series

s390/zfcp: Ensure synchronous unit_add

Message ID 20250603182252.2287285-2-niharp@linux.ibm.com
State New
Headers show
Series s390/zfcp: Ensure synchronous unit_add | expand

Commit Message

Nihar Panda June 3, 2025, 6:21 p.m. UTC
From: Peter Oberparleiter <oberpar@linux.ibm.com>

Improve the usability of the unit_add sysfs attribute by ensuring that
the associated FCP LUN scan processing is completed synchronously.
This enables configuration tooling to consistently determine the end of
the scan process to allow for serialization of follow-on actions.

While the scan process associated with unit_add typically completes
synchronously, it is deferred to an asynchronous background process if
unit_add is used before initial remote port scanning has completed.
This occurs when unit_add is used immediately after setting the
associated FCP device online.

To ensure synchronous unit_add processing, wait for remote port scanning
to complete before initiating the FCP LUN scan.

Note: Adding Cc: stable since this commit addresses a usability bug
      of the unit_add sysfs attribute.

Cc: stable@vger.kernel.org
Reviewed-by: M Nikhil <nikh1092@linux.ibm.com>
Reviewed-by: Nihar Panda <niharp@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Nihar Panda <niharp@linux.ibm.com>
---
 drivers/s390/scsi/zfcp_sysfs.c | 2 ++
 1 file changed, 2 insertions(+)


base-commit: e8007fad5457ea547ca63bb011fdb03213571c7e
diff mbox series

Patch

diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 41e36af35488..90a84ae98b97 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -449,6 +449,8 @@  static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
 	if (kstrtoull(buf, 0, (unsigned long long *) &fcp_lun))
 		return -EINVAL;
 
+	flush_work(&port->rport_work);
+
 	retval = zfcp_unit_add(port, fcp_lun);
 	if (retval)
 		return retval;