1
0
Fork 0
alistair23-linux/include
FUJITA Tomonori ecb554a846 block: fix sg SG_DXFER_TO_FROM_DEV regression
I overlooked SG_DXFER_TO_FROM_DEV support when I converted sg to use
the block layer mapping API (2.6.28).

Douglas Gilbert explained SG_DXFER_TO_FROM_DEV:

http://www.spinics.net/lists/linux-scsi/msg37135.html

=
The semantics of SG_DXFER_TO_FROM_DEV were:
   - copy user space buffer to kernel (LLD) buffer
   - do SCSI command which is assumed to be of the DATA_IN
     (data from device) variety. This would overwrite
     some or all of the kernel buffer
   - copy kernel (LLD) buffer back to the user space.

The idea was to detect short reads by filling the original
user space buffer with some marker bytes ("0xec" it would
seem in this report). The "resid" value is a better way
of detecting short reads but that was only added this century
and requires co-operation from the LLD.
=

This patch changes the block layer mapping API to support this
semantics. This simply adds another field to struct rq_map_data and
enables __bio_copy_iov() to copy data from user space even with READ
requests.

It's better to add the flags field and kills null_mapped and the new
from_user fields in struct rq_map_data but that approach makes it
difficult to send this patch to stable trees because st and osst
drivers use struct rq_map_data (they were converted to use the block
layer in 2.6.29 and 2.6.30). Well, I should clean up the block layer
mapping API.

zhou sf reported this regiression and tested this patch:

http://www.spinics.net/lists/linux-scsi/msg37128.html
http://www.spinics.net/lists/linux-scsi/msg37168.html

Reported-by: zhou sf <sxzzsf@gmail.com>
Tested-by: zhou sf <sxzzsf@gmail.com>
Cc: stable@kernel.org
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-07-10 20:31:53 +02:00
..
acpi Merge branch 'bjorn-notify' into release 2009-06-24 01:22:20 -04:00
asm-generic Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes 2009-07-04 09:46:01 -07:00
crypto
drm drm: Fix shifts which were miscalculated when converting from bitfields. 2009-06-24 16:11:04 +10:00
keys
linux block: fix sg SG_DXFER_TO_FROM_DEV regression 2009-07-10 20:31:53 +02:00
math-emu
media V4L/DVB (12135): Add a driver for mt9v011 sensor 2009-07-05 14:30:02 -03:00
mtd Kill jffs2-user.h 2009-06-05 17:31:38 +01:00
net memory barrier: adding smp_mb__after_lock 2009-07-09 17:06:58 -07:00
pcmcia
rdma
rxrpc
scsi sd, sr: fix Driver 'sd' needs updating message 2009-06-21 12:01:27 -05:00
sound Merge branch 'topic/pcm-jiffies-check' into for-linus 2009-06-10 07:26:41 +02:00
trace ext4: convert instrumentation from markers to tracepoints 2009-06-17 11:48:11 -04:00
video fbdev: s1d13xxxfb: add accelerated bitblt functions 2009-06-16 19:48:00 -07:00
xen
Kbuild [SCSI] FC Pass Thru support 2009-06-12 14:20:05 -05:00