]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/scsi/scsi_transport_srp.c
scsi: Protect SCSI device state changes with a mutex
[karo-tx-linux.git] / drivers / scsi / scsi_transport_srp.c
index 3c5d89852e9f0a8ed124444b25fc13f7f1fe937d..f617021c94f740e6dd8fe8ac2526405a4319c6d2 100644 (file)
@@ -554,11 +554,12 @@ int srp_reconnect_rport(struct srp_rport *rport)
                 * invoking scsi_target_unblock() won't change the state of
                 * these devices into running so do that explicitly.
                 */
-               spin_lock_irq(shost->host_lock);
-               __shost_for_each_device(sdev, shost)
+               shost_for_each_device(sdev, shost) {
+                       mutex_lock(&sdev->state_mutex);
                        if (sdev->sdev_state == SDEV_OFFLINE)
                                sdev->sdev_state = SDEV_RUNNING;
-               spin_unlock_irq(shost->host_lock);
+                       mutex_unlock(&sdev->state_mutex);
+               }
        } else if (rport->state == SRP_RPORT_RUNNING) {
                /*
                 * srp_reconnect_rport() has been invoked with fast_io_fail