public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH ]  scsi/ipr: keep the order of locks
@ 2022-09-18  2:36 flyingpeng(彭浩)
  0 siblings, 0 replies; 4+ messages in thread
From: flyingpeng(彭浩) @ 2022-09-18  2:36 UTC (permalink / raw)
  To: jejb@linux.ibm.com, martin.petersen@oracle.com; +Cc: linux-scsi@vger.kernel.org

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@tencent.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH ] scsi/ipr: keep the order of locks
@ 2022-09-23 14:51 Hao Peng
  2022-10-01  9:32 ` Martin K. Petersen
  0 siblings, 1 reply; 4+ messages in thread
From: Hao Peng @ 2022-09-23 14:51 UTC (permalink / raw)
  To: jejb@linux.ibm.com, martin.petersen@oracle.com; +Cc: linux-scsi@vger.kernel.org

From: Peng Hao <flyingpeng@tencent.com>

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@tencent.com>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH ] scsi/ipr: keep the order of locks
  2022-09-23 14:51 [PATCH ] scsi/ipr: keep the order of locks Hao Peng
@ 2022-10-01  9:32 ` Martin K. Petersen
  2022-10-02  4:14   ` Hao Peng
  0 siblings, 1 reply; 4+ messages in thread
From: Martin K. Petersen @ 2022-10-01  9:32 UTC (permalink / raw)
  To: Hao Peng
  Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org


> 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.

Please make sure to copy the driver maintainer when submitting patches:

$ ./scripts/get_maintainer.pl drivers/scsi/ipr.c | head -1
Brian King <brking@us.ibm.com> (supporter:IBM Power Linux RAID adapter)

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH ] scsi/ipr: keep the order of locks
  2022-10-01  9:32 ` Martin K. Petersen
@ 2022-10-02  4:14   ` Hao Peng
  0 siblings, 0 replies; 4+ messages in thread
From: Hao Peng @ 2022-10-02  4:14 UTC (permalink / raw)
  To: brking
  Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org

On Sat, Oct 1, 2022 at 5:33 PM Martin K. Petersen
<martin.petersen@oracle.com> wrote:
>
>
> > 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.
>
> Please make sure to copy the driver maintainer when submitting patches:
>
> $ ./scripts/get_maintainer.pl drivers/scsi/ipr.c | head -1
> Brian King <brking@us.ibm.com> (supporter:IBM Power Linux RAID adapter)
>
> --
> Martin K. Petersen      Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-02  4:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-23 14:51 [PATCH ] scsi/ipr: keep the order of locks Hao Peng
2022-10-01  9:32 ` Martin K. Petersen
2022-10-02  4:14   ` Hao Peng
  -- strict thread matches above, loose matches on Subject: below --
2022-09-18  2:36 flyingpeng(彭浩)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox