Re: [PATCH 6/8] bsg-lib: handle bidi requests without block layer help

From: Benjamin Block
Date: Tue Nov 13 2018 - 09:35:32 EST


On Sun, Nov 11, 2018 at 02:32:09PM +0100, Christoph Hellwig wrote:
> We can just stash away the second request in struct bsg_job instead
> of using the block layer req->next_rq field, allowing for the eventual
> removal of the latter.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
> block/bsg-lib.c | 44 +++++++++++++++++++---
> block/bsg.c | 62 ++++++-------------------------
> drivers/scsi/scsi_transport_sas.c | 1 -
> include/linux/bsg-lib.h | 4 ++
> 4 files changed, 54 insertions(+), 57 deletions(-)
>
> diff --git a/block/bsg-lib.c b/block/bsg-lib.c
> index 192129856342..005e2b75d775 100644
> --- a/block/bsg-lib.c
> +++ b/block/bsg-lib.c
> @@ -74,6 +74,9 @@ static int bsg_scsi_fill_hdr(struct request *rq, struct sg_io_v4 *hdr,
> {
> struct scsi_request *sreq = scsi_req(rq);
>
> + if (hdr->dout_xfer_len && hdr->din_xfer_len)
> + return -EOPNOTSUPP;
> +

This seems like a non-obvious user-breakage. So apart from removing the
in-kernel stuff that uses bidirectional commands you also forbid
userspace from every using them? That seems wrong to me.

There is other SCSI Command Sets than OSD that provide bidirectional
commands, even SBC has some (i.e. X*WRITE*, COMPARE AND WRITE).



--
With Best Regards, Benjamin Block / Linux on IBM Z Kernel Development
IBM Systems & Technology Group / IBM Deutschland Research & Development GmbH
Vorsitz. AufsR.: Martina Koederitz / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294