iser-target: Match FRMR descriptors to available session tags
authorNicholas Bellinger <nab@linux-iscsi.org>
Tue, 6 May 2014 17:32:52 +0000 (17:32 +0000)
committerJiri Slaby <jslaby@suse.cz>
Fri, 9 May 2014 08:27:04 +0000 (10:27 +0200)
commitce2a2e7f7a4d8cfbe16bc248b325fccc983d752d
tree085a407abd16eb909abf25060c89097f79b975f2
parent5c9b463ca49ed99558585628a608b0914179eee9
iser-target: Match FRMR descriptors to available session tags

commit f46d6a8a01d6bbd83a97140f30a72a89b038807b upstream.

This patch changes isert_conn_create_fastreg_pool() to follow
logic in iscsi_target_locate_portal() for determining how many
FRMR descriptors to allocate based upon the number of possible
per-session command slots that are available.

This addresses an OOPs in isert_reg_rdma() where due to the
use of ISCSI_DEF_XMIT_CMDS_MAX could end up returning a bogus
fast_reg_descriptor when the number of active tags exceeded
the original hardcoded max.

Note this also includes moving isert_conn_create_fastreg_pool()
from isert_connect_request() to isert_put_login_tx() before
posting the final Login Response PDU in order to determine the
se_nacl->queue_depth (eg: number of tags) per session the target
will be enforcing.

v2 changes:
  - Move isert_conn->conn_fr_pool list_head init into
    isert_conn_request()
v3 changes:
  - Drop unnecessary list_empty() check in isert_reg_rdma()
    (Sagi)

(Fix up v3.12.y context changes - nab)

Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: <stable@vger.kernel.org> #3.12+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/infiniband/ulp/isert/ib_isert.c