diff options
author | Paul Mackerras <paulus@samba.org> | 2008-04-14 07:11:02 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-14 07:11:02 -0400 |
commit | ac7c5353b189e10cf5dd27399f64f7b013abffc6 (patch) | |
tree | 8222d92b774c256d6ec4399c716d76b3f05ddc4b /drivers/block | |
parent | a8f75ea70c58546205fb7673be41455b9da5d9a7 (diff) | |
parent | 120dd64cacd4fb796bca0acba3665553f1d9ecaa (diff) |
Merge branch 'linux-2.6'
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cciss.c | 1 | ||||
-rw-r--r-- | drivers/block/nbd.c | 6 | ||||
-rw-r--r-- | drivers/block/ub.c | 38 |
3 files changed, 36 insertions, 9 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 55bd35c0f082..9c9627e8e334 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <scsi/sg.h> | 50 | #include <scsi/sg.h> |
51 | #include <scsi/scsi_ioctl.h> | 51 | #include <scsi/scsi_ioctl.h> |
52 | #include <linux/cdrom.h> | 52 | #include <linux/cdrom.h> |
53 | #include <linux/scatterlist.h> | ||
53 | 54 | ||
54 | #define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) | 55 | #define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) |
55 | #define DRIVER_NAME "HP CISS Driver (v 3.6.14)" | 56 | #define DRIVER_NAME "HP CISS Driver (v 3.6.14)" |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index b53fdb0a282c..60cc54368b66 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -153,6 +153,12 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size, | |||
153 | struct kvec iov; | 153 | struct kvec iov; |
154 | sigset_t blocked, oldset; | 154 | sigset_t blocked, oldset; |
155 | 155 | ||
156 | if (unlikely(!sock)) { | ||
157 | printk(KERN_ERR "%s: Attempted %s on closed socket in sock_xmit\n", | ||
158 | lo->disk->disk_name, (send ? "send" : "recv")); | ||
159 | return -EINVAL; | ||
160 | } | ||
161 | |||
156 | /* Allow interception of SIGKILL only | 162 | /* Allow interception of SIGKILL only |
157 | * Don't allow other signals to interrupt the transmission */ | 163 | * Don't allow other signals to interrupt the transmission */ |
158 | siginitsetinv(&blocked, sigmask(SIGKILL)); | 164 | siginitsetinv(&blocked, sigmask(SIGKILL)); |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index c452e2d355ee..27bfe72aab59 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * and is not licensed separately. See file COPYING for details. | 8 | * and is not licensed separately. See file COPYING for details. |
9 | * | 9 | * |
10 | * TODO (sorted by decreasing priority) | 10 | * TODO (sorted by decreasing priority) |
11 | * -- Return sense now that rq allows it (we always auto-sense anyway). | ||
11 | * -- set readonly flag for CDs, set removable flag for CF readers | 12 | * -- set readonly flag for CDs, set removable flag for CF readers |
12 | * -- do inquiry and verify we got a disk and not a tape (for LUN mismatch) | 13 | * -- do inquiry and verify we got a disk and not a tape (for LUN mismatch) |
13 | * -- verify the 13 conditions and do bulk resets | 14 | * -- verify the 13 conditions and do bulk resets |
@@ -359,7 +360,8 @@ static void ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun, | |||
359 | static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun, | 360 | static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun, |
360 | struct ub_scsi_cmd *cmd, struct ub_request *urq); | 361 | struct ub_scsi_cmd *cmd, struct ub_request *urq); |
361 | static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd); | 362 | static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd); |
362 | static void ub_end_rq(struct request *rq, unsigned int status); | 363 | static void ub_end_rq(struct request *rq, unsigned int status, |
364 | unsigned int cmd_len); | ||
363 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, | 365 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, |
364 | struct ub_request *urq, struct ub_scsi_cmd *cmd); | 366 | struct ub_request *urq, struct ub_scsi_cmd *cmd); |
365 | static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd); | 367 | static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd); |
@@ -642,13 +644,13 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq) | |||
642 | 644 | ||
643 | if (atomic_read(&sc->poison)) { | 645 | if (atomic_read(&sc->poison)) { |
644 | blkdev_dequeue_request(rq); | 646 | blkdev_dequeue_request(rq); |
645 | ub_end_rq(rq, DID_NO_CONNECT << 16); | 647 | ub_end_rq(rq, DID_NO_CONNECT << 16, blk_rq_bytes(rq)); |
646 | return 0; | 648 | return 0; |
647 | } | 649 | } |
648 | 650 | ||
649 | if (lun->changed && !blk_pc_request(rq)) { | 651 | if (lun->changed && !blk_pc_request(rq)) { |
650 | blkdev_dequeue_request(rq); | 652 | blkdev_dequeue_request(rq); |
651 | ub_end_rq(rq, SAM_STAT_CHECK_CONDITION); | 653 | ub_end_rq(rq, SAM_STAT_CHECK_CONDITION, blk_rq_bytes(rq)); |
652 | return 0; | 654 | return 0; |
653 | } | 655 | } |
654 | 656 | ||
@@ -701,7 +703,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq) | |||
701 | 703 | ||
702 | drop: | 704 | drop: |
703 | ub_put_cmd(lun, cmd); | 705 | ub_put_cmd(lun, cmd); |
704 | ub_end_rq(rq, DID_ERROR << 16); | 706 | ub_end_rq(rq, DID_ERROR << 16, blk_rq_bytes(rq)); |
705 | return 0; | 707 | return 0; |
706 | } | 708 | } |
707 | 709 | ||
@@ -770,6 +772,7 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
770 | struct ub_request *urq = cmd->back; | 772 | struct ub_request *urq = cmd->back; |
771 | struct request *rq; | 773 | struct request *rq; |
772 | unsigned int scsi_status; | 774 | unsigned int scsi_status; |
775 | unsigned int cmd_len; | ||
773 | 776 | ||
774 | rq = urq->rq; | 777 | rq = urq->rq; |
775 | 778 | ||
@@ -779,8 +782,18 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
779 | rq->data_len = 0; | 782 | rq->data_len = 0; |
780 | else | 783 | else |
781 | rq->data_len -= cmd->act_len; | 784 | rq->data_len -= cmd->act_len; |
785 | scsi_status = 0; | ||
786 | } else { | ||
787 | if (cmd->act_len != cmd->len) { | ||
788 | if ((cmd->key == MEDIUM_ERROR || | ||
789 | cmd->key == UNIT_ATTENTION) && | ||
790 | ub_rw_cmd_retry(sc, lun, urq, cmd) == 0) | ||
791 | return; | ||
792 | scsi_status = SAM_STAT_CHECK_CONDITION; | ||
793 | } else { | ||
794 | scsi_status = 0; | ||
795 | } | ||
782 | } | 796 | } |
783 | scsi_status = 0; | ||
784 | } else { | 797 | } else { |
785 | if (blk_pc_request(rq)) { | 798 | if (blk_pc_request(rq)) { |
786 | /* UB_SENSE_SIZE is smaller than SCSI_SENSE_BUFFERSIZE */ | 799 | /* UB_SENSE_SIZE is smaller than SCSI_SENSE_BUFFERSIZE */ |
@@ -801,14 +814,17 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
801 | 814 | ||
802 | urq->rq = NULL; | 815 | urq->rq = NULL; |
803 | 816 | ||
817 | cmd_len = cmd->len; | ||
804 | ub_put_cmd(lun, cmd); | 818 | ub_put_cmd(lun, cmd); |
805 | ub_end_rq(rq, scsi_status); | 819 | ub_end_rq(rq, scsi_status, cmd_len); |
806 | blk_start_queue(lun->disk->queue); | 820 | blk_start_queue(lun->disk->queue); |
807 | } | 821 | } |
808 | 822 | ||
809 | static void ub_end_rq(struct request *rq, unsigned int scsi_status) | 823 | static void ub_end_rq(struct request *rq, unsigned int scsi_status, |
824 | unsigned int cmd_len) | ||
810 | { | 825 | { |
811 | int error; | 826 | int error; |
827 | long rqlen; | ||
812 | 828 | ||
813 | if (scsi_status == 0) { | 829 | if (scsi_status == 0) { |
814 | error = 0; | 830 | error = 0; |
@@ -816,8 +832,12 @@ static void ub_end_rq(struct request *rq, unsigned int scsi_status) | |||
816 | error = -EIO; | 832 | error = -EIO; |
817 | rq->errors = scsi_status; | 833 | rq->errors = scsi_status; |
818 | } | 834 | } |
819 | if (__blk_end_request(rq, error, blk_rq_bytes(rq))) | 835 | rqlen = blk_rq_bytes(rq); /* Oddly enough, this is the residue. */ |
820 | BUG(); | 836 | if (__blk_end_request(rq, error, cmd_len)) { |
837 | printk(KERN_WARNING DRV_NAME | ||
838 | ": __blk_end_request blew, %s-cmd total %u rqlen %ld\n", | ||
839 | blk_pc_request(rq)? "pc": "fs", cmd_len, rqlen); | ||
840 | } | ||
821 | } | 841 | } |
822 | 842 | ||
823 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, | 843 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, |