Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx> Cc: Vasu Dev <vasu.dev@xxxxxxxxx> --- drivers/target/tcm_fc/tfc_conf.c | 4 ++-- drivers/target/tcm_fc/tfc_sess.c | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index 5098aad..bb431b2 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c @@ -326,13 +326,13 @@ static void ft_del_tpg(struct se_portal_group *se_tpg) /* * Verify that an lport is configured to use the tcm_fc module, and return * the target port group that should be used. - * - * The caller holds ft_lport_lock. */ struct ft_tpg *ft_lport_find_tpg(struct fc_lport *lport) { struct ft_lport_wwn *ft_wwn; + lockdep_assert_held(&ft_lport_lock); + list_for_each_entry(ft_wwn, &ft_wwn_list, ft_wwn_node) { if (ft_wwn->wwpn == lport->wwpn) return ft_wwn->tpg; diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index 96a2273..00a22d6 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c @@ -48,7 +48,6 @@ static void ft_sess_delete_all(struct ft_tport *); /* * Lookup or allocate target local port. - * Caller holds ft_lport_lock. */ static struct ft_tport *ft_tport_get(struct fc_lport *lport) { @@ -56,6 +55,8 @@ static struct ft_tport *ft_tport_get(struct fc_lport *lport) struct ft_tport *tport; int i; + lockdep_assert_held(&ft_lport_lock); + tport = rcu_dereference_protected(lport->prov[FC_TYPE_FCP], lockdep_is_held(&ft_lport_lock)); if (tport && tport->tpg) @@ -87,13 +88,14 @@ static struct ft_tport *ft_tport_get(struct fc_lport *lport) /* * Delete a target local port. - * Caller holds ft_lport_lock. */ static void ft_tport_delete(struct ft_tport *tport) { struct fc_lport *lport; struct ft_tpg *tpg; + lockdep_assert_held(&ft_lport_lock); + ft_sess_delete_all(tport); lport = tport->lport; BUG_ON(tport != lport->prov[FC_TYPE_FCP]); @@ -193,7 +195,6 @@ out: /* * Allocate session and enter it in the hash for the local port. - * Caller holds ft_lport_lock. */ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id, struct ft_node_acl *acl) @@ -201,6 +202,8 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id, struct ft_sess *sess; struct hlist_head *head; + lockdep_assert_held(&ft_lport_lock); + head = &tport->hash[ft_sess_hash(port_id)]; hlist_for_each_entry_rcu(sess, head, hash) if (sess->port_id == port_id) @@ -233,12 +236,13 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id, /* * Unhash the session. - * Caller holds ft_lport_lock. */ static void ft_sess_unhash(struct ft_sess *sess) { struct ft_tport *tport = sess->tport; + lockdep_assert_held(&ft_lport_lock); + hlist_del_rcu(&sess->hash); BUG_ON(!tport->sess_count); tport->sess_count--; @@ -248,13 +252,14 @@ static void ft_sess_unhash(struct ft_sess *sess) /* * Delete session from hash. - * Caller holds ft_lport_lock. */ static struct ft_sess *ft_sess_delete(struct ft_tport *tport, u32 port_id) { struct hlist_head *head; struct ft_sess *sess; + lockdep_assert_held(&ft_lport_lock); + head = &tport->hash[ft_sess_hash(port_id)]; hlist_for_each_entry_rcu(sess, head, hash) { if (sess->port_id == port_id) { @@ -267,13 +272,14 @@ static struct ft_sess *ft_sess_delete(struct ft_tport *tport, u32 port_id) /* * Delete all sessions from tport. - * Caller holds ft_lport_lock. */ static void ft_sess_delete_all(struct ft_tport *tport) { struct hlist_head *head; struct ft_sess *sess; + lockdep_assert_held(&ft_lport_lock); + for (head = tport->hash; head < &tport->hash[FT_SESS_HASH_SIZE]; head++) { hlist_for_each_entry_rcu(sess, head, hash) { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html