History

Merge branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe: - an NVMe fix from Gabriel, fixing a suspend/resume issue on some setups - addition of a few missing entries in the block queue sysfs documentation, from Joe - a fix for a sparse shadow warning for the bvec iterator, from Johannes - a writeback deadlock involving raid issuing barriers, and not flushing the plug when we wakeup the flusher threads. From Konstantin - a set of patches for the NVMe target/loop/rdma code, from Roland and Sagi * 'for-linus' of git://git.kernel.dk/linux-block: bvec: avoid variable shadowing warning doc: update block/queue-sysfs.txt entries nvme: Suspend all queues before deletion mm, writeback: flush plugged IO in wakeup_flusher_threads() nvme-rdma: Remove unused includes nvme-rdma: start async event handler after reconnecting to a controller nvmet: Fix controller serial number inconsistency nvmet-rdma: Don't use the inline buffer in order to avoid allocation for small reads nvmet-rdma: Correctly handle RDMA device hot removal nvme-rdma: Make sure to shutdown the controller if we can nvme-loop: Remove duplicate call to nvme_remove_namespaces nvme-rdma: Free the I/O tags when we delete the controller nvme-rdma: Remove duplicate call to nvme_remove_namespaces nvme-rdma: Fix device removal handling nvme-rdma: Queue ns scanning after a sucessful reconnection nvme-rdma: Don't leak uninitialized memory in connect request private data

Linus Torvalds committed 10 years ago

Commit a1e21032 parents f31494b 1ea049b10 files · +160 −85Browse files

Unified · Split

10 files
  1. Documentation/block/queue-sysfs.txt +18 −0
  2. drivers/nvme/host/pci.c +8 −12
  3. drivers/nvme/host/rdma.c +45 −38
  4. drivers/nvme/target/admin-cmd.c +1 −5
  5. drivers/nvme/target/core.c +4 −0
  6. drivers/nvme/target/loop.c +1 −3
  7. drivers/nvme/target/nvmet.h +1 −0
  8. drivers/nvme/target/rdma.c +74 −26
  9. fs/fs-writeback.c +6 −0
  10. include/linux/bvec.h +2 −1
