From bb4e5eec2473dadb154511ffd6149c6fa8861c05 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 24 Jul 2012 18:48:03 +0000 Subject: [PATCH] Add q2t_pre_xmit_response comment The fix for the locking bug I found in q2t_pre_xmit_response has already been added, but I had some comments in my copy that couldn't hurt. From "Robinson, Herbie" git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4418 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla2x00-target/qla2x00t.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 4b39f10d4..65102754d 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -2439,6 +2439,11 @@ static inline int q2t_has_data(struct q2t_cmd *cmd) return cmd->bufflen > 0; } +/* + * Acquires pha->hardware lock and returns with the lock held when + * the result == SCST_TGT_RES_SUCCESS. The lock is unlocked if an + * error is returned. + */ static int q2t_pre_xmit_response(struct q2t_cmd *cmd, struct q2t_prm *prm, int xmit_type, unsigned long *flags) { @@ -2545,6 +2550,8 @@ static int q2t_pre_xmit_response(struct q2t_cmd *cmd, /* Does F/W have an IOCBs for this request */ res = q2t_check_reserve_free_req(ha, full_req_cnt); + + /* The following check must match the callers' assumptions */ if (unlikely(res != SCST_TGT_RES_SUCCESS)) goto out_unlock_free_unmap;