|
From: <bva...@us...> - 2014-04-16 06:17:24
|
Revision: 5421
http://sourceforge.net/p/scst/svn/5421
Author: bvassche
Date: 2014-04-16 06:17:19 +0000 (Wed, 16 Apr 2014)
Log Message:
-----------
scst_targ: Fix a checkpatch complaint
Avoid that checkpatch reports the following message:
ERROR: space required before the open parenthesis '('
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2014-04-16 02:24:44 UTC (rev 5420)
+++ trunk/scst/src/scst_targ.c 2014-04-16 06:17:19 UTC (rev 5421)
@@ -2241,7 +2241,7 @@
memset(buf, 0, buf_len);
- switch(options) {
+ switch (options) {
case 0: /* all */
put_unaligned_be32(buf_len - 3, &buf[0]);
offs = 4;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2014-04-24 02:33:09
|
Revision: 5465
http://sourceforge.net/p/scst/svn/5465
Author: vlnb
Date: 2014-04-24 02:33:07 +0000 (Thu, 24 Apr 2014)
Log Message:
-----------
scst_targ: Clarify a comment
Signed-off-by: Bart Van Assche <bva...@ac...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2014-04-24 02:30:52 UTC (rev 5464)
+++ trunk/scst/src/scst_targ.c 2014-04-24 02:33:07 UTC (rev 5465)
@@ -1540,7 +1540,10 @@
break;
#endif
- /* Small context optimization */
+ /*
+ * Make sure that the exec phase runs in thread context since
+ * invoking I/O functions from atomic context is not allowed.
+ */
if ((pref_context == SCST_CONTEXT_TASKLET) ||
(pref_context == SCST_CONTEXT_DIRECT_ATOMIC) ||
((pref_context == SCST_CONTEXT_SAME) &&
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2014-04-24 23:08:00
|
Revision: 5477
http://sourceforge.net/p/scst/svn/5477
Author: vlnb
Date: 2014-04-24 23:07:58 +0000 (Thu, 24 Apr 2014)
Log Message:
-----------
Minor logging cleanup
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2014-04-24 18:49:52 UTC (rev 5476)
+++ trunk/scst/src/scst_targ.c 2014-04-24 23:07:58 UTC (rev 5477)
@@ -2132,7 +2132,8 @@
TRACE_ENTRY();
if (cmd->devt->get_supported_opcodes == NULL) {
- TRACE(TRACE_MINOR, "Unknown opcode 0x%02x", cmd->cdb[0]);
+ TRACE(TRACE_MINOR, "REPORT SUPPORTED OPCODES not supported by "
+ "dev handler %s", cmd->devt->name);
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode));
goto out_compl;
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2014-05-07 02:13:14
|
Revision: 5504
http://sourceforge.net/p/scst/svn/5504
Author: vlnb
Date: 2014-05-07 02:13:11 +0000 (Wed, 07 May 2014)
Log Message:
-----------
Fix COMMAND DATA LENGTH in All_commands parameter data of REPORT SUPPORTED OPERATION CODES
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 2014-05-06 23:22:32 UTC (rev 5503)
+++ trunk/scst/src/scst_targ.c 2014-05-07 02:13:11 UTC (rev 5504)
@@ -2249,7 +2249,7 @@
switch (options) {
case 0: /* all */
- put_unaligned_be32(buf_len - 3, &buf[0]);
+ put_unaligned_be32(buf_len - 4, &buf[0]);
offs = 4;
for (i = 0; i < supp_opcodes_cnt; i++) {
op = supp_opcodes[i];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2014-05-17 00:18:46
|
Revision: 5523
http://sourceforge.net/p/scst/svn/5523
Author: vlnb
Date: 2014-05-17 00:18:42 +0000 (Sat, 17 May 2014)
Log Message:
-----------
scst_lib: Clarify scst_init_cmd() documentation
The possible return values of scst_init_cmd() are -1, 0 and 1. Mention
this in the comment header above that function.
Signed-off-by: Bart Van Assche <bva...@ac...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2014-05-16 02:37:29 UTC (rev 5522)
+++ trunk/scst/src/scst_targ.c 2014-05-17 00:18:42 UTC (rev 5523)
@@ -294,8 +294,9 @@
EXPORT_SYMBOL(scst_rx_cmd);
/*
- * No locks, but might be on IRQ. Returns 0 on success, <0 if processing of
- * this command should be stopped.
+ * No locks, but might be on IRQ. Returns:
+ * - < 0 if the caller must not perform any further processing of @cmd;
+ * - >= 0 if the caller must continue processing @cmd.
*/
static int scst_init_cmd(struct scst_cmd *cmd, enum scst_exec_context *context)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2014-06-13 22:24:11
|
Revision: 5600
http://sourceforge.net/p/scst/svn/5600
Author: vlnb
Date: 2014-06-13 22:24:06 +0000 (Fri, 13 Jun 2014)
Log Message:
-----------
scst: Avoid that W=1 triggers complaints about unused variables
Avoid that building scst with W=1 triggers compiler warnings about
variables that are set but not used. See also the documentation of
the gcc compiler flag -Wunused-but-set-variable.
Signed-off-by: Bart Van Assche <bva...@ac...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2014-06-13 06:59:13 UTC (rev 5599)
+++ trunk/scst/src/scst_targ.c 2014-06-13 22:24:06 UTC (rev 5600)
@@ -5997,6 +5997,8 @@
TRACE(TRACE_MGMT, "Resetting host %d bus ",
dev->scsi_dev->host->host_no);
rc = scsi_reset_provider(dev->scsi_dev, SCSI_TRY_RESET_DEVICE);
+ TRACE(TRACE_MGMT, "scsi_reset_provider(%s) returned %d",
+ dev->virt_name, rc);
#if 0
if (rc != SUCCESS && mcmd->status == SCST_MGMT_STATUS_SUCCESS)
scst_mgmt_cmd_set_status(mcmd, SCST_MGMT_STATUS_FAILED);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2015-01-14 08:06:20
|
Revision: 5967
http://sourceforge.net/p/scst/svn/5967
Author: bvassche
Date: 2015-01-14 08:06:12 +0000 (Wed, 14 Jan 2015)
Log Message:
-----------
scst_targ: Use tabs instead of spaces for indentation (detected by checkpatch)
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2015-01-13 09:38:09 UTC (rev 5966)
+++ trunk/scst/src/scst_targ.c 2015-01-14 08:06:12 UTC (rev 5967)
@@ -1602,17 +1602,17 @@
*/
static inline bool scst_needs_thread_context(struct scst_cmd *cmd)
{
- switch (cmd->cdb[0]) {
- case PERSISTENT_RESERVE_IN:
- case PERSISTENT_RESERVE_OUT:
- case RESERVE:
- case RESERVE_10:
- case RELEASE:
- case RELEASE_10:
- return true;
- }
+ switch (cmd->cdb[0]) {
+ case PERSISTENT_RESERVE_IN:
+ case PERSISTENT_RESERVE_OUT:
+ case RESERVE:
+ case RESERVE_10:
+ case RELEASE:
+ case RELEASE_10:
+ return true;
+ }
- return false;
+ return false;
}
static int scst_tgt_pre_exec(struct scst_cmd *cmd)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2015-01-20 04:18:10
|
Revision: 5977
http://sourceforge.net/p/scst/svn/5977
Author: vlnb
Date: 2015-01-20 04:18:07 +0000 (Tue, 20 Jan 2015)
Log Message:
-----------
Revert r5964 as not needed
Revision Links:
--------------
http://sourceforge.net/p/scst/svn/5964
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2015-01-16 16:20:10 UTC (rev 5976)
+++ trunk/scst/src/scst_targ.c 2015-01-20 04:18:07 UTC (rev 5977)
@@ -1738,17 +1738,9 @@
out_descr:
if (unlikely(cmd->op_flags & SCST_DESCRIPTORS_BASED)) {
- if (scst_cmd_atomic(cmd)) {
- /*
- * Switch to thread context such that
- * scst_parse_descriptors() can use GFP_KERNEL instead
- * of GFP_ATOMIC.
- */
- res = SCST_CMD_STATE_RES_NEED_THREAD;
+ int r = scst_parse_descriptors(cmd);
+ if (unlikely(r != 0))
goto out;
- }
- if (unlikely(scst_parse_descriptors(cmd) != 0))
- goto out;
}
out:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2015-05-01 23:49:22
|
Revision: 6193
http://sourceforge.net/p/scst/svn/6193
Author: vlnb
Date: 2015-05-01 23:49:20 +0000 (Fri, 01 May 2015)
Log Message:
-----------
Decrease time cpu_cmd_counter is held taken for suspending case for debug
mode to minimize race window described in
http://sourceforge.net/p/scst/mailman/message/34074831/
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2015-05-01 04:21:56 UTC (rev 6192)
+++ trunk/scst/src/scst_targ.c 2015-05-01 23:49:20 UTC (rev 6193)
@@ -4461,8 +4461,8 @@
scst_put(cmd->cpu_cmd_counter);
}
} else {
+ scst_put(cmd->cpu_cmd_counter);
TRACE_MGMT_DBG("%s", "FLAG SUSPENDED set, skipping");
- scst_put(cmd->cpu_cmd_counter);
res = 1;
}
@@ -5044,8 +5044,8 @@
if (unlikely(test_bit(SCST_FLAG_SUSPENDED, &scst_flags) &&
!test_bit(SCST_FLAG_SUSPENDING, &scst_flags))) {
+ scst_put(mcmd->cpu_cmd_counter);
TRACE_MGMT_DBG("%s", "FLAG SUSPENDED set, skipping");
- scst_put(mcmd->cpu_cmd_counter);
res = 1;
goto out;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2015-06-17 00:06:20
|
Revision: 6360
http://sourceforge.net/p/scst/svn/6360
Author: bvassche
Date: 2015-06-17 00:06:18 +0000 (Wed, 17 Jun 2015)
Log Message:
-----------
scst_targ: Remove dead code
Detected by Coverity.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2015-06-17 00:05:29 UTC (rev 6359)
+++ trunk/scst/src/scst_targ.c 2015-06-17 00:06:18 UTC (rev 6360)
@@ -3239,7 +3239,6 @@
{
struct scst_cmd *cmd = *active_cmd;
struct scst_cmd *ref_cmd;
- int count = 0;
TRACE_ENTRY();
@@ -3300,8 +3299,6 @@
sBUG_ON(rc != SCST_EXEC_COMPLETED);
done:
- count++;
-
cmd = scst_post_exec_sn(cmd, false);
if (cmd == NULL)
break;
@@ -3320,15 +3317,11 @@
*active_cmd = cmd;
- if (count == 0)
- goto out_put;
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
if (ref_cmd->dev->scsi_dev != NULL)
generic_unplug_device(ref_cmd->dev->scsi_dev->request_queue);
#endif
-out_put:
__scst_cmd_put(ref_cmd);
/* !! At this point sess, dev and tgt_dev can be already freed !! */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2015-10-02 02:30:15
|
Revision: 6526
http://sourceforge.net/p/scst/svn/6526
Author: vlnb
Date: 2015-10-02 02:30:13 +0000 (Fri, 02 Oct 2015)
Log Message:
-----------
Ignore DID_TARGET_FAILURE if status already set
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2015-10-01 21:28:39 UTC (rev 6525)
+++ trunk/scst/src/scst_targ.c 2015-10-02 02:30:13 UTC (rev 6526)
@@ -3547,6 +3547,8 @@
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_write_error));
else
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_read_error));
+ } else if ((cmd->host_status == DID_TARGET_FAILURE) && (cmd->status != 0)) {
+ /* It's OK, normal workflow, ignore */
} else {
TRACE(TRACE_SCSI|TRACE_MINOR_AND_MGMT_DBG, "Host "
"status 0x%x received, returning HARDWARE ERROR "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2017-05-11 03:57:07
|
Revision: 7172
http://sourceforge.net/p/scst/svn/7172
Author: vlnb
Date: 2017-05-11 03:57:04 +0000 (Thu, 11 May 2017)
Log Message:
-----------
scst: scst_finish_cmd() not try to left-shift lba of -1
Change scst_finish_cmd() so that it does not attempt to left-shift lba when it
is -1 (the error value). Left-shifting of a negative value is undefined in C.
Signed-off-by: David Butterfield <dab...@gm...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2017-05-11 03:52:51 UTC (rev 7171)
+++ trunk/scst/src/scst_targ.c 2017-05-11 03:57:04 UTC (rev 7172)
@@ -4721,6 +4721,7 @@
struct scst_session *sess = cmd->sess;
struct scst_io_stat_entry *stat;
int block_shift, align_len;
+ uint64_t lba;
TRACE_ENTRY();
@@ -4753,12 +4754,14 @@
block_shift = cmd->dev->block_shift;
/* Let's track only 4K unaligned cmds at the moment */
align_len = (block_shift != 0) ? 4095 : 0;
+ lba = cmd->lba;
} else {
block_shift = 0;
align_len = 0;
+ lba = 0;
}
- if (unlikely(((cmd->lba << block_shift) & align_len) != 0) ||
+ if (unlikely(((lba << block_shift) & align_len) != 0) ||
unlikely(((cmd->bufflen + cmd->out_bufflen) & align_len) != 0))
stat->unaligned_cmd_count++;
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:16:16
|
Revision: 7922
http://sourceforge.net/p/scst/svn/7922
Author: bvassche
Date: 2019-02-12 03:16:12 +0000 (Tue, 12 Feb 2019)
Log Message:
-----------
scst: Only switch to thread context if no Data-Out buffer and no failure
This patch avoids that the following is reported:
[0]: scst_pre_parse:949:Failed CDB:
(h)___0__1__2__3__4__5__6__7__8__9__A__B__C__D__E__F
0: 8b 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 ................
[0]: dev_vdisk: vdisk_parse_offset:2999:Unknown opcode 0x8b
[0]: scst_parse_cmd:1333:Atomic context and non-WRITE data direction, rescheduling (cmd 00000000cd981f2b)
[0]: scst: scst_process_active_cmd:5571:***CRITICAL ERROR***: cmd 00000000cd981f2b is in invalid state 10)
BUG at /home/bart/software/scst.git/scst/src/scst_targ.c:5572
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(val > preempt_count())
WARNING: CPU: 1 PID: 0 at kernel/sched/core.c:3230 preempt_count_sub+0x7f/0xd0
Modules linked in: qla2x00tgt(O) scst_vdisk(O) isert_scst(O) iscsi_scst(O) scst(O) sd_mod sg brd dlm af_packet crct10dif_pclmul hid_generic aesni_intel aes_x86_64 crypto_simd cryptd usbhid glue_helper hid qla2xxx_scst(O) virtio_balloon l
CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W O 5.0.0-rc6-dbg+ #2
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Call Trace:
<IRQ>
__local_bh_enable_ip+0x7e/0x140
local_bh_enable+0x15/0x20 [scst]
scst_process_active_cmd+0x555/0x570 [scst]
scst_do_job_active.constprop.23+0x57/0xe0 [scst]
scst_cmd_tasklet+0x42/0x70 [scst]
tasklet_action_common.isra.14+0xc3/0x280
tasklet_action+0x3d/0x50
__do_softirq+0x12d/0x5b7
irq_exit+0xdd/0x100
do_IRQ+0xc3/0x160
common_interrupt+0xf/0xf
</IRQ>
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:10:12 UTC (rev 7921)
+++ trunk/scst/src/scst_targ.c 2019-02-12 03:16:12 UTC (rev 7922)
@@ -1327,7 +1327,7 @@
* be because of the SCST_TGT_DEV_AFTER_* optimization, but during
* parsing data_direction can change, so we need to recheck.
*/
- if (unlikely(scst_cmd_atomic(cmd) &&
+ if (unlikely(scst_cmd_atomic(cmd) && cmd->status == 0 &&
!(cmd->data_direction & SCST_DATA_WRITE))) {
TRACE_DBG_FLAG(TRACE_DEBUG|TRACE_MINOR, "Atomic context and "
"non-WRITE data direction, rescheduling (cmd %p)", cmd);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2019-03-10 04:33:54
|
Revision: 8029
http://sourceforge.net/p/scst/svn/8029
Author: bvassche
Date: 2019-03-10 04:33:51 +0000 (Sun, 10 Mar 2019)
Log Message:
-----------
scst_targ: Add a consistency check in __scst_rx_cmd()
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2019-03-10 02:28:44 UTC (rev 8028)
+++ trunk/scst/src/scst_targ.c 2019-03-10 04:33:51 UTC (rev 8029)
@@ -558,6 +558,8 @@
{
TRACE_ENTRY();
+ WARN_ON_ONCE(cmd->cpu_cmd_counter);
+
cmd->sess = sess;
scst_sess_get(sess);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2019-08-12 01:39:40
|
Revision: 8500
http://sourceforge.net/p/scst/svn/8500
Author: bvassche
Date: 2019-08-12 01:39:37 +0000 (Mon, 12 Aug 2019)
Log Message:
-----------
scst: Verify dev_exec_cmd_list protection at runtime
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2019-08-09 17:31:33 UTC (rev 8499)
+++ trunk/scst/src/scst_targ.c 2019-08-12 01:39:37 UTC (rev 8500)
@@ -338,6 +338,8 @@
TRACE_ENTRY();
+ lockdep_assert_held(&dev->dev_lock);
+
/*
* We want to have fairness between just unblocked previously blocked
* SCSI atomic cmds and new cmds came after them. Otherwise, the new
@@ -482,6 +484,8 @@
TRACE_ENTRY();
+ lockdep_assert_held(&dev->dev_lock);
+
/*
* We might be called here as part of Copy Manager's check blocking
* undo, so restore all flags in the previous state to allow
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2020-02-23 00:03:30
|
Revision: 8767
http://sourceforge.net/p/scst/svn/8767
Author: bvassche
Date: 2020-02-23 00:03:28 +0000 (Sun, 23 Feb 2020)
Log Message:
-----------
scst: Replace relative target port information in the INQUIRY response
Signed-off-by: Tamas Bartha <tam...@ba...>
[ bvanassche: reformatted this patch and renamed several variables ]
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2020-02-08 05:45:43 UTC (rev 8766)
+++ trunk/scst/src/scst_targ.c 2020-02-23 00:03:28 UTC (rev 8767)
@@ -4,6 +4,8 @@
* Copyright (C) 2004 - 2018 Vladislav Bolkhovitin <vs...@vl...>
* Copyright (C) 2004 - 2005 Leonid Stoljar
* Copyright (C) 2007 - 2018 Western Digital Corporation
+ * Copyright (C) 2020 Tamas Bartha <tam...@ba...>
+ * Copyright (C) 2008 - 2020 Bart Van Assche <bva...@ac...>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -2203,6 +2205,61 @@
return context;
}
+/*
+ * In a H.A. setup, when using dev_disk for redirecting I/O between H.A. nodes,
+ * and with 'forwarding' mode enabled, the INQUIRY command returns the relative
+ * target port ID of the other node. That breaks the ALUA code at the initiator
+ * side. Hence this function that replaces the relative target port IDs in the
+ * INQUIRY response.
+ */
+static void scst_replace_port_info(struct scst_cmd *cmd)
+{
+ uint8_t *buf, *end, *p, designator_length;
+ int32_t length, page_length;
+
+ if (cmd->cdb[0] != INQUIRY || (cmd->cdb[1] & 0x01/*EVPD*/) == 0 ||
+ cmd->cdb[2] != 0x83/*device identification*/)
+ return;
+
+ length = scst_get_buf_full_sense(cmd, &buf);
+ if (length < 4)
+ goto out_put;
+
+ page_length = get_unaligned_be16(&buf[2]);
+ end = buf + min(length, 4 + page_length);
+
+ for (p = buf + 4; p + 4 <= end; p += 4 + designator_length) {
+ const uint8_t code_set = p[0] & 0xf;
+ const uint8_t association = (p[1] & 0x30) >> 4;
+ const uint8_t designator_type = p[1] & 0xf;
+ uint16_t tg_id;
+
+ designator_length = p[3];
+
+ /*
+ * Only process designators with code set 'binary', target port
+ * association and designator length 4.
+ */
+ if (code_set != 1 || association != 1 || designator_length != 4)
+ continue;
+ switch (designator_type) {
+ case 4:
+ /* relative target port */
+ put_unaligned_be16(cmd->tgt->rel_tgt_id, p + 6);
+ break;
+ case 5:
+ /* target port group */
+ tg_id = scst_lookup_tg_id(cmd->dev, cmd->tgt);
+ if (tg_id)
+ put_unaligned_be16(tg_id, p + 6);
+ break;
+ }
+ }
+
+out_put:
+ scst_put_buf_full(cmd, buf);
+}
+
/**
* scst_pass_through_cmd_done - done callback for pass-through commands
* @data: private opaque data
@@ -2224,6 +2281,9 @@
scst_do_cmd_done(cmd, result, sense, SCSI_SENSE_BUFFERSIZE, resid);
+ if (result == 0)
+ scst_replace_port_info(cmd);
+
scst_set_cmd_state(cmd, SCST_CMD_STATE_PRE_DEV_DONE);
scst_process_redirect_cmd(cmd,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2020-05-26 18:18:32
|
Revision: 8984
http://sourceforge.net/p/scst/svn/8984
Author: bvassche
Date: 2020-05-26 18:18:30 +0000 (Tue, 26 May 2020)
Log Message:
-----------
scst: Adjust indentation to keep checkpatch happy
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2020-05-25 18:19:45 UTC (rev 8983)
+++ trunk/scst/src/scst_targ.c 2020-05-26 18:18:30 UTC (rev 8984)
@@ -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] = {
- [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,
+ [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...> - 2021-01-03 02:56:03
|
Revision: 9320
http://sourceforge.net/p/scst/svn/9320
Author: bvassche
Date: 2021-01-03 02:56:01 +0000 (Sun, 03 Jan 2021)
Log Message:
-----------
scst: Modify the code that decides whether or not to process in tasklet context
Since the next patch will remove cpu_cmd_count, make this decision
independent of cpu_cmd_count.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2021-01-03 02:54:08 UTC (rev 9319)
+++ trunk/scst/src/scst_targ.c 2021-01-03 02:56:01 UTC (rev 9320)
@@ -59,7 +59,16 @@
i = &scst_percpu_infos[smp_processor_id()];
- if (atomic_read(&i->cpu_cmd_count) <= scst_max_tasklet_cmd) {
+ /*
+ * Commands are removed from the list they are on before being
+ * processed. If both lists are empty that means that at most two
+ * commands are being processed and hence that processing a
+ * command in tasklet context is possible without making a CPU core
+ * spend all its time in interrupt and tasklet context and thereby
+ * starving threads scheduled on the same CPU core.
+ */
+ if (list_empty_careful(&i->tasklet_cmd_list) &&
+ list_empty_careful(&cmd->cmd_threads->active_cmd_list)) {
spin_lock_irqsave(&i->tasklet_lock, flags);
TRACE_DBG("Adding cmd %p to tasklet %d cmd list", cmd,
smp_processor_id());
@@ -69,8 +78,8 @@
tasklet_schedule(&i->tasklet);
} else {
spin_lock_irqsave(&cmd->cmd_threads->cmd_list_lock, flags);
- TRACE_DBG("Too many tasklet commands (%d), adding cmd %p to "
- "active cmd list", atomic_read(&i->cpu_cmd_count), cmd);
+ TRACE_DBG("Too many tasklet commands, adding cmd %p to active cmd list",
+ cmd);
list_add_tail(&cmd->cmd_list_entry,
&cmd->cmd_threads->active_cmd_list);
wake_up(&cmd->cmd_threads->cmd_list_waitQ);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2008-11-18 18:42:10
|
Revision: 572
http://scst.svn.sourceforge.net/scst/?rev=572&view=rev
Author: vlnb
Date: 2008-11-18 18:42:09 +0000 (Tue, 18 Nov 2008)
Log Message:
-----------
Log level for "Warning: expected transfer length X for opcode Y" changed to be disabled by default for release build
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2008-11-18 18:23:08 UTC (rev 571)
+++ trunk/scst/src/scst_targ.c 2008-11-18 18:42:09 UTC (rev 572)
@@ -594,25 +594,17 @@
}
}
if (unlikely(cmd->bufflen != cmd->expected_transfer_len)) {
- static int repd;
- if (repd < 100) {
- /*
- * Intentionally unlocked. Few messages more
- * or less don't matter.
- */
- repd++;
- TRACE(TRACE_MINOR, "Warning: expected transfer "
- "length %d for opcode 0x%02x (handler "
- "%s, target %s) doesn't match decoded "
- "value %d. Faulty initiator (e.g. "
- "VMware is known to be such) or "
- "scst_scsi_op_table should be updated?",
- cmd->expected_transfer_len, cmd->cdb[0],
- dev->handler->name, cmd->tgtt->name,
- cmd->bufflen);
- PRINT_BUFF_FLAG(TRACE_MINOR, "Suspicious CDB",
- cmd->cdb, cmd->cdb_len);
- }
+ TRACE(TRACE_MGMT_MINOR, "Warning: expected "
+ "transfer length %d for opcode 0x%02x "
+ "(handler %s, target %s) doesn't match "
+ "decoded value %d. Faulty initiator "
+ "(e.g. VMware is known to be such) or "
+ "scst_scsi_op_table should be updated?",
+ cmd->expected_transfer_len, cmd->cdb[0],
+ dev->handler->name, cmd->tgtt->name,
+ cmd->bufflen);
+ PRINT_BUFF_FLAG(TRACE_MINOR, "Suspicious CDB",
+ cmd->cdb, cmd->cdb_len);
}
#endif
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2008-11-25 16:44:33
|
Revision: 583
http://scst.svn.sourceforge.net/scst/?rev=583&view=rev
Author: vlnb
Date: 2008-11-25 16:44:24 +0000 (Tue, 25 Nov 2008)
Log Message:
-----------
- Now task_mgmt_fn() callback called for TARGET RESET and NEXUS LOSS only once for tgt_dev, which belongs to the session, from which the corresponding request came
- Cleanup
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2008-11-21 12:12:53 UTC (rev 582)
+++ trunk/scst/src/scst_targ.c 2008-11-25 16:44:24 UTC (rev 583)
@@ -3998,7 +3998,7 @@
}
static void __scst_abort_task_set(struct scst_mgmt_cmd *mcmd,
- struct scst_tgt_dev *tgt_dev, int other_ini)
+ struct scst_tgt_dev *tgt_dev)
{
struct scst_cmd *cmd;
struct scst_session *sess = tgt_dev->sess;
@@ -4019,7 +4019,7 @@
(mcmd->cmd_sn == cmd->tgt_sn))
continue;
}
- scst_abort_cmd(cmd, mcmd, other_ini, 0);
+ scst_abort_cmd(cmd, mcmd, 0, 0);
}
}
spin_unlock_irq(&sess->sess_list_lock);
@@ -4044,7 +4044,7 @@
__scst_block_dev(dev);
spin_unlock_bh(&dev->dev_lock);
- __scst_abort_task_set(mcmd, tgt_dev, 0);
+ __scst_abort_task_set(mcmd, tgt_dev);
scst_unblock_aborted_cmds(0);
@@ -4103,7 +4103,7 @@
__scst_block_dev(dev);
spin_unlock_bh(&dev->dev_lock);
- __scst_abort_task_set(mcmd, mcmd->mcmd_tgt_dev, 0);
+ __scst_abort_task_set(mcmd, mcmd->mcmd_tgt_dev);
mutex_lock(&scst_mutex);
@@ -4285,12 +4285,16 @@
list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list,
dev_tgt_dev_list_entry) {
cont = 1;
- rc = scst_call_dev_task_mgmt_fn(mcmd, tgt_dev, 0);
- if (rc == SCST_DEV_TM_NOT_COMPLETED)
- c = 1;
- else if ((rc < 0) &&
- (mcmd->status == SCST_MGMT_STATUS_SUCCESS))
- mcmd->status = rc;
+ if (mcmd->sess == tgt_dev->sess) {
+ rc = scst_call_dev_task_mgmt_fn(mcmd,
+ tgt_dev, 0);
+ if (rc == SCST_DEV_TM_NOT_COMPLETED)
+ c = 1;
+ else if ((rc < 0) &&
+ (mcmd->status == SCST_MGMT_STATUS_SUCCESS))
+ mcmd->status = rc;
+ break;
+ }
}
if (cont && !c)
continue;
@@ -4471,7 +4475,7 @@
spin_unlock_bh(&dev->dev_lock);
}
- __scst_abort_task_set(mcmd, tgt_dev, 0);
+ __scst_abort_task_set(mcmd, tgt_dev);
rc = scst_call_dev_task_mgmt_fn(mcmd, tgt_dev, 0);
if (rc < 0 && mcmd->status == SCST_MGMT_STATUS_SUCCESS)
@@ -4555,16 +4559,18 @@
sess_tgt_dev_list_entry) {
int rc;
- __scst_abort_task_set(mcmd, tgt_dev, 0);
+ __scst_abort_task_set(mcmd, tgt_dev);
if (nexus_loss)
scst_nexus_loss(tgt_dev);
- rc = scst_call_dev_task_mgmt_fn(mcmd, tgt_dev,
- 0);
- if ((rc < 0) &&
- (mcmd->status == SCST_MGMT_STATUS_SUCCESS))
- mcmd->status = rc;
+ if (mcmd->sess == tgt_dev->sess) {
+ rc = scst_call_dev_task_mgmt_fn(
+ mcmd, tgt_dev, 0);
+ if ((rc < 0) &&
+ (mcmd->status == SCST_MGMT_STATUS_SUCCESS))
+ mcmd->status = rc;
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2008-12-10 12:05:21
|
Revision: 615
http://scst.svn.sourceforge.net/scst/?rev=615&view=rev
Author: vlnb
Date: 2008-12-10 12:05:17 +0000 (Wed, 10 Dec 2008)
Log Message:
-----------
Trailing whitespace fixed
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2008-12-10 10:55:01 UTC (rev 614)
+++ trunk/scst/src/scst_targ.c 2008-12-10 12:05:17 UTC (rev 615)
@@ -1779,7 +1779,7 @@
* Write must be before def_cmd_count read to be in sync. with
* scst_post_exec_sn(). See comment in scst_send_for_exec().
*/
- smp_mb();
+ smp_mb();
TRACE_SN("Next expected_sn: %ld", tgt_dev->expected_sn);
out:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bva...@us...> - 2009-08-10 12:39:21
|
Revision: 1033
http://scst.svn.sourceforge.net/scst/?rev=1033&view=rev
Author: bvassche
Date: 2009-08-10 12:39:13 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
Whitespace-only change: fixed a checkpatch complaint about trailing whitespace.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2009-08-10 12:32:06 UTC (rev 1032)
+++ trunk/scst/src/scst_targ.c 2009-08-10 12:39:13 UTC (rev 1033)
@@ -3142,8 +3142,6 @@
scst_finish_cmd_mgmt(cmd);
}
-
-
__scst_cmd_put(cmd);
res = SCST_CMD_STATE_RES_CONT_NEXT;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2009-09-14 18:02:26
|
Revision: 1093
http://scst.svn.sourceforge.net/scst/?rev=1093&view=rev
Author: vlnb
Date: 2009-09-14 18:02:11 +0000 (Mon, 14 Sep 2009)
Log Message:
-----------
Minor cleanup
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2009-09-14 18:00:20 UTC (rev 1092)
+++ trunk/scst/src/scst_targ.c 2009-09-14 18:02:11 UTC (rev 1093)
@@ -220,7 +220,7 @@
((pref_context == SCST_CONTEXT_DIRECT) ||
(pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) {
PRINT_ERROR("Wrong context %d in IRQ from target %s, use "
- "SCST_CONTEXT_THREAD instead\n", pref_context,
+ "SCST_CONTEXT_THREAD instead", pref_context,
cmd->tgtt->name);
pref_context = SCST_CONTEXT_THREAD;
}
@@ -831,7 +831,7 @@
((pref_context == SCST_CONTEXT_DIRECT) ||
(pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) {
PRINT_ERROR("Wrong context %d in IRQ from target %s, use "
- "SCST_CONTEXT_THREAD instead\n", pref_context,
+ "SCST_CONTEXT_THREAD instead", pref_context,
cmd->tgtt->name);
pref_context = SCST_CONTEXT_THREAD;
}
@@ -1068,7 +1068,7 @@
((pref_context == SCST_CONTEXT_DIRECT) ||
(pref_context == SCST_CONTEXT_DIRECT_ATOMIC))) {
PRINT_ERROR("Wrong context %d in IRQ from target %s, use "
- "SCST_CONTEXT_THREAD instead\n", pref_context,
+ "SCST_CONTEXT_THREAD instead", pref_context,
cmd->tgtt->name);
pref_context = SCST_CONTEXT_THREAD;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2009-10-29 19:18:16
|
Revision: 1300
http://scst.svn.sourceforge.net/scst/?rev=1300&view=rev
Author: vlnb
Date: 2009-10-29 19:18:09 +0000 (Thu, 29 Oct 2009)
Log Message:
-----------
Fix for the wrong mcmd state assignment if scst_mgmt_translate_lun() returns >0 because of suspending. Found by Gilad / <gil...@gm...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2009-10-29 18:56:23 UTC (rev 1299)
+++ trunk/scst/src/scst_targ.c 2009-10-29 19:18:09 UTC (rev 1300)
@@ -4398,8 +4398,6 @@
TRACE_ENTRY();
- mcmd->state = SCST_MCMD_STATE_READY;
-
switch (mcmd->fn) {
case SCST_ABORT_TASK:
{
@@ -4454,6 +4452,7 @@
case SCST_NEXUS_LOSS:
case SCST_ABORT_ALL_TASKS:
case SCST_UNREG_SESS_TM:
+ mcmd->state = SCST_MCMD_STATE_READY;
break;
case SCST_ABORT_TASK_SET:
@@ -4461,12 +4460,14 @@
case SCST_CLEAR_TASK_SET:
case SCST_LUN_RESET:
rc = scst_mgmt_translate_lun(mcmd);
- if (rc < 0) {
+ if (rc == 0)
+ mcmd->state = SCST_MCMD_STATE_READY;
+ else if (rc < 0) {
PRINT_ERROR("Corresponding device for LUN %lld not "
"found", (long long unsigned int)mcmd->lun);
mcmd->status = SCST_MGMT_STATUS_LUN_NOT_EXIST;
mcmd->state = SCST_MCMD_STATE_DONE;
- } else if (rc != 0)
+ } else
res = rc;
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vl...@us...> - 2009-11-19 11:58:05
|
Revision: 1350
http://scst.svn.sourceforge.net/scst/?rev=1350&view=rev
Author: vlnb
Date: 2009-11-19 11:57:57 +0000 (Thu, 19 Nov 2009)
Log Message:
-----------
Ordered reads groupped under single config symbol.
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2009-11-19 10:22:25 UTC (rev 1349)
+++ trunk/scst/src/scst_targ.c 2009-11-19 11:57:57 UTC (rev 1350)
@@ -33,6 +33,11 @@
#include "scst.h"
#include "scst_priv.h"
+#if 0 /* Temporary, left for future performance investigations */
+/* Deleting it don't forget to delete write_cmd_count */
+#define CONFIG_SCST_ORDERED_READS
+#endif
+
static void scst_cmd_set_sn(struct scst_cmd *cmd);
static int __scst_init_cmd(struct scst_cmd *cmd);
static void scst_finish_cmd_mgmt(struct scst_cmd *cmd);
@@ -2855,10 +2860,11 @@
if (likely(cmd->tgt_dev != NULL)) {
atomic_dec(&cmd->tgt_dev->tgt_dev_cmd_count);
atomic_dec(&cmd->dev->dev_cmd_count);
+#ifdef CONFIG_SCST_ORDERED_READS
/* If expected values not set, expected direction is UNKNOWN */
if (cmd->expected_data_direction & SCST_DATA_WRITE)
atomic_dec(&cmd->dev->write_cmd_count);
-
+#endif
if (unlikely(cmd->queue_type == SCST_CMD_QUEUE_HEAD_OF_QUEUE))
scst_on_hq_cmd_response(cmd);
@@ -3136,7 +3142,7 @@
switch (cmd->queue_type) {
case SCST_CMD_QUEUE_SIMPLE:
case SCST_CMD_QUEUE_UNTAGGED:
-#if 0 /* left for future performance investigations */
+#ifdef CONFIG_SCST_ORDERED_READS
if (scst_cmd_is_expected_set(cmd)) {
if ((cmd->expected_data_direction == SCST_DATA_READ) &&
(atomic_read(&cmd->dev->write_cmd_count) == 0))
@@ -3332,9 +3338,11 @@
}
}
+#ifdef CONFIG_SCST_ORDERED_READS
/* If expected values not set, expected direction is UNKNOWN */
if (cmd->expected_data_direction & SCST_DATA_WRITE)
atomic_inc(&cmd->dev->write_cmd_count);
+#endif
if (unlikely(failure))
goto out_busy;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|