diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-02 19:48:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-02 19:48:37 -0400 |
commit | d6c24df08255e24dbd19b52dd322f61fbc30b11d (patch) | |
tree | 1cd0773829c76daf2bf9cce9dd5df04ddac8c4ea | |
parent | cb107161df3c52e58033554dcb40065964350f67 (diff) | |
parent | 839559e10601ed4459c802cbfb69747bf1844078 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target fixes from Nicholas Bellinger:
"This includes fixes from HCH for -rc1 configfs default_groups
conversion changes that ended up breaking some iscsi-target
default_groups, along with Sagi's ib_drain_qp() conversion for
iser-target to use the common caller now available to RDMA kernel
consumers in v4.6+ code"
* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
target: add a new add_wwn_groups fabrics method
target: initialize the nacl base CIT begfore init_nodeacl
target: remove ->fabric_cleanup_nodeacl
iser-target: Use ib_drain_qp
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 39 | ||||
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.h | 2 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_configfs.c | 28 | ||||
-rw-r--r-- | drivers/target/target_core_fabric_configfs.c | 24 | ||||
-rw-r--r-- | include/target/target_core_fabric.h | 2 |
5 files changed, 29 insertions, 66 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 60b30d338a81..411e4464ca23 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -63,7 +63,6 @@ isert_rdma_accept(struct isert_conn *isert_conn); | |||
63 | struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np); | 63 | struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np); |
64 | 64 | ||
65 | static void isert_release_work(struct work_struct *work); | 65 | static void isert_release_work(struct work_struct *work); |
66 | static void isert_wait4flush(struct isert_conn *isert_conn); | ||
67 | static void isert_recv_done(struct ib_cq *cq, struct ib_wc *wc); | 66 | static void isert_recv_done(struct ib_cq *cq, struct ib_wc *wc); |
68 | static void isert_send_done(struct ib_cq *cq, struct ib_wc *wc); | 67 | static void isert_send_done(struct ib_cq *cq, struct ib_wc *wc); |
69 | static void isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc); | 68 | static void isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc); |
@@ -141,7 +140,7 @@ isert_create_qp(struct isert_conn *isert_conn, | |||
141 | attr.qp_context = isert_conn; | 140 | attr.qp_context = isert_conn; |
142 | attr.send_cq = comp->cq; | 141 | attr.send_cq = comp->cq; |
143 | attr.recv_cq = comp->cq; | 142 | attr.recv_cq = comp->cq; |
144 | attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS; | 143 | attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS + 1; |
145 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1; | 144 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1; |
146 | attr.cap.max_send_sge = device->ib_device->attrs.max_sge; | 145 | attr.cap.max_send_sge = device->ib_device->attrs.max_sge; |
147 | isert_conn->max_sge = min(device->ib_device->attrs.max_sge, | 146 | isert_conn->max_sge = min(device->ib_device->attrs.max_sge, |
@@ -887,7 +886,7 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id, | |||
887 | break; | 886 | break; |
888 | case ISER_CONN_UP: | 887 | case ISER_CONN_UP: |
889 | isert_conn_terminate(isert_conn); | 888 | isert_conn_terminate(isert_conn); |
890 | isert_wait4flush(isert_conn); | 889 | ib_drain_qp(isert_conn->qp); |
891 | isert_handle_unbound_conn(isert_conn); | 890 | isert_handle_unbound_conn(isert_conn); |
892 | break; | 891 | break; |
893 | case ISER_CONN_BOUND: | 892 | case ISER_CONN_BOUND: |
@@ -3213,36 +3212,6 @@ isert_wait4cmds(struct iscsi_conn *conn) | |||
3213 | } | 3212 | } |
3214 | } | 3213 | } |
3215 | 3214 | ||
3216 | static void | ||
3217 | isert_beacon_done(struct ib_cq *cq, struct ib_wc *wc) | ||
3218 | { | ||
3219 | struct isert_conn *isert_conn = wc->qp->qp_context; | ||
3220 | |||
3221 | isert_print_wc(wc, "beacon"); | ||
3222 | |||
3223 | isert_info("conn %p completing wait_comp_err\n", isert_conn); | ||
3224 | complete(&isert_conn->wait_comp_err); | ||
3225 | } | ||
3226 | |||
3227 | static void | ||
3228 | isert_wait4flush(struct isert_conn *isert_conn) | ||
3229 | { | ||
3230 | struct ib_recv_wr *bad_wr; | ||
3231 | static struct ib_cqe cqe = { .done = isert_beacon_done }; | ||
3232 | |||
3233 | isert_info("conn %p\n", isert_conn); | ||
3234 | |||
3235 | init_completion(&isert_conn->wait_comp_err); | ||
3236 | isert_conn->beacon.wr_cqe = &cqe; | ||
3237 | /* post an indication that all flush errors were consumed */ | ||
3238 | if (ib_post_recv(isert_conn->qp, &isert_conn->beacon, &bad_wr)) { | ||
3239 | isert_err("conn %p failed to post beacon", isert_conn); | ||
3240 | return; | ||
3241 | } | ||
3242 | |||
3243 | wait_for_completion(&isert_conn->wait_comp_err); | ||
3244 | } | ||
3245 | |||
3246 | /** | 3215 | /** |
3247 | * isert_put_unsol_pending_cmds() - Drop commands waiting for | 3216 | * isert_put_unsol_pending_cmds() - Drop commands waiting for |
3248 | * unsolicitate dataout | 3217 | * unsolicitate dataout |
@@ -3288,7 +3257,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) | |||
3288 | isert_conn_terminate(isert_conn); | 3257 | isert_conn_terminate(isert_conn); |
3289 | mutex_unlock(&isert_conn->mutex); | 3258 | mutex_unlock(&isert_conn->mutex); |
3290 | 3259 | ||
3291 | isert_wait4flush(isert_conn); | 3260 | ib_drain_qp(isert_conn->qp); |
3292 | isert_put_unsol_pending_cmds(conn); | 3261 | isert_put_unsol_pending_cmds(conn); |
3293 | isert_wait4cmds(conn); | 3262 | isert_wait4cmds(conn); |
3294 | isert_wait4logout(isert_conn); | 3263 | isert_wait4logout(isert_conn); |
@@ -3300,7 +3269,7 @@ static void isert_free_conn(struct iscsi_conn *conn) | |||
3300 | { | 3269 | { |
3301 | struct isert_conn *isert_conn = conn->context; | 3270 | struct isert_conn *isert_conn = conn->context; |
3302 | 3271 | ||
3303 | isert_wait4flush(isert_conn); | 3272 | ib_drain_qp(isert_conn->qp); |
3304 | isert_put_conn(isert_conn); | 3273 | isert_put_conn(isert_conn); |
3305 | } | 3274 | } |
3306 | 3275 | ||
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h index 192788a4820c..147900cbb578 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.h +++ b/drivers/infiniband/ulp/isert/ib_isert.h | |||
@@ -209,14 +209,12 @@ struct isert_conn { | |||
209 | struct ib_qp *qp; | 209 | struct ib_qp *qp; |
210 | struct isert_device *device; | 210 | struct isert_device *device; |
211 | struct mutex mutex; | 211 | struct mutex mutex; |
212 | struct completion wait_comp_err; | ||
213 | struct kref kref; | 212 | struct kref kref; |
214 | struct list_head fr_pool; | 213 | struct list_head fr_pool; |
215 | int fr_pool_size; | 214 | int fr_pool_size; |
216 | /* lock to protect fastreg pool */ | 215 | /* lock to protect fastreg pool */ |
217 | spinlock_t pool_lock; | 216 | spinlock_t pool_lock; |
218 | struct work_struct release_work; | 217 | struct work_struct release_work; |
219 | struct ib_recv_wr beacon; | ||
220 | bool logout_posted; | 218 | bool logout_posted; |
221 | bool snd_w_inv; | 219 | bool snd_w_inv; |
222 | }; | 220 | }; |
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index a24443ba59ea..97e5b69e0668 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -779,14 +779,6 @@ static int lio_target_init_nodeacl(struct se_node_acl *se_nacl, | |||
779 | return 0; | 779 | return 0; |
780 | } | 780 | } |
781 | 781 | ||
782 | static void lio_target_cleanup_nodeacl( struct se_node_acl *se_nacl) | ||
783 | { | ||
784 | struct iscsi_node_acl *acl = container_of(se_nacl, | ||
785 | struct iscsi_node_acl, se_node_acl); | ||
786 | |||
787 | configfs_remove_default_groups(&acl->se_node_acl.acl_fabric_stat_group); | ||
788 | } | ||
789 | |||
790 | /* End items for lio_target_acl_cit */ | 782 | /* End items for lio_target_acl_cit */ |
791 | 783 | ||
792 | /* Start items for lio_target_tpg_attrib_cit */ | 784 | /* Start items for lio_target_tpg_attrib_cit */ |
@@ -1247,6 +1239,16 @@ static struct se_wwn *lio_target_call_coreaddtiqn( | |||
1247 | if (IS_ERR(tiqn)) | 1239 | if (IS_ERR(tiqn)) |
1248 | return ERR_CAST(tiqn); | 1240 | return ERR_CAST(tiqn); |
1249 | 1241 | ||
1242 | pr_debug("LIO_Target_ConfigFS: REGISTER -> %s\n", tiqn->tiqn); | ||
1243 | pr_debug("LIO_Target_ConfigFS: REGISTER -> Allocated Node:" | ||
1244 | " %s\n", name); | ||
1245 | return &tiqn->tiqn_wwn; | ||
1246 | } | ||
1247 | |||
1248 | static void lio_target_add_wwn_groups(struct se_wwn *wwn) | ||
1249 | { | ||
1250 | struct iscsi_tiqn *tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn); | ||
1251 | |||
1250 | config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_instance_group, | 1252 | config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_instance_group, |
1251 | "iscsi_instance", &iscsi_stat_instance_cit); | 1253 | "iscsi_instance", &iscsi_stat_instance_cit); |
1252 | configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_instance_group, | 1254 | configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_instance_group, |
@@ -1271,12 +1273,6 @@ static struct se_wwn *lio_target_call_coreaddtiqn( | |||
1271 | "iscsi_logout_stats", &iscsi_stat_logout_cit); | 1273 | "iscsi_logout_stats", &iscsi_stat_logout_cit); |
1272 | configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_logout_stats_group, | 1274 | configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_logout_stats_group, |
1273 | &tiqn->tiqn_wwn.fabric_stat_group); | 1275 | &tiqn->tiqn_wwn.fabric_stat_group); |
1274 | |||
1275 | |||
1276 | pr_debug("LIO_Target_ConfigFS: REGISTER -> %s\n", tiqn->tiqn); | ||
1277 | pr_debug("LIO_Target_ConfigFS: REGISTER -> Allocated Node:" | ||
1278 | " %s\n", name); | ||
1279 | return &tiqn->tiqn_wwn; | ||
1280 | } | 1276 | } |
1281 | 1277 | ||
1282 | static void lio_target_call_coredeltiqn( | 1278 | static void lio_target_call_coredeltiqn( |
@@ -1284,8 +1280,6 @@ static void lio_target_call_coredeltiqn( | |||
1284 | { | 1280 | { |
1285 | struct iscsi_tiqn *tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn); | 1281 | struct iscsi_tiqn *tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn); |
1286 | 1282 | ||
1287 | configfs_remove_default_groups(&tiqn->tiqn_wwn.fabric_stat_group); | ||
1288 | |||
1289 | pr_debug("LIO_Target_ConfigFS: DEREGISTER -> %s\n", | 1283 | pr_debug("LIO_Target_ConfigFS: DEREGISTER -> %s\n", |
1290 | tiqn->tiqn); | 1284 | tiqn->tiqn); |
1291 | iscsit_del_tiqn(tiqn); | 1285 | iscsit_del_tiqn(tiqn); |
@@ -1660,12 +1654,12 @@ const struct target_core_fabric_ops iscsi_ops = { | |||
1660 | .aborted_task = lio_aborted_task, | 1654 | .aborted_task = lio_aborted_task, |
1661 | .fabric_make_wwn = lio_target_call_coreaddtiqn, | 1655 | .fabric_make_wwn = lio_target_call_coreaddtiqn, |
1662 | .fabric_drop_wwn = lio_target_call_coredeltiqn, | 1656 | .fabric_drop_wwn = lio_target_call_coredeltiqn, |
1657 | .add_wwn_groups = lio_target_add_wwn_groups, | ||
1663 | .fabric_make_tpg = lio_target_tiqn_addtpg, | 1658 | .fabric_make_tpg = lio_target_tiqn_addtpg, |
1664 | .fabric_drop_tpg = lio_target_tiqn_deltpg, | 1659 | .fabric_drop_tpg = lio_target_tiqn_deltpg, |
1665 | .fabric_make_np = lio_target_call_addnptotpg, | 1660 | .fabric_make_np = lio_target_call_addnptotpg, |
1666 | .fabric_drop_np = lio_target_call_delnpfromtpg, | 1661 | .fabric_drop_np = lio_target_call_delnpfromtpg, |
1667 | .fabric_init_nodeacl = lio_target_init_nodeacl, | 1662 | .fabric_init_nodeacl = lio_target_init_nodeacl, |
1668 | .fabric_cleanup_nodeacl = lio_target_cleanup_nodeacl, | ||
1669 | 1663 | ||
1670 | .tfc_discovery_attrs = lio_target_discovery_auth_attrs, | 1664 | .tfc_discovery_attrs = lio_target_discovery_auth_attrs, |
1671 | .tfc_wwn_attrs = lio_target_wwn_attrs, | 1665 | .tfc_wwn_attrs = lio_target_wwn_attrs, |
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index 1bd5c72b663e..31a096aa16ab 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
@@ -338,10 +338,8 @@ static void target_fabric_nacl_base_release(struct config_item *item) | |||
338 | { | 338 | { |
339 | struct se_node_acl *se_nacl = container_of(to_config_group(item), | 339 | struct se_node_acl *se_nacl = container_of(to_config_group(item), |
340 | struct se_node_acl, acl_group); | 340 | struct se_node_acl, acl_group); |
341 | struct target_fabric_configfs *tf = se_nacl->se_tpg->se_tpg_wwn->wwn_tf; | ||
342 | 341 | ||
343 | if (tf->tf_ops->fabric_cleanup_nodeacl) | 342 | configfs_remove_default_groups(&se_nacl->acl_fabric_stat_group); |
344 | tf->tf_ops->fabric_cleanup_nodeacl(se_nacl); | ||
345 | core_tpg_del_initiator_node_acl(se_nacl); | 343 | core_tpg_del_initiator_node_acl(se_nacl); |
346 | } | 344 | } |
347 | 345 | ||
@@ -383,14 +381,6 @@ static struct config_group *target_fabric_make_nodeacl( | |||
383 | if (IS_ERR(se_nacl)) | 381 | if (IS_ERR(se_nacl)) |
384 | return ERR_CAST(se_nacl); | 382 | return ERR_CAST(se_nacl); |
385 | 383 | ||
386 | if (tf->tf_ops->fabric_init_nodeacl) { | ||
387 | int ret = tf->tf_ops->fabric_init_nodeacl(se_nacl, name); | ||
388 | if (ret) { | ||
389 | core_tpg_del_initiator_node_acl(se_nacl); | ||
390 | return ERR_PTR(ret); | ||
391 | } | ||
392 | } | ||
393 | |||
394 | config_group_init_type_name(&se_nacl->acl_group, name, | 384 | config_group_init_type_name(&se_nacl->acl_group, name, |
395 | &tf->tf_tpg_nacl_base_cit); | 385 | &tf->tf_tpg_nacl_base_cit); |
396 | 386 | ||
@@ -414,6 +404,15 @@ static struct config_group *target_fabric_make_nodeacl( | |||
414 | configfs_add_default_group(&se_nacl->acl_fabric_stat_group, | 404 | configfs_add_default_group(&se_nacl->acl_fabric_stat_group, |
415 | &se_nacl->acl_group); | 405 | &se_nacl->acl_group); |
416 | 406 | ||
407 | if (tf->tf_ops->fabric_init_nodeacl) { | ||
408 | int ret = tf->tf_ops->fabric_init_nodeacl(se_nacl, name); | ||
409 | if (ret) { | ||
410 | configfs_remove_default_groups(&se_nacl->acl_fabric_stat_group); | ||
411 | core_tpg_del_initiator_node_acl(se_nacl); | ||
412 | return ERR_PTR(ret); | ||
413 | } | ||
414 | } | ||
415 | |||
417 | return &se_nacl->acl_group; | 416 | return &se_nacl->acl_group; |
418 | } | 417 | } |
419 | 418 | ||
@@ -892,6 +891,7 @@ static void target_fabric_release_wwn(struct config_item *item) | |||
892 | struct se_wwn, wwn_group); | 891 | struct se_wwn, wwn_group); |
893 | struct target_fabric_configfs *tf = wwn->wwn_tf; | 892 | struct target_fabric_configfs *tf = wwn->wwn_tf; |
894 | 893 | ||
894 | configfs_remove_default_groups(&wwn->fabric_stat_group); | ||
895 | tf->tf_ops->fabric_drop_wwn(wwn); | 895 | tf->tf_ops->fabric_drop_wwn(wwn); |
896 | } | 896 | } |
897 | 897 | ||
@@ -945,6 +945,8 @@ static struct config_group *target_fabric_make_wwn( | |||
945 | &tf->tf_wwn_fabric_stats_cit); | 945 | &tf->tf_wwn_fabric_stats_cit); |
946 | configfs_add_default_group(&wwn->fabric_stat_group, &wwn->wwn_group); | 946 | configfs_add_default_group(&wwn->fabric_stat_group, &wwn->wwn_group); |
947 | 947 | ||
948 | if (tf->tf_ops->add_wwn_groups) | ||
949 | tf->tf_ops->add_wwn_groups(wwn); | ||
948 | return &wwn->wwn_group; | 950 | return &wwn->wwn_group; |
949 | } | 951 | } |
950 | 952 | ||
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 685a51aa98cc..8ff6d40a294f 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
@@ -76,6 +76,7 @@ struct target_core_fabric_ops { | |||
76 | struct se_wwn *(*fabric_make_wwn)(struct target_fabric_configfs *, | 76 | struct se_wwn *(*fabric_make_wwn)(struct target_fabric_configfs *, |
77 | struct config_group *, const char *); | 77 | struct config_group *, const char *); |
78 | void (*fabric_drop_wwn)(struct se_wwn *); | 78 | void (*fabric_drop_wwn)(struct se_wwn *); |
79 | void (*add_wwn_groups)(struct se_wwn *); | ||
79 | struct se_portal_group *(*fabric_make_tpg)(struct se_wwn *, | 80 | struct se_portal_group *(*fabric_make_tpg)(struct se_wwn *, |
80 | struct config_group *, const char *); | 81 | struct config_group *, const char *); |
81 | void (*fabric_drop_tpg)(struct se_portal_group *); | 82 | void (*fabric_drop_tpg)(struct se_portal_group *); |
@@ -87,7 +88,6 @@ struct target_core_fabric_ops { | |||
87 | struct config_group *, const char *); | 88 | struct config_group *, const char *); |
88 | void (*fabric_drop_np)(struct se_tpg_np *); | 89 | void (*fabric_drop_np)(struct se_tpg_np *); |
89 | int (*fabric_init_nodeacl)(struct se_node_acl *, const char *); | 90 | int (*fabric_init_nodeacl)(struct se_node_acl *, const char *); |
90 | void (*fabric_cleanup_nodeacl)(struct se_node_acl *); | ||
91 | 91 | ||
92 | struct configfs_attribute **tfc_discovery_attrs; | 92 | struct configfs_attribute **tfc_discovery_attrs; |
93 | struct configfs_attribute **tfc_wwn_attrs; | 93 | struct configfs_attribute **tfc_wwn_attrs; |