History

Merge tag 'block-5.6-2020-02-16' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe: "Not a lot here, which is great, basically just three small bcache fixes from Coly, and four NVMe fixes via Keith" * tag 'block-5.6-2020-02-16' of git://git.kernel.dk/linux-block: nvme: fix the parameter order for nvme_get_log in nvme_get_fw_slot_info nvme/pci: move cqe check after device shutdown nvme: prevent warning triggered by nvme_stop_keep_alive nvme/tcp: fix bug on double requeue when send fails bcache: remove macro nr_to_fifo_front() bcache: Revert "bcache: shrink btree node cache after bch_btree_check()" bcache: ignore pending signals when creating gc and allocator thread

Linus Torvalds committed 6 years ago

Commit e29c6a12 parents 713db35 f25372f8 files · +63 −38Browse files

Unified · Split

8 files
  1. drivers/md/bcache/alloc.c +16 −2
  2. drivers/md/bcache/btree.c +13 −0
  3. drivers/md/bcache/journal.c +2 −5
  4. drivers/md/bcache/super.c +0 −17
  5. drivers/nvme/host/core.c +6 −6
  6. drivers/nvme/host/pci.c +18 −5
  7. drivers/nvme/host/rdma.c +1 −1
  8. drivers/nvme/host/tcp.c +7 −2
