diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-23 18:33:54 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-23 18:33:54 -0400 |
| commit | 77072ca59fddcb8cefd2cbf5382cfa39c5a10442 (patch) | |
| tree | 3c88a0674264726f6667a19b3f2242c932d906bd | |
| parent | 2dd3f7c904cce0d4b0e4684a62ce8b9024f8efda (diff) | |
| parent | f5e350f021e04ea41d2e5d58487c33b05ba3d25b (diff) | |
Merge tag 'for-linus-20180623' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe:
- Further timeout fixes. We aren't quite there yet, so expect another
round of fixes for that to completely close some of the IRQ vs
completion races. (Christoph/Bart)
- Set of NVMe fixes from the usual suspects, mostly error handling
- Two off-by-one fixes (Dan)
- Another bdi race fix (Jan)
- Fix nbd reconfigure with NBD_DISCONNECT_ON_CLOSE (Doron)
* tag 'for-linus-20180623' of git://git.kernel.dk/linux-block:
blk-mq: Fix timeout handling in case the timeout handler returns BLK_EH_DONE
bdi: Fix another oops in wb_workfn()
lightnvm: Remove depends on HAS_DMA in case of platform dependency
nvme-pci: limit max IO size and segments to avoid high order allocations
nvme-pci: move nvme_kill_queues to nvme_remove_dead_ctrl
nvme-fc: release io queues to allow fast fail
nbd: Add the nbd NBD_DISCONNECT_ON_CLOSE config flag.
block: sed-opal: Fix a couple off by one bugs
blk-mq-debugfs: Off by one in blk_mq_rq_state_name()
nvmet: reset keep alive timer in controller enable
nvme-rdma: don't override opts->queue_size
nvme-rdma: Fix command completion race at error recovery
nvme-rdma: fix possible free of a non-allocated async event buffer
nvme-rdma: fix possible double free condition when failing to create a controller
Revert "block: Add warning for bi_next not NULL in bio_endio()"
block: fix timeout changes for legacy request drivers
| -rw-r--r-- | block/bio.c | 3 | ||||
| -rw-r--r-- | block/blk-core.c | 8 | ||||
| -rw-r--r-- | block/blk-mq-debugfs.c | 2 | ||||
| -rw-r--r-- | block/blk-mq.c | 1 | ||||
| -rw-r--r-- | block/blk-softirq.c | 1 | ||||
| -rw-r--r-- | block/blk-timeout.c | 1 | ||||
| -rw-r--r-- | block/sed-opal.c | 4 | ||||
| -rw-r--r-- | drivers/block/nbd.c | 42 | ||||
| -rw-r--r-- | drivers/block/null_blk.c | 2 | ||||
| -rw-r--r-- | drivers/lightnvm/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/nvme/host/core.c | 1 | ||||
| -rw-r--r-- | drivers/nvme/host/fc.c | 6 | ||||
| -rw-r--r-- | drivers/nvme/host/nvme.h | 1 | ||||
| -rw-r--r-- | drivers/nvme/host/pci.c | 44 | ||||
| -rw-r--r-- | drivers/nvme/host/rdma.c | 73 | ||||
| -rw-r--r-- | drivers/nvme/target/core.c | 8 | ||||
| -rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 2 | ||||
| -rw-r--r-- | include/linux/backing-dev-defs.h | 2 | ||||
| -rw-r--r-- | include/uapi/linux/nbd.h | 3 | ||||
| -rw-r--r-- | mm/backing-dev.c | 20 |
20 files changed, 142 insertions, 84 deletions
diff --git a/block/bio.c b/block/bio.c index 9710e275f230..67eff5eddc49 100644 --- a/block/bio.c +++ b/block/bio.c | |||
| @@ -1807,9 +1807,6 @@ again: | |||
| 1807 | if (!bio_integrity_endio(bio)) | 1807 | if (!bio_integrity_endio(bio)) |
| 1808 | return; | 1808 | return; |
| 1809 | 1809 | ||
| 1810 | if (WARN_ONCE(bio->bi_next, "driver left bi_next not NULL")) | ||
| 1811 | bio->bi_next = NULL; | ||
| 1812 | |||
| 1813 | /* | 1810 | /* |
| 1814 | * Need to have a real endio function for chained bios, otherwise | 1811 | * Need to have a real endio function for chained bios, otherwise |
| 1815 | * various corner cases will break (like stacking block devices that | 1812 | * various corner cases will break (like stacking block devices that |
diff --git a/block/blk-core.c b/block/blk-core.c index cf0ee764b908..afd2596ea3d3 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -273,10 +273,6 @@ static void req_bio_endio(struct request *rq, struct bio *bio, | |||
| 273 | bio_advance(bio, nbytes); | 273 | bio_advance(bio, nbytes); |
| 274 | 274 | ||
| 275 | /* don't actually finish bio if it's part of flush sequence */ | 275 | /* don't actually finish bio if it's part of flush sequence */ |
| 276 | /* | ||
| 277 | * XXX this code looks suspicious - it's not consistent with advancing | ||
| 278 | * req->bio in caller | ||
| 279 | */ | ||
| 280 | if (bio->bi_iter.bi_size == 0 && !(rq->rq_flags & RQF_FLUSH_SEQ)) | 276 | if (bio->bi_iter.bi_size == 0 && !(rq->rq_flags & RQF_FLUSH_SEQ)) |
| 281 | bio_endio(bio); | 277 | bio_endio(bio); |
| 282 | } | 278 | } |
| @@ -3081,10 +3077,8 @@ bool blk_update_request(struct request *req, blk_status_t error, | |||
| 3081 | struct bio *bio = req->bio; | 3077 | struct bio *bio = req->bio; |
| 3082 | unsigned bio_bytes = min(bio->bi_iter.bi_size, nr_bytes); | 3078 | unsigned bio_bytes = min(bio->bi_iter.bi_size, nr_bytes); |
| 3083 | 3079 | ||
| 3084 | if (bio_bytes == bio->bi_iter.bi_size) { | 3080 | if (bio_bytes == bio->bi_iter.bi_size) |
| 3085 | req->bio = bio->bi_next; | 3081 | req->bio = bio->bi_next; |
| 3086 | bio->bi_next = NULL; | ||
| 3087 | } | ||
| 3088 | 3082 | ||
| 3089 | /* Completion has already been traced */ | 3083 | /* Completion has already been traced */ |
| 3090 | bio_clear_flag(bio, BIO_TRACE_COMPLETION); | 3084 | bio_clear_flag(bio, BIO_TRACE_COMPLETION); |
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index ffa622366922..1c4532e92938 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c | |||
| @@ -356,7 +356,7 @@ static const char *const blk_mq_rq_state_name_array[] = { | |||
| 356 | 356 | ||
| 357 | static const char *blk_mq_rq_state_name(enum mq_rq_state rq_state) | 357 | static const char *blk_mq_rq_state_name(enum mq_rq_state rq_state) |
| 358 | { | 358 | { |
| 359 | if (WARN_ON_ONCE((unsigned int)rq_state > | 359 | if (WARN_ON_ONCE((unsigned int)rq_state >= |
| 360 | ARRAY_SIZE(blk_mq_rq_state_name_array))) | 360 | ARRAY_SIZE(blk_mq_rq_state_name_array))) |
| 361 | return "(?)"; | 361 | return "(?)"; |
| 362 | return blk_mq_rq_state_name_array[rq_state]; | 362 | return blk_mq_rq_state_name_array[rq_state]; |
diff --git a/block/blk-mq.c b/block/blk-mq.c index 70c65bb6c013..b429d515b568 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
| @@ -781,7 +781,6 @@ static void blk_mq_rq_timed_out(struct request *req, bool reserved) | |||
| 781 | WARN_ON_ONCE(ret != BLK_EH_RESET_TIMER); | 781 | WARN_ON_ONCE(ret != BLK_EH_RESET_TIMER); |
| 782 | } | 782 | } |
| 783 | 783 | ||
| 784 | req->rq_flags &= ~RQF_TIMED_OUT; | ||
| 785 | blk_add_timer(req); | 784 | blk_add_timer(req); |
| 786 | } | 785 | } |
| 787 | 786 | ||
diff --git a/block/blk-softirq.c b/block/blk-softirq.c index 01e2b353a2b9..15c1f5e12eb8 100644 --- a/block/blk-softirq.c +++ b/block/blk-softirq.c | |||
| @@ -144,6 +144,7 @@ do_local: | |||
| 144 | 144 | ||
| 145 | local_irq_restore(flags); | 145 | local_irq_restore(flags); |
| 146 | } | 146 | } |
| 147 | EXPORT_SYMBOL(__blk_complete_request); | ||
| 147 | 148 | ||
| 148 | /** | 149 | /** |
| 149 | * blk_complete_request - end I/O on a request | 150 | * blk_complete_request - end I/O on a request |
diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 4b8a48d48ba1..f2cfd56e1606 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c | |||
| @@ -210,6 +210,7 @@ void blk_add_timer(struct request *req) | |||
| 210 | if (!req->timeout) | 210 | if (!req->timeout) |
| 211 | req->timeout = q->rq_timeout; | 211 | req->timeout = q->rq_timeout; |
| 212 | 212 | ||
| 213 | req->rq_flags &= ~RQF_TIMED_OUT; | ||
| 213 | blk_rq_set_deadline(req, jiffies + req->timeout); | 214 | blk_rq_set_deadline(req, jiffies + req->timeout); |
| 214 | 215 | ||
| 215 | /* | 216 | /* |
diff --git a/block/sed-opal.c b/block/sed-opal.c index 945f4b8610e0..e0de4dd448b3 100644 --- a/block/sed-opal.c +++ b/block/sed-opal.c | |||
| @@ -877,7 +877,7 @@ static size_t response_get_string(const struct parsed_resp *resp, int n, | |||
| 877 | return 0; | 877 | return 0; |
| 878 | } | 878 | } |
| 879 | 879 | ||
| 880 | if (n > resp->num) { | 880 | if (n >= resp->num) { |
| 881 | pr_debug("Response has %d tokens. Can't access %d\n", | 881 | pr_debug("Response has %d tokens. Can't access %d\n", |
| 882 | resp->num, n); | 882 | resp->num, n); |
| 883 | return 0; | 883 | return 0; |
| @@ -916,7 +916,7 @@ static u64 response_get_u64(const struct parsed_resp *resp, int n) | |||
| 916 | return 0; | 916 | return 0; |
| 917 | } | 917 | } |
| 918 | 918 | ||
| 919 | if (n > resp->num) { | 919 | if (n >= resp->num) { |
| 920 | pr_debug("Response has %d tokens. Can't access %d\n", | 920 | pr_debug("Response has %d tokens. Can't access %d\n", |
| 921 | resp->num, n); | 921 | resp->num, n); |
| 922 | return 0; | 922 | return 0; |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 3b7083b8ecbb..74a05561b620 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
| @@ -76,6 +76,7 @@ struct link_dead_args { | |||
| 76 | #define NBD_HAS_CONFIG_REF 4 | 76 | #define NBD_HAS_CONFIG_REF 4 |
| 77 | #define NBD_BOUND 5 | 77 | #define NBD_BOUND 5 |
| 78 | #define NBD_DESTROY_ON_DISCONNECT 6 | 78 | #define NBD_DESTROY_ON_DISCONNECT 6 |
| 79 | #define NBD_DISCONNECT_ON_CLOSE 7 | ||
| 79 | 80 | ||
| 80 | struct nbd_config { | 81 | struct nbd_config { |
| 81 | u32 flags; | 82 | u32 flags; |
| @@ -138,6 +139,7 @@ static void nbd_config_put(struct nbd_device *nbd); | |||
| 138 | static void nbd_connect_reply(struct genl_info *info, int index); | 139 | static void nbd_connect_reply(struct genl_info *info, int index); |
| 139 | static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info); | 140 | static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info); |
| 140 | static void nbd_dead_link_work(struct work_struct *work); | 141 | static void nbd_dead_link_work(struct work_struct *work); |
| 142 | static void nbd_disconnect_and_put(struct nbd_device *nbd); | ||
| 141 | 143 | ||
| 142 | static inline struct device *nbd_to_dev(struct nbd_device *nbd) | 144 | static inline struct device *nbd_to_dev(struct nbd_device *nbd) |
| 143 | { | 145 | { |
| @@ -1305,6 +1307,12 @@ out: | |||
| 1305 | static void nbd_release(struct gendisk *disk, fmode_t mode) | 1307 | static void nbd_release(struct gendisk *disk, fmode_t mode) |
| 1306 | { | 1308 | { |
| 1307 | struct nbd_device *nbd = disk->private_data; | 1309 | struct nbd_device *nbd = disk->private_data; |
| 1310 | struct block_device *bdev = bdget_disk(disk, 0); | ||
| 1311 | |||
| 1312 | if (test_bit(NBD_DISCONNECT_ON_CLOSE, &nbd->config->runtime_flags) && | ||
| 1313 | bdev->bd_openers == 0) | ||
| 1314 | nbd_disconnect_and_put(nbd); | ||
| 1315 | |||
| 1308 | nbd_config_put(nbd); | 1316 | nbd_config_put(nbd); |
| 1309 | nbd_put(nbd); | 1317 | nbd_put(nbd); |
| 1310 | } | 1318 | } |
| @@ -1705,6 +1713,10 @@ again: | |||
| 1705 | &config->runtime_flags); | 1713 | &config->runtime_flags); |
| 1706 | put_dev = true; | 1714 | put_dev = true; |
| 1707 | } | 1715 | } |
| 1716 | if (flags & NBD_CFLAG_DISCONNECT_ON_CLOSE) { | ||
| 1717 | set_bit(NBD_DISCONNECT_ON_CLOSE, | ||
| 1718 | &config->runtime_flags); | ||
| 1719 | } | ||
| 1708 | } | 1720 | } |
| 1709 | 1721 | ||
| 1710 | if (info->attrs[NBD_ATTR_SOCKETS]) { | 1722 | if (info->attrs[NBD_ATTR_SOCKETS]) { |
| @@ -1749,6 +1761,17 @@ out: | |||
| 1749 | return ret; | 1761 | return ret; |
| 1750 | } | 1762 | } |
| 1751 | 1763 | ||
| 1764 | static void nbd_disconnect_and_put(struct nbd_device *nbd) | ||
| 1765 | { | ||
