Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 618baaf7 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen
Browse files

scsi: target/iscsi: Convert comments about locking into runtime checks



Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b53655b8
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -308,9 +308,6 @@ bool iscsit_check_np_match(
	return false;
}

/*
 * Called with mutex np_lock held
 */
static struct iscsi_np *iscsit_get_np(
	struct sockaddr_storage *sockaddr,
	int network_transport)
@@ -318,6 +315,8 @@ static struct iscsi_np *iscsit_get_np(
	struct iscsi_np *np;
	bool match;

	lockdep_assert_held(&np_lock);

	list_for_each_entry(np, &g_np_list, np_list) {
		spin_lock_bh(&np->np_thread_lock);
		if (np->np_thread_state != ISCSI_NP_THREAD_ACTIVE) {
@@ -2655,9 +2654,6 @@ static int iscsit_handle_immediate_data(
	return IMMEDIATE_DATA_NORMAL_OPERATION;
}

/*
 *	Called with sess->conn_lock held.
 */
/* #warning iscsi_build_conn_drop_async_message() only sends out on connections
	with active network interface */
static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn)
@@ -2666,6 +2662,8 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn)
	struct iscsi_conn *conn_p;
	bool found = false;

	lockdep_assert_held(&conn->sess->conn_lock);

	/*
	 * Only send a Asynchronous Message on connections whos network
	 * interface is still functional.
+2 −3
Original line number Diff line number Diff line
@@ -802,14 +802,13 @@ void iscsit_start_time2retain_handler(struct iscsi_session *sess)
		  jiffies + sess->sess_ops->DefaultTime2Retain * HZ);
}

/*
 *	Called with spin_lock_bh(&struct se_portal_group->session_lock) held
 */
int iscsit_stop_time2retain_timer(struct iscsi_session *sess)
{
	struct iscsi_portal_group *tpg = sess->tpg;
	struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;

	lockdep_assert_held(&se_tpg->session_lock);

	if (sess->time2retain_timer_flags & ISCSI_TF_EXPIRED)
		return -1;

+7 −9
Original line number Diff line number Diff line
@@ -797,14 +797,14 @@ static struct iscsi_ooo_cmdsn *iscsit_allocate_ooo_cmdsn(void)
	return ooo_cmdsn;
}

/*
 *	Called with sess->cmdsn_mutex held.
 */
static int iscsit_attach_ooo_cmdsn(
	struct iscsi_session *sess,
	struct iscsi_ooo_cmdsn *ooo_cmdsn)
{
	struct iscsi_ooo_cmdsn *ooo_tail, *ooo_tmp;

	lockdep_assert_held(&sess->cmdsn_mutex);

	/*
	 * We attach the struct iscsi_ooo_cmdsn entry to the out of order
	 * list in increasing CmdSN order.
@@ -871,15 +871,14 @@ void iscsit_clear_ooo_cmdsns_for_conn(struct iscsi_conn *conn)
	mutex_unlock(&sess->cmdsn_mutex);
}

/*
 *	Called with sess->cmdsn_mutex held.
 */
int iscsit_execute_ooo_cmdsns(struct iscsi_session *sess)
{
	int ooo_count = 0;
	struct iscsi_cmd *cmd = NULL;
	struct iscsi_ooo_cmdsn *ooo_cmdsn, *ooo_cmdsn_tmp;

	lockdep_assert_held(&sess->cmdsn_mutex);

	list_for_each_entry_safe(ooo_cmdsn, ooo_cmdsn_tmp,
				&sess->sess_ooo_cmdsn_list, ooo_list) {
		if (ooo_cmdsn->cmdsn != sess->exp_cmd_sn)
@@ -1232,9 +1231,6 @@ void iscsit_mod_dataout_timer(struct iscsi_cmd *cmd)
	spin_unlock_bh(&cmd->dataout_timeout_lock);
}

/*
 *	Called with cmd->dataout_timeout_lock held.
 */
void iscsit_start_dataout_timer(
	struct iscsi_cmd *cmd,
	struct iscsi_conn *conn)
@@ -1242,6 +1238,8 @@ void iscsit_start_dataout_timer(
	struct iscsi_session *sess = conn->sess;
	struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess);

	lockdep_assert_held(&cmd->dataout_timeout_lock);

	if (cmd->dataout_timer_flags & ISCSI_TF_RUNNING)
		return;

+7 −9
Original line number Diff line number Diff line
@@ -56,9 +56,6 @@
extern struct list_head g_tiqn_list;
extern spinlock_t tiqn_lock;

/*
 *	Called with cmd->r2t_lock held.
 */
int iscsit_add_r2t_to_list(
	struct iscsi_cmd *cmd,
	u32 offset,
@@ -68,6 +65,8 @@ int iscsit_add_r2t_to_list(
{
	struct iscsi_r2t *r2t;

	lockdep_assert_held(&cmd->r2t_lock);

	r2t = kmem_cache_zalloc(lio_r2t_cache, GFP_ATOMIC);
	if (!r2t) {
		pr_err("Unable to allocate memory for struct iscsi_r2t.\n");
@@ -128,11 +127,10 @@ struct iscsi_r2t *iscsit_get_r2t_from_list(struct iscsi_cmd *cmd)
	return NULL;
}

/*
 *	Called with cmd->r2t_lock held.
 */
void iscsit_free_r2t(struct iscsi_r2t *r2t, struct iscsi_cmd *cmd)
{
	lockdep_assert_held(&cmd->r2t_lock);

	list_del(&r2t->r2t_list);
	kmem_cache_free(lio_r2t_cache, r2t);
}
@@ -1013,13 +1011,13 @@ void iscsit_handle_nopin_timeout(struct timer_list *t)
	iscsit_dec_conn_usage_count(conn);
}

/*
 * Called with conn->nopin_timer_lock held.
 */
void __iscsit_start_nopin_timer(struct iscsi_conn *conn)
{
	struct iscsi_session *sess = conn->sess;
	struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess);

	lockdep_assert_held(&conn->nopin_timer_lock);

	/*
	* NOPIN timeout is disabled.
	 */
+2 −3
Original line number Diff line number Diff line
@@ -910,9 +910,6 @@ static int core_alua_write_tpg_metadata(
	return (ret < 0) ? -EIO : 0;
}

/*
 * Called with tg_pt_gp->tg_pt_gp_transition_mutex held
 */
static int core_alua_update_tpg_primary_metadata(
	struct t10_alua_tg_pt_gp *tg_pt_gp)
{
@@ -921,6 +918,8 @@ static int core_alua_update_tpg_primary_metadata(
	char *path;
	int len, rc;

	lockdep_assert_held(&tg_pt_gp->tg_pt_gp_transition_mutex);

	md_buf = kzalloc(ALUA_MD_BUF_LEN, GFP_KERNEL);
	if (!md_buf) {
		pr_err("Unable to allocate buf for ALUA metadata\n");
Loading