|
From: <bva...@us...> - 2015-11-03 16:52:03
|
Revision: 6571
http://sourceforge.net/p/scst/svn/6571
Author: bvassche
Date: 2015-11-03 16:52:00 +0000 (Tue, 03 Nov 2015)
Log Message:
-----------
scst_targ: Report unsupported SELECT REPORT values with 0x prefix
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2015-11-03 05:25:32 UTC (rev 6570)
+++ trunk/scst/src/scst_targ.c 2015-11-03 16:52:00 UTC (rev 6571)
@@ -1887,7 +1887,7 @@
cmd->driver_status = 0;
if ((cmd->cdb[2] != 0) && (cmd->cdb[2] != 2)) {
- TRACE(TRACE_MINOR, "Unsupported SELECT REPORT value %x in "
+ TRACE(TRACE_MINOR, "Unsupported SELECT REPORT value %#x in "
"REPORT LUNS command", cmd->cdb[2]);
scst_set_invalid_field_in_cdb(cmd, 2, 0);
goto out_compl;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2015-11-06 03:49:16
|
Revision: 6582
http://sourceforge.net/p/scst/svn/6582
Author: vlnb
Date: 2015-11-06 03:49:14 +0000 (Fri, 06 Nov 2015)
Log Message:
-----------
Various SCST events producers
Prepared with help from Prasidh Srikanth <Pra...@sa...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2015-11-06 03:48:24 UTC (rev 6581)
+++ trunk/scst/src/scst_targ.c 2015-11-06 03:49:14 UTC (rev 6582)
@@ -4492,6 +4492,7 @@
"unexisting LU (initiator %s, target %s)?",
(unsigned long long int)cmd->lun,
cmd->sess->initiator_name, cmd->tgt->tgt_name);
+ scst_event_queue_lun_not_found(cmd);
}
scst_put(cmd->cpu_cmd_counter);
}
@@ -5966,6 +5967,8 @@
}
out:
+ scst_event_queue_tm_fn_received(mcmd);
+
TRACE_EXIT_RES(res);
return res;
}
@@ -7101,6 +7104,9 @@
res = !list_empty(&acg->acg_dev_list);
+ if (!res)
+ scst_event_queue_negative_luns_inquiry(tgt, initiator_name);
+
mutex_unlock(&scst_mutex);
TRACE_EXIT_RES(res);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2016-05-06 03:51:23
|
Revision: 6888
http://sourceforge.net/p/scst/svn/6888
Author: vlnb
Date: 2016-05-06 03:51:21 +0000 (Fri, 06 May 2016)
Log Message:
-----------
scst: follow up to r6886
Change local and more global queue priority ratio to 2:1
Revision Links:
--------------
http://sourceforge.net/p/scst/svn/6886
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2016-05-06 02:20:41 UTC (rev 6887)
+++ trunk/scst/src/scst_targ.c 2016-05-06 03:51:21 UTC (rev 6888)
@@ -5604,7 +5604,7 @@
someth_done = true;
- if (++thr_cnt == 3)
+ if (++thr_cnt == 2)
break;
else {
spin_lock_irq(&thr->thr_cmd_list_lock);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2016-06-30 04:05:17
|
Revision: 6905
http://sourceforge.net/p/scst/svn/6905
Author: vlnb
Date: 2016-06-30 04:05:14 +0000 (Thu, 30 Jun 2016)
Log Message:
-----------
scst: fix possible error path crash in debug mode
It could happen, if a non-pass-through dev handler erroneously returned
SCST_EXEC_NOT_COMPLETED and TRAGE_DBG() statements enabled in debug mode.
Reported-by: Jeff Goldszer <jef...@al...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2016-06-25 00:56:09 UTC (rev 6904)
+++ trunk/scst/src/scst_targ.c 2016-06-30 04:05:14 UTC (rev 6905)
@@ -3464,10 +3464,6 @@
scsi_dev = dev->scsi_dev;
- TRACE_DBG("Sending cmd %p to SCSI mid-level dev %d:%d:%d:%lld", cmd,
- scsi_dev->host->host_no, scsi_dev->channel, scsi_dev->id,
- (u64)scsi_dev->lun);
-
if (unlikely(scsi_dev == NULL)) {
PRINT_ERROR("Command for virtual device must be "
"processed by device handler (LUN %lld)!",
@@ -3475,6 +3471,10 @@
goto out_error;
}
+ TRACE_DBG("Sending cmd %p to SCSI mid-level dev %d:%d:%d:%lld", cmd,
+ scsi_dev->host->host_no, scsi_dev->channel, scsi_dev->id,
+ (u64)scsi_dev->lun);
+
scst_set_exec_start(cmd);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2017-05-20 03:00:31
|
Revision: 7190
http://sourceforge.net/p/scst/svn/7190
Author: vlnb
Date: 2017-05-20 03:00:28 +0000 (Sat, 20 May 2017)
Log Message:
-----------
scst: fix possible NULL dereference in TM code
TM command accessing a non-existing LUN might lead NULL dereference in
scst_call_dev_task_mgmt_fn_done().
Reported-By: <Ilan Steinberg <ila...@ka...>>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2017-05-20 02:04:16 UTC (rev 7189)
+++ trunk/scst/src/scst_targ.c 2017-05-20 03:00:28 UTC (rev 7190)
@@ -7393,7 +7393,8 @@
case SCST_CLEAR_TASK_SET:
case SCST_PR_ABORT_ALL:
case SCST_LUN_RESET:
- scst_call_dev_task_mgmt_fn_done(mcmd, mcmd->mcmd_tgt_dev);
+ if (mcmd->mcmd_tgt_dev != NULL)
+ scst_call_dev_task_mgmt_fn_done(mcmd, mcmd->mcmd_tgt_dev);
break;
case SCST_TARGET_RESET:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2017-11-13 16:47:46
|
Revision: 7265
http://sourceforge.net/p/scst/svn/7265
Author: bvassche
Date: 2017-11-13 16:47:43 +0000 (Mon, 13 Nov 2017)
Log Message:
-----------
scst/src/scst_targ: Use READ_ONCE() instead of ACCESS_ONCE()
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2017-11-13 16:47:10 UTC (rev 7264)
+++ trunk/scst/src/scst_targ.c 2017-11-13 16:47:43 UTC (rev 7265)
@@ -3836,8 +3836,8 @@
/* dev->qerr can be changed behind our back */
q = cmd->dev->qerr;
- /* ACCESS_ONCE doesn't work for bit fields */
- qerr = ACCESS_ONCE(q);
+ /* READ_ONCE doesn't work for bit fields */
+ qerr = READ_ONCE(q);
switch (qerr) {
case SCST_QERR_2_RESERVED:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2017-12-30 03:36:41
|
Revision: 7308
http://sourceforge.net/p/scst/svn/7308
Author: bvassche
Date: 2017-12-30 03:36:39 +0000 (Sat, 30 Dec 2017)
Log Message:
-----------
scst: Fix source code indentation
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2017-12-30 02:25:54 UTC (rev 7307)
+++ trunk/scst/src/scst_targ.c 2017-12-30 03:36:39 UTC (rev 7308)
@@ -1346,7 +1346,7 @@
if (cmd->data_direction & SCST_DATA_READ)
cmd->resp_data_len = cmd->bufflen;
else
- cmd->resp_data_len = 0;
+ cmd->resp_data_len = 0;
}
#ifndef CONFIG_SCST_TEST_IO_IN_SIRQ
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2018-01-20 16:57:54
|
Revision: 7342
http://sourceforge.net/p/scst/svn/7342
Author: bvassche
Date: 2018-01-20 16:57:52 +0000 (Sat, 20 Jan 2018)
Log Message:
-----------
scst: Fix spelling in a source code comment
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2018-01-20 05:04:50 UTC (rev 7341)
+++ trunk/scst/src/scst_targ.c 2018-01-20 16:57:52 UTC (rev 7342)
@@ -8367,7 +8367,7 @@
* Description:
* Registers new MQ session. Returns new session on success or NULL otherwise.
*
- * MQ session is asession, which is part of a set of sessions from the same
+ * MQ session is a session, which is part of a set of sessions from the same
* initiator, for instance, one session per CPU. The only difference with
* non-MQ sessions is that reservations are not supported on MQ-sessions
* (because there is no way to group sessions together from reservations POV)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2018-02-04 23:06:00
|
Revision: 7356
http://sourceforge.net/p/scst/svn/7356
Author: bvassche
Date: 2018-02-04 23:05:58 +0000 (Sun, 04 Feb 2018)
Log Message:
-----------
scst: Document scst_register_session_mq() arguments
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2018-02-04 17:55:38 UTC (rev 7355)
+++ trunk/scst/src/scst_targ.c 2018-02-04 23:05:58 UTC (rev 7356)
@@ -8363,6 +8363,22 @@
/**
* scst_register_session_mq() - register multi-queue session
+ * @tgt: target
+ * @atomic: True if called from atomic context. If false,
+ * this function will block until the session registration is
+ * completed.
+ * @initiator_name: Remote initiator name, NULL-terminated, e.g. the iSCSI
+ * initiator name. Used as key when looking up access control
+ * group information. If NULL then the default target's LUNs are
+ * used.
+ * @tgt_priv: Pointer to the private data of the target driver.
+ * @result_fn_data: Any target driver supplied data.
+ * @result_fn: Pointer to a function that will be asynchronously when session
+ * initialization has finished. Can be NULL. Parameters:
+ * - sess - session.
+ * - data - @result_fn_data.
+ * - result - session initialization result, 0 on success or
+ * appropriate error code otherwise.
*
* Description:
* Registers new MQ session. Returns new session on success or NULL otherwise.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2018-07-11 16:50:43
|
Revision: 7417
http://sourceforge.net/p/scst/svn/7417
Author: bvassche
Date: 2018-07-11 16:50:41 +0000 (Wed, 11 Jul 2018)
Log Message:
-----------
scst_targ: Port to Linux kernel v4.18
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2018-07-11 16:48:22 UTC (rev 7416)
+++ trunk/scst/src/scst_targ.c 2018-07-11 16:50:41 UTC (rev 7417)
@@ -5822,17 +5822,9 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
if (scst_poll_ns > 0) {
- struct timespec ts;
ktime_t end, kt;
- int rc;
- rc = __getnstimeofday(&ts);
- if (unlikely(rc != 0)) {
- WARN_ON_ONCE(rc);
- goto go;
- }
-
- end = timespec_to_ktime(ts);
+ end = ktime_get();
end = ktime_add_ns(end, scst_poll_ns);
do {
@@ -5843,16 +5835,9 @@
goto again;
}
cpu_relax();
- rc = __getnstimeofday(&ts);
- if (unlikely(rc != 0)) {
- WARN_ON_ONCE(rc);
- goto go;
- }
- kt = timespec_to_ktime(ts);
+ kt = ktime_get();
} while (ktime_before(kt, end));
}
-
-go:
#endif
spin_lock_irq(&p_cmd_threads->cmd_list_lock);
spin_lock(&thr->thr_cmd_list_lock);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2019-02-12 03:40:51
|
Revision: 7923
http://sourceforge.net/p/scst/svn/7923
Author: bvassche
Date: 2019-02-12 03:40:48 +0000 (Tue, 12 Feb 2019)
Log Message:
-----------
scst: Introduce scst_handle_aca()
Move the ACA code out of __scst_init_cmd() to make __scst_init_cmd()
easier to read. This patch does not change any functionality.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2019-02-12 03:16:12 UTC (rev 7922)
+++ trunk/scst/src/scst_targ.c 2019-02-12 03:40:48 UTC (rev 7923)
@@ -5036,6 +5036,89 @@
return res;
}
+static void scst_handle_aca(struct scst_cmd *cmd)
+{
+ struct scst_order_data *order_data = cmd->cur_order_data;
+ unsigned long flags;
+
+again:
+ if (unlikely(order_data->aca_tgt_dev != 0)) {
+ spin_lock_irqsave(&order_data->sn_lock, flags);
+ if (order_data->aca_tgt_dev == 0) {
+ spin_unlock_irqrestore(&order_data->sn_lock, flags);
+ goto again;
+ }
+
+ if (order_data->aca_tgt_dev == (unsigned long)cmd->tgt_dev) {
+ if (cmd->queue_type != SCST_CMD_QUEUE_ACA ||
+ order_data->aca_cmd || cmd->dev->tmf_only) {
+ TRACE_DBG("Refusing cmd %p, because ACA active (aca_cmd %p, tgt_dev %p)",
+ cmd, order_data->aca_cmd,
+ cmd->tgt_dev);
+ goto out_unlock_aca_active;
+ } else {
+ TRACE_MGMT_DBG("ACA cmd %p (tgt_dev %p)",
+ cmd, cmd->tgt_dev);
+ order_data->aca_cmd = cmd;
+ /* allow it */
+ }
+ } else {
+ /* Non-faulted I_T nexus */
+ EXTRACHECKS_BUG_ON(cmd->dev->tst !=
+ SCST_TST_0_SINGLE_TASK_SET);
+ if (cmd->queue_type == SCST_CMD_QUEUE_ACA) {
+ TRACE_MGMT_DBG("Refusing ACA cmd %p from wrong I_T nexus (aca_tgt_dev %ld, cmd->tgt_dev %p)",
+ cmd, order_data->aca_tgt_dev,
+ cmd->tgt_dev);
+ scst_set_cmd_error(cmd,
+ SCST_LOAD_SENSE(scst_sense_invalid_message));
+ goto out_unlock_aca_active;
+ } else {
+ if (cmd->cdb[0] == PERSISTENT_RESERVE_OUT &&
+ (cmd->cdb[1] & 0x1f) ==
+ PR_PREEMPT_AND_ABORT) {
+ TRACE_MGMT_DBG("Allow PR PREEMPT AND ABORT cmd %p during ACA (tgt_dev %p)",
+ cmd, cmd->tgt_dev);
+ /* allow it */
+ } else {
+ TRACE_DBG("Refusing other IT-nexus cmd %p, because ACA active (tgt_dev %p)",
+ cmd, cmd->tgt_dev);
+ if (cmd->cmd_naca)
+ goto out_unlock_aca_active;
+ else {
+ spin_unlock_irqrestore(&order_data->sn_lock, flags);
+ scst_set_cmd_error_status(cmd, SAM_STAT_BUSY);
+ goto out_bypass_aca;
+ }
+ }
+ }
+ }
+
+ cmd->cmd_aca_allowed = 1;
+
+ spin_unlock_irqrestore(&order_data->sn_lock, flags);
+ } else if (unlikely(cmd->queue_type == SCST_CMD_QUEUE_ACA)) {
+ TRACE_MGMT_DBG("Refusing ACA cmd %p, because there's no ACA, tgt_dev %p",
+ cmd, cmd->tgt_dev);
+ scst_set_cmd_error(cmd,
+ SCST_LOAD_SENSE(scst_sense_invalid_message));
+ goto out_abnormal;
+ }
+
+ return;
+
+out_unlock_aca_active:
+ spin_unlock_irqrestore(&order_data->sn_lock, flags);
+ scst_set_cmd_error_status(cmd, SAM_STAT_ACA_ACTIVE);
+
+out_bypass_aca:
+ cmd->cmd_aca_allowed = 1; /* for check in scst_pre_xmit_response2() */
+
+out_abnormal:
+ scst_set_cmd_abnormal_done_state(cmd);
+ return;
+}
+
/*
* No locks, but might be on IRQ.
*
@@ -5045,8 +5128,6 @@
static int __scst_init_cmd(struct scst_cmd *cmd)
{
int res = 0;
- unsigned long flags;
- struct scst_order_data *order_data;
TRACE_ENTRY();
@@ -5055,8 +5136,6 @@
int cnt;
bool failure = false;
- order_data = cmd->cur_order_data;
-
scst_set_cmd_state(cmd, SCST_CMD_STATE_PARSE);
cnt = atomic_inc_return(&cmd->tgt_dev->tgt_dev_cmd_count);
@@ -5102,74 +5181,10 @@
* queue_type to change it if needed. ToDo.
*/
scst_pre_parse(cmd);
-again:
- if (unlikely(order_data->aca_tgt_dev != 0)) {
- spin_lock_irqsave(&order_data->sn_lock, flags);
+ scst_handle_aca(cmd);
+ if (cmd->completed)
+ goto out;
- if (order_data->aca_tgt_dev == 0) {
- spin_unlock_irqrestore(&order_data->sn_lock, flags);
- goto again;
- }
-
- if (order_data->aca_tgt_dev == (unsigned long)cmd->tgt_dev) {
- if ((cmd->queue_type != SCST_CMD_QUEUE_ACA) ||
- (order_data->aca_cmd != NULL) ||
- cmd->dev->tmf_only) {
- TRACE_DBG("Refusing cmd %p, because ACA "
- "active (aca_cmd %p, tgt_dev %p)",
- cmd, order_data->aca_cmd,
- cmd->tgt_dev);
- goto out_unlock_aca_active;
- } else {
- TRACE_MGMT_DBG("ACA cmd %p (tgt_dev %p)",
- cmd, cmd->tgt_dev);
- order_data->aca_cmd = cmd;
- /* allow it */
- }
- } else {
- /* Non-faulted I_T nexus */
- EXTRACHECKS_BUG_ON(cmd->dev->tst != SCST_TST_0_SINGLE_TASK_SET);
- if (cmd->queue_type == SCST_CMD_QUEUE_ACA) {
- TRACE_MGMT_DBG("Refusing ACA cmd %p "
- "from wrong I_T nexus (aca_tgt_dev %ld, "
- "cmd->tgt_dev %p)", cmd,
- order_data->aca_tgt_dev, cmd->tgt_dev);
- scst_set_cmd_error(cmd,
- SCST_LOAD_SENSE(scst_sense_invalid_message));
- goto out_unlock_aca_active;
- } else {
- if ((cmd->cdb[0] == PERSISTENT_RESERVE_OUT) &&
- ((cmd->cdb[1] & 0x1f) == PR_PREEMPT_AND_ABORT)) {
- TRACE_MGMT_DBG("Allow PR PREEMPT AND "
- "ABORT cmd %p during ACA "
- "(tgt_dev %p)", cmd, cmd->tgt_dev);
- /* allow it */
- } else {
- TRACE_DBG("Refusing other IT-nexus "
- "cmd %p, because ACA active "
- "(tgt_dev %p)", cmd, cmd->tgt_dev);
- if (cmd->cmd_naca)
- goto out_unlock_aca_active;
- else {
- spin_unlock_irqrestore(&order_data->sn_lock, flags);
- scst_set_cmd_error_status(cmd, SAM_STAT_BUSY);
- goto out_bypass_aca;
- }
- }
- }
- }
-
- cmd->cmd_aca_allowed = 1;
-
- spin_unlock_irqrestore(&order_data->sn_lock, flags);
- } else if (unlikely(cmd->queue_type == SCST_CMD_QUEUE_ACA)) {
- TRACE_MGMT_DBG("Refusing ACA cmd %p, because there's no ACA, "
- "tgt_dev %p", cmd, cmd->tgt_dev);
- scst_set_cmd_error(cmd,
- SCST_LOAD_SENSE(scst_sense_invalid_message));
- goto out_abnormal;
- }
-
if (!cmd->set_sn_on_restart_cmd) {
if (!cmd->tgtt->multithreaded_init_done)
scst_cmd_set_sn(cmd);
@@ -5194,18 +5209,11 @@
out_busy_bypass_aca:
scst_set_busy(cmd);
-
-out_bypass_aca:
cmd->cmd_aca_allowed = 1; /* for check in scst_pre_xmit_response2() */
out_abnormal:
scst_set_cmd_abnormal_done_state(cmd);
goto out;
-
-out_unlock_aca_active:
- spin_unlock_irqrestore(&order_data->sn_lock, flags);
- scst_set_cmd_error_status(cmd, SAM_STAT_ACA_ACTIVE);
- goto out_bypass_aca;
}
/* Called under scst_init_lock and IRQs disabled */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2019-02-12 03:41:19
|
Revision: 7924
http://sourceforge.net/p/scst/svn/7924
Author: bvassche
Date: 2019-02-12 03:41:16 +0000 (Tue, 12 Feb 2019)
Log Message:
-----------
scst: Rework scst_handle_aca()
Make sure that the code that is in the hot path occurs first.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2019-02-12 03:40:48 UTC (rev 7923)
+++ trunk/scst/src/scst_targ.c 2019-02-12 03:41:16 UTC (rev 7924)
@@ -5042,68 +5042,69 @@
unsigned long flags;
again:
- if (unlikely(order_data->aca_tgt_dev != 0)) {
- spin_lock_irqsave(&order_data->sn_lock, flags);
- if (order_data->aca_tgt_dev == 0) {
- spin_unlock_irqrestore(&order_data->sn_lock, flags);
- goto again;
+ if (likely(!order_data->aca_tgt_dev)) {
+ if (unlikely(cmd->queue_type == SCST_CMD_QUEUE_ACA)) {
+ TRACE_MGMT_DBG("Refusing ACA cmd %p, because there's no ACA, tgt_dev %p",
+ cmd, cmd->tgt_dev);
+ scst_set_cmd_error(cmd,
+ SCST_LOAD_SENSE(scst_sense_invalid_message));
+ scst_set_cmd_abnormal_done_state(cmd);
}
+ return;
+ }
- if (order_data->aca_tgt_dev == (unsigned long)cmd->tgt_dev) {
- if (cmd->queue_type != SCST_CMD_QUEUE_ACA ||
- order_data->aca_cmd || cmd->dev->tmf_only) {
- TRACE_DBG("Refusing cmd %p, because ACA active (aca_cmd %p, tgt_dev %p)",
- cmd, order_data->aca_cmd,
- cmd->tgt_dev);
- goto out_unlock_aca_active;
- } else {
- TRACE_MGMT_DBG("ACA cmd %p (tgt_dev %p)",
+ spin_lock_irqsave(&order_data->sn_lock, flags);
+ if (!order_data->aca_tgt_dev) {
+ spin_unlock_irqrestore(&order_data->sn_lock, flags);
+ goto again;
+ }
+
+ if (order_data->aca_tgt_dev == (unsigned long)cmd->tgt_dev) {
+ if (cmd->queue_type != SCST_CMD_QUEUE_ACA ||
+ order_data->aca_cmd || cmd->dev->tmf_only) {
+ TRACE_DBG("Refusing cmd %p, because ACA active (aca_cmd %p, tgt_dev %p)",
+ cmd, order_data->aca_cmd,
+ cmd->tgt_dev);
+ goto out_unlock_aca_active;
+ } else {
+ TRACE_MGMT_DBG("ACA cmd %p (tgt_dev %p)",
+ cmd, cmd->tgt_dev);
+ order_data->aca_cmd = cmd;
+ /* allow it */
+ }
+ } else {
+ /* Non-faulted I_T nexus */
+ EXTRACHECKS_BUG_ON(cmd->dev->tst != SCST_TST_0_SINGLE_TASK_SET);
+ if (cmd->queue_type == SCST_CMD_QUEUE_ACA) {
+ TRACE_MGMT_DBG("Refusing ACA cmd %p from wrong I_T nexus (aca_tgt_dev %ld, cmd->tgt_dev %p)",
+ cmd, order_data->aca_tgt_dev,
+ cmd->tgt_dev);
+ scst_set_cmd_error(cmd,
+ SCST_LOAD_SENSE(scst_sense_invalid_message));
+ goto out_unlock_aca_active;
+ } else {
+ if (cmd->cdb[0] == PERSISTENT_RESERVE_OUT &&
+ (cmd->cdb[1] & 0x1f) == PR_PREEMPT_AND_ABORT) {
+ TRACE_MGMT_DBG("Allow PR PREEMPT AND ABORT cmd %p during ACA (tgt_dev %p)",
cmd, cmd->tgt_dev);
- order_data->aca_cmd = cmd;
/* allow it */
- }
- } else {
- /* Non-faulted I_T nexus */
- EXTRACHECKS_BUG_ON(cmd->dev->tst !=
- SCST_TST_0_SINGLE_TASK_SET);
- if (cmd->queue_type == SCST_CMD_QUEUE_ACA) {
- TRACE_MGMT_DBG("Refusing ACA cmd %p from wrong I_T nexus (aca_tgt_dev %ld, cmd->tgt_dev %p)",
- cmd, order_data->aca_tgt_dev,
- cmd->tgt_dev);
- scst_set_cmd_error(cmd,
- SCST_LOAD_SENSE(scst_sense_invalid_message));
- goto out_unlock_aca_active;
} else {
- if (cmd->cdb[0] == PERSISTENT_RESERVE_OUT &&
- (cmd->cdb[1] & 0x1f) ==
- PR_PREEMPT_AND_ABORT) {
- TRACE_MGMT_DBG("Allow PR PREEMPT AND ABORT cmd %p during ACA (tgt_dev %p)",
- cmd, cmd->tgt_dev);
- /* allow it */
+ TRACE_DBG("Refusing other IT-nexus cmd %p, because ACA active (tgt_dev %p)",
+ cmd, cmd->tgt_dev);
+ if (cmd->cmd_naca) {
+ goto out_unlock_aca_active;
} else {
- TRACE_DBG("Refusing other IT-nexus cmd %p, because ACA active (tgt_dev %p)",
- cmd, cmd->tgt_dev);
- if (cmd->cmd_naca)
- goto out_unlock_aca_active;
- else {
- spin_unlock_irqrestore(&order_data->sn_lock, flags);
- scst_set_cmd_error_status(cmd, SAM_STAT_BUSY);
- goto out_bypass_aca;
- }
+ spin_unlock_irqrestore(&order_data->sn_lock, flags);
+ scst_set_cmd_error_status(cmd, SAM_STAT_BUSY);
+ goto out_bypass_aca;
}
}
}
+ }
- cmd->cmd_aca_allowed = 1;
+ cmd->cmd_aca_allowed = 1;
- spin_unlock_irqrestore(&order_data->sn_lock, flags);
- } else if (unlikely(cmd->queue_type == SCST_CMD_QUEUE_ACA)) {
- TRACE_MGMT_DBG("Refusing ACA cmd %p, because there's no ACA, tgt_dev %p",
- cmd, cmd->tgt_dev);
- scst_set_cmd_error(cmd,
- SCST_LOAD_SENSE(scst_sense_invalid_message));
- goto out_abnormal;
- }
+ spin_unlock_irqrestore(&order_data->sn_lock, flags);
return;
@@ -5113,8 +5114,6 @@
out_bypass_aca:
cmd->cmd_aca_allowed = 1; /* for check in scst_pre_xmit_response2() */
-
-out_abnormal:
scst_set_cmd_abnormal_done_state(cmd);
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2019-03-08 03:06:39
|
Revision: 8017
http://sourceforge.net/p/scst/svn/8017
Author: bvassche
Date: 2019-03-08 03:06:36 +0000 (Fri, 08 Mar 2019)
Log Message:
-----------
scst: Introduce two local variables
This patch does not change any functionality.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2019-03-08 03:01:27 UTC (rev 8016)
+++ trunk/scst/src/scst_targ.c 2019-03-08 03:06:36 UTC (rev 8017)
@@ -5132,13 +5132,15 @@
res = scst_translate_lun(cmd);
if (likely(res == 0)) {
+ struct scst_tgt_dev *tgt_dev = cmd->tgt_dev;
+ struct scst_device *dev = cmd->dev;
+ bool failure = false;
int cnt;
- bool failure = false;
scst_set_cmd_state(cmd, SCST_CMD_STATE_PARSE);
- cnt = atomic_inc_return(&cmd->tgt_dev->tgt_dev_cmd_count);
- if (unlikely(cnt > cmd->dev->max_tgt_dev_commands)) {
+ cnt = atomic_inc_return(&tgt_dev->tgt_dev_cmd_count);
+ if (unlikely(cnt > dev->max_tgt_dev_commands)) {
TRACE(TRACE_FLOW_CONTROL,
"Too many pending commands (%d) in "
"session, returning BUSY to initiator \"%s\"",
@@ -5148,7 +5150,7 @@
}
#ifdef CONFIG_SCST_PER_DEVICE_CMD_COUNT_LIMIT
- cnt = atomic_inc_return(&cmd->dev->dev_cmd_count);
+ cnt = atomic_inc_return(&dev->dev_cmd_count);
if (unlikely(cnt > SCST_MAX_DEV_COMMANDS)) {
if (!failure) {
TRACE(TRACE_FLOW_CONTROL,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2019-06-16 20:53:42
|
Revision: 8425
http://sourceforge.net/p/scst/svn/8425
Author: bvassche
Date: 2019-06-16 20:53:37 +0000 (Sun, 16 Jun 2019)
Log Message:
-----------
scst: Introduce scst_reset_scsi_target() and scst_reset_scsi_device()
This patch does not change any functionality.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2019-06-15 14:11:27 UTC (rev 8424)
+++ trunk/scst/src/scst_targ.c 2019-06-16 20:53:37 UTC (rev 8425)
@@ -6771,6 +6771,30 @@
return res;
}
+static int scst_reset_scsi_target(struct scsi_device *sdev)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+ int arg = SG_SCSI_RESET_TARGET;
+
+ return scsi_ioctl_reset(sdev, (__force __user int *)&arg);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+ return scsi_reset_provider(sdev, SCSI_TRY_RESET_TARGET);
+#else
+ return scsi_reset_provider(sdev, SCSI_TRY_RESET_BUS);
+#endif
+}
+
+static int scst_reset_scsi_device(struct scsi_device *sdev)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+ int arg = SG_SCSI_RESET_DEVICE;
+
+ return scsi_ioctl_reset(sdev, (__force __user int *)&arg);
+#else
+ return scsi_reset_provider(sdev, SCSI_TRY_RESET_DEVICE);
+#endif
+}
+
/* Returns 0 if the command processing should be continued, <0 otherwise */
static int scst_target_reset(struct scst_mgmt_cmd *mcmd)
{
@@ -6837,18 +6861,7 @@
/* dev->scsi_dev must be non-NULL here */
TRACE(TRACE_MGMT, "Resetting host %d bus ",
dev->scsi_dev->host->host_no);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
- {
- int arg = SG_SCSI_RESET_TARGET;
-
- rc = scsi_ioctl_reset(dev->scsi_dev,
- (__force __user int *)&arg);
- }
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
- rc = scsi_reset_provider(dev->scsi_dev, SCSI_TRY_RESET_TARGET);
-#else
- rc = scsi_reset_provider(dev->scsi_dev, SCSI_TRY_RESET_BUS);
-#endif
+ rc = scst_reset_scsi_target(dev->scsi_dev);
TRACE(TRACE_MGMT, "Result of host %d target reset: %s",
dev->scsi_dev->host->host_no,
(rc == SUCCESS) ? "SUCCESS" : "FAILED");
@@ -6908,16 +6921,7 @@
if (dev->scsi_dev != NULL) {
TRACE(TRACE_MGMT, "Resetting host %d bus ",
dev->scsi_dev->host->host_no);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
- {
- int arg = SG_SCSI_RESET_DEVICE;
-
- rc = scsi_ioctl_reset(dev->scsi_dev,
- (__force __user int *)&arg);
- }
-#else
- rc = scsi_reset_provider(dev->scsi_dev, SCSI_TRY_RESET_DEVICE);
-#endif
+ rc = scst_reset_scsi_device(dev->scsi_dev);
TRACE(TRACE_MGMT, "scsi_reset_provider(%s) returned %d",
dev->virt_name, rc);
#if 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2019-06-16 21:07:25
|
Revision: 8426
http://sourceforge.net/p/scst/svn/8426
Author: bvassche
Date: 2019-06-16 21:07:17 +0000 (Sun, 16 Jun 2019)
Log Message:
-----------
scst: Fix build against Linux kernel v5.2
Reported-by: Sebastian Herbszt <he...@gm...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2019-06-16 20:53:37 UTC (rev 8425)
+++ trunk/scst/src/scst_targ.c 2019-06-16 21:07:17 UTC (rev 8426)
@@ -6773,7 +6773,11 @@
static int scst_reset_scsi_target(struct scsi_device *sdev)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0)
+ /* To do: implement this functionality. */
+ WARN_ON_ONCE(true);
+ return FAILED;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
int arg = SG_SCSI_RESET_TARGET;
return scsi_ioctl_reset(sdev, (__force __user int *)&arg);
@@ -6786,7 +6790,11 @@
static int scst_reset_scsi_device(struct scsi_device *sdev)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0)
+ /* To do: implement this functionality. */
+ WARN_ON_ONCE(true);
+ return FAILED;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
int arg = SG_SCSI_RESET_DEVICE;
return scsi_ioctl_reset(sdev, (__force __user int *)&arg);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2019-07-23 21:06:07
|
Revision: 8472
http://sourceforge.net/p/scst/svn/8472
Author: bvassche
Date: 2019-07-23 21:06:03 +0000 (Tue, 23 Jul 2019)
Log Message:
-----------
scst: Fix __scst_init_cmd()
Fixes: 5b0f9ef0b935 ("scst: Increase tgt_dev_cmd_count by one") / r8465.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2019-07-23 19:18:38 UTC (rev 8471)
+++ trunk/scst/src/scst_targ.c 2019-07-23 21:06:03 UTC (rev 8472)
@@ -5142,7 +5142,7 @@
scst_set_cmd_state(cmd, SCST_CMD_STATE_PARSE);
- cnt = atomic_inc_return(&tgt_dev->tgt_dev_cmd_count);
+ cnt = atomic_inc_return(&tgt_dev->tgt_dev_cmd_count) - 1;
if (unlikely(cnt > dev->max_tgt_dev_commands)) {
TRACE(TRACE_FLOW_CONTROL,
"Too many pending commands (%d) in "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2019-08-05 01:43:43
|
Revision: 8496
http://sourceforge.net/p/scst/svn/8496
Author: bvassche
Date: 2019-08-05 01:43:41 +0000 (Mon, 05 Aug 2019)
Log Message:
-----------
scst: Fix a race condition between LUN translation and LUN removal
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2019-08-05 01:43:03 UTC (rev 8495)
+++ trunk/scst/src/scst_targ.c 2019-08-05 01:43:41 UTC (rev 8496)
@@ -4996,6 +4996,9 @@
rcu_read_lock();
tgt_dev = scst_lookup_tgt_dev(cmd->sess, cmd->lun);
+ if (tgt_dev &&
+ !atomic_inc_not_zero(&tgt_dev->tgt_dev_cmd_count))
+ tgt_dev = NULL;
rcu_read_unlock();
if (tgt_dev) {
@@ -5014,6 +5017,7 @@
"the device will not be visible remotely",
(unsigned long long)cmd->lun);
nul_dev = true;
+ scst_tgt_dev_dec_cmd_count(tgt_dev);
}
}
if (unlikely(res != 0)) {
@@ -5142,7 +5146,7 @@
scst_set_cmd_state(cmd, SCST_CMD_STATE_PARSE);
- cnt = atomic_inc_return(&tgt_dev->tgt_dev_cmd_count) - 1;
+ cnt = atomic_read(&tgt_dev->tgt_dev_cmd_count) - 1;
if (unlikely(cnt > dev->max_tgt_dev_commands)) {
TRACE(TRACE_FLOW_CONTROL,
"Too many pending commands (%d) in "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2020-03-20 17:25:40
|
Revision: 8842
http://sourceforge.net/p/scst/svn/8842
Author: bvassche
Date: 2020-03-20 17:25:38 +0000 (Fri, 20 Mar 2020)
Log Message:
-----------
scst_targ: Sort scst_local_fns[] alphabetically
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2020-03-20 17:25:16 UTC (rev 8841)
+++ trunk/scst/src/scst_targ.c 2020-03-20 17:25:38 UTC (rev 8842)
@@ -2696,19 +2696,19 @@
typedef enum scst_exec_res (*scst_local_exec_fn)(struct scst_cmd *cmd);
static scst_local_exec_fn scst_local_fns[256] = {
- [RESERVE] = scst_reserve_local,
- [RESERVE_10] = scst_reserve_local,
- [RELEASE] = scst_release_local,
- [RELEASE_10] = scst_release_local,
- [PERSISTENT_RESERVE_IN] = scst_persistent_reserve_in_local,
- [PERSISTENT_RESERVE_OUT] = scst_persistent_reserve_out_local,
- [REPORT_LUNS] = scst_report_luns_local,
- [REQUEST_SENSE] = scst_request_sense_local,
- [COMPARE_AND_WRITE] = scst_cmp_wr_local,
- [EXTENDED_COPY] = scst_cm_ext_copy_exec,
- [RECEIVE_COPY_RESULTS] = scst_cm_rcv_copy_res_exec,
- [MAINTENANCE_IN] = scst_maintenance_in,
- [MAINTENANCE_OUT] = scst_maintenance_out,
+ [COMPARE_AND_WRITE] = scst_cmp_wr_local,
+ [EXTENDED_COPY] = scst_cm_ext_copy_exec,
+ [MAINTENANCE_IN] = scst_maintenance_in,
+ [MAINTENANCE_OUT] = scst_maintenance_out,
+ [PERSISTENT_RESERVE_IN] = scst_persistent_reserve_in_local,
+ [PERSISTENT_RESERVE_OUT]= scst_persistent_reserve_out_local,
+ [RECEIVE_COPY_RESULTS] = scst_cm_rcv_copy_res_exec,
+ [RELEASE] = scst_release_local,
+ [RELEASE_10] = scst_release_local,
+ [REPORT_LUNS] = scst_report_luns_local,
+ [REQUEST_SENSE] = scst_request_sense_local,
+ [RESERVE] = scst_reserve_local,
+ [RESERVE_10] = scst_reserve_local,
};
static enum scst_exec_res scst_do_local_exec(struct scst_cmd *cmd)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2020-07-12 23:32:02
|
Revision: 9047
http://sourceforge.net/p/scst/svn/9047
Author: bvassche
Date: 2020-07-12 23:32:00 +0000 (Sun, 12 Jul 2020)
Log Message:
-----------
scst: Introduce a local variable
This patch does not change any functionality.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2020-07-12 23:31:34 UTC (rev 9046)
+++ trunk/scst/src/scst_targ.c 2020-07-12 23:32:00 UTC (rev 9047)
@@ -4181,14 +4181,16 @@
rcu_read_unlock();
if (tgt_dev) {
+ struct scst_device *dev = tgt_dev->dev;
+
TRACE_DBG("tgt_dev %p found", tgt_dev);
- if (likely(tgt_dev->dev->handler != &scst_null_devtype)) {
+ if (likely(dev->handler != &scst_null_devtype)) {
cmd->cmd_threads = tgt_dev->active_cmd_threads;
cmd->tgt_dev = tgt_dev;
cmd->cur_order_data = tgt_dev->curr_order_data;
- cmd->dev = tgt_dev->dev;
- cmd->devt = tgt_dev->dev->handler;
+ cmd->dev = dev;
+ cmd->devt = dev->handler;
res = 0;
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|