diff options
author | Satish Kharat <satishkh@cisco.com> | 2019-01-15 02:09:23 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-01-23 03:18:34 +0100 |
commit | 68f03bd1eec6b064644e4b20dbc4a0f54a27b6b1 (patch) | |
tree | afa56b2199e6cf54f4adc306298b0b4826d03e9e /drivers/scsi/fnic | |
parent | scsi: fnic: vnic_rq_clean change BUG_ON to WARN_ON (diff) | |
download | linux-68f03bd1eec6b064644e4b20dbc4a0f54a27b6b1.tar.xz linux-68f03bd1eec6b064644e4b20dbc4a0f54a27b6b1.zip |
scsi: fnic: use fnic_lock to guard fnic->state_flags
Need to use fnic_lock as well as host lock in that order to set state
flags.
[mkp: typos]
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/fnic')
-rw-r--r-- | drivers/scsi/fnic/fnic_scsi.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index cafbcfb85bfa..a49b0f36b2f8 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -180,20 +180,19 @@ void __fnic_set_state_flags(struct fnic *fnic, unsigned long st_flags, unsigned long clearbits) { - struct Scsi_Host *host = fnic->lport->host; - int sh_locked = spin_is_locked(host->host_lock); unsigned long flags = 0; + unsigned long host_lock_flags = 0; - if (!sh_locked) - spin_lock_irqsave(host->host_lock, flags); + spin_lock_irqsave(&fnic->fnic_lock, flags); + spin_lock_irqsave(fnic->lport->host->host_lock, host_lock_flags); if (clearbits) fnic->state_flags &= ~st_flags; else fnic->state_flags |= st_flags; - if (!sh_locked) - spin_unlock_irqrestore(host->host_lock, flags); + spin_unlock_irqrestore(fnic->lport->host->host_lock, host_lock_flags); + spin_unlock_irqrestore(&fnic->fnic_lock, flags); return; } |