Skip to contentSkip to conversation

BUG: scsi/qla2xxx: BUG_ON(blk_queued_rq(req) is triggered in blk_finish_request

DISCUSSION jianchao.wang 1 participant 3 messages May 23, 2018 – May 24, 2018 1 message not in the archive SCSI

lore
Share & tools
lore
#0 lore raw

Hi all

Our customer met a panic triggered by BUG_ON in blk_finish_request.

Quoted 1 line

From the dmesg log, the BUG_ON was triggered after command abort occurred many times.

There is a race condition in the following scenario.

cpu A cpu B
kworker interrupt

scmd_eh_abort_handler()
-> scsi_try_to_abort_cmd()

    -> qla2xxx_eh_abort()                        
      -> qla2x00_eh_wait_on_command()   qla2x00_status_entry()   
                                          -> qla2x00_sp_compl()
                                            -> qla2x00_sp_free_dma()
  -> scsi_queue_insert()                          
    -> __scsi_queue_insert()                         
      -> blk_requeue_request()
        -> blk_clear_rq_complete()
                                            -> scsi_done
                                              -> blk_complete_request
                                                -> blk_mark_rq_complete       
          -> elv_requeue_request()              -> __blk_complete_request()
            -> __elv_add_request()
            // req will be queued here                                                         
                                                    BLK_SOFTIRQ
                                                    scsi_softirq_done()
                                                      -> scsi_finish_command()
                                                        -> scsi_io_completion()
                                                          -> scsi_end_request()
                                                            -> blk_finish_request()  // BUG_ON(blk_queued_rq(req)) !!!

The issue will not be triggered most of time, because the request is marked as complete by timeout path. So the scsi_done from qla2x00_sp_compl does nothing.
But as the scenario above, if the complete state has been cleaned by blk_requeue_request, we will get the request both requeued and completed, and then BUG_ON(blk_queued_rq(req)) in blk_finish_request comes up.

Is there any solution for this in qla2xxx driver side ?

Thanks
Jianchao

#1 lore raw

Would anyone please take a look at this ?

Thanks in advance
Jianchao

Quoted 45 lines · jianchao.wang

Hi all

Our customer met a panic triggered by BUG_ON in blk_finish_request.

Quoted 1 line

From the dmesg log, the BUG_ON was triggered after command abort occurred many times.

There is a race condition in the following scenario.

cpu A cpu B
kworker interrupt

scmd_eh_abort_handler()
-> scsi_try_to_abort_cmd()

    -> qla2xxx_eh_abort()                        
      -> qla2x00_eh_wait_on_command()   qla2x00_status_entry()   
                                          -> qla2x00_sp_compl()
                                            -> qla2x00_sp_free_dma()
  -> scsi_queue_insert()                          
    -> __scsi_queue_insert()                         
      -> blk_requeue_request()
        -> blk_clear_rq_complete()
                                            -> scsi_done
                                              -> blk_complete_request
                                                -> blk_mark_rq_complete       
          -> elv_requeue_request()              -> __blk_complete_request()
            -> __elv_add_request()
            // req will be queued here                                                         
                                                    BLK_SOFTIRQ
                                                    scsi_softirq_done()
                                                      -> scsi_finish_command()
                                                        -> scsi_io_completion()
                                                          -> scsi_end_request()
                                                            -> blk_finish_request()  // BUG_ON(blk_queued_rq(req)) !!!

The issue will not be triggered most of time, because the request is marked as complete by timeout path. So the scsi_done from qla2x00_sp_compl does nothing.
But as the scenario above, if the complete state has been cleaned by blk_requeue_request, we will get the request both requeued and completed, and then BUG_ON(blk_queued_rq(req)) in blk_finish_request comes up.

Is there any solution for this in qla2xxx driver side ?

Thanks
Jianchao

A message that is not in the archive (sent off-list or not yet received): SN4PR0701MB363286637D0317358D61ECBFF56A0@SN4PR0701MB3632.namprd07.prod.outlook.com

#3 lore raw

Hi Himanshu

Thanks god get response from your side finally :)
I get [email protected] from the maintainer information of driver/scsi/qla2xxx Looks like it should be modified.

Thanks
Jianchao

Quoted 74 lines · Himanshu

Hi,

Yes. We'll look at this issue.

Thanks,
Himanshu

Quoted 67 lines

-----Original Message-----
From: jianchao.wang [mailto:[email protected]]
Sent: Wednesday, May 23, 2018 6:51 PM
To: Dept-Eng QLA2xxx Upstream <[email protected]>; Madhani, Himanshu <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Martin K. Petersen <[email protected]>; Junxiao Bi <[email protected]>
Subject: Re: BUG: scsi/qla2xxx: BUG_ON(blk_queued_rq(req) is triggered in blk_finish_request

Would anyone please take a look at this ?

Thanks in advance
Jianchao

Quoted 6 lines · jianchao.wang

Hi all

Our customer met a panic triggered by BUG_ON in blk_finish_request.

Quoted 1 line

From the dmesg log, the BUG_ON was triggered after command abort

occurred many times.

Quoted 19 lines

There is a race condition in the following scenario.

cpu A cpu B
kworker interrupt

scmd_eh_abort_handler()
-> scsi_try_to_abort_cmd()

    -> qla2xxx_eh_abort()
      -> qla2x00_eh_wait_on_command()   qla2x00_status_entry()
                                          -> qla2x00_sp_compl()
                                            -> qla2x00_sp_free_dma()
  -> scsi_queue_insert()
    -> __scsi_queue_insert()
      -> blk_requeue_request()
        -> blk_clear_rq_complete()
                                            -> scsi_done
                                              -> blk_complete_request
                                                -> blk_mark_rq_complete
          -> elv_requeue_request()              -> __blk_complete_request()
Quoted 8 lines
            -> __elv_add_request()
            // req will be queued here
                                                    BLK_SOFTIRQ
                                                    scsi_softirq_done()
                                                      -> scsi_finish_command()
                                                        -> scsi_io_completion()
                                                          -> scsi_end_request()
                                                            -> blk_finish_request()  //

BUG_ON(blk_queued_rq(req)) !!!

Quoted 2 lines

The issue will not be triggered most of time, because the request is marked as

complete by timeout path.

Quoted 2 lines

So the scsi_done from qla2x00_sp_compl does nothing.
But as the scenario above, if the complete state has been cleaned by

blk_requeue_request, we will get

Quoted 1 line

the request both requeued and completed, and then

BUG_ON(blk_queued_rq(req)) in blk_finish_request comes up.

Quoted 7 lines

Is there any solution for this in qla2xxx driver side ?

Thanks
Jianchao