Skip to content

Commit d6c24df

Browse files
committed
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
2 parents cb10716 + 839559e commit d6c24df

File tree

5 files changed

+29
-66
lines changed

5 files changed

+29
-66
lines changed

drivers/infiniband/ulp/isert/ib_isert.c

+4-35
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ isert_rdma_accept(struct isert_conn *isert_conn);
6363
struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np);
6464

6565
static void isert_release_work(struct work_struct *work);
66-
static void isert_wait4flush(struct isert_conn *isert_conn);
6766
static void isert_recv_done(struct ib_cq *cq, struct ib_wc *wc);
6867
static void isert_send_done(struct ib_cq *cq, struct ib_wc *wc);
6968
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,
141140
attr.qp_context = isert_conn;
142141
attr.send_cq = comp->cq;
143142
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;
145144
attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1;
146145
attr.cap.max_send_sge = device->ib_device->attrs.max_sge;
147146
isert_conn->max_sge = min(device->ib_device->attrs.max_sge,
@@ -887,7 +886,7 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id,
887886
break;
888887
case ISER_CONN_UP:
889888
isert_conn_terminate(isert_conn);
890-
isert_wait4flush(isert_conn);
889+
ib_drain_qp(isert_conn->qp);
891890
isert_handle_unbound_conn(isert_conn);
892891
break;
893892
case ISER_CONN_BOUND:
@@ -3213,36 +3212,6 @@ isert_wait4cmds(struct iscsi_conn *conn)
32133212
}
32143213
}
32153214

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-
32463215
/**
32473216
* isert_put_unsol_pending_cmds() - Drop commands waiting for
32483217
* unsolicitate dataout
@@ -3288,7 +3257,7 @@ static void isert_wait_conn(struct iscsi_conn *conn)
32883257
isert_conn_terminate(isert_conn);
32893258
mutex_unlock(&isert_conn->mutex);
32903259

3291-
isert_wait4flush(isert_conn);
3260+
ib_drain_qp(isert_conn->qp);
32923261
isert_put_unsol_pending_cmds(conn);
32933262
isert_wait4cmds(conn);
32943263
isert_wait4logout(isert_conn);
@@ -3300,7 +3269,7 @@ static void isert_free_conn(struct iscsi_conn *conn)
33003269
{
33013270
struct isert_conn *isert_conn = conn->context;
33023271

3303-
isert_wait4flush(isert_conn);
3272+
ib_drain_qp(isert_conn->qp);
33043273
isert_put_conn(isert_conn);
33053274
}
33063275

drivers/infiniband/ulp/isert/ib_isert.h

-2
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,12 @@ struct isert_conn {
209209
struct ib_qp *qp;
210210
struct isert_device *device;
211211
struct mutex mutex;
212-
struct completion wait_comp_err;
213212
struct kref kref;
214213
struct list_head fr_pool;
215214
int fr_pool_size;
216215
/* lock to protect fastreg pool */
217216
spinlock_t pool_lock;
218217
struct work_struct release_work;
219-
struct ib_recv_wr beacon;
220218
bool logout_posted;
221219
bool snd_w_inv;
222220
};

drivers/target/iscsi/iscsi_target_configfs.c

+11-17
Original file line numberDiff line numberDiff line change
@@ -779,14 +779,6 @@ static int lio_target_init_nodeacl(struct se_node_acl *se_nacl,
779779
return 0;
780780
}
781781

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-
790782
/* End items for lio_target_acl_cit */
791783

