mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 18:51:27 +00:00
Cleanups
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4456 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2427,8 +2427,9 @@ typedef struct scsi_qla_host {
|
||||
uint16_t atio_q_length;
|
||||
|
||||
/*
|
||||
* Protected by tgt_mutex AND hardware_lock for writing and
|
||||
* tgt_mutex OR hardware_lock for reading.
|
||||
* Processing Q2T tgt reference. NULL on not enabled targets. Protected
|
||||
* by tgt_mutex AND hardware_lock for writing and tgt_mutex OR
|
||||
* hardware_lock for reading.
|
||||
*/
|
||||
struct q2t_tgt *tgt;
|
||||
|
||||
@@ -2701,7 +2702,10 @@ typedef struct scsi_qla_host {
|
||||
|
||||
struct mutex tgt_host_action_mutex;
|
||||
|
||||
/* Protected by tgt_host_action_mutex */
|
||||
/*
|
||||
* Main Q2T tgt reference, which always points to the target, if the
|
||||
* target mode addon loaded. Protected by tgt_host_action_mutex.
|
||||
*/
|
||||
struct q2t_tgt *q2t_tgt;
|
||||
|
||||
struct list_head ha_list_entry;
|
||||
|
||||
@@ -1662,8 +1662,8 @@ struct scst_session {
|
||||
/* Name of attached initiator */
|
||||
const char *initiator_name;
|
||||
|
||||
/* Session name: initiator name + optional _%d. */
|
||||
const char *name;
|
||||
/* Unique session name: initiator name + optional _%d. */
|
||||
const char *sess_name;
|
||||
|
||||
/* List entry of sessions per target */
|
||||
struct list_head sess_list_entry;
|
||||
|
||||
@@ -5086,8 +5086,10 @@ void scst_free_session(struct scst_session *sess)
|
||||
mutex_lock(&scst_mutex);
|
||||
|
||||
scst_sess_free_tgt_devs(sess);
|
||||
|
||||
TRACE_DBG("Removing sess %p from the list", sess);
|
||||
list_del(&sess->sess_list_entry);
|
||||
|
||||
TRACE_DBG("Removing session %p from acg %s", sess, sess->acg->acg_name);
|
||||
list_del(&sess->acg_sess_list_entry);
|
||||
|
||||
@@ -5115,8 +5117,8 @@ void scst_free_session(struct scst_session *sess)
|
||||
|
||||
kfree(sess->transport_id);
|
||||
kfree(sess->initiator_name);
|
||||
if (sess->name != sess->initiator_name)
|
||||
kfree(sess->name);
|
||||
if (sess->sess_name != sess->initiator_name)
|
||||
kfree(sess->sess_name);
|
||||
|
||||
kmem_cache_free(scst_sess_cachep, sess);
|
||||
|
||||
@@ -8641,7 +8643,7 @@ int scst_parse_descriptors(struct scst_cmd *cmd)
|
||||
break;
|
||||
default:
|
||||
sBUG_ON(1);
|
||||
res = false;
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ int scst_assign_dev_handler(struct scst_device *dev,
|
||||
struct scst_dev_type *handler);
|
||||
|
||||
struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask,
|
||||
const char *initiator_name);
|
||||
const char *initiator_name);
|
||||
void scst_free_session(struct scst_session *sess);
|
||||
void scst_free_session_callback(struct scst_session *sess);
|
||||
|
||||
|
||||
@@ -3602,7 +3602,7 @@ int scst_sess_sysfs_create(struct scst_session *sess)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
name = sess->name;
|
||||
name = sess->sess_name;
|
||||
TRACE_DBG("Adding session %s to sysfs", name);
|
||||
|
||||
res = kobject_init_and_add(&sess->sess_kobj, &scst_session_ktype,
|
||||
|
||||
@@ -6412,6 +6412,7 @@ bool scst_initiator_has_luns(struct scst_tgt *tgt, const char *initiator_name)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(scst_initiator_has_luns);
|
||||
|
||||
/* Supposed to be called under scst_mutex */
|
||||
static char *scst_get_unique_sess_name(struct list_head *sess_list,
|
||||
const char *initiator_name)
|
||||
{
|
||||
@@ -6426,7 +6427,7 @@ static char *scst_get_unique_sess_name(struct list_head *sess_list,
|
||||
|
||||
restart:
|
||||
list_for_each_entry(s, sess_list, sess_list_entry) {
|
||||
if (s->name && strcmp(name, s->name) == 0) {
|
||||
if (s->sess_name && strcmp(name, s->sess_name) == 0) {
|
||||
TRACE_DBG("Duplicated session from the same initiator "
|
||||
"%s found", name);
|
||||
|
||||
@@ -6485,9 +6486,9 @@ static int scst_init_session(struct scst_session *sess)
|
||||
}
|
||||
|
||||
res = -ENOMEM;
|
||||
sess->name = scst_get_unique_sess_name(&sess->tgt->sess_list,
|
||||
sess->sess_name = scst_get_unique_sess_name(&sess->tgt->sess_list,
|
||||
sess->initiator_name);
|
||||
if (!sess->name)
|
||||
if (!sess->sess_name)
|
||||
goto failed;
|
||||
|
||||
res = scst_sess_sysfs_create(sess);
|
||||
|
||||
Reference in New Issue
Block a user