Skip to content

Commit 291d0e5

Browse files
committed
Merge tag 'for-linus-20180929' of git://git.kernel.dk/linux-block
Jens writes: "Block fixes for 4.19-rc6 A set of fixes that should go into this release. This pull request contains: - A fix (hopefully) for the persistent grants for xen-blkfront. A previous fix from this series wasn't complete, hence reverted, and this one should hopefully be it. (Boris Ostrovsky) - Fix for an elevator drain warning with SMR devices, which is triggered when you switch schedulers (Damien) - bcache deadlock fix (Guoju Fang) - Fix for the block unplug tracepoint, which has had the timer/explicit flag reverted since 4.11 (Ilya) - Fix a regression in this series where the blk-mq timeout hook is invoked with the RCU read lock held, hence preventing it from blocking (Keith) - NVMe pull from Christoph, with a single multipath fix (Susobhan Dey)" * tag 'for-linus-20180929' of git://git.kernel.dk/linux-block: xen/blkfront: correct purging of persistent grants Revert "xen/blkfront: When purging persistent grants, keep them in the buffer" blk-mq: I/O and timer unplugs are inverted in blktrace bcache: add separate workqueue for journal_write to avoid deadlock xen/blkfront: When purging persistent grants, keep them in the buffer block: fix deadline elevator drain for zoned block devices blk-mq: Allow blocking queue tag iter callbacks nvme: properly propagate errors in nvme_mpath_init
2 parents e754177 + 133424a commit 291d0e5

File tree

8 files changed

+25
-19
lines changed

8 files changed

+25
-19
lines changed

block/blk-mq-tag.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,11 @@ void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_iter_fn *fn,
322322

323323
/*
324324
* __blk_mq_update_nr_hw_queues will update the nr_hw_queues and
325-
* queue_hw_ctx after freeze the queue. So we could use q_usage_counter
326-
* to avoid race with it. __blk_mq_update_nr_hw_queues will users
327-
* synchronize_rcu to ensure all of the users go out of the critical
328-
* section below and see zeroed q_usage_counter.
325+
* queue_hw_ctx after freeze the queue, so we use q_usage_counter
326+
* to avoid race with it.
329327
*/
330-
rcu_read_lock();
331-
if (percpu_ref_is_zero(&q->q_usage_counter)) {
332-
rcu_read_unlock();
328+
if (!percpu_ref_tryget(&q->q_usage_counter))
333329
return;
334-
}
335330

336331
queue_for_each_hw_ctx(q, hctx, i) {
337332
struct blk_mq_tags *tags = hctx->tags;
@@ -347,7 +342,7 @@ void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_iter_fn *fn,
347342
bt_for_each(hctx, &tags->breserved_tags, fn, priv, true);
348343
bt_for_each(hctx, &tags->bitmap_tags, fn, priv, false);
349344
}
350-
rcu_read_unlock();
345+
blk_queue_exit(q);
351346
}
352347

