aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-core.c6
-rw-r--r--drivers/scsi/sd.c4
-rw-r--r--include/linux/blkdev.h9
3 files changed, 12 insertions, 7 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 476244d59309..35607dd0223b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2447,14 +2447,16 @@ struct request *blk_peek_request(struct request_queue *q)
2447 2447
2448 rq = NULL; 2448 rq = NULL;
2449 break; 2449 break;
2450 } else if (ret == BLKPREP_KILL) { 2450 } else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID) {
2451 int err = (ret == BLKPREP_INVALID) ? -EREMOTEIO : -EIO;
2452
2451 rq->cmd_flags |= REQ_QUIET; 2453 rq->cmd_flags |= REQ_QUIET;
2452 /* 2454 /*
2453 * Mark this request as started so we don't trigger 2455 * Mark this request as started so we don't trigger
2454 * any debug logic in the end I/O path. 2456 * any debug logic in the end I/O path.
2455 */ 2457 */
2456 blk_start_request(rq); 2458 blk_start_request(rq);
2457 __blk_end_request_all(rq, -EIO); 2459 __blk_end_request_all(rq, err);
2458 } else { 2460 } else {
2459 printk(KERN_ERR "%s: bad return=%d\n", __func__, ret); 2461 printk(KERN_ERR "%s: bad return=%d\n", __func__, ret);
2460 break; 2462 break;
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index ec163d08f6c3..6e841c6da632 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -761,7 +761,7 @@ static int sd_setup_discard_cmnd(struct scsi_cmnd *cmd)
761 break; 761 break;
762 762
763 default: 763 default:
764 ret = BLKPREP_KILL; 764 ret = BLKPREP_INVALID;
765 goto out; 765 goto out;
766 } 766 }
767 767
@@ -839,7 +839,7 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
839 int ret; 839 int ret;
840 840
841 if (sdkp->device->no_write_same) 841 if (sdkp->device->no_write_same)
842 return BLKPREP_KILL; 842 return BLKPREP_INVALID;
843 843
844 BUG_ON(bio_offset(bio) || bio_iovec(bio).bv_len != sdp->sector_size); 844 BUG_ON(bio_offset(bio) || bio_iovec(bio).bv_len != sdp->sector_size);
845 845
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d372ea87ead5..a9b643a0647f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -681,9 +681,12 @@ static inline bool blk_write_same_mergeable(struct bio *a, struct bio *b)
681/* 681/*
682 * q->prep_rq_fn return values 682 * q->prep_rq_fn return values
683 */ 683 */
684#define BLKPREP_OK 0 /* serve it */ 684enum {
685#define BLKPREP_KILL 1 /* fatal error, kill */ 685 BLKPREP_OK, /* serve it */
686#define BLKPREP_DEFER 2 /* leave on queue */ 686 BLKPREP_KILL, /* fatal error, kill, return -EIO */
687 BLKPREP_DEFER, /* leave on queue */
688 BLKPREP_INVALID, /* invalid command, kill, return -EREMOTEIO */
689};
687 690
688extern unsigned long blk_max_low_pfn, blk_max_pfn; 691extern unsigned long blk_max_low_pfn, blk_max_pfn;
689 692