diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-23 17:06:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-23 17:06:05 -0500 |
commit | a8946afe5a3519bf4fd84d87f94c92d49f2f13d8 (patch) | |
tree | ee9e9f4b0126cbc592980580312d9f3ddc4a4c68 /drivers | |
parent | f789dcc75c90409c4f1319a656225489c8fa28e1 (diff) | |
parent | 893d290f1d7496db97c9471bc352ad4a11dc8a25 (diff) |
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block layer fixes from Jens Axboe:
"Distilled down version of bug fixes for 3.7. The patches have been
well tested. If you notice that commit dates are from today, it's
because I pulled less important bits out and shuffled them into the
3.8 mix. Apart from that, no changes, base still the same.
It contains:
- Fix for aoe, don't run request_fn while it's plugged.
- Fix for a regression in floppy since 3.6, which causes problems if
no floppy is found.
- Stable fix for blk_exec(), don't touch a request after it has been
sent to the scheduler (and the device as well).
- Five fixes for various nasties in mtip32xx."
* 'for-linus' of git://git.kernel.dk/linux-block:
block: Don't access request after it might be freed
mtip32xx: Fix padding issue
aoe: avoid running request handler on plugged queue
mtip32xx: fix potential NULL pointer dereference in mtip_timeout_function()
mtip32xx: fix shift larger than type warning
mtip32xx: Fix incorrect mask used for erase mode
mtip32xx: Fix to make lba address correct in big-endian systems
mtip32xx: fix potential crash on SEC_ERASE_UNIT
dm: fix deadlock with request based dm and queue request_fn recursion
floppy: destroy floppy workqueue before cleaning up the queue
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/aoe/aoecmd.c | 2 | ||||
-rw-r--r-- | drivers/block/floppy.c | 5 | ||||
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 18 | ||||
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.h | 6 | ||||
-rw-r--r-- | drivers/md/dm.c | 8 |
5 files changed, 26 insertions, 13 deletions
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 3804a0af3ef1..9fe4f1865558 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -935,7 +935,7 @@ aoe_end_request(struct aoedev *d, struct request *rq, int fastfail) | |||
935 | 935 | ||
936 | /* cf. http://lkml.org/lkml/2006/10/31/28 */ | 936 | /* cf. http://lkml.org/lkml/2006/10/31/28 */ |
937 | if (!fastfail) | 937 | if (!fastfail) |
938 | q->request_fn(q); | 938 | __blk_run_queue(q); |
939 | } | 939 | } |
940 | 940 | ||
941 | static void | 941 | static void |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 1c49d7173966..2ddd64a9ffde 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4330,6 +4330,7 @@ out_unreg_region: | |||
4330 | out_unreg_blkdev: | 4330 | out_unreg_blkdev: |
4331 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 4331 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
4332 | out_put_disk: | 4332 | out_put_disk: |
4333 | destroy_workqueue(floppy_wq); | ||
4333 | for (drive = 0; drive < N_DRIVE; drive++) { | 4334 | for (drive = 0; drive < N_DRIVE; drive++) { |
4334 | if (!disks[drive]) | 4335 | if (!disks[drive]) |
4335 | break; | 4336 | break; |
@@ -4340,7 +4341,6 @@ out_put_disk: | |||
4340 | } | 4341 | } |
4341 | put_disk(disks[drive]); | 4342 | put_disk(disks[drive]); |
4342 | } | 4343 | } |
4343 | destroy_workqueue(floppy_wq); | ||
4344 | return err; | 4344 | return err; |
4345 | } | 4345 | } |
4346 | 4346 | ||
@@ -4555,6 +4555,8 @@ static void __exit floppy_module_exit(void) | |||
4555 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 4555 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
4556 | platform_driver_unregister(&floppy_driver); | 4556 | platform_driver_unregister(&floppy_driver); |
4557 | 4557 | ||
4558 | destroy_workqueue(floppy_wq); | ||
4559 | |||
4558 | for (drive = 0; drive < N_DRIVE; drive++) { | 4560 | for (drive = 0; drive < N_DRIVE; drive++) { |
4559 | del_timer_sync(&motor_off_timer[drive]); | 4561 | del_timer_sync(&motor_off_timer[drive]); |
4560 | 4562 | ||
@@ -4578,7 +4580,6 @@ static void __exit floppy_module_exit(void) | |||
4578 | 4580 | ||
4579 | cancel_delayed_work_sync(&fd_timeout); | 4581 | cancel_delayed_work_sync(&fd_timeout); |
4580 | cancel_delayed_work_sync(&fd_timer); | 4582 | cancel_delayed_work_sync(&fd_timer); |
4581 | destroy_workqueue(floppy_wq); | ||
4582 | 4583 | ||
4583 | if (atomic_read(&usage_count)) | 4584 | if (atomic_read(&usage_count)) |
4584 | floppy_release_irq_and_dma(); | 4585 | floppy_release_irq_and_dma(); |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index adc6f36564cf..9694dd99bbbc 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -559,7 +559,7 @@ static void mtip_timeout_function(unsigned long int data) | |||
559 | struct mtip_cmd *command; | 559 | struct mtip_cmd *command; |
560 | int tag, cmdto_cnt = 0; | 560 | int tag, cmdto_cnt = 0; |
561 | unsigned int bit, group; | 561 | unsigned int bit, group; |
562 | unsigned int num_command_slots = port->dd->slot_groups * 32; | 562 | unsigned int num_command_slots; |
563 | unsigned long to, tagaccum[SLOTBITS_IN_LONGS]; | 563 | unsigned long to, tagaccum[SLOTBITS_IN_LONGS]; |
564 | 564 | ||
565 | if (unlikely(!port)) | 565 | if (unlikely(!port)) |
@@ -572,6 +572,7 @@ static void mtip_timeout_function(unsigned long int data) | |||
572 | } | 572 | } |
573 | /* clear the tag accumulator */ | 573 | /* clear the tag accumulator */ |
574 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); | 574 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); |
575 | num_command_slots = port->dd->slot_groups * 32; | ||
575 | 576 | ||
576 | for (tag = 0; tag < num_command_slots; tag++) { | 577 | for (tag = 0; tag < num_command_slots; tag++) { |
577 | /* | 578 | /* |
@@ -2218,8 +2219,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
2218 | fis.device); | 2219 | fis.device); |
2219 | 2220 | ||
2220 | /* check for erase mode support during secure erase.*/ | 2221 | /* check for erase mode support during secure erase.*/ |
2221 | if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) | 2222 | if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) && outbuf && |
2222 | && (outbuf[0] & MTIP_SEC_ERASE_MODE)) { | 2223 | (outbuf[0] & MTIP_SEC_ERASE_MODE)) { |
2223 | erasemode = 1; | 2224 | erasemode = 1; |
2224 | } | 2225 | } |
2225 | 2226 | ||
@@ -2439,7 +2440,7 @@ static int mtip_hw_ioctl(struct driver_data *dd, unsigned int cmd, | |||
2439 | * return value | 2440 | * return value |
2440 | * None | 2441 | * None |
2441 | */ | 2442 | */ |
2442 | static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | 2443 | static void mtip_hw_submit_io(struct driver_data *dd, sector_t sector, |
2443 | int nsect, int nents, int tag, void *callback, | 2444 | int nsect, int nents, int tag, void *callback, |
2444 | void *data, int dir) | 2445 | void *data, int dir) |
2445 | { | 2446 | { |
@@ -2447,6 +2448,7 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | |||
2447 | struct mtip_port *port = dd->port; | 2448 | struct mtip_port *port = dd->port; |
2448 | struct mtip_cmd *command = &port->commands[tag]; | 2449 | struct mtip_cmd *command = &port->commands[tag]; |
2449 | int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | 2450 | int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; |
2451 | u64 start = sector; | ||
2450 | 2452 | ||
2451 | /* Map the scatter list for DMA access */ | 2453 | /* Map the scatter list for DMA access */ |
2452 | nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir); | 2454 | nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir); |
@@ -2465,8 +2467,12 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | |||
2465 | fis->opts = 1 << 7; | 2467 | fis->opts = 1 << 7; |
2466 | fis->command = | 2468 | fis->command = |
2467 | (dir == READ ? ATA_CMD_FPDMA_READ : ATA_CMD_FPDMA_WRITE); | 2469 | (dir == READ ? ATA_CMD_FPDMA_READ : ATA_CMD_FPDMA_WRITE); |
2468 | *((unsigned int *) &fis->lba_low) = (start & 0xFFFFFF); | 2470 | fis->lba_low = start & 0xFF; |
2469 | *((unsigned int *) &fis->lba_low_ex) = ((start >> 24) & 0xFFFFFF); | 2471 | fis->lba_mid = (start >> 8) & 0xFF; |
2472 | fis->lba_hi = (start >> 16) & 0xFF; | ||
2473 | fis->lba_low_ex = (start >> 24) & 0xFF; | ||
2474 | fis->lba_mid_ex = (start >> 32) & 0xFF; | ||
2475 | fis->lba_hi_ex = (start >> 40) & 0xFF; | ||
2470 | fis->device = 1 << 6; | 2476 | fis->device = 1 << 6; |
2471 | fis->features = nsect & 0xFF; | 2477 | fis->features = nsect & 0xFF; |
2472 | fis->features_ex = (nsect >> 8) & 0xFF; | 2478 | fis->features_ex = (nsect >> 8) & 0xFF; |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index 5f4a917bd8bb..b1742640556a 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -34,7 +34,7 @@ | |||
34 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 | 34 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 |
35 | 35 | ||
36 | /* check for erase mode support during secure erase */ | 36 | /* check for erase mode support during secure erase */ |
37 | #define MTIP_SEC_ERASE_MODE 0x3 | 37 | #define MTIP_SEC_ERASE_MODE 0x2 |
38 | 38 | ||
39 | /* # of times to retry timed out/failed IOs */ | 39 | /* # of times to retry timed out/failed IOs */ |
40 | #define MTIP_MAX_RETRIES 2 | 40 | #define MTIP_MAX_RETRIES 2 |
@@ -155,14 +155,14 @@ enum { | |||
155 | MTIP_DDF_REBUILD_FAILED_BIT = 8, | 155 | MTIP_DDF_REBUILD_FAILED_BIT = 8, |
156 | }; | 156 | }; |
157 | 157 | ||
158 | __packed struct smart_attr{ | 158 | struct smart_attr { |
159 | u8 attr_id; | 159 | u8 attr_id; |
160 | u16 flags; | 160 | u16 flags; |
161 | u8 cur; | 161 | u8 cur; |
162 | u8 worst; | 162 | u8 worst; |
163 | u32 data; | 163 | u32 data; |
164 | u8 res[3]; | 164 | u8 res[3]; |
165 | }; | 165 | } __packed; |
166 | 166 | ||
167 | /* Register Frame Information Structure (FIS), host to device. */ | 167 | /* Register Frame Information Structure (FIS), host to device. */ |
168 | struct host_to_dev_fis { | 168 | struct host_to_dev_fis { |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 02db9183ca01..77e6eff41cae 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -740,8 +740,14 @@ static void rq_completed(struct mapped_device *md, int rw, int run_queue) | |||
740 | if (!md_in_flight(md)) | 740 | if (!md_in_flight(md)) |
741 | wake_up(&md->wait); | 741 | wake_up(&md->wait); |
742 | 742 | ||
743 | /* | ||
744 | * Run this off this callpath, as drivers could invoke end_io while | ||
745 | * inside their request_fn (and holding the queue lock). Calling | ||
746 | * back into ->request_fn() could deadlock attempting to grab the | ||
747 | * queue lock again. | ||
748 | */ | ||
743 | if (run_queue) | 749 | if (run_queue) |
744 | blk_run_queue(md->queue); | 750 | blk_run_queue_async(md->queue); |
745 | 751 | ||
746 | /* | 752 | /* |
747 | * dm_put() must be at the end of this function. See the comment above | 753 | * dm_put() must be at the end of this function. See the comment above |