summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-05-19 09:03:07 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2015-06-01 09:27:38 +0200
commit4cc987eaff9144182cde88d6d132420c28d3f81b (patch)
tree15cf7d432599e1e09446462968ef01c4d10a087e /include
parenttarget: Subsume se_port + t10_alua_tg_pt_gp_member into se_lun (diff)
downloadlinux-4cc987eaff9144182cde88d6d132420c28d3f81b.tar.xz
linux-4cc987eaff9144182cde88d6d132420c28d3f81b.zip
target: Drop lun_sep_lock for se_lun->lun_se_dev RCU usage
With se_port and t10_alua_tg_pt_gp_member being absored into se_lun, there is no need for an extra lock to protect se_lun->lun_se_dev assignment. This patch also converts backend drivers to use call_rcu() release to allow any se_device readers to complete. The call_rcu() instead of kfree_rcu() is required here because se_device is embedded into the backend driver specific structure. Also, convert se_lun->lun_stats to use atomic_long_t within the target_complete_ok_work() completion callback, and add FIXME for transport_lookup_tmr_lun() with se_lun->lun_ref. Finally, update sbp_update_unit_directory() special case usage with proper rcu_dereference_raw() and configfs symlink comment. Reported-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Chris Boot <bootc@bootc.net> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include')
-rw-r--r--include/target/target_core_base.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 1927dd5947a7..b82a989a4d3b 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -690,9 +690,9 @@ struct se_port_stat_grps {
};
struct scsi_port_stats {
- u32 cmd_pdus;
- u64 tx_data_octets;
- u64 rx_data_octets;
+ atomic_long_t cmd_pdus;
+ atomic_long_t tx_data_octets;
+ atomic_long_t rx_data_octets;
};
struct se_lun {
@@ -705,7 +705,6 @@ struct se_lun {
u32 unpacked_lun;
u32 lun_index;
atomic_t lun_acl_count;
- spinlock_t lun_sep_lock;
struct se_device __rcu *lun_se_dev;
struct list_head lun_deve_list;
@@ -818,6 +817,9 @@ struct se_device {
struct se_lun xcopy_lun;
/* Protection Information */
int prot_length;
+ /* For se_lun->lun_se_dev RCU read-side critical access */
+ u32 hba_index;
+ struct rcu_head rcu_head;
};
struct se_hba {