OSDN Git Service

scsi: ufs-bsg: complete ufs-bsg job only if no error
authorBean Huo <beanhuo@micron.com>
Sun, 23 Jun 2019 17:38:56 +0000 (17:38 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 27 Jun 2019 02:42:24 +0000 (22:42 -0400)
commitb13a3539eb2affcb8833c189d68d6a4b99c41f6e
treeecf9271bab85a281c86dbefa5c2c4fc7d283d9f7
parentc870d65fe3084193113ec622049b6906b899366c
scsi: ufs-bsg: complete ufs-bsg job only if no error

In the case of UPIU/DME request execution failed in UFS device,
ufs_bsg_request() will complete the failed bsg job by calling
bsg_job_done(). Meanwhile, it returns this error status to blk-mq layer,
then triggers blk-mq completing this request again, this will cause the
following panic.

Call trace:
ll_sc___cmpxchg_case_acq_32+0x4/0x20
complete+0x28/0x70
blk_end_sync_rq+0x24/0x30
blk_mq_end_request+0xb8/0x118
bsg_job_put+0x4c/0x58
bsg_complete+0x20/0x30
blk_done_softirq+0xb4/0xe8
do_softirq+0x154/0x3f0
run_ksoftirqd+0x4c/0x68
smpboot_thread_fn+0x22c/0x268
kthread+0x130/0x138
ret_from_fork+0x10/0x1c
Code: f84107fe d65f03c0 d503201f f9800011 (885ffc10)
---[ end trace d92825bff6326e66 ]---
Kernel panic - not syncing: Fatal exception in interrupt

This patch is to fix this issue. The solution is to complete the ufs-bsg
job only if no error happened.

[mkp: commit description tweak]

Fixes: df032bf27a41 (scsi: ufs: Add a bsg endpoint that supports UPIUs)
Signed-off-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufs_bsg.c