nvmet-rdma: occasionally flush ongoing controller teardown
authorSagi Grimberg <sagi@grimberg.me>
Tue, 21 Mar 2017 14:29:49 +0000 (16:29 +0200)
committerJens Axboe <axboe@fb.com>
Tue, 4 Apr 2017 15:48:23 +0000 (09:48 -0600)
If we are attacked with establishments/teradowns we need to
make sure we do not consume too much system memory. Thus
let ongoing controller teardowns complete before accepting
new controller establishments.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/target/rdma.c

index ecc4fe8..88bb581 100644 (file)
@@ -1199,6 +1199,11 @@ static int nvmet_rdma_queue_connect(struct rdma_cm_id *cm_id,
        }
        queue->port = cm_id->context;
 
+       if (queue->host_qid == 0) {
+               /* Let inflight controller teardown complete */
+               flush_scheduled_work();
+       }
+
        ret = nvmet_rdma_cm_accept(cm_id, queue, &event->param.conn);
        if (ret)
                goto release_queue;