Merge tag 'locks-v3.17-2' of git://git.samba.org/jlayton/linux
[firefly-linux-kernel-4.4.55.git] / block / scsi_ioctl.c
index bda1497add4c7d1e54a4017d4f16b966574f8f1e..51bf5155ee756a4ac479e9c49fcf88824b0aeedc 100644 (file)
@@ -290,6 +290,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
        unsigned long start_time;
        ssize_t ret = 0;
        int writing = 0;
+       int at_head = 0;
        struct request *rq;
        char sense[SCSI_SENSE_BUFFERSIZE];
        struct bio *bio;
@@ -313,6 +314,8 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
                case SG_DXFER_FROM_DEV:
                        break;
                }
+       if (hdr->flags & SG_FLAG_Q_AT_HEAD)
+               at_head = 1;
 
        rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL);
        if (!rq)
@@ -369,7 +372,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
         * (if he doesn't check that is his problem).
         * N.B. a non-zero SCSI status is _not_ necessarily an error.
         */
-       blk_execute_rq(q, bd_disk, rq, 0);
+       blk_execute_rq(q, bd_disk, rq, at_head);
 
        hdr->duration = jiffies_to_msecs(jiffies - start_time);