drivers/md/bcache/alloc.c+16−2
@@ -67,6 +67,7 @@ · 66 unmodified lines
67#include <linux/blkdev.h>67#include <linux/blkdev.h>
68#include <linux/kthread.h>68#include <linux/kthread.h>
69#include <linux/random.h>69#include <linux/random.h>
70#include <linux/sched/signal.h>
70#include <trace/events/bcache.h>71#include <trace/events/bcache.h>
71 72
72#define MAX_OPEN_BUCKETS 12873#define MAX_OPEN_BUCKETS 128
@@ -733,8 +734,21 @@ int bch_open_buckets_alloc(struct cache_set *c) · 660 unmodified lines
733 734
734int bch_cache_allocator_start(struct cache *ca)735int bch_cache_allocator_start(struct cache *ca)
735{736{
736 struct task_struct *k = kthread_run(bch_allocator_thread,737 struct task_struct *k;
737 ca, "bcache_allocator");738
739 /*
740 * In case previous btree check operation occupies too many
741 * system memory for bcache btree node cache, and the
742 * registering process is selected by OOM killer. Here just
743 * ignore the SIGKILL sent by OOM killer if there is, to
744 * avoid kthread_run() being failed by pending signals. The
745 * bcache registering process will exit after the registration
746 * done.
747 */
748 if (signal_pending(current))
749 flush_signals(current);
750
751 k = kthread_run(bch_allocator_thread, ca, "bcache_allocator");
738 if (IS_ERR(k))752 if (IS_ERR(k))
739 return PTR_ERR(k);753 return PTR_ERR(k);
740 754
drivers/md/bcache/btree.c+13−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#include <linux/random.h>34#include <linux/random.h>
35#include <linux/rcupdate.h>35#include <linux/rcupdate.h>
36#include <linux/sched/clock.h>36#include <linux/sched/clock.h>
37#include <linux/sched/signal.h>
37#include <linux/rculist.h>38#include <linux/rculist.h>
38#include <linux/delay.h>39#include <linux/delay.h>
39#include <trace/events/bcache.h>40#include <trace/events/bcache.h>
@@ -1913,6 +1914,18 @@ static int bch_gc_thread(void *arg) · 1873 unmodified lines
1913 1914
1914int bch_gc_thread_start(struct cache_set *c)1915int bch_gc_thread_start(struct cache_set *c)
1915{1916{
1917 /*
1918 * In case previous btree check operation occupies too many
1919 * system memory for bcache btree node cache, and the
1920 * registering process is selected by OOM killer. Here just
1921 * ignore the SIGKILL sent by OOM killer if there is, to
1922 * avoid kthread_run() being failed by pending signals. The
1923 * bcache registering process will exit after the registration
1924 * done.
1925 */
1926 if (signal_pending(current))
1927 flush_signals(current);
1928
1916 c->gc_thread = kthread_run(bch_gc_thread, c, "bcache_gc");1929 c->gc_thread = kthread_run(bch_gc_thread, c, "bcache_gc");
1917 return PTR_ERR_OR_ZERO(c->gc_thread);1930 return PTR_ERR_OR_ZERO(c->gc_thread);
1918}1931}
drivers/md/bcache/journal.c+2−5
@@ -417,8 +417,6 @@ err: · 416 unmodified lines
417 417
418/* Journalling */418/* Journalling */
419 419
420#define nr_to_fifo_front(p, front_p, mask) (((p) - (front_p)) & (mask))
421
422static void btree_flush_write(struct cache_set *c)420static void btree_flush_write(struct cache_set *c)
423{421{
424 struct btree *b, *t, *btree_nodes[BTREE_FLUSH_NR];422 struct btree *b, *t, *btree_nodes[BTREE_FLUSH_NR];
@@ -510,9 +508,8 @@ static void btree_flush_write(struct cache_set *c) · 85 unmodified lines
510 * journal entry can be reclaimed). These selected nodes508 * journal entry can be reclaimed). These selected nodes
511 * will be ignored and skipped in the folowing for-loop.509 * will be ignored and skipped in the folowing for-loop.
512 */510 */
513 if (nr_to_fifo_front(btree_current_write(b)->journal,511 if (((btree_current_write(b)->journal - fifo_front_p) &
514 fifo_front_p,512 mask) != 0) {
515 mask) != 0) {
516 mutex_unlock(&b->write_lock);513 mutex_unlock(&b->write_lock);
517 continue;514 continue;
518 }515 }
drivers/md/bcache/super.c+0−17
@@ -1917,23 +1917,6 @@ static int run_cache_set(struct cache_set *c) · 1916 unmodified lines
1917 if (bch_btree_check(c))1917 if (bch_btree_check(c))
1918 goto err;1918 goto err;
1919 1919
1920 /*
1921 * bch_btree_check() may occupy too much system memory which
1922 * has negative effects to user space application (e.g. data
1923 * base) performance. Shrink the mca cache memory proactively
1924 * here to avoid competing memory with user space workloads..
1925 */
1926 if (!c->shrinker_disabled) {
1927 struct shrink_control sc;
1928
1929 sc.gfp_mask = GFP_KERNEL;
1930 sc.nr_to_scan = c->btree_cache_used * c->btree_pages;
1931 /* first run to clear b->accessed tag */
1932 c->shrink.scan_objects(&c->shrink, &sc);
1933 /* second run to reap non-accessed nodes */
1934 c->shrink.scan_objects(&c->shrink, &sc);
1935 }
1936
1937 bch_journal_mark(c, &journal);1920 bch_journal_mark(c, &journal);
1938 bch_initial_gc_finish(c);1921 bch_initial_gc_finish(c);
1939 pr_debug("btree_check() done");1922 pr_debug("btree_check() done");
drivers/nvme/host/core.c+6−6
@@ -66,8 +66,8 @@ MODULE_PARM_DESC(streams, "turn on support for Streams write directives"); · 65 unmodified lines
66 * nvme_reset_wq - hosts nvme reset works66 * nvme_reset_wq - hosts nvme reset works
67 * nvme_delete_wq - hosts nvme delete works67 * nvme_delete_wq - hosts nvme delete works
68 *68 *
69 * nvme_wq will host works such are scan, aen handling, fw activation,69 * nvme_wq will host works such as scan, aen handling, fw activation,
70 * keep-alive error recovery, periodic reconnects etc. nvme_reset_wq70 * keep-alive, periodic reconnects etc. nvme_reset_wq
71 * runs reset works which also flush works hosted on nvme_wq for71 * runs reset works which also flush works hosted on nvme_wq for
72 * serialization purposes. nvme_delete_wq host controller deletion72 * serialization purposes. nvme_delete_wq host controller deletion
73 * works which flush reset works for serialization.73 * works which flush reset works for serialization.
@@ -976,7 +976,7 @@ static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status) · 902 unmodified lines
976 startka = true;976 startka = true;
977 spin_unlock_irqrestore(&ctrl->lock, flags);977 spin_unlock_irqrestore(&ctrl->lock, flags);
978 if (startka)978 if (startka)
979 schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);979 queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
980}980}
981 981
982static int nvme_keep_alive(struct nvme_ctrl *ctrl)982static int nvme_keep_alive(struct nvme_ctrl *ctrl)
@@ -1006,7 +1006,7 @@ static void nvme_keep_alive_work(struct work_struct *work) · 23 unmodified lines
1006 dev_dbg(ctrl->device,1006 dev_dbg(ctrl->device,
1007 "reschedule traffic based keep-alive timer\n");1007 "reschedule traffic based keep-alive timer\n");
1008 ctrl->comp_seen = false;1008 ctrl->comp_seen = false;
1009 schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);1009 queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
1010 return;1010 return;
1011 }1011 }
1012 1012
@@ -1023,7 +1023,7 @@ static void nvme_start_keep_alive(struct nvme_ctrl *ctrl) · 10 unmodified lines
1023 if (unlikely(ctrl->kato == 0))1023 if (unlikely(ctrl->kato == 0))
1024 return;1024 return;
1025 1025
1026 schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);1026 queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
1027}1027}
1028 1028
1029void nvme_stop_keep_alive(struct nvme_ctrl *ctrl)1029void nvme_stop_keep_alive(struct nvme_ctrl *ctrl)
@@ -3867,7 +3867,7 @@ static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl) · 2837 unmodified lines
3867 if (!log)3867 if (!log)
3868 return;3868 return;
3869 3869
3870 if (nvme_get_log(ctrl, NVME_NSID_ALL, 0, NVME_LOG_FW_SLOT, log,3870 if (nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_FW_SLOT, 0, log,
3871 sizeof(*log), 0))3871 sizeof(*log), 0))
3872 dev_warn(ctrl->device, "Get FW SLOT INFO log error\n");3872 dev_warn(ctrl->device, "Get FW SLOT INFO log error\n");
3873 kfree(log);3873 kfree(log);
drivers/nvme/host/pci.c+18−5
@@ -1401,6 +1401,23 @@ static void nvme_disable_admin_queue(struct nvme_dev *dev, bool shutdown) · 1400 unmodified lines
1401 nvme_poll_irqdisable(nvmeq, -1);1401 nvme_poll_irqdisable(nvmeq, -1);
1402}1402}
1403 1403
1404/*
1405 * Called only on a device that has been disabled and after all other threads
1406 * that can check this device's completion queues have synced. This is the
1407 * last chance for the driver to see a natural completion before
1408 * nvme_cancel_request() terminates all incomplete requests.
1409 */
1410static void nvme_reap_pending_cqes(struct nvme_dev *dev)
1411{
1412 u16 start, end;
1413 int i;
1414
1415 for (i = dev->ctrl.queue_count - 1; i > 0; i--) {
1416 nvme_process_cq(&dev->queues[i], &start, &end, -1);
1417 nvme_complete_cqes(&dev->queues[i], start, end);
1418 }
1419}
1420
1404static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues,1421static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues,
1405 int entry_size)1422 int entry_size)
1406{1423{
@@ -2235,11 +2252,6 @@ static bool __nvme_disable_io_queues(struct nvme_dev *dev, u8 opcode) · 828 unmodified lines
2235 if (timeout == 0)2252 if (timeout == 0)
2236 return false;2253 return false;
2237 2254
2238 /* handle any remaining CQEs */
2239 if (opcode == nvme_admin_delete_cq &&
2240 !test_bit(NVMEQ_DELETE_ERROR, &nvmeq->flags))
2241 nvme_poll_irqdisable(nvmeq, -1);
2242
2243 sent--;2255 sent--;
2244 if (nr_queues)2256 if (nr_queues)
2245 goto retry;2257 goto retry;
@@ -2428,6 +2440,7 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) · 182 unmodified lines
2428 nvme_suspend_io_queues(dev);2440 nvme_suspend_io_queues(dev);
2429 nvme_suspend_queue(&dev->queues[0]);2441 nvme_suspend_queue(&dev->queues[0]);
2430 nvme_pci_disable(dev);2442 nvme_pci_disable(dev);
2443 nvme_reap_pending_cqes(dev);
2431 2444
2432 blk_mq_tagset_busy_iter(&dev->tagset, nvme_cancel_request, &dev->ctrl);2445 blk_mq_tagset_busy_iter(&dev->tagset, nvme_cancel_request, &dev->ctrl);
2433 blk_mq_tagset_busy_iter(&dev->admin_tagset, nvme_cancel_request, &dev->ctrl);2446 blk_mq_tagset_busy_iter(&dev->admin_tagset, nvme_cancel_request, &dev->ctrl);
drivers/nvme/host/rdma.c+1−1
@@ -1088,7 +1088,7 @@ static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl) · 1087 unmodified lines
1088 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))1088 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))
1089 return;1089 return;
1090 1090
1091 queue_work(nvme_wq, &ctrl->err_work);1091 queue_work(nvme_reset_wq, &ctrl->err_work);
1092}1092}
1093 1093
1094static void nvme_rdma_wr_error(struct ib_cq *cq, struct ib_wc *wc,1094static void nvme_rdma_wr_error(struct ib_cq *cq, struct ib_wc *wc,
drivers/nvme/host/tcp.c+7−2
@@ -422,7 +422,7 @@ static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl) · 421 unmodified lines
422 if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))422 if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
423 return;423 return;
424 424
425 queue_work(nvme_wq, &to_tcp_ctrl(ctrl)->err_work);425 queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work);
426}426}
427 427
428static int nvme_tcp_process_nvme_cqe(struct nvme_tcp_queue *queue,428static int nvme_tcp_process_nvme_cqe(struct nvme_tcp_queue *queue,
@@ -1054,7 +1054,12 @@ static void nvme_tcp_io_work(struct work_struct *w) · 625 unmodified lines
1054 } else if (unlikely(result < 0)) {1054 } else if (unlikely(result < 0)) {
1055 dev_err(queue->ctrl->ctrl.device,1055 dev_err(queue->ctrl->ctrl.device,
1056 "failed to send request %d\n", result);1056 "failed to send request %d\n", result);
1057 if (result != -EPIPE)1057
1058 /*
1059 * Fail the request unless peer closed the connection,
1060 * in which case error recovery flow will complete all.
1061 */
1062 if ((result != -EPIPE) && (result != -ECONNRESET))
1058 nvme_tcp_fail_request(queue->request);1063 nvme_tcp_fail_request(queue->request);
1059 nvme_tcp_done_send_req(queue);1064 nvme_tcp_done_send_req(queue);
1060 return;1065 return;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t