Re: [RFC] weird semantics of SG_DXFER_TO_FROM_DEV in BLK_DEV_SKD (drivers/block/skd*)

From: Christoph Hellwig
Date: Thu Apr 07 2016 - 11:53:36 EST


On Mon, Apr 04, 2016 at 06:16:12PM +0100, Al Viro wrote:
> Another fun question: should the normal sg_io() copy the buffer in on
> SG_DXFER_TO_FROM_DEV? Right now it doesn't; in !copy case (when it goes
> through bio_map_user_iov()) the effect is achieved simply by doing the
> read into the pages user has mapped in that area, but bio_copy_user_iov()
> doesn't do it:
> /*
> * success
> */
> if (((iter->type & WRITE) && (!map_data || !map_data->null_mapped)) ||
> (map_data && map_data->from_user)) {
> ret = bio_copy_from_iter(bio, *iter);
> if (ret)
> goto cleanup;
> }
> will see NULL map_data; the ->from_user case is sg_start_req() stuff. IOW,
> SG_IO behaviour for /dev/sg* is different from the generic one...

meh. I really wish /dev/sg was just using the generic page pool :(