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

Changed files
+25 -19
block
drivers
+4 -9
block/blk-mq-tag.c
··· 322 322 323 323 /* 324 324 * __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. 329 327 */ 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)) 333 329 return; 334 - } 335 330 336 331 queue_for_each_hw_ctx(q, hctx, i) { 337 332 struct blk_mq_tags *tags = hctx->tags; ··· 342 347 bt_for_each(hctx, &tags->breserved_tags, fn, priv, true); 343 348 bt_for_each(hctx, &tags->bitmap_tags, fn, priv, false); 344 349 } 345 - rcu_read_unlock(); 350 + blk_queue_exit(q); 346 351 } 347 352 348 353 static int bt_alloc(struct sbitmap_queue *bt, unsigned int depth,
+2 -2
block/blk-mq.c
··· 1628 1628 BUG_ON(!rq->q); 1629 1629 if (rq->mq_ctx != this_ctx) { 1630 1630 if (this_ctx) { 1631 - trace_block_unplug(this_q, depth, from_schedule); 1631 + trace_block_unplug(this_q, depth, !from_schedule); 1632 1632 blk_mq_sched_insert_requests(this_q, this_ctx, 1633 1633 &ctx_list, 1634 1634 from_schedule); ··· 1648 1648 * on 'ctx_list'. Do those. 1649 1649 */ 1650 1650 if (this_ctx) { 1651 - trace_block_unplug(this_q, depth, from_schedule); 1651 + trace_block_unplug(this_q, depth, !from_schedule); 1652 1652 blk_mq_sched_insert_requests(this_q, this_ctx, &ctx_list, 1653 1653 from_schedule); 1654 1654 }
+1 -1
block/elevator.c
··· 609 609 610 610 while (e->type->ops.sq.elevator_dispatch_fn(q, 1)) 611 611 ; 612 - if (q->nr_sorted && printed++ < 10) { 612 + if (q->nr_sorted && !blk_queue_is_zoned(q) && printed++ < 10 ) { 613 613 printk(KERN_ERR "%s: forced dispatching is broken " 614 614 "(nr_sorted=%u), please report this\n", 615 615 q->elevator->type->elevator_name, q->nr_sorted);
+2 -2
drivers/block/xen-blkfront.c
··· 2670 2670 list_del(&gnt_list_entry->node); 2671 2671 gnttab_end_foreign_access(gnt_list_entry->gref, 0, 0UL); 2672 2672 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); 2675 2675 } 2676 2676 2677 2677 spin_unlock_irqrestore(&rinfo->ring_lock, flags);
+1
drivers/md/bcache/bcache.h
··· 965 965 void bch_write_bdev_super(struct cached_dev *dc, struct closure *parent); 966 966 967 967 extern struct workqueue_struct *bcache_wq; 968 + extern struct workqueue_struct *bch_journal_wq; 968 969 extern struct mutex bch_register_lock; 969 970 extern struct list_head bch_cache_sets; 970 971
+3 -3
drivers/md/bcache/journal.c
··· 485 485 486 486 closure_get(&ca->set->cl); 487 487 INIT_WORK(&ja->discard_work, journal_discard_work); 488 - schedule_work(&ja->discard_work); 488 + queue_work(bch_journal_wq, &ja->discard_work); 489 489 } 490 490 } 491 491 ··· 592 592 : &j->w[0]; 593 593 594 594 __closure_wake_up(&w->wait); 595 - continue_at_nobarrier(cl, journal_write, system_wq); 595 + continue_at_nobarrier(cl, journal_write, bch_journal_wq); 596 596 } 597 597 598 598 static void journal_write_unlock(struct closure *cl) ··· 627 627 spin_unlock(&c->journal.lock); 628 628 629 629 btree_flush_write(c); 630 - continue_at(cl, journal_write, system_wq); 630 + continue_at(cl, journal_write, bch_journal_wq); 631 631 return; 632 632 } 633 633
+8
drivers/md/bcache/super.c
··· 47 47 static DEFINE_IDA(bcache_device_idx); 48 48 static wait_queue_head_t unregister_wait; 49 49 struct workqueue_struct *bcache_wq; 50 + struct workqueue_struct *bch_journal_wq; 50 51 51 52 #define BTREE_MAX_PAGES (256 * 1024 / PAGE_SIZE) 52 53 /* limitation of partitions number on single bcache device */ ··· 2342 2341 kobject_put(bcache_kobj); 2343 2342 if (bcache_wq) 2344 2343 destroy_workqueue(bcache_wq); 2344 + if (bch_journal_wq) 2345 + destroy_workqueue(bch_journal_wq); 2346 + 2345 2347 if (bcache_major) 2346 2348 unregister_blkdev(bcache_major, "bcache"); 2347 2349 unregister_reboot_notifier(&reboot); ··· 2372 2368 2373 2369 bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0); 2374 2370 if (!bcache_wq) 2371 + goto err; 2372 + 2373 + bch_journal_wq = alloc_workqueue("bch_journal", WQ_MEM_RECLAIM, 0); 2374 + if (!bch_journal_wq) 2375 2375 goto err; 2376 2376 2377 2377 bcache_kobj = kobject_create_and_add("bcache", fs_kobj);
+4 -2
drivers/nvme/host/multipath.c
··· 537 537 538 538 INIT_WORK(&ctrl->ana_work, nvme_ana_work); 539 539 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; 541 542 goto out; 543 + } 542 544 543 545 error = nvme_read_ana_log(ctrl, true); 544 546 if (error) ··· 549 547 out_free_ana_log_buf: 550 548 kfree(ctrl->ana_log_buf); 551 549 out: 552 - return -ENOMEM; 550 + return error; 553 551 } 554 552 555 553 void nvme_mpath_uninit(struct nvme_ctrl *ctrl)