mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-18 21:26:31 +00:00
Minor fixes and improvements
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2015 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -672,12 +672,13 @@ static ssize_t iscsi_attr_store(struct kobject *kobj,
|
||||
res = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memcpy(buffer, buf, count);
|
||||
buffer[count] = '\0';
|
||||
|
||||
tgt_attr = container_of(attr, struct iscsi_attr, attr);
|
||||
|
||||
TRACE_DBG("attr %s, buffer %s", tgt_attr->attr.attr.name, buffer);
|
||||
|
||||
res = iscsi_sysfs_send_event(
|
||||
(tgt_attr->target != NULL) ? tgt_attr->target->tid : 0,
|
||||
E_SET_ATTR_VALUE, tgt_attr->name, buffer, NULL);
|
||||
|
||||
+9
-4
@@ -4072,15 +4072,20 @@ void scst_free_session(struct scst_session *sess)
|
||||
|
||||
mutex_lock(&scst_mutex);
|
||||
|
||||
scst_sess_free_tgt_devs(sess);
|
||||
|
||||
scst_sess_sysfs_del(sess);
|
||||
|
||||
/*
|
||||
* The lists delete must be after sysfs del. Otherwise it would break
|
||||
* logic in scst_sess_sysfs_create() to avoid duplicate sysfs names.
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
scst_sess_free_tgt_devs(sess);
|
||||
|
||||
scst_sess_sysfs_del(sess);
|
||||
|
||||
/* Called under lock to protect from too early tgt release */
|
||||
wake_up_all(&sess->tgt->unreg_waitQ);
|
||||
|
||||
|
||||
@@ -993,7 +993,7 @@ static int scst_process_tgt_enable_store(struct scst_tgt *tgt, bool enable)
|
||||
|
||||
/* Tgt protected by kobject reference */
|
||||
|
||||
TRACE_DBG("tgt%p, enable %d", tgt, enable);
|
||||
TRACE_DBG("tgt %s, enable %d", tgt->tgt_name, enable);
|
||||
|
||||
if (enable && (tgt->rel_tgt_id == 0)) {
|
||||
res = gen_relative_target_port_id(&tgt->rel_tgt_id);
|
||||
@@ -2341,6 +2341,7 @@ restart:
|
||||
list_for_each_entry(s, &sess->tgt->sess_list, sess_list_entry) {
|
||||
if (!sess->sess_kobj_ready)
|
||||
continue;
|
||||
|
||||
if (strcmp(name, kobject_name(&s->sess_kobj)) == 0) {
|
||||
if (s == sess)
|
||||
continue;
|
||||
@@ -2406,9 +2407,11 @@ void scst_sess_sysfs_del(struct scst_session *sess)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
if (sess->sess_kobj_ready)
|
||||
if (!sess->sess_kobj_ready)
|
||||
goto out;
|
||||
|
||||
TRACE_DBG("Deleting session %s", kobject_name(&sess->sess_kobj));
|
||||
|
||||
kobject_del(&sess->sess_kobj);
|
||||
kobject_put(&sess->sess_kobj);
|
||||
|
||||
|
||||
@@ -6251,7 +6251,7 @@ EXPORT_SYMBOL(scst_initiator_has_luns);
|
||||
|
||||
static int scst_init_session(struct scst_session *sess)
|
||||
{
|
||||
int res = 0, rc;
|
||||
int res = 0;
|
||||
struct scst_cmd *cmd;
|
||||
struct scst_mgmt_cmd *mcmd, *tm;
|
||||
int mwake = 0;
|
||||
@@ -6284,14 +6284,11 @@ static int scst_init_session(struct scst_session *sess)
|
||||
sess->transport_id), sess->tgt->rel_tgt_id);
|
||||
}
|
||||
|
||||
/* Let's always create sysfs to simplify code */
|
||||
rc = scst_sess_sysfs_create(sess);
|
||||
if (res == 0)
|
||||
res = rc;
|
||||
res = scst_sess_sysfs_create(sess);
|
||||
if (res != 0)
|
||||
goto failed;
|
||||
|
||||
rc = scst_sess_alloc_tgt_devs(sess);
|
||||
if (res == 0)
|
||||
res = rc;
|
||||
res = scst_sess_alloc_tgt_devs(sess);
|
||||
|
||||
failed:
|
||||
mutex_unlock(&scst_mutex);
|
||||
|
||||
Reference in New Issue
Block a user