- Minor improvements

- Incorrect BUG_ON removed



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@629 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2009-01-04 16:14:33 +00:00
parent e7429fd16e
commit c89d549bbe
3 changed files with 17 additions and 4 deletions

View File

@@ -185,10 +185,10 @@ struct scst_user_tm {
};
struct scst_user_get_cmd {
aligned_u64 preply;
uint32_t cmd_h;
uint32_t subcode;
union {
aligned_u64 preply;
struct scst_user_sess sess;
struct scst_user_scsi_cmd_parse parse_cmd;
struct scst_user_scsi_cmd_alloc_mem alloc_cmd;

View File

@@ -923,7 +923,6 @@ static void dev_user_on_free_cmd(struct scst_cmd *cmd)
if (unlikely(!ucmd->seen_by_user)) {
TRACE_MGMT_DBG("Not seen by user ucmd %p", ucmd);
sBUG_ON((ucmd->sgv != NULL) || (ucmd->data_pages != NULL));
goto out_reply;
}
@@ -1683,7 +1682,10 @@ static int dev_user_reply_get_cmd(struct file *file, void __user *arg)
down_read(&dev->dev_rwsem);
mutex_unlock(&dev_priv_mutex);
res = copy_from_user(&ureply, arg, sizeof(ureply));
/* get_user() can't be used with 64-bit values on x86_32 */
res = copy_from_user(&ureply, (uint64_t __user *)
&((struct scst_user_get_cmd *)arg)->preply,
sizeof(ureply));
if (res < 0)
goto out_up;

View File

@@ -420,8 +420,19 @@ void scst_unregister(struct scst_tgt *tgt)
TRACE_DBG("%s", "Target driver's release() returned");
mutex_lock(&scst_mutex);
again:
list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) {
sBUG_ON(sess->shut_phase == SCST_SESS_SPH_READY);
if (sess->shut_phase == SCST_SESS_SPH_READY) {
/*
* Sometimes it's hard for target driver to track all
* its sessions (see scst_local, for example), so let's
* help it.
*/
mutex_unlock(&scst_mutex);
scst_unregister_session(sess, 0, NULL);
mutex_lock(&scst_mutex);
goto again;
}
}
mutex_unlock(&scst_mutex);