On Tue, May 25, 2021 at 01:05:56PM -0500, Mike Christie wrote: > With one worker we will always send the scsi cmd responses then send the > TMF rsp, because LIO will always complete the scsi cmds first which > calls vhost_scsi_release_cmd to add them to the work queue. > > When the next patches adds multiple worker support, the worker threads > could still be sending their responses when the tmf's work is run. > So this patch has vhost-scsi flush the IO vqs on other worker threads > before we send the tmf response. > > Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx> > --- > drivers/vhost/scsi.c | 17 ++++++++++++++--- > drivers/vhost/vhost.c | 6 ++++++ > drivers/vhost/vhost.h | 1 + > 3 files changed, 21 insertions(+), 3 deletions(-) > > diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c > index 46f897e41217..e585f2180457 100644 > --- a/drivers/vhost/scsi.c > +++ b/drivers/vhost/scsi.c > @@ -1168,12 +1168,23 @@ static void vhost_scsi_tmf_resp_work(struct vhost_work *work) > { > struct vhost_scsi_tmf *tmf = container_of(work, struct vhost_scsi_tmf, > vwork); > - int resp_code; > + int resp_code, i; > + > + if (tmf->scsi_resp == TMR_FUNCTION_COMPLETE) { > + /* > + * When processing a TMF lio completes the cmds then the TMF, > + * so with one worker the TMF always completes after cmds. For > + * multiple worker support we must flush the IO vqs to make > + * sure if they have differrent workers then the cmds have s/differrent/different/ Reviewed-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
Attachment:
signature.asc
Description: PGP signature