aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-09-19 14:04:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-09-19 14:04:34 -0400
commitc46de2263f42fb4bbde411b9126f471e9343cb22 (patch)
tree7e7209d5d70bdeac3e26234c357474aad461e4b7
parent077fee003624c06a1349895d8c0f89cc625cc39e (diff)
parent2453f5f992717251cfadab6184fbb3ec2f2e8b40 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: "A small collection of driver fixes/updates and a core fix for 3.6. It contains: - Bug fixes for mtip32xx, and support for new hardware (just addition of IDs). They have been queued up for 3.7 for a few weeks as well. - rate-limit a failing command error message in block core. - A fix for an old cciss bug from Stephen. - Prevent overflow of partition count from Alan." * 'for-linus' of git://git.kernel.dk/linux-block: cciss: fix handling of protocol error blk: add an upper sanity check on partition adding mtip32xx: fix user_buffer check in exec_drive_command mtip32xx: Remove dead code mtip32xx: Change printk to pr_xxxx mtip32xx: Proper reporting of write protect status on big-endian mtip32xx: Increase timeout for standby command mtip32xx: Handle NCQ commands during the security locked state mtip32xx: Add support for new devices block: rate-limit the error message from failing commands
-rw-r--r--block/blk-core.c8
-rw-r--r--block/ioctl.c2
-rw-r--r--drivers/block/cciss_scsi.c1
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c38
-rw-r--r--drivers/block/mtip32xx/mtip32xx.h10
5 files changed, 39 insertions, 20 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 4b4dbdfbca89..ee3cb3a5e278 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2254,9 +2254,11 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
2254 error_type = "I/O"; 2254 error_type = "I/O";
2255 break; 2255 break;
2256 } 2256 }
2257 printk(KERN_ERR "end_request: %s error, dev %s, sector %llu\n", 2257 printk_ratelimited(KERN_ERR "end_request: %s error, dev %s, sector %llu\n",
2258 error_type, req->rq_disk ? req->rq_disk->disk_name : "?", 2258 error_type, req->rq_disk ?
2259 (unsigned long long)blk_rq_pos(req)); 2259 req->rq_disk->disk_name : "?",
2260 (unsigned long long)blk_rq_pos(req));
2261
2260 } 2262 }
2261 2263
2262 blk_account_io_completion(req, nr_bytes); 2264 blk_account_io_completion(req, nr_bytes);
diff --git a/block/ioctl.c b/block/ioctl.c
index 4476e0e85d16..4a85096f5410 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -41,7 +41,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
41 sizeof(long long) > sizeof(long)) { 41 sizeof(long long) > sizeof(long)) {
42 long pstart = start, plength = length; 42 long pstart = start, plength = length;
43 if (pstart != start || plength != length 43 if (pstart != start || plength != length
44 || pstart < 0 || plength < 0) 44 || pstart < 0 || plength < 0 || partno > 65535)
45 return -EINVAL; 45 return -EINVAL;
46 } 46 }
47 47
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 38aa6dda6b81..da3311129a0c 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -795,6 +795,7 @@ static void complete_scsi_command(CommandList_struct *c, int timeout,
795 } 795 }
796 break; 796 break;
797 case CMD_PROTOCOL_ERR: 797 case CMD_PROTOCOL_ERR:
798 cmd->result = DID_ERROR << 16;
798 dev_warn(&h->pdev->dev, 799 dev_warn(&h->pdev->dev,
799 "%p has protocol error\n", c); 800 "%p has protocol error\n", c);
800 break; 801 break;
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index a8fddeb3d638..f946d31d6917 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -1148,11 +1148,15 @@ static bool mtip_pause_ncq(struct mtip_port *port,
1148 reply = port->rxfis + RX_FIS_D2H_REG; 1148 reply = port->rxfis + RX_FIS_D2H_REG;
1149 task_file_data = readl(port->mmio+PORT_TFDATA); 1149 task_file_data = readl(port->mmio+PORT_TFDATA);
1150 1150
1151 if ((task_file_data & 1) || (fis->command == ATA_CMD_SEC_ERASE_UNIT)) 1151 if (fis->command == ATA_CMD_SEC_ERASE_UNIT)
1152 clear_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag);
1153
1154 if ((task_file_data & 1))
1152 return false; 1155 return false;
1153 1156
1154 if (fis->command == ATA_CMD_SEC_ERASE_PREP) { 1157 if (fis->command == ATA_CMD_SEC_ERASE_PREP) {
1155 set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); 1158 set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags);
1159 set_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag);
1156 port->ic_pause_timer = jiffies; 1160 port->ic_pause_timer = jiffies;
1157 return true; 1161 return true;
1158 } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) && 1162 } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) &&
@@ -1900,7 +1904,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command,
1900 int rv = 0, xfer_sz = command[3]; 1904 int rv = 0, xfer_sz = command[3];
1901 1905
1902 if (xfer_sz) { 1906 if (xfer_sz) {
1903 if (user_buffer) 1907 if (!user_buffer)
1904 return -EFAULT; 1908 return -EFAULT;
1905 1909
1906 buf = dmam_alloc_coherent(&port->dd->pdev->dev, 1910 buf = dmam_alloc_coherent(&port->dd->pdev->dev,
@@ -2043,7 +2047,7 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)
2043 *timeout = 240000; /* 4 minutes */ 2047 *timeout = 240000; /* 4 minutes */
2044 break; 2048 break;
2045 case ATA_CMD_STANDBYNOW1: 2049 case ATA_CMD_STANDBYNOW1:
2046 *timeout = 10000; /* 10 seconds */ 2050 *timeout = 120000; /* 2 minutes */
2047 break; 2051 break;
2048 case 0xF7: 2052 case 0xF7:
2049 case 0xFA: 2053 case 0xFA:
@@ -2588,9 +2592,6 @@ static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf,
2588 if (!len || size) 2592 if (!len || size)
2589 return 0; 2593 return 0;
2590 2594
2591 if (size < 0)
2592 return -EINVAL;
2593
2594 size += sprintf(&buf[size], "H/ S ACTive : [ 0x"); 2595 size += sprintf(&buf[size], "H/ S ACTive : [ 0x");
2595 2596
2596 for (n = dd->slot_groups-1; n >= 0; n--) 2597 for (n = dd->slot_groups-1; n >= 0; n--)
@@ -2660,9 +2661,6 @@ static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf,
2660 if (!len || size) 2661 if (!len || size)
2661 return 0; 2662 return 0;
2662 2663
2663 if (size < 0)
2664 return -EINVAL;
2665
2666 size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n", 2664 size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n",
2667 dd->port->flags); 2665 dd->port->flags);
2668 size += sprintf(&buf[size], "Flag-dd : [ %08lX ]\n", 2666 size += sprintf(&buf[size], "Flag-dd : [ %08lX ]\n",
@@ -3214,8 +3212,8 @@ static int mtip_hw_init(struct driver_data *dd)
3214 "Unable to check write protect progress\n"); 3212 "Unable to check write protect progress\n");
3215 else 3213 else
3216 dev_info(&dd->pdev->dev, 3214 dev_info(&dd->pdev->dev,
3217 "Write protect progress: %d%% (%d blocks)\n", 3215 "Write protect progress: %u%% (%u blocks)\n",
3218 attr242.cur, attr242.data); 3216 attr242.cur, le32_to_cpu(attr242.data));
3219 return rv; 3217 return rv;
3220 3218
3221out3: 3219out3:
@@ -3619,6 +3617,10 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio)
3619 bio_endio(bio, -ENODATA); 3617 bio_endio(bio, -ENODATA);
3620 return; 3618 return;
3621 } 3619 }
3620 if (unlikely(test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag))) {
3621 bio_endio(bio, -ENODATA);
3622 return;
3623 }
3622 } 3624 }
3623 3625
3624 if (unlikely(!bio_has_data(bio))) { 3626 if (unlikely(!bio_has_data(bio))) {
@@ -4168,7 +4170,13 @@ static void mtip_pci_shutdown(struct pci_dev *pdev)
4168 4170
4169/* Table of device ids supported by this driver. */ 4171/* Table of device ids supported by this driver. */
4170static DEFINE_PCI_DEVICE_TABLE(mtip_pci_tbl) = { 4172static DEFINE_PCI_DEVICE_TABLE(mtip_pci_tbl) = {
4171 { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320_DEVICE_ID) }, 4173 { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320H_DEVICE_ID) },
4174 { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320M_DEVICE_ID) },
4175 { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320S_DEVICE_ID) },
4176 { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P325M_DEVICE_ID) },
4177 { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P420H_DEVICE_ID) },
4178 { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P420M_DEVICE_ID) },
4179 { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P425M_DEVICE_ID) },
4172 { 0 } 4180 { 0 }
4173}; 4181};
4174 4182
@@ -4199,12 +4207,12 @@ static int __init mtip_init(void)
4199{ 4207{
4200 int error; 4208 int error;
4201 4209
4202 printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); 4210 pr_info(MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n");
4203 4211
4204 /* Allocate a major block device number to use with this driver. */ 4212 /* Allocate a major block device number to use with this driver. */
4205 error = register_blkdev(0, MTIP_DRV_NAME); 4213 error = register_blkdev(0, MTIP_DRV_NAME);
4206 if (error <= 0) { 4214 if (error <= 0) {
4207 printk(KERN_ERR "Unable to register block device (%d)\n", 4215 pr_err("Unable to register block device (%d)\n",
4208 error); 4216 error);
4209 return -EBUSY; 4217 return -EBUSY;
4210 } 4218 }
@@ -4213,7 +4221,7 @@ static int __init mtip_init(void)
4213 if (!dfs_parent) { 4221 if (!dfs_parent) {
4214 dfs_parent = debugfs_create_dir("rssd", NULL); 4222 dfs_parent = debugfs_create_dir("rssd", NULL);
4215 if (IS_ERR_OR_NULL(dfs_parent)) { 4223 if (IS_ERR_OR_NULL(dfs_parent)) {
4216 printk(KERN_WARNING "Error creating debugfs parent\n"); 4224 pr_warn("Error creating debugfs parent\n");
4217 dfs_parent = NULL; 4225 dfs_parent = NULL;
4218 } 4226 }
4219 } 4227 }
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index f51fc23d17bb..18627a1d04c5 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -76,7 +76,13 @@
76 76
77/* Micron Vendor ID & P320x SSD Device ID */ 77/* Micron Vendor ID & P320x SSD Device ID */
78#define PCI_VENDOR_ID_MICRON 0x1344 78#define PCI_VENDOR_ID_MICRON 0x1344
79#define P320_DEVICE_ID 0x5150 79#define P320H_DEVICE_ID 0x5150
80#define P320M_DEVICE_ID 0x5151
81#define P320S_DEVICE_ID 0x5152
82#define P325M_DEVICE_ID 0x5153
83#define P420H_DEVICE_ID 0x5160
84#define P420M_DEVICE_ID 0x5161
85#define P425M_DEVICE_ID 0x5163
80 86
81/* Driver name and version strings */ 87/* Driver name and version strings */
82#define MTIP_DRV_NAME "mtip32xx" 88#define MTIP_DRV_NAME "mtip32xx"
@@ -131,10 +137,12 @@ enum {
131 MTIP_PF_SVC_THD_STOP_BIT = 8, 137 MTIP_PF_SVC_THD_STOP_BIT = 8,
132 138
133 /* below are bit numbers in 'dd_flag' defined in driver_data */ 139 /* below are bit numbers in 'dd_flag' defined in driver_data */
140 MTIP_DDF_SEC_LOCK_BIT = 0,
134 MTIP_DDF_REMOVE_PENDING_BIT = 1, 141 MTIP_DDF_REMOVE_PENDING_BIT = 1,
135 MTIP_DDF_OVER_TEMP_BIT = 2, 142 MTIP_DDF_OVER_TEMP_BIT = 2,
136 MTIP_DDF_WRITE_PROTECT_BIT = 3, 143 MTIP_DDF_WRITE_PROTECT_BIT = 3,
137 MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ 144 MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \
145 (1 << MTIP_DDF_SEC_LOCK_BIT) | \
138 (1 << MTIP_DDF_OVER_TEMP_BIT) | \ 146 (1 << MTIP_DDF_OVER_TEMP_BIT) | \
139 (1 << MTIP_DDF_WRITE_PROTECT_BIT)), 147 (1 << MTIP_DDF_WRITE_PROTECT_BIT)),
140 148