On 20/08/2013 11:08, Mike Christie wrote:
Thanks for doing this and sorry for the lateness.


On 08/08/2013 08:25 AM, Or Gerlitz wrote:
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d24a286..6c6631c 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -225,20 +225,20 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc)
        cls_session = starget_to_session(scsi_target(sc->device));
        session = cls_session->dd_data;
- spin_lock_bh(&session->lock);
+       spin_lock_bh(&session->frwd_lock);
If we set the task->sc to a scsi_cmnd under the frwd_lock but then set
it to NULL and cleanup the task at completion time in the
iscsi_complete_task/iscsi_fail_task paths do we need to hold both locks
in the eh paths like here and iscsi_eh_abort?

In iscsi_free_task the back lock actually protects the insertion of this task back to the kfifo (just to make sure we're on the same page, the kfifo for itself it safe for single writer / single reader, so the back lock protects from insertion from multiple contexts). Resetting task->sc to NULL only takes place after the task refcount drops to zero and hence there's no contention and no need
to hold both locks.



It looks like locking around the requeue list is incorrect. For the
conn->requeue list we can add under the back lock but we are taking it
off with the frwd lock.

Good catch! iscsi_requeue_task should take the forward lock before inserting to the list

Is the max_cmdsn use correct? If we set it under the back_log but read
it under the frwd_lock will that work?  We really just need it to be
updated on the send side when it is updated on the recv side.

session->max_cmdsn is not updated on the send side, it is only updated on the recv side and it tells us to which value session->cmdsn can grow to. It is read under the forward lock indeed, but this isn't actually needed. Since the upcall/response flow is the only writer of the value (which for itself is protected with the back lock), and the reader can look without locking, in worst case the sender will see a closed
window and will re-try again later.


Shlomo and Or.


--
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to