RE: [PATCH 2/2] qla2xxx: Properly set the tagging for commands.

2013-07-21 Thread Saurav Kashyap
HI Greg, Thanks, I will resend the relevant patch in proper way. Thanks, ~Saurav -Original Message- From: Greg KH [mailto:gre...@linuxfoundation.org] Sent: Friday, July 19, 2013 9:11 PM To: Saurav Kashyap Cc: jbottom...@parallels.com; sta...@vger.kernel.org; Giridhar Malavali; Andrew Va

RE: [PATCH 1/2] qla2xxx: Fix sparse warnings in qlafx00_fxdisc_iocb function.

2013-07-21 Thread Saurav Kashyap
HI James, Yes, agreed. I will resend the relevant patch set. Thanks, ~Saurav -Original Message- From: James Bottomley [mailto:jbottom...@parallels.com] Sent: Friday, July 19, 2013 8:14 PM To: Saurav Kashyap Cc: Giridhar Malavali; Andrew Vasquez; linux-scsi Subject: Re: [PATCH 1/2] qla2xx

[PATCH v5 1/4] [SCSI] sg: use rwsem to solve race during exclusive open

2013-07-21 Thread Vaughan Cao
A race condition may happen if two threads are both trying to open the same sg with O_EXCL simultaneously. It's possible that they both find fsds list is empty and get_exclude(sdp) returns 0, then they both call set_exclude() and break out from wait_event_interruptible and resume open. Now use rws

[PATCH v5 2/4] [SCSI] sg: no need sg_open_exclusive_lock

2013-07-21 Thread Vaughan Cao
Open exclusive check is protected by o_sem, no need sg_open_exclusive_lock. @exclude is used to record which type of rwsem we are holding. Signed-off-by: Vaughan Cao --- drivers/scsi/sg.c | 34 +- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/driv

[PATCH v5 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-21 Thread Vaughan Cao
Push file descriptor list locking down to per-device locking. Let sg_index_lock only protect device lookup. sdp->detached is also set and checked with this lock held. Changes from v4: * Since I use ERR_PTR and friends in sg_add_sfp, this patch should also be updated to resolve conflict in cherrry

[PATCH v5 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-21 Thread Vaughan Cao
@detached is set under the protection of sg_index_lock. Without getting the lock, new sfp will be added during sg removal and there is no chance for it to be picked out. So check with sg_index_lock held in sg_add_sfp(). Changes from v4: * use ERR_PTR series instead of adding another parameter in

[PATCH v5 0/4] [SCSI] sg: fix race condition in sg_open

2013-07-21 Thread Vaughan Cao
There is a race when open sg with O_EXCL flag. Also a race may happen between sg_open and sg_remove. Changes from v4: * [3/4] use ERR_PTR series instead of adding another parameter in sg_add_sfp * [4/4] fix conflict for cherry-pick from v3. Changes from v3: * release o_sem in sg_release(), not

[PATCH v5 4/4] [SCSI] sg: push file descriptor list locking down to per-device locking

2013-07-21 Thread Vaughan Cao
Push file descriptor list locking down to per-device locking. Let sg_index_lock only protect device lookup. sdp->detached is also set and checked with this lock held. Changes from v4: * Since I use ERR_PTR and friends in sg_add_sfp, this patch should also be updated to resolve conflict in cherrry

[PATCH v5 3/4] [SCSI] sg: checking sdp->detached isn't protected when open

2013-07-21 Thread Vaughan Cao
@detached is set under the protection of sg_index_lock. Without getting the lock, new sfp will be added during sg removal and there is no chance for it to be picked out. So check with sg_index_lock held in sg_add_sfp(). Changes from v4: * use ERR_PTR series instead of adding another parameter in