Skip to contentSkip to conversation

csiostor:Fix locking issues in the function csio_scsim_cleanup_io_lnode

PATCH Anish Bhatt 2 participants 3 messages Sep 3, 2015 – Sep 4, 2015 1 message not in the archive SCSI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Anish Bhatt

author Acked-by
#1 lore raw
Quoted 36 lines

-----Original Message-----
From: Nicholas Krause [mailto:[email protected]]
Sent: Wednesday, September 2, 2015 10:36 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Anish Bhatt; Hariprasad S; [email protected]; linux- [email protected]
Subject: [PATCH] csiostor:Fix locking issues in the function csio_scsim_cleanup_io_lnode

This fixes locking issues in the function csio_scsim_cleanup_io_lnode by locking around the call to the function csio_csci_gather_active_ios with the function pair spin_lock_irq/spin_unlock_irq as any function calling this particular function must do in order to avoid concurrent threads of execution on the passed structure pointer of type csio_hw as this structure pointer can be shared across mutliple threads in the kernel.

---
 drivers/scsi/csiostor/csio_scsi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/csiostor/csio_scsi.c +2 -0
index 2c4562d..c318855 100644
@@ -1327,7 +1327,9 @@ csio_scsim_cleanup_io_lnode(struct csio_scsim
 *scm, struct csio_lnode *ln)
 	sld.level = CSIO_LEV_LNODE;
 	sld.lnode = ln;
 	INIT_LIST_HEAD(&ln->cmpl_q);
+	spin_lock_irq(&hw->lock);
 	csio_scsi_gather_active_ios(scm, &sld, &ln->cmpl_q);
+	spin_unlock_irq(&hw->lock);
 
 	/* No I/Os pending on this lnode  */
Quoted 3 lines

if (list_empty(&ln->cmpl_q))
--
2.1.4

Acked-by Anish Bhatt
#2 lore raw

csio_scsim_cleanup_io_lnode always called with spin_lock_irq held. Please refer:
csio_attr.c:624: csio_scsim_cleanup_io_lnode(csio_hw_to_scsim(hw), ln);
csio_attr.c:649: csio_scsim_cleanup_io_lnode(csio_hw_to_scsim(hw), ln);

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Anish Bhatt
Sent: Thursday, September 03, 2015 7:07 AM
To: Nicholas Krause; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hariprasad S; [email protected]; [email protected]
Subject: RE: [PATCH] csiostor:Fix locking issues in the function csio_scsim_cleanup_io_lnode

Quoted 37 lines

-----Original Message-----
From: Nicholas Krause [mailto:[email protected]]
Sent: Wednesday, September 2, 2015 10:36 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Anish Bhatt; Hariprasad S; [email protected]; linux- [email protected]
Subject: [PATCH] csiostor:Fix locking issues in the function csio_scsim_cleanup_io_lnode

This fixes locking issues in the function csio_scsim_cleanup_io_lnode by locking around the call to the function csio_csci_gather_active_ios with the function pair spin_lock_irq/spin_unlock_irq as any function calling this particular function must do in order to avoid concurrent threads of execution on the passed structure pointer of type csio_hw as this structure pointer can be shared across mutliple threads in the kernel.

---
 drivers/scsi/csiostor/csio_scsi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/csiostor/csio_scsi.c +2 -0
index 2c4562d..c318855 100644
@@ -1327,7 +1327,9 @@ csio_scsim_cleanup_io_lnode(struct csio_scsim 
 *scm, struct csio_lnode *ln)
 	sld.level = CSIO_LEV_LNODE;
 	sld.lnode = ln;
 	INIT_LIST_HEAD(&ln->cmpl_q);
+	spin_lock_irq(&hw->lock);
 	csio_scsi_gather_active_ios(scm, &sld, &ln->cmpl_q);
+	spin_unlock_irq(&hw->lock);
 
 	/* No I/Os pending on this lnode  */
Quoted 3 lines

if (list_empty(&ln->cmpl_q))
--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 65 lines

-----Original Message-----
From: Praveen Madhavan
Sent: Friday, September 4, 2015 6:12 AM
To: Anish Bhatt; Nicholas Krause; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hariprasad S; [email protected]; [email protected]
Subject: RE: [PATCH] csiostor:Fix locking issues in the function csio_scsim_cleanup_io_lnode

csio_scsim_cleanup_io_lnode always called with spin_lock_irq held. Please refer:
csio_attr.c:624: csio_scsim_cleanup_io_lnode(csio_hw_to_scsim(hw),
ln);
csio_attr.c:649:
csio_scsim_cleanup_io_lnode(csio_hw_to_scsim(hw), ln);

-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Anish Bhatt
Sent: Thursday, September 03, 2015 7:07 AM
To: Nicholas Krause; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hariprasad S; [email protected]; [email protected]
Subject: RE: [PATCH] csiostor:Fix locking issues in the function csio_scsim_cleanup_io_lnode

Quoted 10 lines

-----Original Message-----
From: Nicholas Krause [mailto:[email protected]]
Sent: Wednesday, September 2, 2015 10:36 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Anish Bhatt; Hariprasad S; [email protected]; linux- [email protected]
Subject: [PATCH] csiostor:Fix locking issues in the function csio_scsim_cleanup_io_lnode

Quoted 6 lines

This fixes locking issues in the function csio_scsim_cleanup_io_lnode by locking around the call to the function csio_csci_gather_active_ios with the function pair spin_lock_irq/spin_unlock_irq as any function calling this particular function must do in order to avoid concurrent threads of execution on the passed structure pointer of type csio_hw as this structure pointer can be shared across mutliple threads in the

kernel.

Quoted 20 lines
---
 drivers/scsi/csiostor/csio_scsi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/csiostor/csio_scsi.c +2 -0
index 2c4562d..c318855 100644
@@ -1327,7 +1327,9 @@ csio_scsim_cleanup_io_lnode(struct csio_scsim
 *scm, struct csio_lnode *ln)
 	sld.level = CSIO_LEV_LNODE;
 	sld.lnode = ln;
 	INIT_LIST_HEAD(&ln->cmpl_q);
+	spin_lock_irq(&hw->lock);
 	csio_scsi_gather_active_ios(scm, &sld, &ln->cmpl_q);
+	spin_unlock_irq(&hw->lock);
 
Quoted 6 lines
Quoted 4 lines
drivers/scsi/csiostor/csio_scsi.c +0 -0
 	/* No I/Os pending on this lnode  */

if (list_empty(&ln->cmpl_q))
--
2.1.4

My bad, NACK.