792784
/* Start items for lio_target_tpg_attrib_cit */
@@ -1247,6 +1239,16 @@ static struct se_wwn *lio_target_call_coreaddtiqn(
12471239
if (IS_ERR(tiqn))
12481240
return ERR_CAST(tiqn);
12491241

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+
12501252
config_group_init_type_name(&tiqn->tiqn_stat_grps.iscsi_instance_group,
12511253
"iscsi_instance", &iscsi_stat_instance_cit);
12521254
configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_instance_group,
@@ -1271,21 +1273,13 @@ static struct se_wwn *lio_target_call_coreaddtiqn(
12711273
"iscsi_logout_stats", &iscsi_stat_logout_cit);
12721274
configfs_add_default_group(&tiqn->tiqn_stat_grps.iscsi_logout_stats_group,
12731275
&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;
12801276
}
12811277

12821278
static void lio_target_call_coredeltiqn(
12831279
struct se_wwn *wwn)
12841280
{
12851281
struct iscsi_tiqn *tiqn = container_of(wwn, struct iscsi_tiqn, tiqn_wwn);
12861282

1287-
configfs_remove_default_groups(&tiqn->tiqn_wwn.fabric_stat_group);
1288-
12891283
pr_debug("LIO_Target_ConfigFS: DEREGISTER -> %s\n",
12901284
tiqn->tiqn);
12911285
iscsit_del_tiqn(tiqn);
@@ -1660,12 +1654,12 @@ const struct target_core_fabric_ops iscsi_ops = {
16601654
.aborted_task = lio_aborted_task,
16611655
.fabric_make_wwn = lio_target_call_coreaddtiqn,
16621656
.fabric_drop_wwn = lio_target_call_coredeltiqn,
1657+
.add_wwn_groups = lio_target_add_wwn_groups,
16631658
.fabric_make_tpg = lio_target_tiqn_addtpg,
16641659
.fabric_drop_tpg = lio_target_tiqn_deltpg,
16651660
.fabric_make_np = lio_target_call_addnptotpg,
16661661
.fabric_drop_np = lio_target_call_delnpfromtpg,
16671662
.fabric_init_nodeacl = lio_target_init_nodeacl,
1668-
.fabric_cleanup_nodeacl = lio_target_cleanup_nodeacl,
16691663

16701664
.tfc_discovery_attrs = lio_target_discovery_auth_attrs,
16711665
.tfc_wwn_attrs = lio_target_wwn_attrs,

drivers/target/target_core_fabric_configfs.c

+13-11
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,8 @@ static void target_fabric_nacl_base_release(struct config_item *item)
338338
{
339339
struct se_node_acl *se_nacl = container_of(to_config_group(item),
340340
struct se_node_acl, acl_group);
341-
struct target_fabric_configfs *tf = se_nacl->se_tpg->se_tpg_wwn->wwn_tf;
342341

343-
if (tf->tf_ops->fabric_cleanup_nodeacl)
344-
tf->tf_ops->fabric_cleanup_nodeacl(se_nacl);
342+
configfs_remove_default_groups(&se_nacl->acl_fabric_stat_group);
345343
core_tpg_del_initiator_node_acl(se_nacl);
346344
}
347345

@@ -383,14 +381,6 @@ static struct config_group *target_fabric_make_nodeacl(
383381
if (IS_ERR(se_nacl))
384382
return ERR_CAST(se_nacl);
385383

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-
394384
config_group_init_type_name(&se_nacl->acl_group, name,
395385
&tf->tf_tpg_nacl_base_cit);
396386

@@ -414,6 +404,15 @@ static struct config_group *target_fabric_make_nodeacl(
414404
configfs_add_default_group(&se_nacl->acl_fabric_stat_group,
415405
&se_nacl->acl_group);
416406

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+
417416
return &se_nacl->acl_group;
418417
}
419418

@@ -892,6 +891,7 @@ static void target_fabric_release_wwn(struct config_item *item)
892891
struct se_wwn, wwn_group);
893892
struct target_fabric_configfs *tf = wwn->wwn_tf;
894893

894+
configfs_remove_default_groups(&wwn->fabric_stat_group);
895895
tf->tf_ops->fabric_drop_wwn(wwn);
896896
}
897897

@@ -945,6 +945,8 @@ static struct config_group *target_fabric_make_wwn(
945945
&tf->tf_wwn_fabric_stats_cit);
946946
configfs_add_default_group(&wwn->fabric_stat_group, &wwn->wwn_group);
947947

948+
if (tf->tf_ops->add_wwn_groups)
949+
tf->tf_ops->add_wwn_groups(wwn);
948950
return &wwn->wwn_group;
949951
}
950952

include/target/target_core_fabric.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ struct target_core_fabric_ops {
7676
struct se_wwn *(*fabric_make_wwn)(struct target_fabric_configfs *,
7777
struct config_group *, const char *);
7878
void (*fabric_drop_wwn)(struct se_wwn *);
79+
void (*add_wwn_groups)(struct se_wwn *);
7980
struct se_portal_group *(*fabric_make_tpg)(struct se_wwn *,
8081
struct config_group *, const char *);
8182
void (*fabric_drop_tpg)(struct se_portal_group *);
@@ -87,7 +88,6 @@ struct target_core_fabric_ops {
8788
struct config_group *, const char *);
8889
void (*fabric_drop_np)(struct se_tpg_np *);
8990
int (*fabric_init_nodeacl)(struct se_node_acl *, const char *);
90-
void (*fabric_cleanup_nodeacl)(struct se_node_acl *);
9191

9292
struct configfs_attribute **tfc_discovery_attrs;
9393
struct configfs_attribute **tfc_wwn_attrs;

0 commit comments

Comments
 (0)