Skip to contentSkip to conversation

csiostor:Fix locking issues in the function csio_scsim_cleanup_io_lnode

PATCH RESEND Jens Axboe 1 participant 1 message Dec 29, 2015 1 message not in the archive SCSI

lore
Share & tools
lore

Jens Axboe

author
#1 lore raw
In reply to a message not in the archive
Quoted 18 lines · Nicholas Krause

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 +0 -0
index 2c4562d..c318855 100644

drivers/scsi/csiostor/csio_scsi.c csio_scsim_cleanup_io_lnode(struct csio_scsim *scm, struct csio_lnode *ln) · line 1332

Quoted 6 lines
drivers/scsi/csiostor/csio_scsi.c +2 -0
@@ -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);

All the callers grab that lock, you've just added a deadlock instead.

Nick, I've said this before and I'll say this again. Stop sending me patches. They are all untested and broken, you are wasting peoples time.

Signature · 1 line
Jens Axboe