Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: qla2xxx: Add qla2x00_async_done() for async routines

This done routine will delete the timer and check for its return value and
decrease the reference count accordingly. This prevents boot hangs reported
after commit 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB")
was merged.

Link: https://lore.kernel.org/r/20220208093946.4471-1-njavali@marvell.com
Fixes: 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB")
Reported-by: Ewan Milne <emilne@redhat.com>
Tested-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Saurav Kashyap and committed by
Martin K. Petersen
49b729f5 62ed6622

+16 -1
+16 -1
drivers/scsi/qla2xxx/qla_iocb.c
··· 2560 2560 } 2561 2561 } 2562 2562 2563 + static void 2564 + qla2x00_async_done(struct srb *sp, int res) 2565 + { 2566 + if (del_timer(&sp->u.iocb_cmd.timer)) { 2567 + /* 2568 + * Successfully cancelled the timeout handler 2569 + * ref: TMR 2570 + */ 2571 + if (kref_put(&sp->cmd_kref, qla2x00_sp_release)) 2572 + return; 2573 + } 2574 + sp->async_done(sp, res); 2575 + } 2576 + 2563 2577 void 2564 2578 qla2x00_sp_release(struct kref *kref) 2565 2579 { ··· 2587 2573 void (*done)(struct srb *sp, int res)) 2588 2574 { 2589 2575 timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0); 2590 - sp->done = done; 2576 + sp->done = qla2x00_async_done; 2577 + sp->async_done = done; 2591 2578 sp->free = qla2x00_sp_free; 2592 2579 sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; 2593 2580 sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ;