Nicholas A. Bellinger | 20 Apr 22:12 2009

[PATCH] [Target_Core_Mod/STGT]: Add struct Scsi_Host target infrastructure WIP

Greetings all,

This patch adds the first pieces of a v3.x subsystem plugin that interacts
with Linux/SCSI to create a virtual target mode struct Scsi_Host, and using
userspace backstores from the existing STGT codebase.

So far, creating and removing STGT virtual target HBAs in through ConfigFS is
working and status appearing under /sys/bus/stgt_bus and /sys/class/scsi_host/host#/

Most of the code required for actual STGT struct scsi_cmnd is in place
(but not-tested yet), and the next main step is hooking up stgt_create_virtdevice()
in drivers/target/target_core_stgt.c to assoicate the userspace backstore
attached to the Target_Core_Mod/STGT virtual SCSI target mode HBA.

The long term goal to allow all kernel level fabric modules to take advantage of the
upstream STGT code in drivers/scsi/scsi_tgt_[if,lib].c.

Here is what the running code looks like:

*) tree /sys/kernel/config/target/core/

/sys/kernel/config/target/core/
|-- alua
|   |-- lu_gps
|   |   `-- default_lu_gp
|   |       |-- alua_access_state
|   |       |-- lu_gp_id
|   |       `-- members
|   `-- tg_pt_gps
|       `-- default_tg_pt_gp
(Continue reading)

FUJITA Tomonori | 19 Sep 16:44 2008
Picon

Re: Fwd: Delivery Status Notification (Failure)

On Fri, 19 Sep 2008 17:01:44 +0530
"aniket agashe" <agasheac@...> wrote:

> Sir
>  i have 2 machines A & B
> i installed iser initiator on A and target on B where i am using RAID disk
> as target
> i have installed ext3 on raid disk after creating login session with B, i
> mounted file system on the disk which is visible to the A machine on the A
> machine
> 
> 
> 
> but whenever i am creating new file on A machine on the file system which is
> mounted it is visible to local machine(B) as -

First, please use stgt@...

stgt-devel@... doesn't accept mails any more.

Second, what you try to do is not impossible with the combination of
iSCSI and ext3.

Just use NFS. If you want iSER, you need to use a cluseter file system
like GFS.
Nicholas A. Bellinger | 11 Sep 05:48 2008

Re: LVM2 vs FileIO - pros/cons?

On Wed, 2008-09-10 at 10:16 -0700, Martin wrote:
> If I have space presented to my iscsi host as a large hw-based LUN,
> and I would like to provide that to initiators in several chunks
> through multiple targets, am I best off dividing up the space using
> the FileIO hba type, or setting up LVM2, or another option?  What are
> the pros and cons of the possible choices?
> 

So, the targets communicate with LVM2's device-mapper struct
block_device using struct bio requets that employs *UNBUFFERED*
opteration.  That is, acknowledgements for iSCSI I/O CDBs get sent back
to the Initiator Port (or client or whatever you want to call it) *ONLY*
when the underlying storage tells it it has be put down to the media.
If you are using a hardware RAID, this means that the request may be
going into a write-back or write-through memory cache before it actually
goes down to disk.  With a hardware RAID, you need a battery backup in
order to ensure data integrity across a power failure.  There is a
limitiation with kernel level FILEIO where O_DIRECT is unimplemented on
kernel level memory pages, which means only *BUFFERED* ops are supported
on FILEIO.  If a machine was to crash and then restart with the same
kernel level export, the initiator side would have the incorrect view of
the actual blocks on media.  NOT GOOD..  Same type of problem if your
hardware RAID does has write cache enabled and *NO* battery backup.

A transport layer like SCSI or SATA is a DMA ring to hardware, and has
no concept of buffers, they just queue requests into the hardware ring
and out onto the BUS, etc.  The same type of unbuffered option is
happens for a SCSI passthrough (eg, LIO-Target hba_type=1).  Using
struct scsi_device as a target engine storage object in kernel space
*REQUIRES* this type of unbuffered I/O, and actually happens to be the
(Continue reading)

FUJITA Tomonori | 21 Aug 08:21 2008
Picon

the old mailing list will be closed

Hi,

As I noticed a week ago, we moved stgt mailing list to
vger.kernel.org. If you have not subscribed to the new mailing list,
please subscribe:

http://vger.kernel.org/vger-lists.html#stgt

I'll change the configuration that nobody can post to the old mailing
list, stgt-devel@...

Thanks,
Seddon Seher | 20 Aug 20:20 2008

Rolex, Rado, Patek Philippe, Omegga, Gucci

Heyello,


New watchees here


Mind filled with great anxiety in consequence to me also
to approach the table. The others stood was never meant
to cut whiskers. However, in the at the top were three circles
of different colours, and voluntarily subjected themselves
and the nation, tell me all this without vaisampayana continued,
to the measure of their might and courage, against of ours,
fie on our prowess, fie on the practices a peoplewatcher
all right. No question about that. I, o krishna, have been
chosen as the great antagonist.

_______________________________________________
Stgt-devel mailing list
Stgt-devel@...
https://lists.berlios.de/mailman/listinfo/stgt-devel
Mark Harvey | 20 Aug 07:01 2008
Picon

RFC [PATCH] Implement PERSISTENT RESERVE IN/OUT

Apologies for sending as an attachment... gmail and all.

This is an initial attempt to implement PERSISTENT RESERVE IN and
PERSISTENT RESERVE OUT.

Currently only READ KEY service action will actually return anything.
It returns a hard-coded 'ABC1234'.

This post is a request for comment before I get too far into coding effort.

# lsscsi -g
[3:0:0:0]    disk    USB-HS   HTS726060M9AT00  0.01  /dev/sda  /dev/sg0
[7:0:0:0]    storage IET      Controller       0001  -         /dev/sg1
[7:0:0:1]    disk    QUANTUM  HD100            0010  /dev/sdb  /dev/sg2
[7:0:0:2]    tape    QUANTUM  DLT6000          0010  /dev/st0  /dev/sg3
[7:0:0:3]    tape    QUANTUM  DLT6000          0010  /dev/st1  /dev/sg4
[7:0:0:4]    tape    QUANTUM  DLT6000          0010  /dev/st2  /dev/sg5
[7:0:0:5]    mediumx STK      L700             0010  -         /dev/sg6

# sg_persist -i /dev/sg3
>> No service action given; assume Persistent Reservations In command
>> with Read Keys service action
  QUANTUM  DLT6000  0010
  Peripheral device type: tape
  PR generation=0x0, 4 registered reservation keys follow:
    0x4142433132333400
    0x0
    0x0
    0x0

I'll include in-line for viewing pleasure :)

[PATCH 1/2]
From 11ad9ee209708f51bd2884598d309b1e7079cdce Mon Sep 17 00:00:00 2001
From: Mark Harvey <markh794@...>
Date: Wed, 20 Aug 2008 14:42:27 +1000
Subject: RFC - Implement PERSISTENT RESERVE IN/OUT

Implement service action 'READ KEY' which returns
a hard-coded string 'ABC1234'

Signed-off-by: Mark Harvey <markh794@...>
---
 usr/scsi.h |    5 ++
 usr/spc.c  |  231 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 usr/spc.h  |    2 +
 usr/tgtd.h |   13 ++++
 4 files changed, 251 insertions(+), 0 deletions(-)

diff --git a/usr/scsi.h b/usr/scsi.h
index 84fadff..a9481a1 100644
--- a/usr/scsi.h
+++ b/usr/scsi.h
 <at>  <at>  -208,6 +208,11  <at>  <at> 
 #define ASC_POSITION_PAST_BOM			0x3b0c
 #define ASC_MEDIUM_REMOVAL_PREVENTED		0x5302
 #define ASC_BAD_MICROCODE_DETECTED		0x8283
+#define ASC_INSUFFICENT_RESERVE_RESOURCE	0x5502
+#define ASC_INSUFFICENT_RESOURCE		0x5503
+#define ASC_INSUFFICENT_REGISTRAT_RESOURCE	0x5504
+#define ASC_INSUFFICENT_AC_RESOURCE		0x5505
+#define ASC_AUX_MEMORY_OUT_OF_SPACE		0x5506

 /* Key 6: Unit Attention */
 #define ASC_NOT_READY_TO_TRANSITION		0x2800
diff --git a/usr/spc.c b/usr/spc.c
index bd2c975..cc088bf 100644
--- a/usr/spc.c
+++ b/usr/spc.c
 <at>  <at>  -880,6 +880,237  <at>  <at>  void dump_cdb(struct scsi_cmd *cmd)
 	}
 }

+/**
+ * SCSI Persistent Reservation
+ *
+ * Reference: spc4r16 Ch 5.7
+ *
+ * Interesting points:
+ *  - Persistent reservations are not reset by hard reset, lu reset ot I_T loss
+ *  - Optionally, may be retained when power to target is lost
+ */
+
+/**
+ * PERSISTENT RESERVE IN - 5Eh
+ * Ref: 6.13
+ *
+ */
+#define PR_IN_READ_KEYS 0
+#define PR_IN_READ_RESERVATION 1
+#define PR_IN_REPORT_CAPABILITIES 2
+#define PR_IN_READ_FULL_STATUS 3
+static int spc_pr_read_keys(int host_no, struct scsi_cmd *cmd)
+{
+	uint8_t *buf;
+	int len;
+	int cdb_alloc_len;
+	struct scsi_pr *pr;
+
+	cdb_alloc_len = ((cmd->scb[7] & 0xff) << 8) | (cmd->scb[8] & 0xff);
+
+	dprintf("**** Called ****\n");
+	pr = &cmd->dev->pr;
+
+	buf = scsi_get_in_buffer(cmd);
+	len = sizeof(cmd->dev->pr.pr_key);
+	memset(buf, 0, len + 8);
+
+	dprintf("Buf: %p, len: %d, cdb_alloc_len: %d\n",
+			 buf, len, cdb_alloc_len);
+
+	buf[0] = (pr->PRgeneration >> 24) & 0xff;
+	buf[1] = (pr->PRgeneration >> 16) & 0xff;
+	buf[2] = (pr->PRgeneration >>  8) & 0xff;
+	buf[3] = pr->PRgeneration & 0xff;
+	buf[4] = (len >> 24) & 0xff;
+	buf[5] = (len >> 16) & 0xff;
+	buf[6] = (len >>  8) & 0xff;
+	buf[7] = len & 0xff;
+
+	strcpy(buf + 8, "ABC1234");
+	memcpy(scsi_get_in_buffer(cmd), buf, min(cdb_alloc_len, len + 8));
+
+	scsi_set_in_resid_by_actual(cmd, len + 8);
+
+	return SAM_STAT_GOOD;
+}
+
+static int spc_pr_read_reservation(int host_no, struct scsi_cmd *cmd)
+{
+	dprintf("**** Called ****\n");
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+static int spc_pr_report_capabilities(int host_no, struct scsi_cmd *cmd)
+{
+	dprintf("**** Called ****\n");
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+static int spc_pr_read_full_status(int host_no, struct scsi_cmd *cmd)
+{
+	dprintf("**** Called ****\n");
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+struct service_action pr_in_service_actions[] = {
+	{PR_IN_READ_KEYS, spc_pr_read_keys},
+	{PR_IN_READ_RESERVATION, spc_pr_read_reservation},
+	{PR_IN_REPORT_CAPABILITIES, spc_pr_report_capabilities},
+	{PR_IN_READ_FULL_STATUS, spc_pr_read_full_status},
+	{0, NULL}
+};
+
+int persistent_reserve_in(int host_no, struct scsi_cmd *cmd)
+{
+	uint8_t action;
+	struct service_action *service_action;
+
+	action = cmd->scb[1] & 0x1f;
+	service_action = find_service_action(pr_in_service_actions, action);
+
+	if (!service_action) {
+		scsi_set_in_resid_by_actual(cmd, 0);
+		sense_data_build(cmd, ILLEGAL_REQUEST,
+				ASC_INVALID_FIELD_IN_CDB);
+		return SAM_STAT_CHECK_CONDITION;
+	}
+
+	return service_action->cmd_perform(host_no, cmd);
+}
+
+/**
+ * PERSISTENT RESERVE OUT - 5Fh
+ * Ref: 6.14
+ */
+#define PR_OUT_REGISTER 0
+#define PR_OUT_RESERVE 1
+#define PR_OUT_RELEASE 2
+#define PR_OUT_CLEAR 3
+#define PR_OUT_PREEMPT 4
+#define PR_OUT_PREEMPT_ABORT 5
+#define PR_OUT_REGISTER_IGNORE 6
+#define PR_OUT_REGISTER_MOVE 7
+
+static int spc_pr_register(int host_no, struct scsi_cmd *cmd)
+{
+	struct scsi_pr *pr;
+
+	dprintf("**** Called ****\n");
+	pr = &cmd->dev->pr;
+	pr->PRgeneration += 1;
+
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+static int spc_pr_reserve(int host_no, struct scsi_cmd *cmd)
+{
+	dprintf("**** Called ****\n");
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+static int spc_pr_release(int host_no, struct scsi_cmd *cmd)
+{
+	dprintf("**** Called ****\n");
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+static int spc_pr_clear(int host_no, struct scsi_cmd *cmd)
+{
+	struct scsi_pr *pr;
+
+	dprintf("**** Called ****\n");
+	pr = &cmd->dev->pr;
+	pr->PRgeneration += 1;
+
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+static int spc_pr_preempt(int host_no, struct scsi_cmd *cmd)
+{
+	struct scsi_pr *pr;
+
+	dprintf("**** Called ****\n");
+	pr = &cmd->dev->pr;
+	pr->PRgeneration += 1;
+
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+static int spc_pr_preempt_abort(int host_no, struct scsi_cmd *cmd)
+{
+	struct scsi_pr *pr;
+
+	dprintf("**** Called ****\n");
+	pr = &cmd->dev->pr;
+	pr->PRgeneration += 1;
+
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+static int spc_pr_register_ignore(int host_no, struct scsi_cmd *cmd)
+{
+	struct scsi_pr *pr;
+
+	dprintf("**** Called ****\n");
+	pr = &cmd->dev->pr;
+	pr->PRgeneration += 1;
+
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+static int spc_pr_register_move(int host_no, struct scsi_cmd *cmd)
+{
+	struct scsi_pr *pr;
+
+	dprintf("**** Called ****\n");
+	pr = &cmd->dev->pr;
+	pr->PRgeneration += 1;
+
+	sense_data_build(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE);
+	return SAM_STAT_CHECK_CONDITION;
+}
+
+struct service_action pr_out_service_actions[] = {
+	{PR_OUT_REGISTER, spc_pr_register},
+	{PR_OUT_RESERVE, spc_pr_reserve},
+	{PR_OUT_RELEASE, spc_pr_release},
+	{PR_OUT_CLEAR, spc_pr_clear},
+	{PR_OUT_PREEMPT, spc_pr_preempt},
+	{PR_OUT_PREEMPT_ABORT, spc_pr_preempt_abort},
+	{PR_OUT_REGISTER_IGNORE, spc_pr_register_ignore},
+	{PR_OUT_REGISTER_MOVE, spc_pr_register_move},
+	{0, NULL}
+};
+
+int persistent_reserve_out(int host_no, struct scsi_cmd *cmd)
+{
+	uint8_t action;
+	struct service_action *service_action;
+
+	action = cmd->scb[1] & 0x1f;
+	service_action = find_service_action(pr_out_service_actions, action);
+
+	if (!service_action) {
+		scsi_set_in_resid_by_actual(cmd, 0);
+		sense_data_build(cmd, ILLEGAL_REQUEST,
+				ASC_INVALID_FIELD_IN_CDB);
+		return SAM_STAT_CHECK_CONDITION;
+	}
+
+	return service_action->cmd_perform(host_no, cmd);
+}
+
 int spc_illegal_op(int host_no, struct scsi_cmd *cmd)
 {
 	dump_cdb(cmd);
diff --git a/usr/spc.h b/usr/spc.h
index 8fe3e3c..bdc3c1f 100644
--- a/usr/spc.h
+++ b/usr/spc.h
 <at>  <at>  -9,6 +9,8  <at>  <at>  extern int spc_start_stop(int host_no, struct scsi_cmd *cmd);
 extern int spc_test_unit(int host_no, struct scsi_cmd *cmd);
 extern int spc_request_sense(int host_no, struct scsi_cmd *cmd);
 extern int spc_illegal_op(int host_no, struct scsi_cmd *cmd);
+extern int persistent_reserve_in(int host_no, struct scsi_cmd *cmd);
+extern int persistent_reserve_out(int host_no, struct scsi_cmd *cmd);
 extern int spc_lu_init(struct scsi_lu *lu);

 typedef int (match_fn_t)(struct scsi_lu *lu, char *params);
diff --git a/usr/tgtd.h b/usr/tgtd.h
index 4febcd3..d2c7135 100644
--- a/usr/tgtd.h
+++ b/usr/tgtd.h
 <at>  <at>  -19,6 +19,11  <at>  <at> 

 #define VENDOR_ID	"IET"

+/* 8 byte reservation key size */
+#define PR_KEY_SZ 8
+/* Number of PR keys we can store at any one time */
+#define PR_RESERVATION_SZ 4
+
 #define _TAB1 "    "
 #define _TAB2 _TAB1 _TAB1
 #define _TAB3 _TAB1 _TAB1 _TAB1
 <at>  <at>  -126,6 +131,12  <at>  <at>  struct mode_pg {
 	uint8_t mode_data[0];	/* Rest of mode page info */
 };

+struct scsi_pr {
+	/* Persistent Reservation Generation */
+	uint32_t PRgeneration;
+	uint8_t pr_key[PR_RESERVATION_SZ][PR_KEY_SZ];
+};
+
 struct scsi_lu {
 	int fd;
 	uint64_t addr; /* persistent mapped address */
 <at>  <at>  -150,6 +161,8  <at>  <at>  struct scsi_lu {
 	uint8_t	mode_block_descriptor[BLOCK_DESCRIPTOR_LEN];
 	struct mode_pg *mode_pgs[0x3f];

+	struct scsi_pr pr;
+
 	struct lu_phy_attr attrs;

 	/* A pointer for each modules private use.
-- 
1.5.6

[PATCH 2/2]
From 68c454d2d7f1b64f9dbce9410e5c2c8500d6ceb3 Mon Sep 17 00:00:00 2001
From: Mark Harvey <markh794@...>
Date: Wed, 20 Aug 2008 14:45:30 +1000
Subject: Add persistent reserve in/out to ssc module

Signed-off-by: Mark Harvey <markh794@...>
---
 usr/ssc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/ssc.c b/usr/ssc.c
index 2630a6a..6dbdc0b 100644
--- a/usr/ssc.c
+++ b/usr/ssc.c
 <at>  <at>  -251,8 +251,8  <at>  <at>  static struct device_type_template ssc_template = {
 		{spc_illegal_op,},
 		{spc_illegal_op,},
 		{spc_illegal_op,},
-		{spc_illegal_op,},
-		{spc_illegal_op,},
+		{persistent_reserve_in,},
+		{persistent_reserve_out,},

 		[0x60 ... 0x7f] = {spc_illegal_op,},

--

-- 
1.5.6
_______________________________________________
Stgt-devel mailing list
Stgt-devel@...
https://lists.berlios.de/mailman/listinfo/stgt-devel
Mark Harvey | 20 Aug 03:38 2008
Picon

[PATCH 2/2] Take 2: Implement smc INITIALIZE ELEMENT STATUS WITH RANGE

commit d8c5617849c15d54c0ebd2efbc9f16161a6f2e56
Author: Mark Harvey <markh794@...>
Date:   Wed Aug 20 10:58:02 2008 +1000

    Implement smc INITIALIZE ELEMENT STATUS WITH RANGE op code as NO-OP

    - Implemented INITIALIZE ELEMENT STATUS WITH RANGE as a No Operation.

    Reported-by: Richard Sharpe <realrichardsharpe@...>
    Signed-off-by: Mark Harvey <markh794@...>

diff --git a/usr/smc.c b/usr/smc.c
index e735deb..ab36e9c 100644
--- a/usr/smc.c
+++ b/usr/smc.c
 <at>  <at>  -225,6 +225,23  <at>  <at>  static int build_element_descriptors(uint8_t *data, struct
list_head *head,
 }

 /**
+ * smc_initialize_element_status with range
+ *                      - INITIALIZE ELEMENT STATUS WITH RANGE op code
+ *
+ * Support the SCSI op code INITIALIZE_ELEMENT_STATUS_WITH_RANGE
+ * Ref: smc3r11, 6.5
+ */
+static int smc_initialize_element_status_range(int host_no, struct scsi_cmd *cm
d)
+{
+       scsi_set_in_resid_by_actual(cmd, 0);
+
+       if (device_reserved(cmd))
+               return SAM_STAT_RESERVATION_CONFLICT;
+       else
+               return SAM_STAT_GOOD;
+}
+
+/**
  * smc_initialize_element_status - INITIALIZE ELEMENT STATUS op code
  *
  * Some backup libraries seem to require this.
 <at>  <at>  -796,7 +813,28  <at>  <at>  struct device_type_template smc_template = {
                {spc_illegal_op,},
                {spc_illegal_op,},

-               [0x20 ... 0x4f] = {spc_illegal_op,},
+               [0x20 ... 0x2f] = {spc_illegal_op,},
+
+               /* 0x30 */
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {smc_initialize_element_status_range,},
+
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+               {spc_illegal_op,},
+
+               [0x40 ... 0x4f] = {spc_illegal_op,},

                /* 0x50 */
                {spc_illegal_op,},
_______________________________________________
Stgt-devel mailing list
Stgt-devel@...
https://lists.berlios.de/mailman/listinfo/stgt-devel
Mark Harvey | 20 Aug 03:08 2008
Picon

[PATCH 1/2] Take 2: Implement smc INITIALIZE ELEMENT STATUS

Added test for SCSI RESERVATION.

Still implemented as a no-op.

(Attached patch due to gmail web mangling whitespaces).

commit de9949ce821ed1bca9d60e8d98ec806c3c80ec6b
Author: Mark Harvey <markh794@...>
Date:   Wed Aug 20 10:48:57 2008 +1000

    Implement smc INITIALIZE ELEMENT STATUS op code as NO-OP

    Re-submit Richard Sharpe's patch in git format

    Added test for reservation.

    Reported-by: Richard Sharpe <realrichardsharpe@...>
    Signed-off-by: Mark Harvey <markh794@...>

diff --git a/usr/smc.c b/usr/smc.c
index 9d7f681..e735deb 100644
--- a/usr/smc.c
+++ b/usr/smc.c
 <at>  <at>  -225,6 +225,24  <at>  <at>  static int build_element_descriptors(uint8_t *data, struct
list_head *head,
 }

 /**
+ * smc_initialize_element_status - INITIALIZE ELEMENT STATUS op code
+ *
+ * Some backup libraries seem to require this.
+ *
+ * Support the SCSI op code INITIALIZE_ELEMENT_STATUS
+ * Ref: smc3r10a, 6.2
+ */
+static int smc_initialize_element_status(int host_no, struct scsi_cmd *cmd)
+{
+       scsi_set_in_resid_by_actual(cmd, 0);
+
+       if (device_reserved(cmd))
+               return SAM_STAT_RESERVATION_CONFLICT;
+       else
+               return SAM_STAT_GOOD;
+}
+
+/**
  * smc_read_element_status  -  READ ELEMENT STATUS op code
  *
  * Support the SCSI op code READ ELEMENT STATUS
 <at>  <at>  -748,7 +766,7  <at>  <at>  struct device_type_template smc_template = {
                {spc_illegal_op,},
                {spc_illegal_op,},
                {spc_illegal_op,},
-               {spc_illegal_op,},
+               {smc_initialize_element_status,},

                {spc_illegal_op,},
                {spc_illegal_op,},
_______________________________________________
Stgt-devel mailing list
Stgt-devel@...
https://lists.berlios.de/mailman/listinfo/stgt-devel
Mark Harvey | 20 Aug 01:09 2008
Picon

vger mailing list

I am a little concerned I am not seeing all email sent to the
stgt@... list.

I have subscribed from both gmail and work email addresses. I have yet
to see an email arrive in my work's inbox (they have aggressive email
filtering and hence may be a different issue)

An attempt to query Majordomo@... to either request a list
of users (message advising functionality disabled) or 'which'
   ========================
>>>> which
The string 'mark_harvey@...' appears in the following entries
in lists served by Majordomo@...:
**** No matches found
   ========================
>>>> which
The string 'markh794@...' appears in the following
entries in lists served by Majordomo@...:
**** No matches found
   ========================

To date, I have submitted a couple of patches. I know at least one was
seen by Richard Sharpe (as he commented)..

I subscribed using a netscape email address, and have seen nothing
arrive at that address either. In fact, the only email I've seen
arrive at the netscape address was an incorrect posting of "[PATCH
2/2] Implement smc INITIALIZE ELEMENT STATUS WITH RANGE" to the old
stgt-devel@... (which I re-sent to vger list a few hrs
later when I realised my mistake).

Cheers
Mark
Mark Harvey | 19 Aug 01:47 2008
Picon

[PATCH 2/2] Implement smc INITIALIZE ELEMENT STATUS WITH RANGE

From 6ea07a536dcc3fe89f11d46bfadd3cafca75c911 Mon Sep 17 00:00:00 2001
From: Mark Harvey <markh794@...>
Date: Tue, 19 Aug 2008 09:41:47 +1000
Subject: Implement smc INITIALIZE ELEMENT STATUS WITH RANGE as NO-OP

Signed-off-by: Mark Harvey <markh794@...>
---
 usr/smc.c |   39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/usr/smc.c b/usr/smc.c
index a04e905..d2dda4f 100644
--- a/usr/smc.c
+++ b/usr/smc.c
 <at>  <at>  -225,6 +225,22  <at>  <at>  static int build_element_descriptors(uint8_t *data, struct list_head *head,
 }

 /**
+ * smc_initialize_element_status with range
+ *                      - INITIALIZE ELEMENT STATUS WITH RANGE op code
+ *
+ * Support the SCSI op code INITIALIZE_ELEMENT_STATUS_WITH_RANGE
+ * Ref: smc3r11, 6.5
+ */
+static int smc_initialize_element_status_range(int host_no, struct scsi_cmd *cmd)
+{
+	/*
+	 * Should do some error checking here ... the spec says some stuff
+	 * about having a reservation
+	 */
+	return SAM_STAT_GOOD;
+}
+
+/**
  * smc_initialize_element_status - INITIALIZE ELEMENT STATUS op code
  *
  * Some backup libraries seem to require this.
 <at>  <at>  -795,7 +811,28  <at>  <at>  struct device_type_template smc_template = {
 		{spc_illegal_op,},
 		{spc_illegal_op,},

-		[0x20 ... 0x4f] = {spc_illegal_op,},
+		[0x20 ... 0x2f] = {spc_illegal_op,},
+
+		/* 0x30 */
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{smc_initialize_element_status_range,},
+
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+		{spc_illegal_op,},
+
+		[0x40 ... 0x4f] = {spc_illegal_op,},

 		/* 0x50 */
 		{spc_illegal_op,},
--

-- 
1.5.4.3
Richard Sharpe | 17 Aug 21:33 2008
Picon

SSC Changes that allow BakBone NetVault to work ...

Hi,

Attached are the diffs for my current SSC implementation. These
changes, along with the diffs I posted for SMC, allow BakBone to work,
to see a Tape Library, and to backup to tapes in the library.

There are undoubtedly many problems with the code, not the least of
which is that it is pretty ugly :-)

One thing I note is that the latest drafts of SSC and SMC support the
READ_ATTRIBUTES command, with SMC allowing the reading of attributes
from tapes in media slots. Thus, the current ssc.h definitions for MAM
seem incomplete. I would suggest a common set of routines for dealing
MAM in bot SSC and SMC.
Attachment (ssc.h.diff): application/octet-stream, 1098 bytes
Attachment (ssc.c.diff): application/octet-stream, 7023 bytes
Attachment (bs_ssc.c.diff): application/octet-stream, 20 KiB
_______________________________________________
Stgt-devel mailing list
Stgt-devel@...
https://lists.berlios.de/mailman/listinfo/stgt-devel

Gmane