Skip to content

Commit 63832aa

Browse files
quadstorNicholas Bellinger
authored andcommitted
qla2xxx: Fix schedule_delayed_work() for target timeout calculations
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 <[email protected]> Cc: <[email protected]> #3.6+ Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 94a7111 commit 63832aa

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/scsi/qla2xxx/qla_target.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ static void qlt_schedule_sess_for_deletion(struct qla_tgt_sess *sess,
471471
schedule_delayed_work(&tgt->sess_del_work, 0);
472472
else
473473
schedule_delayed_work(&tgt->sess_del_work,
474-
jiffies - sess->expires);
474+
sess->expires - jiffies);
475475
}
476476

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

555555
spin_lock_irqsave(&ha->hardware_lock, flags);
556556
while (!list_empty(&tgt->del_sess_list)) {
557557
sess = list_entry(tgt->del_sess_list.next, typeof(*sess),
558558
del_list_entry);
559-
if (time_after_eq(jiffies, sess->expires)) {
559+
elapsed = jiffies;
560+
if (time_after_eq(elapsed, sess->expires)) {
560561
qlt_undelete_sess(sess);
561562

562563
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf004,
@@ -566,7 +567,7 @@ static void qlt_del_sess_work_fn(struct delayed_work *work)
566567
ha->tgt.tgt_ops->put_sess(sess);
567568
} else {
568569
schedule_delayed_work(&tgt->sess_del_work,
569-
jiffies - sess->expires);
570+
sess->expires - elapsed);
570571
break;
571572
}
572573
}

0 commit comments

Comments
 (0)