[PATCH] Fix bad data direction in SG_IO
authorJens Axboe <jens.axboe@oracle.com>
Mon, 13 Nov 2006 17:04:59 +0000 (18:04 +0100)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 13 Nov 2006 17:47:00 +0000 (09:47 -0800)
Contrary to what the name misleads you to believe, SG_DXFER_TO_FROM_DEV
is really just a normal read seen from the device side.

This patch fixes http://lkml.org/lkml/2006/10/13/100

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
block/scsi_ioctl.c

index 2dc326421a24af9c745e9f4eb34f7a80f1a41d0a..a19338e6215da1b20a48c4861453ac8230b01536 100644 (file)
@@ -246,10 +246,10 @@ static int sg_io(struct file *file, request_queue_t *q,
                switch (hdr->dxfer_direction) {
                default:
                        return -EINVAL;
-               case SG_DXFER_TO_FROM_DEV:
                case SG_DXFER_TO_DEV:
                        writing = 1;
                        break;
+               case SG_DXFER_TO_FROM_DEV:
                case SG_DXFER_FROM_DEV:
                        break;
                }