]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
IB/srp: Fix possible send queue overflow
authorSagi Grimberg <sagig@mellanox.com>
Tue, 1 Dec 2015 18:18:03 +0000 (10:18 -0800)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 11 Jan 2016 10:50:19 +0000 (10:50 +0000)
commit 09c0c0bea500a9ad362589990ee316c9b2482f44 upstream.

When using work request based memory registration (fast_reg)
we must reserve SQ entries for registration and invalidation
in addition to send operations. Each IO consumes 3 SQ entries
(registration, send, invalidation) so we need to allocate 3x
larger send-queue instead of 2x.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Doug Ledford <dledford@redhat.com>
[ luis: backported to 3.16:
  - change function srp_create_target_ib() instead of srp_create_ch_ib()
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/infiniband/ulp/srp/ib_srp.c

index 767000811cf93c6aea99dc4ba217689311452939..36876960f97e04432cec2beeff8f749c139b324d 100644 (file)
@@ -451,7 +451,7 @@ static int srp_create_target_ib(struct srp_target_port *target)
        struct ib_qp *qp;
        struct ib_fmr_pool *fmr_pool = NULL;
        struct srp_fr_pool *fr_pool = NULL;
-       const int m = 1 + dev->use_fast_reg;
+       const int m = dev->use_fast_reg ? 3 : 1;
        int ret;
 
        init_attr = kzalloc(sizeof *init_attr, GFP_KERNEL);