scsi: ibmvfc: flush rport_add_work_q during driver teardown

INIT_WORK is called on rport_add_work_q during driver probe. When the
adapter is removed, ibmvfc_remove() stops the work thread and proceeds
to tear down the FC host, but any work item queued via schedule_work()
that raced the teardown could still be running or pending in the
system workqueue.

Add a flush_work() call after kthread_stop() and before fc_remove_host()
to drain any outstanding rport add work before the FC host and its rports
are torn down.

Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Link: https://patch.msgid.link/20260723000149.969416-3-tyreld@linux.ibm.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Tyrel Datwyler
2026-07-22 17:01:18 -07:00
committed by Martin K. Petersen
parent 9c2aa65000
commit 7e35396ec8

View File

@@ -6443,6 +6443,7 @@ static void ibmvfc_remove(struct vio_dev *vdev)
ibmvfc_wait_while_resetting(vhost);
kthread_stop(vhost->work_thread);
flush_work(&vhost->rport_add_work_q);
fc_remove_host(vhost->host);
scsi_remove_host(vhost->host);