Skip to content

Commit

Permalink
qla2xxx: Fix schedule_delayed_work() for target timeout calculations
Browse files Browse the repository at this point in the history
This patch fixes two cases in qla_target.c code where the
schedule_delayed_work() value was being incorrectly calculated
from sess->expires - jiffies.

Signed-off-by: Shivaram U <shivaram.u@quadstor.com>
Cc: <stable@vger.kernel.org> #3.6+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Shivaram Upadhyayula authored and Nicholas Bellinger committed Dec 12, 2013
1 parent 94a7111 commit 63832aa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/scsi/qla2xxx/qla_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ static void qlt_schedule_sess_for_deletion(struct qla_tgt_sess *sess,
schedule_delayed_work(&tgt->sess_del_work, 0);
else
schedule_delayed_work(&tgt->sess_del_work,
jiffies - sess->expires);
sess->expires - jiffies);
}

/* ha->hardware_lock supposed to be held on entry */
Expand Down Expand Up @@ -550,13 +550,14 @@ static void qlt_del_sess_work_fn(struct delayed_work *work)
struct scsi_qla_host *vha = tgt->vha;
struct qla_hw_data *ha = vha->hw;
struct qla_tgt_sess *sess;
unsigned long flags;
unsigned long flags, elapsed;

spin_lock_irqsave(&ha->hardware_lock, flags);
while (!list_empty(&tgt->del_sess_list)) {
sess = list_entry(tgt->del_sess_list.next, typeof(*sess),
del_list_entry);
if (time_after_eq(jiffies, sess->expires)) {
elapsed = jiffies;
if (time_after_eq(elapsed, sess->expires)) {
qlt_undelete_sess(sess);

ql_dbg(ql_dbg_tgt_mgt, vha, 0xf004,
Expand All @@ -566,7 +567,7 @@ static void qlt_del_sess_work_fn(struct delayed_work *work)
ha->tgt.tgt_ops->put_sess(sess);
} else {
schedule_delayed_work(&tgt->sess_del_work,
jiffies - sess->expires);
sess->expires - elapsed);
break;
}
}
Expand Down

0 comments on commit 63832aa

Please sign in to comment.