[PATCH ] scsi/ipr: keep the order of locks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ipr_ata_post_internal:
    acquire host_lock
       acquire hrrq->_lock
             ipr_device_reset
                 ipr_send_blocking_cmd
                    release host_lock
                    acquire host_lock
       release hrrq->_lock
    release host_lock

As shown above, there are two lock acquisition order changes.
At the same time, when ipr_device_reset is executed, the lock
hrrq->_lock does not need to be held.

Signed-off-by: Peng Hao <flyingpeng@xxxxxxxxxxx>
---
 drivers/scsi/ipr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 9d01a3e3c26a..6ca987dda397 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -6837,7 +6837,9 @@ static void ipr_ata_post_internal(struct ata_queued_cmd *qc)
                spin_lock(&hrrq->_lock);
                list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) {
                        if (ipr_cmd->qc == qc) {
+                               spin_unlock(&hrrq->_lock);
                                ipr_device_reset(ioa_cfg, sata_port->res);
+                               spin_lock(&hrrq->_lock);
                                break;
                        }
                }
--
2.27.0





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux