Skip to content

Commit fee7871

Browse files
Bhanu GollapudiJames Bottomley
authored andcommitted
[SCSI] bnx2fc: IO completion not processed due to missed wakeup
Driver does not detect a new CQE (completion queue entry) if a thread receives the wakup when it is in TASK_RUNNING state. Fix is to set the state to TASK_INTERRUPTIBLE while holding the fp_work_lock. Also, Use __set_current_task() since it is now set inside a spinlock with synchronization. Two other related optimizations: 1. After we exit the while (!kthread_should_stop()) loop, use __set_current_state() since synchronization is no longer needed. 2. Remove set_current_state(TASK_RUNNING) after schedule() since it should always be TASK_RUNNING after schedule(). Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
1 parent 2dcb0a6 commit fee7871

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/scsi/bnx2fc/bnx2fc_fcoe.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,17 +437,16 @@ static int bnx2fc_l2_rcv_thread(void *arg)
437437
set_current_state(TASK_INTERRUPTIBLE);
438438
while (!kthread_should_stop()) {
439439
schedule();
440-
set_current_state(TASK_RUNNING);
441440
spin_lock_bh(&bg->fcoe_rx_list.lock);
442441
while ((skb = __skb_dequeue(&bg->fcoe_rx_list)) != NULL) {
443442
spin_unlock_bh(&bg->fcoe_rx_list.lock);
444443
bnx2fc_recv_frame(skb);
445444
spin_lock_bh(&bg->fcoe_rx_list.lock);
446445
}
446+
__set_current_state(TASK_INTERRUPTIBLE);
447447
spin_unlock_bh(&bg->fcoe_rx_list.lock);
448-
set_current_state(TASK_INTERRUPTIBLE);
449448
}
450-
set_current_state(TASK_RUNNING);
449+
__set_current_state(TASK_RUNNING);
451450
return 0;
452451
}
453452

@@ -569,7 +568,6 @@ int bnx2fc_percpu_io_thread(void *arg)
569568
set_current_state(TASK_INTERRUPTIBLE);
570569
while (!kthread_should_stop()) {
571570
schedule();
572-
set_current_state(TASK_RUNNING);
573571
spin_lock_bh(&p->fp_work_lock);
574572
while (!list_empty(&p->work_list)) {
575573
list_splice_init(&p->work_list, &work_list);
@@ -583,10 +581,10 @@ int bnx2fc_percpu_io_thread(void *arg)
583581

584582
spin_lock_bh(&p->fp_work_lock);
585583
}
584+
__set_current_state(TASK_INTERRUPTIBLE);
586585
spin_unlock_bh(&p->fp_work_lock);
587-
set_current_state(TASK_INTERRUPTIBLE);
588586
}
589-
set_current_state(TASK_RUNNING);
587+
__set_current_state(TASK_RUNNING);
590588

591589
return 0;
592590
}

0 commit comments

Comments
 (0)