Commit c46de226 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 077fee00 2453f5f9
...@@ -2254,9 +2254,11 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) ...@@ -2254,9 +2254,11 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
error_type = "I/O"; error_type = "I/O";
break; break;
} }
printk(KERN_ERR "end_request: %s error, dev %s, sector %llu\n", printk_ratelimited(KERN_ERR "end_request: %s error, dev %s, sector %llu\n",
error_type, req->rq_disk ? req->rq_disk->disk_name : "?", error_type, req->rq_disk ?
(unsigned long long)blk_rq_pos(req)); req->rq_disk->disk_name : "?",
(unsigned long long)blk_rq_pos(req));
} }
blk_account_io_completion(req, nr_bytes); blk_account_io_completion(req, nr_bytes);
......
...@@ -41,7 +41,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user ...@@ -41,7 +41,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
sizeof(long long) > sizeof(long)) { sizeof(long long) > sizeof(long)) {
long pstart = start, plength = length; long pstart = start, plength = length;
if (pstart != start || plength != length if (pstart != start || plength != length
|| pstart < 0 || plength < 0) || pstart < 0 || plength < 0 || partno > 65535)
return -EINVAL; return -EINVAL;
} }
......
...@@ -795,6 +795,7 @@ static void complete_scsi_command(CommandList_struct *c, int timeout, ...@@ -795,6 +795,7 @@ static void complete_scsi_command(CommandList_struct *c, int timeout,
} }
break; break;
case CMD_PROTOCOL_ERR: case CMD_PROTOCOL_ERR:
cmd->result = DID_ERROR << 16;
dev_warn(&h->pdev->dev, dev_warn(&h->pdev->dev,
"%p has protocol error\n", c); "%p has protocol error\n", c);
break; break;
......
...@@ -1148,11 +1148,15 @@ static bool mtip_pause_ncq(struct mtip_port *port, ...@@ -1148,11 +1148,15 @@ static bool mtip_pause_ncq(struct mtip_port *port,
reply = port->rxfis + RX_FIS_D2H_REG; reply = port->rxfis + RX_FIS_D2H_REG;
task_file_data = readl(port->mmio+PORT_TFDATA); task_file_data = readl(port->mmio+PORT_TFDATA);
if ((task_file_data & 1) || (fis->command == ATA_CMD_SEC_ERASE_UNIT)) if (fis->command == ATA_CMD_SEC_ERASE_UNIT)
clear_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag);
if ((task_file_data & 1))
return false; return false;
if (fis->command == ATA_CMD_SEC_ERASE_PREP) { if (fis->command == ATA_CMD_SEC_ERASE_PREP) {
set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags);
set_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag);
port->ic_pause_timer = jiffies; port->ic_pause_timer = jiffies;
return true; return true;
} else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) && } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) &&
...@@ -1900,7 +1904,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command, ...@@ -1900,7 +1904,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command,
int rv = 0, xfer_sz = command[3]; int rv = 0, xfer_sz = command[3];
if (xfer_sz) { if (xfer_sz) {
if (user_buffer) if (!user_buffer)
return -EFAULT; return -EFAULT;
buf = dmam_alloc_coherent(&port->dd->pdev->dev, 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,7 +2047,7 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)
*timeout = 240000; /* 4 minutes */ *timeout = 240000; /* 4 minutes */
break; break;
case ATA_CMD_STANDBYNOW1: case ATA_CMD_STANDBYNOW1:
*timeout = 10000; /* 10 seconds */ *timeout = 120000; /* 2 minutes */
break; break;
case 0xF7: case 0xF7:
case 0xFA: case 0xFA:
...@@ -2588,9 +2592,6 @@ static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf, ...@@ -2588,9 +2592,6 @@ static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf,
if (!len || size) if (!len || size)
return 0; return 0;
if (size < 0)
return -EINVAL;
size += sprintf(&buf[size], "H/ S ACTive : [ 0x"); size += sprintf(&buf[size], "H/ S ACTive : [ 0x");
for (n = dd->slot_groups-1; n >= 0; n--) 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,9 +2661,6 @@ static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf,
if (!len || size) if (!len || size)
return 0; return 0;
if (size < 0)
return -EINVAL;
size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n", size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n",
dd->port->flags); dd->port->flags);
size += sprintf(&buf[size], "Flag-dd : [ %08lX ]\n", size += sprintf(&buf[size], "Flag-dd : [ %08lX ]\n",
...@@ -3214,8 +3212,8 @@ static int mtip_hw_init(struct driver_data *dd) ...@@ -3214,8 +3212,8 @@ static int mtip_hw_init(struct driver_data *dd)
"Unable to check write protect progress\n"); "Unable to check write protect progress\n");
else else
dev_info(&dd->pdev->dev, dev_info(&dd->pdev->dev,
"Write protect progress: %d%% (%d blocks)\n", "Write protect progress: %u%% (%u blocks)\n",
attr242.cur, attr242.data); attr242.cur, le32_to_cpu(attr242.data));
return rv; return rv;
out3: out3:
...@@ -3619,6 +3617,10 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) ...@@ -3619,6 +3617,10 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio)
bio_endio(bio, -ENODATA); bio_endio(bio, -ENODATA);
return; return;
} }
if (unlikely(test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag))) {
bio_endio(bio, -ENODATA);
return;
}
} }
if (unlikely(!bio_has_data(bio))) { if (unlikely(!bio_has_data(bio))) {
...@@ -4168,7 +4170,13 @@ static void mtip_pci_shutdown(struct pci_dev *pdev) ...@@ -4168,7 +4170,13 @@ static void mtip_pci_shutdown(struct pci_dev *pdev)
/* Table of device ids supported by this driver. */ /* Table of device ids supported by this driver. */
static DEFINE_PCI_DEVICE_TABLE(mtip_pci_tbl) = { static DEFINE_PCI_DEVICE_TABLE(mtip_pci_tbl) = {
{ PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320_DEVICE_ID) }, { PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320H_DEVICE_ID) },
{ PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320M_DEVICE_ID) },
{ PCI_DEVICE(PCI_VENDOR_ID_MICRON, P320S_DEVICE_ID) },
{ PCI_DEVICE(PCI_VENDOR_ID_MICRON, P325M_DEVICE_ID) },
{ PCI_DEVICE(PCI_VENDOR_ID_MICRON, P420H_DEVICE_ID) },
{ PCI_DEVICE(PCI_VENDOR_ID_MICRON, P420M_DEVICE_ID) },
{ PCI_DEVICE(PCI_VENDOR_ID_MICRON, P425M_DEVICE_ID) },
{ 0 } { 0 }
}; };
...@@ -4199,12 +4207,12 @@ static int __init mtip_init(void) ...@@ -4199,12 +4207,12 @@ static int __init mtip_init(void)
{ {
int error; int error;
printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); pr_info(MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n");
/* Allocate a major block device number to use with this driver. */ /* Allocate a major block device number to use with this driver. */
error = register_blkdev(0, MTIP_DRV_NAME); error = register_blkdev(0, MTIP_DRV_NAME);
if (error <= 0) { if (error <= 0) {
printk(KERN_ERR "Unable to register block device (%d)\n", pr_err("Unable to register block device (%d)\n",
error); error);
return -EBUSY; return -EBUSY;
} }
...@@ -4213,7 +4221,7 @@ static int __init mtip_init(void) ...@@ -4213,7 +4221,7 @@ static int __init mtip_init(void)
if (!dfs_parent) { if (!dfs_parent) {
dfs_parent = debugfs_create_dir("rssd", NULL); dfs_parent = debugfs_create_dir("rssd", NULL);
if (IS_ERR_OR_NULL(dfs_parent)) { if (IS_ERR_OR_NULL(dfs_parent)) {
printk(KERN_WARNING "Error creating debugfs parent\n"); pr_warn("Error creating debugfs parent\n");
dfs_parent = NULL; dfs_parent = NULL;
} }
} }
......
...@@ -76,7 +76,13 @@ ...@@ -76,7 +76,13 @@
/* Micron Vendor ID & P320x SSD Device ID */ /* Micron Vendor ID & P320x SSD Device ID */
#define PCI_VENDOR_ID_MICRON 0x1344 #define PCI_VENDOR_ID_MICRON 0x1344
#define P320_DEVICE_ID 0x5150 #define P320H_DEVICE_ID 0x5150
#define P320M_DEVICE_ID 0x5151
#define P320S_DEVICE_ID 0x5152
#define P325M_DEVICE_ID 0x5153
#define P420H_DEVICE_ID 0x5160
#define P420M_DEVICE_ID 0x5161
#define P425M_DEVICE_ID 0x5163
/* Driver name and version strings */ /* Driver name and version strings */
#define MTIP_DRV_NAME "mtip32xx" #define MTIP_DRV_NAME "mtip32xx"
...@@ -131,10 +137,12 @@ enum { ...@@ -131,10 +137,12 @@ enum {
MTIP_PF_SVC_THD_STOP_BIT = 8, MTIP_PF_SVC_THD_STOP_BIT = 8,
/* below are bit numbers in 'dd_flag' defined in driver_data */ /* below are bit numbers in 'dd_flag' defined in driver_data */
MTIP_DDF_SEC_LOCK_BIT = 0,
MTIP_DDF_REMOVE_PENDING_BIT = 1, MTIP_DDF_REMOVE_PENDING_BIT = 1,
MTIP_DDF_OVER_TEMP_BIT = 2, MTIP_DDF_OVER_TEMP_BIT = 2,
MTIP_DDF_WRITE_PROTECT_BIT = 3, MTIP_DDF_WRITE_PROTECT_BIT = 3,
MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \
(1 << MTIP_DDF_SEC_LOCK_BIT) | \
(1 << MTIP_DDF_OVER_TEMP_BIT) | \ (1 << MTIP_DDF_OVER_TEMP_BIT) | \
(1 << MTIP_DDF_WRITE_PROTECT_BIT)), (1 << MTIP_DDF_WRITE_PROTECT_BIT)),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment