diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-03-22 23:42:19 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-06-01 03:23:46 -0400 |
commit | 29a05deebf6c2e3010934fb78ee65cab3d329470 (patch) | |
tree | 5b91d971e31c45919ef212513104350877807c3c /drivers/target/target_core_stat.c | |
parent | d2c27f0d0b7eb18f40b9b1a0d793c8ba074e5c23 (diff) |
target: Convert se_node_acl->device_list[] to RCU hlist
This patch converts se_node_acl->device_list[] table for mappedluns
to modern RCU hlist_head usage in order to support an arbitrary number
of node_acl lun mappings.
It converts transport_lookup_*_lun() fast-path code to use RCU read path
primitives when looking up se_dev_entry. It adds a new hlist_head at
se_node_acl->lun_entry_hlist for this purpose.
For transport_lookup_cmd_lun() code, it works with existing per-cpu
se_lun->lun_ref when associating se_cmd with se_lun + se_device.
Also, go ahead and update core_create_device_list_for_node() +
core_free_device_list_for_node() to use ->lun_entry_hlist.
It also converts se_dev_entry->pr_ref_count access to use modern
struct kref counting, and updates core_disable_device_list_for_node()
to kref_put() and block on se_deve->pr_comp waiting for outstanding PR
special-case PR references to drop, then invoke kfree_rcu() to wait
for the RCU grace period to complete before releasing memory.
So now that se_node_acl->lun_entry_hlist fast path access uses RCU
protected pointers, go ahead and convert remaining non-fast path
RCU updater code using ->lun_entry_lock to struct mutex to allow
callers to block while walking se_node_acl->lun_entry_hlist.
Finally drop the left-over core_clear_initiator_node_from_tpg() that
originally cleared lun_access during se_node_acl shutdown, as post
RCU conversion it now becomes duplicated logic.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_stat.c')
-rw-r--r-- | drivers/target/target_core_stat.c | 197 |
1 files changed, 100 insertions, 97 deletions
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c index 64efee2fba52..ea1287940a7c 100644 --- a/drivers/target/target_core_stat.c +++ b/drivers/target/target_core_stat.c | |||
@@ -1084,17 +1084,17 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_inst( | |||
1084 | struct se_portal_group *tpg; | 1084 | struct se_portal_group *tpg; |
1085 | ssize_t ret; | 1085 | ssize_t ret; |
1086 | 1086 | ||
1087 | spin_lock_irq(&nacl->device_list_lock); | 1087 | rcu_read_lock(); |
1088 | deve = nacl->device_list[lacl->mapped_lun]; | 1088 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1089 | if (!deve->se_lun || !deve->se_lun_acl) { | 1089 | if (!deve) { |
1090 | spin_unlock_irq(&nacl->device_list_lock); | 1090 | rcu_read_unlock(); |
1091 | return -ENODEV; | 1091 | return -ENODEV; |
1092 | } | 1092 | } |
1093 | tpg = nacl->se_tpg; | 1093 | tpg = nacl->se_tpg; |
1094 | /* scsiInstIndex */ | 1094 | /* scsiInstIndex */ |
1095 | ret = snprintf(page, PAGE_SIZE, "%u\n", | 1095 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
1096 | tpg->se_tpg_tfo->tpg_get_inst_index(tpg)); | 1096 | tpg->se_tpg_tfo->tpg_get_inst_index(tpg)); |
1097 | spin_unlock_irq(&nacl->device_list_lock); | 1097 | rcu_read_unlock(); |
1098 | return ret; | 1098 | return ret; |
1099 | } | 1099 | } |
1100 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(inst); | 1100 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(inst); |
@@ -1109,16 +1109,16 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev( | |||
1109 | struct se_lun *lun; | 1109 | struct se_lun *lun; |
1110 | ssize_t ret; | 1110 | ssize_t ret; |
1111 | 1111 | ||
1112 | spin_lock_irq(&nacl->device_list_lock); | 1112 | rcu_read_lock(); |
1113 | deve = nacl->device_list[lacl->mapped_lun]; | 1113 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1114 | if (!deve->se_lun || !deve->se_lun_acl) { | 1114 | if (!deve) { |
1115 | spin_unlock_irq(&nacl->device_list_lock); | 1115 | rcu_read_unlock(); |
1116 | return -ENODEV; | 1116 | return -ENODEV; |
1117 | } | 1117 | } |
1118 | lun = deve->se_lun; | 1118 | lun = rcu_dereference(deve->se_lun); |
1119 | /* scsiDeviceIndex */ | 1119 | /* scsiDeviceIndex */ |
1120 | ret = snprintf(page, PAGE_SIZE, "%u\n", lun->lun_se_dev->dev_index); | 1120 | ret = snprintf(page, PAGE_SIZE, "%u\n", lun->lun_index); |
1121 | spin_unlock_irq(&nacl->device_list_lock); | 1121 | rcu_read_unlock(); |
1122 | return ret; | 1122 | return ret; |
1123 | } | 1123 | } |
1124 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(dev); | 1124 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(dev); |
@@ -1133,16 +1133,16 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_port( | |||
1133 | struct se_portal_group *tpg; | 1133 | struct se_portal_group *tpg; |
1134 | ssize_t ret; | 1134 | ssize_t ret; |
1135 | 1135 | ||
1136 | spin_lock_irq(&nacl->device_list_lock); | 1136 | rcu_read_lock(); |
1137 | deve = nacl->device_list[lacl->mapped_lun]; | 1137 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1138 | if (!deve->se_lun || !deve->se_lun_acl) { | 1138 | if (!deve) { |
1139 | spin_unlock_irq(&nacl->device_list_lock); | 1139 | rcu_read_unlock(); |
1140 | return -ENODEV; | 1140 | return -ENODEV; |
1141 | } | 1141 | } |
1142 | tpg = nacl->se_tpg; | 1142 | tpg = nacl->se_tpg; |
1143 | /* scsiAuthIntrTgtPortIndex */ | 1143 | /* scsiAuthIntrTgtPortIndex */ |
1144 | ret = snprintf(page, PAGE_SIZE, "%u\n", tpg->se_tpg_tfo->tpg_get_tag(tpg)); | 1144 | ret = snprintf(page, PAGE_SIZE, "%u\n", tpg->se_tpg_tfo->tpg_get_tag(tpg)); |
1145 | spin_unlock_irq(&nacl->device_list_lock); | 1145 | rcu_read_unlock(); |
1146 | return ret; | 1146 | return ret; |
1147 | } | 1147 | } |
1148 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(port); | 1148 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(port); |
@@ -1156,15 +1156,15 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_indx( | |||
1156 | struct se_dev_entry *deve; | 1156 | struct se_dev_entry *deve; |
1157 | ssize_t ret; | 1157 | ssize_t ret; |
1158 | 1158 | ||
1159 | spin_lock_irq(&nacl->device_list_lock); | 1159 | rcu_read_lock(); |
1160 | deve = nacl->device_list[lacl->mapped_lun]; | 1160 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1161 | if (!deve->se_lun || !deve->se_lun_acl) { | 1161 | if (!deve) { |
1162 | spin_unlock_irq(&nacl->device_list_lock); | 1162 | rcu_read_unlock(); |
1163 | return -ENODEV; | 1163 | return -ENODEV; |
1164 | } | 1164 | } |
1165 | /* scsiAuthIntrIndex */ | 1165 | /* scsiAuthIntrIndex */ |
1166 | ret = snprintf(page, PAGE_SIZE, "%u\n", nacl->acl_index); | 1166 | ret = snprintf(page, PAGE_SIZE, "%u\n", nacl->acl_index); |
1167 | spin_unlock_irq(&nacl->device_list_lock); | 1167 | rcu_read_unlock(); |
1168 | return ret; | 1168 | return ret; |
1169 | } | 1169 | } |
1170 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(indx); | 1170 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(indx); |
@@ -1178,15 +1178,15 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev_or_port( | |||
1178 | struct se_dev_entry *deve; | 1178 | struct se_dev_entry *deve; |
1179 | ssize_t ret; | 1179 | ssize_t ret; |
1180 | 1180 | ||
1181 | spin_lock_irq(&nacl->device_list_lock); | 1181 | rcu_read_lock(); |
1182 | deve = nacl->device_list[lacl->mapped_lun]; | 1182 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1183 | if (!deve->se_lun || !deve->se_lun_acl) { | 1183 | if (!deve) { |
1184 | spin_unlock_irq(&nacl->device_list_lock); | 1184 | rcu_read_unlock(); |
1185 | return -ENODEV; | 1185 | return -ENODEV; |
1186 | } | 1186 | } |
1187 | /* scsiAuthIntrDevOrPort */ | 1187 | /* scsiAuthIntrDevOrPort */ |
1188 | ret = snprintf(page, PAGE_SIZE, "%u\n", 1); | 1188 | ret = snprintf(page, PAGE_SIZE, "%u\n", 1); |
1189 | spin_unlock_irq(&nacl->device_list_lock); | 1189 | rcu_read_unlock(); |
1190 | return ret; | 1190 | return ret; |
1191 | } | 1191 | } |
1192 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(dev_or_port); | 1192 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(dev_or_port); |
@@ -1200,15 +1200,15 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_intr_name( | |||
1200 | struct se_dev_entry *deve; | 1200 | struct se_dev_entry *deve; |
1201 | ssize_t ret; | 1201 | ssize_t ret; |
1202 | 1202 | ||
1203 | spin_lock_irq(&nacl->device_list_lock); | 1203 | rcu_read_lock(); |
1204 | deve = nacl->device_list[lacl->mapped_lun]; | 1204 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1205 | if (!deve->se_lun || !deve->se_lun_acl) { | 1205 | if (!deve) { |
1206 | spin_unlock_irq(&nacl->device_list_lock); | 1206 | rcu_read_unlock(); |
1207 | return -ENODEV; | 1207 | return -ENODEV; |
1208 | } | 1208 | } |
1209 | /* scsiAuthIntrName */ | 1209 | /* scsiAuthIntrName */ |
1210 | ret = snprintf(page, PAGE_SIZE, "%s\n", nacl->initiatorname); | 1210 | ret = snprintf(page, PAGE_SIZE, "%s\n", nacl->initiatorname); |
1211 | spin_unlock_irq(&nacl->device_list_lock); | 1211 | rcu_read_unlock(); |
1212 | return ret; | 1212 | return ret; |
1213 | } | 1213 | } |
1214 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(intr_name); | 1214 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(intr_name); |
@@ -1222,15 +1222,15 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_map_indx( | |||
1222 | struct se_dev_entry *deve; | 1222 | struct se_dev_entry *deve; |
1223 | ssize_t ret; | 1223 | ssize_t ret; |
1224 | 1224 | ||
1225 | spin_lock_irq(&nacl->device_list_lock); | 1225 | rcu_read_lock(); |
1226 | deve = nacl->device_list[lacl->mapped_lun]; | 1226 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1227 | if (!deve->se_lun || !deve->se_lun_acl) { | 1227 | if (!deve) { |
1228 | spin_unlock_irq(&nacl->device_list_lock); | 1228 | rcu_read_unlock(); |
1229 | return -ENODEV; | 1229 | return -ENODEV; |
1230 | } | 1230 | } |
1231 | /* FIXME: scsiAuthIntrLunMapIndex */ | 1231 | /* FIXME: scsiAuthIntrLunMapIndex */ |
1232 | ret = snprintf(page, PAGE_SIZE, "%u\n", 0); | 1232 | ret = snprintf(page, PAGE_SIZE, "%u\n", 0); |
1233 | spin_unlock_irq(&nacl->device_list_lock); | 1233 | rcu_read_unlock(); |
1234 | return ret; | 1234 | return ret; |
1235 | } | 1235 | } |
1236 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(map_indx); | 1236 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(map_indx); |
@@ -1244,15 +1244,15 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_att_count( | |||
1244 | struct se_dev_entry *deve; | 1244 | struct se_dev_entry *deve; |
1245 | ssize_t ret; | 1245 | ssize_t ret; |
1246 | 1246 | ||
1247 | spin_lock_irq(&nacl->device_list_lock); | 1247 | rcu_read_lock(); |
1248 | deve = nacl->device_list[lacl->mapped_lun]; | 1248 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1249 | if (!deve->se_lun || !deve->se_lun_acl) { | 1249 | if (!deve) { |
1250 | spin_unlock_irq(&nacl->device_list_lock); | 1250 | rcu_read_unlock(); |
1251 | return -ENODEV; | 1251 | return -ENODEV; |
1252 | } | 1252 | } |
1253 | /* scsiAuthIntrAttachedTimes */ | 1253 | /* scsiAuthIntrAttachedTimes */ |
1254 | ret = snprintf(page, PAGE_SIZE, "%u\n", deve->attach_count); | 1254 | ret = snprintf(page, PAGE_SIZE, "%u\n", deve->attach_count); |
1255 | spin_unlock_irq(&nacl->device_list_lock); | 1255 | rcu_read_unlock(); |
1256 | return ret; | 1256 | return ret; |
1257 | } | 1257 | } |
1258 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(att_count); | 1258 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(att_count); |
@@ -1266,15 +1266,16 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_num_cmds( | |||
1266 | struct se_dev_entry *deve; | 1266 | struct se_dev_entry *deve; |
1267 | ssize_t ret; | 1267 | ssize_t ret; |
1268 | 1268 | ||
1269 | spin_lock_irq(&nacl->device_list_lock); | 1269 | rcu_read_lock(); |
1270 | deve = nacl->device_list[lacl->mapped_lun]; | 1270 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1271 | if (!deve->se_lun || !deve->se_lun_acl) { | 1271 | if (!deve) { |
1272 | spin_unlock_irq(&nacl->device_list_lock); | 1272 | rcu_read_unlock(); |
1273 | return -ENODEV; | 1273 | return -ENODEV; |
1274 | } | 1274 | } |
1275 | /* scsiAuthIntrOutCommands */ | 1275 | /* scsiAuthIntrOutCommands */ |
1276 | ret = snprintf(page, PAGE_SIZE, "%u\n", deve->total_cmds); | 1276 | ret = snprintf(page, PAGE_SIZE, "%lu\n", |
1277 | spin_unlock_irq(&nacl->device_list_lock); | 1277 | atomic_long_read(&deve->total_cmds)); |
1278 | rcu_read_unlock(); | ||
1278 | return ret; | 1279 | return ret; |
1279 | } | 1280 | } |
1280 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(num_cmds); | 1281 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(num_cmds); |
@@ -1288,15 +1289,16 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_read_mbytes( | |||
1288 | struct se_dev_entry *deve; | 1289 | struct se_dev_entry *deve; |
1289 | ssize_t ret; | 1290 | ssize_t ret; |
1290 | 1291 | ||
1291 | spin_lock_irq(&nacl->device_list_lock); | 1292 | rcu_read_lock(); |
1292 | deve = nacl->device_list[lacl->mapped_lun]; | 1293 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1293 | if (!deve->se_lun || !deve->se_lun_acl) { | 1294 | if (!deve) { |
1294 | spin_unlock_irq(&nacl->device_list_lock); | 1295 | rcu_read_unlock(); |
1295 | return -ENODEV; | 1296 | return -ENODEV; |
1296 | } | 1297 | } |
1297 | /* scsiAuthIntrReadMegaBytes */ | 1298 | /* scsiAuthIntrReadMegaBytes */ |
1298 | ret = snprintf(page, PAGE_SIZE, "%u\n", (u32)(deve->read_bytes >> 20)); | 1299 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
1299 | spin_unlock_irq(&nacl->device_list_lock); | 1300 | (u32)(atomic_long_read(&deve->read_bytes) >> 20)); |
1301 | rcu_read_unlock(); | ||
1300 | return ret; | 1302 | return ret; |
1301 | } | 1303 | } |
1302 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(read_mbytes); | 1304 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(read_mbytes); |
@@ -1310,15 +1312,16 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_write_mbytes( | |||
1310 | struct se_dev_entry *deve; | 1312 | struct se_dev_entry *deve; |
1311 | ssize_t ret; | 1313 | ssize_t ret; |
1312 | 1314 | ||
1313 | spin_lock_irq(&nacl->device_list_lock); | 1315 | rcu_read_lock(); |
1314 | deve = nacl->device_list[lacl->mapped_lun]; | 1316 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1315 | if (!deve->se_lun || !deve->se_lun_acl) { | 1317 | if (!deve) { |
1316 | spin_unlock_irq(&nacl->device_list_lock); | 1318 | rcu_read_unlock(); |
1317 | return -ENODEV; | 1319 | return -ENODEV; |
1318 | } | 1320 | } |
1319 | /* scsiAuthIntrWrittenMegaBytes */ | 1321 | /* scsiAuthIntrWrittenMegaBytes */ |
1320 | ret = snprintf(page, PAGE_SIZE, "%u\n", (u32)(deve->write_bytes >> 20)); | 1322 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
1321 | spin_unlock_irq(&nacl->device_list_lock); | 1323 | (u32)(atomic_long_read(&deve->write_bytes) >> 20)); |
1324 | rcu_read_unlock(); | ||
1322 | return ret; | 1325 | return ret; |
1323 | } | 1326 | } |
1324 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(write_mbytes); | 1327 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(write_mbytes); |
@@ -1332,15 +1335,15 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_hs_num_cmds( | |||
1332 | struct se_dev_entry *deve; | 1335 | struct se_dev_entry *deve; |
1333 | ssize_t ret; | 1336 | ssize_t ret; |
1334 | 1337 | ||
1335 | spin_lock_irq(&nacl->device_list_lock); | 1338 | rcu_read_lock(); |
1336 | deve = nacl->device_list[lacl->mapped_lun]; | 1339 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1337 | if (!deve->se_lun || !deve->se_lun_acl) { | 1340 | if (!deve) { |
1338 | spin_unlock_irq(&nacl->device_list_lock); | 1341 | rcu_read_unlock(); |
1339 | return -ENODEV; | 1342 | return -ENODEV; |
1340 | } | 1343 | } |
1341 | /* FIXME: scsiAuthIntrHSOutCommands */ | 1344 | /* FIXME: scsiAuthIntrHSOutCommands */ |
1342 | ret = snprintf(page, PAGE_SIZE, "%u\n", 0); | 1345 | ret = snprintf(page, PAGE_SIZE, "%u\n", 0); |
1343 | spin_unlock_irq(&nacl->device_list_lock); | 1346 | rcu_read_unlock(); |
1344 | return ret; | 1347 | return ret; |
1345 | } | 1348 | } |
1346 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(hs_num_cmds); | 1349 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(hs_num_cmds); |
@@ -1354,16 +1357,16 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_creation_time( | |||
1354 | struct se_dev_entry *deve; | 1357 | struct se_dev_entry *deve; |
1355 | ssize_t ret; | 1358 | ssize_t ret; |
1356 | 1359 | ||
1357 | spin_lock_irq(&nacl->device_list_lock); | 1360 | rcu_read_lock(); |
1358 | deve = nacl->device_list[lacl->mapped_lun]; | 1361 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1359 | if (!deve->se_lun || !deve->se_lun_acl) { | 1362 | if (!deve) { |
1360 | spin_unlock_irq(&nacl->device_list_lock); | 1363 | rcu_read_unlock(); |
1361 | return -ENODEV; | 1364 | return -ENODEV; |
1362 | } | 1365 | } |
1363 | /* scsiAuthIntrLastCreation */ | 1366 | /* scsiAuthIntrLastCreation */ |
1364 | ret = snprintf(page, PAGE_SIZE, "%u\n", (u32)(((u32)deve->creation_time - | 1367 | ret = snprintf(page, PAGE_SIZE, "%u\n", (u32)(((u32)deve->creation_time - |
1365 | INITIAL_JIFFIES) * 100 / HZ)); | 1368 | INITIAL_JIFFIES) * 100 / HZ)); |
1366 | spin_unlock_irq(&nacl->device_list_lock); | 1369 | rcu_read_unlock(); |
1367 | return ret; | 1370 | return ret; |
1368 | } | 1371 | } |
1369 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(creation_time); | 1372 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(creation_time); |
@@ -1377,15 +1380,15 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_row_status( | |||
1377 | struct se_dev_entry *deve; | 1380 | struct se_dev_entry *deve; |
1378 | ssize_t ret; | 1381 | ssize_t ret; |
1379 | 1382 | ||
1380 | spin_lock_irq(&nacl->device_list_lock); | 1383 | rcu_read_lock(); |
1381 | deve = nacl->device_list[lacl->mapped_lun]; | 1384 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1382 | if (!deve->se_lun || !deve->se_lun_acl) { | 1385 | if (!deve) { |
1383 | spin_unlock_irq(&nacl->device_list_lock); | 1386 | rcu_read_unlock(); |
1384 | return -ENODEV; | 1387 | return -ENODEV; |
1385 | } | 1388 | } |
1386 | /* FIXME: scsiAuthIntrRowStatus */ | 1389 | /* FIXME: scsiAuthIntrRowStatus */ |
1387 | ret = snprintf(page, PAGE_SIZE, "Ready\n"); | 1390 | ret = snprintf(page, PAGE_SIZE, "Ready\n"); |
1388 | spin_unlock_irq(&nacl->device_list_lock); | 1391 | rcu_read_unlock(); |
1389 | return ret; | 1392 | return ret; |
1390 | } | 1393 | } |
1391 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(row_status); | 1394 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(row_status); |
@@ -1450,17 +1453,17 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_inst( | |||
1450 | struct se_portal_group *tpg; | 1453 | struct se_portal_group *tpg; |
1451 | ssize_t ret; | 1454 | ssize_t ret; |
1452 | 1455 | ||
1453 | spin_lock_irq(&nacl->device_list_lock); | 1456 | rcu_read_lock(); |
1454 | deve = nacl->device_list[lacl->mapped_lun]; | 1457 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1455 | if (!deve->se_lun || !deve->se_lun_acl) { | 1458 | if (!deve) { |
1456 | spin_unlock_irq(&nacl->device_list_lock); | 1459 | rcu_read_unlock(); |
1457 | return -ENODEV; | 1460 | return -ENODEV; |
1458 | } | 1461 | } |
1459 | tpg = nacl->se_tpg; | 1462 | tpg = nacl->se_tpg; |
1460 | /* scsiInstIndex */ | 1463 | /* scsiInstIndex */ |
1461 | ret = snprintf(page, PAGE_SIZE, "%u\n", | 1464 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
1462 | tpg->se_tpg_tfo->tpg_get_inst_index(tpg)); | 1465 | tpg->se_tpg_tfo->tpg_get_inst_index(tpg)); |
1463 | spin_unlock_irq(&nacl->device_list_lock); | 1466 | rcu_read_unlock(); |
1464 | return ret; | 1467 | return ret; |
1465 | } | 1468 | } |
1466 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(inst); | 1469 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(inst); |
@@ -1475,16 +1478,16 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_dev( | |||
1475 | struct se_lun *lun; | 1478 | struct se_lun *lun; |
1476 | ssize_t ret; | 1479 | ssize_t ret; |
1477 | 1480 | ||
1478 | spin_lock_irq(&nacl->device_list_lock); | 1481 | rcu_read_lock(); |
1479 | deve = nacl->device_list[lacl->mapped_lun]; | 1482 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1480 | if (!deve->se_lun || !deve->se_lun_acl) { | 1483 | if (!deve) { |
1481 | spin_unlock_irq(&nacl->device_list_lock); | 1484 | rcu_read_unlock(); |
1482 | return -ENODEV; | 1485 | return -ENODEV; |
1483 | } | 1486 | } |
1484 | lun = deve->se_lun; | 1487 | lun = rcu_dereference(deve->se_lun); |
1485 | /* scsiDeviceIndex */ | 1488 | /* scsiDeviceIndex */ |
1486 | ret = snprintf(page, PAGE_SIZE, "%u\n", lun->lun_se_dev->dev_index); | 1489 | ret = snprintf(page, PAGE_SIZE, "%u\n", lun->lun_index); |
1487 | spin_unlock_irq(&nacl->device_list_lock); | 1490 | rcu_read_unlock(); |
1488 | return ret; | 1491 | return ret; |
1489 | } | 1492 | } |
1490 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(dev); | 1493 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(dev); |
@@ -1499,16 +1502,16 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port( | |||
1499 | struct se_portal_group *tpg; | 1502 | struct se_portal_group *tpg; |
1500 | ssize_t ret; | 1503 | ssize_t ret; |
1501 | 1504 | ||
1502 | spin_lock_irq(&nacl->device_list_lock); | 1505 | rcu_read_lock(); |
1503 | deve = nacl->device_list[lacl->mapped_lun]; | 1506 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1504 | if (!deve->se_lun || !deve->se_lun_acl) { | 1507 | if (!deve) { |
1505 | spin_unlock_irq(&nacl->device_list_lock); | 1508 | rcu_read_unlock(); |
1506 | return -ENODEV; | 1509 | return -ENODEV; |
1507 | } | 1510 | } |
1508 | tpg = nacl->se_tpg; | 1511 | tpg = nacl->se_tpg; |
1509 | /* scsiPortIndex */ | 1512 | /* scsiPortIndex */ |
1510 | ret = snprintf(page, PAGE_SIZE, "%u\n", tpg->se_tpg_tfo->tpg_get_tag(tpg)); | 1513 | ret = snprintf(page, PAGE_SIZE, "%u\n", tpg->se_tpg_tfo->tpg_get_tag(tpg)); |
1511 | spin_unlock_irq(&nacl->device_list_lock); | 1514 | rcu_read_unlock(); |
1512 | return ret; | 1515 | return ret; |
1513 | } | 1516 | } |
1514 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port); | 1517 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port); |
@@ -1548,15 +1551,15 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port_auth_indx( | |||
1548 | struct se_dev_entry *deve; | 1551 | struct se_dev_entry *deve; |
1549 | ssize_t ret; | 1552 | ssize_t ret; |
1550 | 1553 | ||
1551 | spin_lock_irq(&nacl->device_list_lock); | 1554 | rcu_read_lock(); |
1552 | deve = nacl->device_list[lacl->mapped_lun]; | 1555 | deve = target_nacl_find_deve(nacl, lacl->mapped_lun); |
1553 | if (!deve->se_lun || !deve->se_lun_acl) { | 1556 | if (!deve) { |
1554 | spin_unlock_irq(&nacl->device_list_lock); | 1557 | rcu_read_unlock(); |
1555 | return -ENODEV; | 1558 | return -ENODEV; |
1556 | } | 1559 | } |
1557 | /* scsiAttIntrPortAuthIntrIdx */ | 1560 | /* scsiAttIntrPortAuthIntrIdx */ |
1558 | ret = snprintf(page, PAGE_SIZE, "%u\n", nacl->acl_index); | 1561 | ret = snprintf(page, PAGE_SIZE, "%u\n", nacl->acl_index); |
1559 | spin_unlock_irq(&nacl->device_list_lock); | 1562 | rcu_read_unlock(); |
1560 | return ret; | 1563 | return ret; |
1561 | } | 1564 | } |
1562 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port_auth_indx); | 1565 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port_auth_indx); |