mirror of
https://github.com/SCST-project/scst.git
synced 2026-09-20 15:04:19 +00:00
Merge of the missed commits r3447,3452,3458 from the trunk.
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.1.0.x@3559 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -4047,10 +4047,10 @@ static int __init iscsi_init(void)
|
|||||||
|
|
||||||
iscsi_cmnd_abort_mempool = mempool_create_kmalloc_pool(2500,
|
iscsi_cmnd_abort_mempool = mempool_create_kmalloc_pool(2500,
|
||||||
sizeof(struct iscsi_cmnd_abort_params));
|
sizeof(struct iscsi_cmnd_abort_params));
|
||||||
if (iscsi_cmnd_abort_mempool == NULL) {
|
if (iscsi_cmnd_abort_mempool == NULL) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto out_free_dummy;
|
goto out_free_dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION)
|
#if defined(CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION)
|
||||||
err = net_set_get_put_page_callbacks(iscsi_get_page_callback,
|
err = net_set_get_put_page_callbacks(iscsi_get_page_callback,
|
||||||
|
|||||||
@@ -1888,6 +1888,12 @@ struct scst_cmd {
|
|||||||
*/
|
*/
|
||||||
unsigned int finished:1;
|
unsigned int finished:1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set if scst_check_local_events() can be called more than once. Set by
|
||||||
|
* scst_pre_check_local_events().
|
||||||
|
*/
|
||||||
|
unsigned int check_local_events_once_done:1;
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_DEBUG_TM
|
#ifdef CONFIG_SCST_DEBUG_TM
|
||||||
/* Set if the cmd was delayed by task management debugging code */
|
/* Set if the cmd was delayed by task management debugging code */
|
||||||
unsigned int tm_dbg_delayed:1;
|
unsigned int tm_dbg_delayed:1;
|
||||||
@@ -3789,6 +3795,13 @@ void scst_post_alloc_data_buf(struct scst_cmd *cmd);
|
|||||||
|
|
||||||
int scst_check_local_events(struct scst_cmd *cmd);
|
int scst_check_local_events(struct scst_cmd *cmd);
|
||||||
|
|
||||||
|
static inline int scst_pre_check_local_events(struct scst_cmd *cmd)
|
||||||
|
{
|
||||||
|
int res = scst_check_local_events(cmd);
|
||||||
|
cmd->check_local_events_once_done = 1;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
int scst_set_cmd_abnormal_done_state(struct scst_cmd *cmd);
|
int scst_set_cmd_abnormal_done_state(struct scst_cmd *cmd);
|
||||||
|
|
||||||
struct scst_trace_log {
|
struct scst_trace_log {
|
||||||
|
|||||||
+17
-5
@@ -72,11 +72,14 @@ static inline void scst_dec_pr_readers_count(struct scst_cmd *cmd,
|
|||||||
{
|
{
|
||||||
struct scst_device *dev = cmd->dev;
|
struct scst_device *dev = cmd->dev;
|
||||||
|
|
||||||
/*
|
if (unlikely(!cmd->dec_pr_readers_count_needed)) {
|
||||||
* scst_check_local_events() should not be called twice for the
|
PRINT_ERROR("scst_check_local_events() should not be called "
|
||||||
* same cmd
|
"twice (cmd %p, op %x)! Use "
|
||||||
*/
|
"scst_pre_check_local_events() instead.", cmd,
|
||||||
WARN_ON(!cmd->dec_pr_readers_count_needed);
|
cmd->cdb[0]);
|
||||||
|
WARN_ON(1);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!locked)
|
if (!locked)
|
||||||
spin_lock_bh(&dev->dev_lock);
|
spin_lock_bh(&dev->dev_lock);
|
||||||
@@ -91,10 +94,19 @@ static inline void scst_dec_pr_readers_count(struct scst_cmd *cmd,
|
|||||||
if (!locked)
|
if (!locked)
|
||||||
spin_unlock_bh(&dev->dev_lock);
|
spin_unlock_bh(&dev->dev_lock);
|
||||||
|
|
||||||
|
out:
|
||||||
EXTRACHECKS_BUG_ON(dev->pr_readers_count < 0);
|
EXTRACHECKS_BUG_ON(dev->pr_readers_count < 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void scst_reset_requeued_cmd(struct scst_cmd *cmd)
|
||||||
|
{
|
||||||
|
TRACE_DBG("Reset requeued cmd %p (op %x)", cmd, cmd->cdb[0]);
|
||||||
|
scst_inc_pr_readers_count(cmd, false);
|
||||||
|
cmd->check_local_events_once_done = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool scst_pr_type_valid(uint8_t type)
|
static inline bool scst_pr_type_valid(uint8_t type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
+18
-13
@@ -1949,7 +1949,7 @@ static int scst_reserve_local(struct scst_cmd *cmd)
|
|||||||
* it, also there's no point to do any extra protection actions.
|
* it, also there's no point to do any extra protection actions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rc = scst_check_local_events(cmd);
|
rc = scst_pre_check_local_events(cmd);
|
||||||
if (unlikely(rc != 0))
|
if (unlikely(rc != 0))
|
||||||
goto out_done;
|
goto out_done;
|
||||||
|
|
||||||
@@ -2010,7 +2010,7 @@ static int scst_release_local(struct scst_cmd *cmd)
|
|||||||
* other protection is needed here.
|
* other protection is needed here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rc = scst_check_local_events(cmd);
|
rc = scst_pre_check_local_events(cmd);
|
||||||
if (unlikely(rc != 0))
|
if (unlikely(rc != 0))
|
||||||
goto out_done;
|
goto out_done;
|
||||||
|
|
||||||
@@ -2343,8 +2343,11 @@ out_done:
|
|||||||
* aborted, > 0 if there is an event and command should be immediately
|
* aborted, > 0 if there is an event and command should be immediately
|
||||||
* completed, or 0 otherwise.
|
* completed, or 0 otherwise.
|
||||||
*
|
*
|
||||||
* !! Dev handlers implementing exec() callback must call this function there
|
* !! 1.Dev handlers implementing exec() callback must call this function there
|
||||||
* !! just before the actual command's execution!
|
* !! just before the actual command's execution!
|
||||||
|
* !!
|
||||||
|
* !! 2. If this function can be called more than once on the processing path
|
||||||
|
* !! scst_pre_check_local_events() should be used for the first call!
|
||||||
*
|
*
|
||||||
* On call no locks, no IRQ or IRQ-disabled context allowed.
|
* On call no locks, no IRQ or IRQ-disabled context allowed.
|
||||||
*/
|
*/
|
||||||
@@ -2373,14 +2376,16 @@ int scst_check_local_events(struct scst_cmd *cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->pr_is_set) {
|
if (likely(!cmd->check_local_events_once_done)) {
|
||||||
if (unlikely(!scst_pr_is_cmd_allowed(cmd))) {
|
if (dev->pr_is_set) {
|
||||||
scst_set_cmd_error_status(cmd,
|
if (unlikely(!scst_pr_is_cmd_allowed(cmd))) {
|
||||||
SAM_STAT_RESERVATION_CONFLICT);
|
scst_set_cmd_error_status(cmd,
|
||||||
goto out_complete;
|
SAM_STAT_RESERVATION_CONFLICT);
|
||||||
}
|
goto out_complete;
|
||||||
} else
|
}
|
||||||
scst_dec_pr_readers_count(cmd, false);
|
} else
|
||||||
|
scst_dec_pr_readers_count(cmd, false);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Let's check for ABORTED after scst_pr_is_cmd_allowed(), because
|
* Let's check for ABORTED after scst_pr_is_cmd_allowed(), because
|
||||||
@@ -2946,7 +2951,7 @@ static int scst_check_sense(struct scst_cmd *cmd)
|
|||||||
|
|
||||||
cmd->state = SCST_CMD_STATE_REAL_EXEC;
|
cmd->state = SCST_CMD_STATE_REAL_EXEC;
|
||||||
cmd->retry = 1;
|
cmd->retry = 1;
|
||||||
scst_inc_pr_readers_count(cmd, false);
|
scst_reset_requeued_cmd(cmd);
|
||||||
res = 1;
|
res = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user