> From: Bart Van Assche <bvanassche@xxxxxxx> > Sent: Wednesday, June 28, 2023 4:54 AM > To: hoyoung seo <hy50.seo@xxxxxxxxxxx> > Cc: Arthur.Simchaev@xxxxxxx; JBottomley@xxxxxxxxxxxxx; > adrian.hunter@xxxxxxxxx; athierry@xxxxxxxxxx; avri.altman@xxxxxxx; > beanhuo@xxxxxxxxxx; jaegeuk@xxxxxxxxxx; jejb@xxxxxxxxxxxxx; linux- > scsi@xxxxxxxxxxxxxxx; martin.petersen@xxxxxxxxxx; > quic_asutoshd@xxxxxxxxxxx; quic_ziqichen@xxxxxxxxxxx; santoshsy@xxxxxxxxx; > stanley.chu@xxxxxxxxxxxx; cpgs@xxxxxxxxxxx; sc.suh@xxxxxxxxxxx; > kwmad.kim@xxxxxxxxxxx; kwangwon.min@xxxxxxxxxxx; sh425.lee@xxxxxxxxxxx > Subject: Re: [PATCH v3 2/4] scsi: ufs: Fix handling of lrbp->cmd > > On 6/26/23 18:26, hoyoung seo wrote: > > @@ -5408,7 +5406,6 @@ static void ufshcd_release_scsi_cmd(struct ufs_hba > *hba, > > struct scsi_cmnd *cmd = lrbp->cmd; > > > > scsi_dma_unmap(cmd); > > - lrbp->cmd = NULL; /* Mark the command as completed. */ > > ufshcd_release(hba); > > ufshcd_clk_scaling_update_busy(hba); > > } > > > > Hi, > > Is there any reason to delete "lrbp->cmd = NULL"? > > As far as I know, clear to NULL to indicate that cmd is completed. > > > > When the UFS MCQ mode is activated, check that lrbp->cmd is NULL to > check the completion of the command. > > https://lore.kernel.org/linux-scsi/f0d923ee1f009f171a55c258d044e814ec0 > > 917ab.1685396241.git.quic_nguyenb@xxxxxxxxxxx/ > > > > If there is no special reason, why don't you add "lrb->cmd = NULL" again? > > The lrbp->cmd = NULL assignment has been removed because if it would be > kept the SCSI error handler would crash if it reuses a SCSI command. See > also the > scsi_eh_prep_cmnd() and scsi_eh_restore_cmnd() callers. The MCQ code > should still work because it uses blk_mq_request_started() to check > whether or not a request is still active. > > Bart. Hi, Thank you for your kind reply. Let me take a closer look at the code of the scsi layer Seo.