353348
static int bt_alloc(struct sbitmap_queue *bt, unsigned int depth,

block/blk-mq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
16281628
BUG_ON(!rq->q);
16291629
if (rq->mq_ctx != this_ctx) {
16301630
if (this_ctx) {
1631-
trace_block_unplug(this_q, depth, from_schedule);
1631+
trace_block_unplug(this_q, depth, !from_schedule);
16321632
blk_mq_sched_insert_requests(this_q, this_ctx,
16331633
&ctx_list,
16341634
from_schedule);
@@ -1648,7 +1648,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
16481648
* on 'ctx_list'. Do those.
16491649
*/
16501650
if (this_ctx) {
1651-
trace_block_unplug(this_q, depth, from_schedule);
1651+
trace_block_unplug(this_q, depth, !from_schedule);
16521652
blk_mq_sched_insert_requests(this_q, this_ctx, &ctx_list,
16531653
from_schedule);
16541654
}

block/elevator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ void elv_drain_elevator(struct request_queue *q)
609609

610610
while (e->type->ops.sq.elevator_dispatch_fn(q, 1))
611611
;
612-
if (q->nr_sorted && printed++ < 10) {
612+
if (q->nr_sorted && !blk_queue_is_zoned(q) && printed++ < 10 ) {
613613
printk(KERN_ERR "%s: forced dispatching is broken "
614614
"(nr_sorted=%u), please report this\n",
615615
q->elevator->type->elevator_name, q->nr_sorted);

drivers/block/xen-blkfront.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,8 +2670,8 @@ static void purge_persistent_grants(struct blkfront_info *info)
26702670
list_del(&gnt_list_entry->node);
26712671
gnttab_end_foreign_access(gnt_list_entry->gref, 0, 0UL);
26722672
rinfo->persistent_gnts_c--;
2673-
__free_page(gnt_list_entry->page);
2674-
kfree(gnt_list_entry);
2673+
gnt_list_entry->gref = GRANT_INVALID_REF;
2674+
list_add_tail(&gnt_list_entry->node, &rinfo->grants);
26752675
}
26762676

26772677
spin_unlock_irqrestore(&rinfo->ring_lock, flags);

drivers/md/bcache/bcache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,7 @@ void bch_prio_write(struct cache *ca);
965965
void bch_write_bdev_super(struct cached_dev *dc, struct closure *parent);
966966

967967
extern struct workqueue_struct *bcache_wq;
968+
extern struct workqueue_struct *bch_journal_wq;
968969
extern struct mutex bch_register_lock;
969970
extern struct list_head bch_cache_sets;
970971

drivers/md/bcache/journal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ static void do_journal_discard(struct cache *ca)
485485

486486
closure_get(&ca->set->cl);
487487
INIT_WORK(&ja->discard_work, journal_discard_work);
488-
schedule_work(&ja->discard_work);
488+
queue_work(bch_journal_wq, &ja->discard_work);
489489
}
490490
}
491491

@@ -592,7 +592,7 @@ static void journal_write_done(struct closure *cl)
592592
: &j->w[0];
593593

594594
__closure_wake_up(&w->wait);
595-
continue_at_nobarrier(cl, journal_write, system_wq);
595+
continue_at_nobarrier(cl, journal_write, bch_journal_wq);
596596
}
597597

598598
static void journal_write_unlock(struct closure *cl)
@@ -627,7 +627,7 @@ static void journal_write_unlocked(struct closure *cl)
627627
spin_unlock(&c->journal.lock);
628628

629629
btree_flush_write(c);
630-
continue_at(cl, journal_write, system_wq);
630+
continue_at(cl, journal_write, bch_journal_wq);
631631
return;
632632
}
633633

drivers/md/bcache/super.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static int bcache_major;
4747
static DEFINE_IDA(bcache_device_idx);
4848
static wait_queue_head_t unregister_wait;
4949
struct workqueue_struct *bcache_wq;
50+
struct workqueue_struct *bch_journal_wq;
5051

5152
#define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE)
5253
/* limitation of partitions number on single bcache device */
@@ -2341,6 +2342,9 @@ static void bcache_exit(void)
23412342
kobject_put(bcache_kobj);
23422343
if (bcache_wq)
23432344
destroy_workqueue(bcache_wq);
2345+
if (bch_journal_wq)
2346+
destroy_workqueue(bch_journal_wq);
2347+
23442348
if (bcache_major)
23452349
unregister_blkdev(bcache_major, "bcache");
23462350
unregister_reboot_notifier(&reboot);
@@ -2370,6 +2374,10 @@ static int __init bcache_init(void)
23702374
if (!bcache_wq)
23712375
goto err;
23722376

2377+
bch_journal_wq = alloc_workqueue("bch_journal", WQ_MEM_RECLAIM, 0);
2378+
if (!bch_journal_wq)
2379+
goto err;
2380+
23732381
bcache_kobj = kobject_create_and_add("bcache", fs_kobj);
23742382
if (!bcache_kobj)
23752383
goto err;

drivers/nvme/host/multipath.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,10 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
537537

538538
INIT_WORK(&ctrl->ana_work, nvme_ana_work);
539539
ctrl->ana_log_buf = kmalloc(ctrl->ana_log_size, GFP_KERNEL);
540-
if (!ctrl->ana_log_buf)
540+
if (!ctrl->ana_log_buf) {
541+
error = -ENOMEM;
541542
goto out;
543+
}
542544

543545
error = nvme_read_ana_log(ctrl, true);
544546
if (error)
@@ -547,7 +549,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
547549
out_free_ana_log_buf:
548550
kfree(ctrl->ana_log_buf);
549551
out:
550-
return -ENOMEM;
552+
return error;
551553
}
552554

553555
void nvme_mpath_uninit(struct nvme_ctrl *ctrl)

0 commit comments

Comments
 (0)