Documentation/block/queue-sysfs.txt+18−0
@@ -14,6 +14,12 @@ add_random (RW) · 13 unmodified lines
1414 This file allows to turn off the disk entropy contribution. Default
1515 value of this file is '1'(on).
1616
17+dax (RO)
18+--------
19+This file indicates whether the device supports Direct Access (DAX),
20+used by CPU-addressable storage to bypass the pagecache. It shows '1'
21+if true, '0' if not.
22+
1723 discard_granularity (RO)
1824 -----------------------
1925 This shows the size of internal allocation of the device in bytes, if
@@ -46,6 +52,12 @@ hw_sector_size (RO) · 26 unmodified lines
4652 -------------------
4753 This is the hardware sector size of the device, in bytes.
4854
55+io_poll (RW)
56+------------
57+When read, this file shows the total number of block IO polls and how
58+many returned success. Writing '0' to this file will disable polling
59+for this device. Writing any non-zero value will enable this feature.
60+
4961 iostats (RW)
5062 -------------
5163 This file is used to control (on/off) the iostats accounting of the
@@ -151,5 +163,11 @@ device state. This means that it might not be safe to toggle the · 99 unmodified lines
151163 setting from "write back" to "write through", since that will also
152164 eliminate cache flushes issued by the kernel.
153165
166+write_same_max_bytes (RO)
167+-------------------------
168+This is the number of bytes the device can write in a single write-same
169+command. A value of '0' means write-same is not supported by this
170+device.
171+
154172
155173 Jens Axboe <jens.axboe@oracle.com>, February 2009
drivers/nvme/host/pci.c+8−12
@@ -1543,15 +1543,10 @@ static void nvme_disable_io_queues(struct nvme_dev *dev) · 1542 unmodified lines
15431543 reinit_completion(&dev->ioq_wait);
15441544 retry:
15451545 timeout = ADMIN_TIMEOUT;
1546− for (; i > 0; i--) {
1547− struct nvme_queue *nvmeq = dev->queues[i];
1548−
1549− if (!pass)
1550− nvme_suspend_queue(nvmeq);
1551− if (nvme_delete_queue(nvmeq, opcode))
1546+ for (; i > 0; i--, sent++)
1547+ if (nvme_delete_queue(dev->queues[i], opcode))
15521548 break;
1553− ++sent;
1554− }
1549+
15551550 while (sent--) {
15561551 timeout = wait_for_completion_io_timeout(&dev->ioq_wait, timeout);
15571552 if (timeout == 0)
@@ -1693,11 +1688,12 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) · 135 unmodified lines
16931688 nvme_stop_queues(&dev->ctrl);
16941689 csts = readl(dev->bar + NVME_REG_CSTS);
16951690 }
1691+
1692+ for (i = dev->queue_count - 1; i > 0; i--)
1693+ nvme_suspend_queue(dev->queues[i]);
1694+
16961695 if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) {
1697− for (i = dev->queue_count - 1; i >= 0; i--) {
1698− struct nvme_queue *nvmeq = dev->queues[i];
1699− nvme_suspend_queue(nvmeq);
1700− }
1696+ nvme_suspend_queue(dev->queues[0]);
17011697 } else {
17021698 nvme_disable_io_queues(dev);
17031699 nvme_disable_admin_queue(dev, shutdown);
drivers/nvme/host/rdma.c+45−38
@@ -12,13 +12,11 @@ · 11 unmodified lines
1212 * more details.
1313 */
1414 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15−#include <linux/delay.h>
1615 #include <linux/module.h>
1716 #include <linux/init.h>
1817 #include <linux/slab.h>
1918 #include <linux/err.h>
2019 #include <linux/string.h>
21−#include <linux/jiffies.h>
2220 #include <linux/atomic.h>
2321 #include <linux/blk-mq.h>
2422 #include <linux/types.h>
@@ -26,7 +24,6 @@ · 1 unmodified line
2624 #include <linux/mutex.h>
2725 #include <linux/scatterlist.h>
2826 #include <linux/nvme.h>
29−#include <linux/t10-pi.h>
3027 #include <asm/unaligned.h>
3128
3229 #include <rdma/ib_verbs.h>
@@ -169,7 +166,6 @@ MODULE_PARM_DESC(register_always, · 136 unmodified lines
169166 static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id,
170167 struct rdma_cm_event *event);
171168 static void nvme_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc);
172−static int __nvme_rdma_del_ctrl(struct nvme_rdma_ctrl *ctrl);
173169
174170 /* XXX: really should move to a generic header sooner or later.. */
175171 static inline void put_unaligned_le24(u32 val, u8 *p)
@@ -687,11 +683,6 @@ static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) · 511 unmodified lines
687683 list_del(&ctrl->list);
688684 mutex_unlock(&nvme_rdma_ctrl_mutex);
689685
690− if (ctrl->ctrl.tagset) {
691− blk_cleanup_queue(ctrl->ctrl.connect_q);
692− blk_mq_free_tag_set(&ctrl->tag_set);
693− nvme_rdma_dev_put(ctrl->device);
694− }
695686 kfree(ctrl->queues);
696687 nvmf_free_options(nctrl->opts);
697688 free_ctrl:
@@ -748,8 +739,11 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work) · 50 unmodified lines
748739 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
749740 WARN_ON_ONCE(!changed);
750741
751− if (ctrl->queue_count > 1)
742+ if (ctrl->queue_count > 1) {
752743 nvme_start_queues(&ctrl->ctrl);
744+ nvme_queue_scan(&ctrl->ctrl);
745+ nvme_queue_async_events(&ctrl->ctrl);
746+ }
753747
754748 dev_info(ctrl->ctrl.device, "Successfully reconnected\n");
755749
@@ -1269,7 +1263,7 @@ static int nvme_rdma_route_resolved(struct nvme_rdma_queue *queue) · 513 unmodified lines
12691263 {
12701264 struct nvme_rdma_ctrl *ctrl = queue->ctrl;
12711265 struct rdma_conn_param param = { };
1272− struct nvme_rdma_cm_req priv;
1266+ struct nvme_rdma_cm_req priv = { };
12731267 int ret;
12741268
12751269 param.qp_num = queue->qp->qp_num;
@@ -1318,37 +1312,39 @@ out_destroy_queue_ib: · 42 unmodified lines
13181312 * that caught the event. Since we hold the callout until the controller
13191313 * deletion is completed, we'll deadlock if the controller deletion will
13201314 * call rdma_destroy_id on this queue's cm_id. Thus, we claim ownership
1321− * of destroying this queue before-hand, destroy the queue resources
1322− * after the controller deletion completed with the exception of destroying
1323− * the cm_id implicitely by returning a non-zero rc to the callout.
1315+ * of destroying this queue before-hand, destroy the queue resources,
1316+ * then queue the controller deletion which won't destroy this queue and
1317+ * we destroy the cm_id implicitely by returning a non-zero rc to the callout.
13241318 */
13251319 static int nvme_rdma_device_unplug(struct nvme_rdma_queue *queue)
13261320 {
13271321 struct nvme_rdma_ctrl *ctrl = queue->ctrl;
1328− int ret, ctrl_deleted = 0;
1322+ int ret;
13291323
1330− /* First disable the queue so ctrl delete won't free it */
1331− if (!test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags))
1332− goto out;
1324+ /* Own the controller deletion */
1325+ if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING))
1326+ return 0;
13331327
1334− /* delete the controller */
1335− ret = __nvme_rdma_del_ctrl(ctrl);
1336− if (!ret) {
1337− dev_warn(ctrl->ctrl.device,
1338− "Got rdma device removal event, deleting ctrl\n");
1339− flush_work(&ctrl->delete_work);
1328+ dev_warn(ctrl->ctrl.device,
1329+ "Got rdma device removal event, deleting ctrl\n");
13401330
1341− /* Return non-zero so the cm_id will destroy implicitly */
1342− ctrl_deleted = 1;
1331+ /* Get rid of reconnect work if its running */
1332+ cancel_delayed_work_sync(&ctrl->reconnect_work);
13431333
1334+ /* Disable the queue so ctrl delete won't free it */
1335+ if (test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags)) {
13441336 /* Free this queue ourselves */
1345− rdma_disconnect(queue->cm_id);
1346− ib_drain_qp(queue->qp);
1337+ nvme_rdma_stop_queue(queue);
13471338 nvme_rdma_destroy_queue_ib(queue);
1339+
1340+ /* Return non-zero so the cm_id will destroy implicitly */
1341+ ret = 1;
13481342 }
13491343
1350−out:
1351− return ctrl_deleted;
1344+ /* Queue controller deletion */
1345+ queue_work(nvme_rdma_wq, &ctrl->delete_work);
1346+ flush_work(&ctrl->delete_work);
1347+ return ret;
13521348 }
13531349
13541350 static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id,
@@ -1648,7 +1644,7 @@ static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl) · 293 unmodified lines
16481644 nvme_rdma_free_io_queues(ctrl);
16491645 }
16501646
1651− if (ctrl->ctrl.state == NVME_CTRL_LIVE)
1647+ if (test_bit(NVME_RDMA_Q_CONNECTED, &ctrl->queues[0].flags))
16521648 nvme_shutdown_ctrl(&ctrl->ctrl);
16531649
16541650 blk_mq_stop_hw_queues(ctrl->ctrl.admin_q);
@@ -1657,15 +1653,27 @@ static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl) · 2 unmodified lines
16571653 nvme_rdma_destroy_admin_queue(ctrl);
16581654 }
16591655
1656+static void __nvme_rdma_remove_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
1657+{
1658+ nvme_uninit_ctrl(&ctrl->ctrl);
1659+ if (shutdown)
1660+ nvme_rdma_shutdown_ctrl(ctrl);
1661+
1662+ if (ctrl->ctrl.tagset) {
1663+ blk_cleanup_queue(ctrl->ctrl.connect_q);
1664+ blk_mq_free_tag_set(&ctrl->tag_set);
1665+ nvme_rdma_dev_put(ctrl->device);
1666+ }
1667+
1668+ nvme_put_ctrl(&ctrl->ctrl);
1669+}
1670+
16601671 static void nvme_rdma_del_ctrl_work(struct work_struct *work)
16611672 {
16621673 struct nvme_rdma_ctrl *ctrl = container_of(work,
16631674 struct nvme_rdma_ctrl, delete_work);
16641675
1665− nvme_remove_namespaces(&ctrl->ctrl);
1666− nvme_rdma_shutdown_ctrl(ctrl);
1667− nvme_uninit_ctrl(&ctrl->ctrl);
1668− nvme_put_ctrl(&ctrl->ctrl);
1676+ __nvme_rdma_remove_ctrl(ctrl, true);
16691677 }
16701678
16711679 static int __nvme_rdma_del_ctrl(struct nvme_rdma_ctrl *ctrl)
@@ -1698,9 +1706,7 @@ static void nvme_rdma_remove_ctrl_work(struct work_struct *work) · 26 unmodified lines
16981706 struct nvme_rdma_ctrl *ctrl = container_of(work,
16991707 struct nvme_rdma_ctrl, delete_work);
17001708
1701− nvme_remove_namespaces(&ctrl->ctrl);
1702− nvme_uninit_ctrl(&ctrl->ctrl);
1703− nvme_put_ctrl(&ctrl->ctrl);
1709+ __nvme_rdma_remove_ctrl(ctrl, false);
17041710 }
17051711
17061712 static void nvme_rdma_reset_ctrl_work(struct work_struct *work)
@@ -1739,6 +1745,7 @@ static void nvme_rdma_reset_ctrl_work(struct work_struct *work) · 32 unmodified lines
17391745 if (ctrl->queue_count > 1) {
17401746 nvme_start_queues(&ctrl->ctrl);
17411747 nvme_queue_scan(&ctrl->ctrl);
1748+ nvme_queue_async_events(&ctrl->ctrl);
17421749 }
17431750
17441751 return;
drivers/nvme/target/admin-cmd.c+1−5
@@ -13,7 +13,6 @@ · 12 unmodified lines
1313 */
1414 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1515 #include <linux/module.h>
16−#include <linux/random.h>
1716 #include <generated/utsrelease.h>
1817 #include "nvmet.h"
1918
@@ -83,7 +82,6 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) · 63 unmodified lines
8382 {
8483 struct nvmet_ctrl *ctrl = req->sq->ctrl;
8584 struct nvme_id_ctrl *id;
86− u64 serial;
8785 u16 status = 0;
8886
8987 id = kzalloc(sizeof(*id), GFP_KERNEL);
@@ -96,10 +94,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) · 6 unmodified lines
9694 id->vid = 0;
9795 id->ssvid = 0;
9896
99− /* generate a random serial number as our controllers are ephemeral: */
100− get_random_bytes(&serial, sizeof(serial));
10197 memset(id->sn, ' ', sizeof(id->sn));
102− snprintf(id->sn, sizeof(id->sn), "%llx", serial);
98+ snprintf(id->sn, sizeof(id->sn), "%llx", ctrl->serial);
10399
104100 memset(id->mn, ' ', sizeof(id->mn));
105101 strncpy((char *)id->mn, "Linux", sizeof(id->mn));
drivers/nvme/target/core.c+4−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 */
1414 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1515 #include <linux/module.h>
16+#include <linux/random.h>
1617 #include "nvmet.h"
1718
1819 static struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
@@ -728,6 +729,9 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, · 709 unmodified lines
728729 memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE);
729730 memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE);
730731
732+ /* generate a random serial number as our controllers are ephemeral: */
733+ get_random_bytes(&ctrl->serial, sizeof(ctrl->serial));
734+
731735 kref_init(&ctrl->ref);
732736 ctrl->subsys = subsys;
733737
drivers/nvme/target/loop.c+1−3
@@ -414,9 +414,8 @@ static void nvme_loop_del_ctrl_work(struct work_struct *work) · 413 unmodified lines
414414 struct nvme_loop_ctrl *ctrl = container_of(work,
415415 struct nvme_loop_ctrl, delete_work);
416416
417− nvme_remove_namespaces(&ctrl->ctrl);
418− nvme_loop_shutdown_ctrl(ctrl);
419417 nvme_uninit_ctrl(&ctrl->ctrl);
418+ nvme_loop_shutdown_ctrl(ctrl);
420419 nvme_put_ctrl(&ctrl->ctrl);
421420 }
422421
@@ -501,7 +500,6 @@ out_free_queues: · 78 unmodified lines
501500 nvme_loop_destroy_admin_queue(ctrl);
502501 out_disable:
503502 dev_warn(ctrl->ctrl.device, "Removing after reset failure\n");
504− nvme_remove_namespaces(&ctrl->ctrl);
505503 nvme_uninit_ctrl(&ctrl->ctrl);
506504 nvme_put_ctrl(&ctrl->ctrl);
507505 }
drivers/nvme/target/nvmet.h+1−0
@@ -113,6 +113,7 @@ struct nvmet_ctrl { · 112 unmodified lines
113113
114114 struct mutex lock;
115115 u64 cap;
116+ u64 serial;
116117 u32 cc;
117118 u32 csts;
118119
drivers/nvme/target/rdma.c+74−26
@@ -77,6 +77,7 @@ enum nvmet_rdma_queue_state { · 76 unmodified lines
7777 NVMET_RDMA_Q_CONNECTING,
7878 NVMET_RDMA_Q_LIVE,
7979 NVMET_RDMA_Q_DISCONNECTING,
80+ NVMET_RDMA_IN_DEVICE_REMOVAL,
8081 };
8182
8283 struct nvmet_rdma_queue {
@@ -615,15 +616,10 @@ static u16 nvmet_rdma_map_sgl_keyed(struct nvmet_rdma_rsp *rsp, · 532 unmodified lines
615616 if (!len)
616617 return 0;
617618
618− /* use the already allocated data buffer if possible */
619− if (len <= NVMET_RDMA_INLINE_DATA_SIZE && rsp->queue->host_qid) {
620− nvmet_rdma_use_inline_sg(rsp, len, 0);
621− } else {
622− status = nvmet_rdma_alloc_sgl(&rsp->req.sg, &rsp->req.sg_cnt,
623− len);
624− if (status)
625− return status;
626− }
619+ status = nvmet_rdma_alloc_sgl(&rsp->req.sg, &rsp->req.sg_cnt,
620+ len);
621+ if (status)
622+ return status;
627623
628624 ret = rdma_rw_ctx_init(&rsp->rw, cm_id->qp, cm_id->port_num,
629625 rsp->req.sg, rsp->req.sg_cnt, 0, addr, key,
@@ -984,7 +980,10 @@ static void nvmet_rdma_release_queue_work(struct work_struct *w) · 354 unmodified lines
984980 struct nvmet_rdma_device *dev = queue->dev;
985981
986982 nvmet_rdma_free_queue(queue);
987− rdma_destroy_id(cm_id);
983+
984+ if (queue->state != NVMET_RDMA_IN_DEVICE_REMOVAL)
985+ rdma_destroy_id(cm_id);
986+
988987 kref_put(&dev->ref, nvmet_rdma_free_dev);
989988 }
990989
@@ -1233,8 +1232,9 @@ static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue) · 242 unmodified lines
12331232 switch (queue->state) {
12341233 case NVMET_RDMA_Q_CONNECTING:
12351234 case NVMET_RDMA_Q_LIVE:
1236− disconnect = true;
12371235 queue->state = NVMET_RDMA_Q_DISCONNECTING;
1236+ case NVMET_RDMA_IN_DEVICE_REMOVAL:
1237+ disconnect = true;
12381238 break;
12391239 case NVMET_RDMA_Q_DISCONNECTING:
12401240 break;
@@ -1272,6 +1272,62 @@ static void nvmet_rdma_queue_connect_fail(struct rdma_cm_id *cm_id, · 31 unmodified lines
12721272 schedule_work(&queue->release_work);
12731273 }
12741274
1275+/**
1276+ * nvme_rdma_device_removal() - Handle RDMA device removal
1277+ * @queue: nvmet rdma queue (cm id qp_context)
1278+ * @addr: nvmet address (cm_id context)
1279+ *
1280+ * DEVICE_REMOVAL event notifies us that the RDMA device is about
1281+ * to unplug so we should take care of destroying our RDMA resources.
1282+ * This event will be generated for each allocated cm_id.
1283+ *
1284+ * Note that this event can be generated on a normal queue cm_id
1285+ * and/or a device bound listener cm_id (where in this case
1286+ * queue will be null).
1287+ *
1288+ * we claim ownership on destroying the cm_id. For queues we move
1289+ * the queue state to NVMET_RDMA_IN_DEVICE_REMOVAL and for port
1290+ * we nullify the priv to prevent double cm_id destruction and destroying
1291+ * the cm_id implicitely by returning a non-zero rc to the callout.
1292+ */
1293+static int nvmet_rdma_device_removal(struct rdma_cm_id *cm_id,
1294+ struct nvmet_rdma_queue *queue)
1295+{
1296+ unsigned long flags;
1297+
1298+ if (!queue) {
1299+ struct nvmet_port *port = cm_id->context;
1300+
1301+ /*
1302+ * This is a listener cm_id. Make sure that
1303+ * future remove_port won't invoke a double
1304+ * cm_id destroy. use atomic xchg to make sure
1305+ * we don't compete with remove_port.
1306+ */
1307+ if (xchg(&port->priv, NULL) != cm_id)
1308+ return 0;
1309+ } else {
1310+ /*
1311+ * This is a queue cm_id. Make sure that
1312+ * release queue will not destroy the cm_id
1313+ * and schedule all ctrl queues removal (only
1314+ * if the queue is not disconnecting already).
1315+ */
1316+ spin_lock_irqsave(&queue->state_lock, flags);
1317+ if (queue->state != NVMET_RDMA_Q_DISCONNECTING)
1318+ queue->state = NVMET_RDMA_IN_DEVICE_REMOVAL;
1319+ spin_unlock_irqrestore(&queue->state_lock, flags);
1320+ nvmet_rdma_queue_disconnect(queue);
1321+ flush_scheduled_work();
1322+ }
1323+
1324+ /*
1325+ * We need to return 1 so that the core will destroy
1326+ * it's own ID. What a great API design..
1327+ */
1328+ return 1;
1329+}
1330+
12751331 static int nvmet_rdma_cm_handler(struct rdma_cm_id *cm_id,
12761332 struct rdma_cm_event *event)
12771333 {
@@ -1294,20 +1350,11 @@ static int nvmet_rdma_cm_handler(struct rdma_cm_id *cm_id, · 16 unmodified lines
12941350 break;
12951351 case RDMA_CM_EVENT_ADDR_CHANGE:
12961352 case RDMA_CM_EVENT_DISCONNECTED:
1297− case RDMA_CM_EVENT_DEVICE_REMOVAL:
12981353 case RDMA_CM_EVENT_TIMEWAIT_EXIT:
1299− /*
1300− * We can get the device removal callback even for a
1301− * CM ID that we aren't actually using. In that case
1302− * the context pointer is NULL, so we shouldn't try
1303− * to disconnect a non-existing queue. But we also
1304− * need to return 1 so that the core will destroy
1305− * it's own ID. What a great API design..
1306− */
1307− if (queue)
1308− nvmet_rdma_queue_disconnect(queue);
1309− else
1310− ret = 1;
1354+ nvmet_rdma_queue_disconnect(queue);
1355+ break;
1356+ case RDMA_CM_EVENT_DEVICE_REMOVAL:
1357+ ret = nvmet_rdma_device_removal(cm_id, queue);
13111358 break;
13121359 case RDMA_CM_EVENT_REJECTED:
13131360 case RDMA_CM_EVENT_UNREACHABLE:
@@ -1396,9 +1443,10 @@ out_destroy_id: · 82 unmodified lines
13961443
13971444 static void nvmet_rdma_remove_port(struct nvmet_port *port)
13981445 {
1399− struct rdma_cm_id *cm_id = port->priv;
1446+ struct rdma_cm_id *cm_id = xchg(&port->priv, NULL);
14001447
1401− rdma_destroy_id(cm_id);
1448+ if (cm_id)
1449+ rdma_destroy_id(cm_id);
14021450 }
14031451
14041452 static struct nvmet_fabrics_ops nvmet_rdma_ops = {
fs/fs-writeback.c+6−0
@@ -1949,6 +1949,12 @@ void wakeup_flusher_threads(long nr_pages, enum wb_reason reason) · 1948 unmodified lines
19491949 {
19501950 struct backing_dev_info *bdi;
19511951
1952+ /*
1953+ * If we are expecting writeback progress we must submit plugged IO.
1954+ */
1955+ if (blk_needs_flush_plug(current))
1956+ blk_schedule_flush_plug(current);
1957+
19521958 if (!nr_pages)
19531959 nr_pages = get_nr_dirty_pages();
19541960
include/linux/bvec.h+2−1
@@ -74,7 +74,8 @@ static inline void bvec_iter_advance(const struct bio_vec *bv, · 73 unmodified lines
7474 "Attempted to advance past end of bvec iter\n");
7575
7676 while (bytes) {
77− unsigned len = min(bytes, bvec_iter_len(bv, *iter));
77+ unsigned iter_len = bvec_iter_len(bv, *iter);
78+ unsigned len = min(bytes, iter_len);
7879
7980 bytes -= len;
8081 iter->bi_size -= len;