aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-26 00:05:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-26 00:05:15 -0400
commit8fba70b0850a0163f1018a122200ec11b854135c (patch)
tree390ae1ce5cdb36c96fb850e35eb65648d5e4a51d
parentc6dc3e711a28b6b4c5e63f2bca34a5cfd35e9a22 (diff)
parent4412efecf7fda3b8f9f18feed7938f2281f5ccbc (diff)
Merge tag 'for-linus-20180425' of git://git.kernel.dk/linux-block
Pull block updates from Jens Axboe: "I ended up sitting on this about a week longer than I wanted to, since we were hashing out details with a timeout change. I've now killed that patch, so we can flush the existing queue in due time. This contains: - Fix for an old regression, where entering the queue can be disturbed by a signal to the process. This can cause spurious EIO. Fix from Alan Jenkins. - cdrom information leak fix from Dan. - Trivial helper for testing queue FUA from Dave Chinner, part of his O_DIRECT FUA series. - Series of swim fixes from Finn that actually makes it work again. - Loop O_DIRECT corruption fix, which caused data corruption in production for us. From me. - BFQ crash fix from me. - bcache maintainer update. Michael no longer has the time to do it, Coly has stepped up to serve as the new maintainer. - blkcg locking fixes from Jiang Biao. - Revert of a change from this merge window from Ming, that causes an issue on some hardware. - Minor clarification doc addition from Linus Walleij" * tag 'for-linus-20180425' of git://git.kernel.dk/linux-block: (22 commits) Revert "blk-mq: remove code for dealing with remapping queue" block: mq: Add some minor doc for core structs bcache: mark Coly Li as bcache maintainer MAINTAINERS: Remove me as maintainer of bcache blkcg: init root blkcg_gq under lock blkcg: small fix on comment in blkcg_init_queue blkcg: don't hold blkcg lock when deactivating policy block: add blk_queue_fua() helper function cdrom: information leak in cdrom_ioctl_media_changed() bfq-iosched: ensure to clear bic/bfqq pointers when preparing request blk-mq: start request gstate with gen 1 block/swim: Select appropriate drive on device open block/swim: Fix IO error at end of medium block/swim: Check drive type block/swim: Rename macros to avoid inconsistent inverted logic block/swim: Don't log an error message for an invalid ioctl block/swim: Remove extra put_disk() call from error path block/swim: Fix array bounds check m68k/mac: Don't remap SWIM MMIO region loop: handle short DIO reads ...
-rw-r--r--MAINTAINERS2
-rw-r--r--block/bfq-iosched.c10
-rw-r--r--block/blk-cgroup.c28
-rw-r--r--block/blk-core.c15
-rw-r--r--block/blk-mq.c41
-rw-r--r--block/blk-mq.h3
-rw-r--r--drivers/block/loop.c64
-rw-r--r--drivers/block/loop.h1
-rw-r--r--drivers/block/swim.c49
-rw-r--r--drivers/block/swim3.c6
-rw-r--r--drivers/cdrom/cdrom.c2
-rw-r--r--include/linux/blk-mq.h3
-rw-r--r--include/linux/blkdev.h1
13 files changed, 144 insertions, 81 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 92be777d060a..dd66ae9a847e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2617,7 +2617,7 @@ S: Maintained
2617F: drivers/net/hamradio/baycom* 2617F: drivers/net/hamradio/baycom*
2618 2618
2619BCACHE (BLOCK LAYER CACHE) 2619BCACHE (BLOCK LAYER CACHE)
2620M: Michael Lyle <mlyle@lyle.org> 2620M: Coly Li <colyli@suse.de>
2621M: Kent Overstreet <kent.overstreet@gmail.com> 2621M: Kent Overstreet <kent.overstreet@gmail.com>
2622L: linux-bcache@vger.kernel.org 2622L: linux-bcache@vger.kernel.org
2623W: http://bcache.evilpiepirate.org 2623W: http://bcache.evilpiepirate.org
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index f0ecd98509d8..771ae9730ac6 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4934,8 +4934,16 @@ static void bfq_prepare_request(struct request *rq, struct bio *bio)
4934 bool new_queue = false; 4934 bool new_queue = false;
4935 bool bfqq_already_existing = false, split = false; 4935 bool bfqq_already_existing = false, split = false;
4936 4936
4937 if (!rq->elv.icq) 4937 /*
4938 * Even if we don't have an icq attached, we should still clear
4939 * the scheduler pointers, as they might point to previously
4940 * allocated bic/bfqq structs.
4941 */
4942 if (!rq->elv.icq) {
4943 rq->elv.priv[0] = rq->elv.priv[1] = NULL;
4938 return; 4944 return;
4945 }
4946
4939 bic = icq_to_bic(rq->elv.icq); 4947 bic = icq_to_bic(rq->elv.icq);
4940 4948
4941 spin_lock_irq(&bfqd->lock); 4949 spin_lock_irq(&bfqd->lock);
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 1c16694ae145..eb85cb87c40f 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1177,26 +1177,20 @@ int blkcg_init_queue(struct request_queue *q)
1177 1177
1178 preloaded = !radix_tree_preload(GFP_KERNEL); 1178 preloaded = !radix_tree_preload(GFP_KERNEL);
1179 1179
1180 /* 1180 /* Make sure the root blkg exists. */
1181 * Make sure the root blkg exists and count the existing blkgs. As
1182 * @q is bypassing at this point, blkg_lookup_create() can't be
1183 * used. Open code insertion.
1184 */
1185 rcu_read_lock(); 1181 rcu_read_lock();
1186 spin_lock_irq(q->queue_lock); 1182 spin_lock_irq(q->queue_lock);
1187 blkg = blkg_create(&blkcg_root, q, new_blkg); 1183 blkg = blkg_create(&blkcg_root, q, new_blkg);
1184 if (IS_ERR(blkg))
1185 goto err_unlock;
1186 q->root_blkg = blkg;
1187 q->root_rl.blkg = blkg;
1188 spin_unlock_irq(q->queue_lock); 1188 spin_unlock_irq(q->queue_lock);
1189 rcu_read_unlock(); 1189 rcu_read_unlock();
1190 1190
1191 if (preloaded) 1191 if (preloaded)
1192 radix_tree_preload_end(); 1192 radix_tree_preload_end();
1193 1193
1194 if (IS_ERR(blkg))
1195 return PTR_ERR(blkg);
1196
1197 q->root_blkg = blkg;
1198 q->root_rl.blkg = blkg;
1199
1200 ret = blk_throtl_init(q); 1194 ret = blk_throtl_init(q);
1201 if (ret) { 1195 if (ret) {
1202 spin_lock_irq(q->queue_lock); 1196 spin_lock_irq(q->queue_lock);
@@ -1204,6 +1198,13 @@ int blkcg_init_queue(struct request_queue *q)
1204 spin_unlock_irq(q->queue_lock); 1198 spin_unlock_irq(q->queue_lock);
1205 } 1199 }
1206 return ret; 1200 return ret;
1201
1202err_unlock:
1203 spin_unlock_irq(q->queue_lock);
1204 rcu_read_unlock();
1205 if (preloaded)
1206 radix_tree_preload_end();
1207 return PTR_ERR(blkg);
1207} 1208}
1208 1209
1209/** 1210/**
@@ -1410,9 +1411,6 @@ void blkcg_deactivate_policy(struct request_queue *q,
1410 __clear_bit(pol->plid, q->blkcg_pols); 1411 __clear_bit(pol->plid, q->blkcg_pols);
1411 1412
1412 list_for_each_entry(blkg, &q->blkg_list, q_node) { 1413 list_for_each_entry(blkg, &q->blkg_list, q_node) {
1413 /* grab blkcg lock too while removing @pd from @blkg */
1414 spin_lock(&blkg->blkcg->lock);
1415
1416 if (blkg->pd[pol->plid]) { 1414 if (blkg->pd[pol->plid]) {
1417 if (!blkg->pd[pol->plid]->offline && 1415 if (!blkg->pd[pol->plid]->offline &&
1418 pol->pd_offline_fn) { 1416 pol->pd_offline_fn) {
@@ -1422,8 +1420,6 @@ void blkcg_deactivate_policy(struct request_queue *q,
1422 pol->pd_free_fn(blkg->pd[pol->plid]); 1420 pol->pd_free_fn(blkg->pd[pol->plid]);
1423 blkg->pd[pol->plid] = NULL; 1421 blkg->pd[pol->plid] = NULL;
1424 } 1422 }
1425
1426 spin_unlock(&blkg->blkcg->lock);
1427 } 1423 }
1428 1424
1429 spin_unlock_irq(q->queue_lock); 1425 spin_unlock_irq(q->queue_lock);
diff --git a/block/blk-core.c b/block/blk-core.c
index 806ce2442819..85909b431eb0 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -201,6 +201,10 @@ void blk_rq_init(struct request_queue *q, struct request *rq)
201 rq->part = NULL; 201 rq->part = NULL;
202 seqcount_init(&rq->gstate_seq); 202 seqcount_init(&rq->gstate_seq);
203 u64_stats_init(&rq->aborted_gstate_sync); 203 u64_stats_init(&rq->aborted_gstate_sync);
204 /*
205 * See comment of blk_mq_init_request
206 */
207 WRITE_ONCE(rq->gstate, MQ_RQ_GEN_INC);
204} 208}
205EXPORT_SYMBOL(blk_rq_init); 209EXPORT_SYMBOL(blk_rq_init);
206 210
@@ -915,7 +919,6 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
915 919
916 while (true) { 920 while (true) {
917 bool success = false; 921 bool success = false;
918 int ret;
919 922
920 rcu_read_lock(); 923 rcu_read_lock();
921 if (percpu_ref_tryget_live(&q->q_usage_counter)) { 924 if (percpu_ref_tryget_live(&q->q_usage_counter)) {
@@ -947,14 +950,12 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
947 */ 950 */
948 smp_rmb(); 951 smp_rmb();
949 952
950 ret = wait_event_interruptible(q->mq_freeze_wq, 953 wait_event(q->mq_freeze_wq,
951 (atomic_read(&q->mq_freeze_depth) == 0 && 954 (atomic_read(&q->mq_freeze_depth) == 0 &&
952 (preempt || !blk_queue_preempt_only(q))) || 955 (preempt || !blk_queue_preempt_only(q))) ||
953 blk_queue_dying(q)); 956 blk_queue_dying(q));
954 if (blk_queue_dying(q)) 957 if (blk_queue_dying(q))
955 return -ENODEV; 958 return -ENODEV;
956 if (ret)
957 return ret;
958 } 959 }
959} 960}
960 961
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 0dc9e341c2a7..c3621453ad87 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2042,6 +2042,13 @@ static int blk_mq_init_request(struct blk_mq_tag_set *set, struct request *rq,
2042 2042
2043 seqcount_init(&rq->gstate_seq); 2043 seqcount_init(&rq->gstate_seq);
2044 u64_stats_init(&rq->aborted_gstate_sync); 2044 u64_stats_init(&rq->aborted_gstate_sync);
2045 /*
2046 * start gstate with gen 1 instead of 0, otherwise it will be equal
2047 * to aborted_gstate, and be identified timed out by
2048 * blk_mq_terminate_expired.
2049 */
2050 WRITE_ONCE(rq->gstate, MQ_RQ_GEN_INC);
2051
2045 return 0; 2052 return 0;
2046} 2053}
2047 2054
@@ -2329,7 +2336,7 @@ static void blk_mq_free_map_and_requests(struct blk_mq_tag_set *set,
2329 2336
2330static void blk_mq_map_swqueue(struct request_queue *q) 2337static void blk_mq_map_swqueue(struct request_queue *q)
2331{ 2338{