aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_pr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-05-03 02:50:52 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-05-30 21:04:20 -0400
commitd588cf8f618d7b316743a0bc99fede20f7a01bb7 (patch)
treeee81f6056ec9868f83338b67256a9e21044f6f84 /drivers/target/target_core_pr.c
parentee7619f2eb21304dcc846b8dc8f8c3d6cbe11792 (diff)
target: Fix se_tpg_tfo->tf_subsys regression + remove tf_subsystem
There is just one configfs subsystem in the target code, so we might as well add two helpers to reference / unreference it from the core code instead of passing pointers to it around. This fixes a regression introduced for v4.1-rc1 with commit 9ac8928e6, where configfs_depend_item() callers using se_tpg_tfo->tf_subsys would fail, because the assignment from the original target_core_subsystem[] is no longer happening at target_register_template() time. (Fix target_core_exit_configfs pointer dereference - Sagi) Signed-off-by: Christoph Hellwig <hch@lst.de> Reported-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_pr.c')
-rw-r--r--drivers/target/target_core_pr.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index c1aa9655e96e..b7c81acf08d0 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -1367,41 +1367,26 @@ void core_scsi3_free_all_registrations(
1367 1367
1368static int core_scsi3_tpg_depend_item(struct se_portal_group *tpg) 1368static int core_scsi3_tpg_depend_item(struct se_portal_group *tpg)
1369{ 1369{
1370 return configfs_depend_item(tpg->se_tpg_tfo->tf_subsys, 1370 return target_depend_item(&tpg->tpg_group.cg_item);
1371 &tpg->tpg_group.cg_item);
1372} 1371}
1373 1372
1374static void core_scsi3_tpg_undepend_item(struct se_portal_group *tpg) 1373static void core_scsi3_tpg_undepend_item(struct se_portal_group *tpg)
1375{ 1374{
1376 configfs_undepend_item(tpg->se_tpg_tfo->tf_subsys, 1375 target_undepend_item(&tpg->tpg_group.cg_item);
1377 &tpg->tpg_group.cg_item);
1378
1379 atomic_dec_mb(&tpg->tpg_pr_ref_count); 1376 atomic_dec_mb(&tpg->tpg_pr_ref_count);
1380} 1377}
1381 1378
1382static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl) 1379static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl)
1383{ 1380{
1384 struct se_portal_group *tpg = nacl->se_tpg;
1385
1386 if (nacl->dynamic_node_acl) 1381 if (nacl->dynamic_node_acl)
1387 return 0; 1382 return 0;
1388 1383 return target_depend_item(&nacl->acl_group.cg_item);
1389 return configfs_depend_item(tpg->se_tpg_tfo->tf_subsys,
1390 &nacl->acl_group.cg_item);
1391} 1384}
1392 1385
1393static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl) 1386static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl)
1394{ 1387{
1395 struct se_portal_group *tpg = nacl->se_tpg; 1388 if (!nacl->dynamic_node_acl)
1396 1389 target_undepend_item(&nacl->acl_group.cg_item);
1397 if (nacl->dynamic_node_acl) {
1398 atomic_dec_mb(&nacl->acl_pr_ref_count);
1399 return;
1400 }
1401
1402 configfs_undepend_item(tpg->se_tpg_tfo->tf_subsys,
1403 &nacl->acl_group.cg_item);
1404
1405 atomic_dec_mb(&nacl->acl_pr_ref_count); 1390 atomic_dec_mb(&nacl->acl_pr_ref_count);
1406} 1391}
1407 1392
@@ -1419,8 +1404,7 @@ static int core_scsi3_lunacl_depend_item(struct se_dev_entry *se_deve)
1419 nacl = lun_acl->se_lun_nacl; 1404 nacl = lun_acl->se_lun_nacl;
1420 tpg = nacl->se_tpg; 1405 tpg = nacl->se_tpg;
1421 1406
1422 return configfs_depend_item(tpg->se_tpg_tfo->tf_subsys, 1407 return target_depend_item(&lun_acl->se_lun_group.cg_item);
1423 &lun_acl->se_lun_group.cg_item);
1424} 1408}
1425 1409
1426static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) 1410static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve)
@@ -1438,9 +1422,7 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve)
1438 nacl = lun_acl->se_lun_nacl; 1422 nacl = lun_acl->se_lun_nacl;
1439 tpg = nacl->se_tpg; 1423 tpg = nacl->se_tpg;
1440 1424
1441 configfs_undepend_item(tpg->se_tpg_tfo->tf_subsys, 1425 target_undepend_item(&lun_acl->se_lun_group.cg_item);
1442 &lun_acl->se_lun_group.cg_item);
1443
1444 atomic_dec_mb(&se_deve->pr_ref_count); 1426 atomic_dec_mb(&se_deve->pr_ref_count);
1445} 1427}
1446 1428