Message ID | eaf06511-1cef-c8ab-3864-70d5312abbb1@cybernetics.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On 2018-07-12 06:09 PM, Tony Battersby wrote: > The calling convention of blk_get_request() has changed in lk 4.18; > update the comment in sg.c to match. > > Fixes: ff005a066240 ("block: sanitize blk_get_request calling conventions") > Signed-off-by: Tony Battersby <tonyb@cybernetics.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> > --- > > I wrote the original comment in commit 7772855a996e ("sg: fix EWOULDBLOCK > errors with scsi-mq") back in 2015. > > diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c > index cd2fdac..1b90e5a 100644 > --- a/drivers/scsi/sg.c > +++ b/drivers/scsi/sg.c > @@ -1741,15 +1741,11 @@ sg_start_req(Sg_request *srp, unsigned char *cmd) > * > * With scsi-mq enabled, there are a fixed number of preallocated > * requests equal in number to shost->can_queue. If all of the > - * preallocated requests are already in use, then using GFP_ATOMIC with > - * blk_get_request() will return -EWOULDBLOCK, whereas using GFP_KERNEL > - * will cause blk_get_request() to sleep until an active command > - * completes, freeing up a request. Neither option is ideal, but > - * GFP_KERNEL is the better choice to prevent userspace from getting an > - * unexpected EWOULDBLOCK. > - * > - * With scsi-mq disabled, blk_get_request() with GFP_KERNEL usually > - * does not sleep except under memory pressure. > + * preallocated requests are already in use, then blk_get_request() > + * will sleep until an active command completes, freeing up a request. > + * Although waiting in an asynchronous interface is less than ideal, we > + * do not want to use BLK_MQ_REQ_NOWAIT here because userspace might > + * not expect an EWOULDBLOCK from this condition. > */ > rq = blk_get_request(q, hp->dxfer_direction == SG_DXFER_TO_DEV ? > REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); > >
Tony, > The calling convention of blk_get_request() has changed in lk 4.18; > update the comment in sg.c to match. Applied to 4.18/scsi-fixes, thanks!
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index cd2fdac..1b90e5a 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1741,15 +1741,11 @@ sg_start_req(Sg_request *srp, unsigned char *cmd) * * With scsi-mq enabled, there are a fixed number of preallocated * requests equal in number to shost->can_queue. If all of the - * preallocated requests are already in use, then using GFP_ATOMIC with - * blk_get_request() will return -EWOULDBLOCK, whereas using GFP_KERNEL - * will cause blk_get_request() to sleep until an active command - * completes, freeing up a request. Neither option is ideal, but - * GFP_KERNEL is the better choice to prevent userspace from getting an - * unexpected EWOULDBLOCK. - * - * With scsi-mq disabled, blk_get_request() with GFP_KERNEL usually - * does not sleep except under memory pressure. + * preallocated requests are already in use, then blk_get_request() + * will sleep until an active command completes, freeing up a request. + * Although waiting in an asynchronous interface is less than ideal, we + * do not want to use BLK_MQ_REQ_NOWAIT here because userspace might + * not expect an EWOULDBLOCK from this condition. */ rq = blk_get_request(q, hp->dxfer_direction == SG_DXFER_TO_DEV ? REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0);
The calling convention of blk_get_request() has changed in lk 4.18; update the comment in sg.c to match. Fixes: ff005a066240 ("block: sanitize blk_get_request calling conventions") Signed-off-by: Tony Battersby <tonyb@cybernetics.com> --- I wrote the original comment in commit 7772855a996e ("sg: fix EWOULDBLOCK errors with scsi-mq") back in 2015.