Steven Allen | 24 Oct 23:43 2014

[PATCH] target: return CONFLICT only when SA key unmatched

PREEMPT (and PREEMPT AND ABORT) should return CONFLICT iff a specified
SERVICE ACTION RESERVATION KEY is specified and matches no existing
persistent reservation.

Without this patch, a PREEMPT will return CONFLICT if either all
reservations are held by the initiator (self preemption) or there is
nothing to preempt. According to the spec, both of these cases should
 drivers/target/target_core_pr.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 3013287..a88f040 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
 <at>  <at>  -2758,7 +2758,8  <at>  <at>  core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
 	struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder;
 	struct t10_reservation *pr_tmpl = &dev->t10_pr;
 	u32 pr_res_mapped_lun = 0;
-	int all_reg = 0, calling_it_nexus = 0, released_regs = 0;
+	int all_reg = 0, calling_it_nexus = 0;
+	bool sa_res_key_unmatched = sa_res_key != 0;
 	int prh_type = 0, prh_scope = 0;

 	if (!se_sess)
 <at>  <at>  -2833,6 +2834,7  <at>  <at>  core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
 			if (!all_reg) {
 				if (pr_reg->pr_res_key != sa_res_key)
(Continue reading)

Nicholas A. Bellinger | 24 Oct 08:02 2014


Hey Or & Sagi,

Quick CMA related question for you..

I've been hitting the following NULL pointer dereference during reboot
using a v3.14.y based kernel with Sagi's latest ib_isert fixes in the
stable-queue from v3.17.

Note this system was not performing /etc/init.d/target stop during
reboot to take down the configfs layout, and no actual iser logins or
sessions had been previously established on iser enabled network portal
in question:

[info] Will now restart.
[  111.076328] kvm: exiting hardware virtualization
[  111.083670] sd 9:0:3:0: [sdi] Synchronizing SCSI cache
[  111.089825] sd 9:0:2:0: [sdh] Synchronizing SCSI cache
[  111.095924] sd 9:0:1:0: [sdg] Synchronizing SCSI cache
[  111.103375] sd 9:0:0:0: [sdf] Synchronizing SCSI cache
[  111.109707] sd 8:0:3:0: [sde] Synchronizing SCSI cache
[  111.116036] sd 8:0:2:0: [sdd] Synchronizing SCSI cache
[  111.122368] sd 8:0:1:0: [sdc] Synchronizing SCSI cache
[  111.128723] sd 8:0:0:0: [sdb] Synchronizing SCSI cache
[  111.134979] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[  111.273440] isert_cma_handler: event 11 status 0 conn ffff880815896000 id ffff88101440d400
[  111.282871] isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[  111.290808] BUG: unable to handle kernel NULL pointer dereference at           (null)
[  111.299886] IP: [<          (null)>]           (null)
[  111.305736] PGD 10186c6067 PUD 1016d84067 PMD 0 
[  111.311271] Oops: 0010 [#1] SMP 
(Continue reading)

Sagi Grimberg | 19 Oct 17:05 2014

[PATCH] srp-target: Rertry when QP creation fails with ENOMEM

From: Bart Van Assche <bvanassche <at>>

Retry with srp_sq_size/2.

Reported-by: Mark Lehrer <lehrer <at>>
Signed-off-by: Bart Van Assche <bvanassche <at>>
Signed-off-by: Sagi Grimberg <sagig <at>>
 drivers/infiniband/ulp/srpt/ib_srpt.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index d28a8c2..d1042eb 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
 <at>  <at>  -2092,6 +2092,7  <at>  <at>  static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
 	if (!qp_init)
 		goto out;

 	ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch,
 			      ch->rq_size + srp_sq_size, 0);
 	if (IS_ERR(ch->cq)) {
 <at>  <at>  -2115,6 +2116,13  <at>  <at>  static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
 	ch->qp = ib_create_qp(sdev->pd, qp_init);
 	if (IS_ERR(ch->qp)) {
 		ret = PTR_ERR(ch->qp);
+		if (ret == -ENOMEM) {
+			srp_sq_size /= 2;
+			if (srp_sq_size >= MIN_SRPT_SQ_SIZE) {
(Continue reading)

Rufe Glick | 15 Oct 22:48 2014

Inconsistencies in boolean parameter settings of targetcli

Hello all,

Just a feedback of a newcomer to the targetcli.

Some boolean parameters accept true or false, e.g. 'set global
auto_cd_after_create=true|false'; while other boolean parameters
accept 0 or 1, e.g. 'set attribute authentication=1|0'.

It doesn't bother me much, but it would be nice to eliminate these
inconsistencies. That'll make overall user experience a bit more
smooth and consistent.

The other thing of the same nature is paramter naming. Some of them
come with underscores, e.g. 'set global auto_cd_after_create' and
friends; while others come in camel case, e.g. 'set parameter

Steven Allen | 15 Oct 19:59 2014

[PATCH] iscsi-target: return the correct port in SendTargets

The fact that a target is published on the any address has no bearing on
which port(s) it is published. SendTargets should always send the
portal's port, not the port used for discovery.
 drivers/target/iscsi/iscsi_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 260c3e1..ad85abe 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
 <at>  <at>  -3491,7 +3491,7  <at>  <at>  iscsit_build_sendtargets_response(struct iscsi_cmd *cmd,
 				len = sprintf(buf, "TargetAddress="
 					inaddr_any ? conn->local_ip : np->np_ip,
-					inaddr_any ? conn->local_port : np->np_port,
+					np->np_port,
 				len += 1;



Jerome Martin | 15 Oct 18:51 2014

Re: CDROM not recognised: 'Device is not a TYPE_DISK block device'

On 10/15/2014 06:21 PM, Andrew Watt wrote:
> Hi Jerome,
>  > Could you please give me the rtslib and targetcli versions you are
> using so I can take a look at the code?
> If only life were so easy:
> /> version
> Cannot find configshell version. The configshell package has probably
> not been built properly from either the git repository or a public tarball.
> Cannot find rtslib version. The rtslib package has probably not been
> built properly from either the git repository or a public tarball.
> Cannot find targetcli version. The targetcli package has probably not
> been built properly from either the git repository or a public tarball.
> I installed targetcli from the Ubuntu repositories (apt-get install
> targetcli), so I *think* that I'm using version 2.1-1 or targetcli
> (, and version 2.2-1 or
> rtslib (, but I could be
> wrong. There are several Python directories on this server (2.7, 3,
> 3.4), but firing up the Python interpreter brings me into Python 2.7.6.
> HTH,
> a.

Mmmmh. OK.
I guess I should have a word or two with the Ubuntu package maintainer.

Thanks for the info!
Andrew Watt | 15 Oct 14:11 2014

CDROM not recognised: 'Device is not a TYPE_DISK block device'

 Hello all,

I'm having a problem creating an iblock backstore from the CDROM drive in my HP Microserver.

The command:

create name=cdrom dev=/dev/sr0

Will return the following error:

Generating a wwn serial.
Device is not a TYPE_DISK block device.

I have been able to create a pscsi backstore to this device, and I can access it from my Windows 7 laptop,
although it can get confused and lock the drive tray if I mount it within the server - which is why I'm trying
the iblock configuration.

This behaviour is for a TSST Corp CDDVDW SH-24DBSCSI CDRom in a HP Microserver N54, with a clean install of
Ubuntu 14.04 server, and targetcli.

Any help would be greatly appreciated.

Thanks in advance,
Suresh Babu Kandukuru | 15 Oct 08:16 2014

LIO filter driver to tap the data

Hi Group , I  need to write a LIO target driver which can tap all the incoming Data for a target lun and  give
one copy of that data to one of user space process in same machine of target lun. I have the LIO code with me . I
have chosen the FILEIO as back store . I have to tap all data coming into this target file and give that user
space process. Highly appreciate  any pointers , link or material on this topic . Thanks in advance.

Roland Dreier | 14 Oct 23:16 2014

[PATCH] target: Don't call TFO->write_pending if data_length == 0

From: Roland Dreier <roland <at>>

If an initiator sends a zero-length command (e.g. TEST UNIT READY) but
sets the transfer direction in the transport layer to indicate a
data-out phase, we still shouldn't try to transfer data.  At best it's
a NOP, and depending on the transport, we might crash on an
uninitialized sg list.

Reported-by: Craig Watson <craig.watson <at>>
Signed-off-by: Roland Dreier <roland <at>>
 drivers/target/target_core_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 7fa62fc93e0b..f7e659bd11ea 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
 <at>  <at>  -2296,7 +2296,7  <at>  <at>  transport_generic_new_cmd(struct se_cmd *cmd)
 	 * and let it call back once the write buffers are ready.
-	if (cmd->data_direction != DMA_TO_DEVICE) {
+	if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) {
 		return 0;


(Continue reading)

Rufe Glick | 14 Oct 05:37 2014

What does cache_dynamic_acls parameter do?

Hello all,

I'm just starting to learn the targetcli. Examples on internet that
set up 'TPG demo mode' along with authentication=0,
generate_noide_acls=1 and demo_mode_write_protect=0 parameters use
cache_dynamic_acls=1. I figured what the first three parameters do,
but I can't find information on the fourth - cache_dynamic_acls. Can
someone please explain me what does that parameter do. Also what are
dynamic acls?

Another question -- is there any better documentation available for
targetcli? I found the man page for targetcli version 2.1.fb34-1 that
comes with CentOS 7 pretty scanty. The man page from github repository
( is a
bit better, but still doesn't thoroughly describe all available
configuration parameters.

Rickard Strandqvist | 12 Oct 19:55 2014

[PATCH] target: iscsi: iscsi_target_tpg.c: Cleaning up possible size overwriting in conjunction with sprintf

Changed same snprintf and sprintf to strlcpy and strlcat.
This will guarantee that the string size is not overwritten,
and they are significantly faster than sprintf also.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist <at>>
 drivers/target/iscsi/iscsi_target_tpg.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
index c3cb5c1..6fc8bfe 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
 <at>  <at>  -608,7 +608,6  <at>  <at>  int iscsit_tpg_set_initiator_node_queue_depth(
 int iscsit_ta_authentication(struct iscsi_portal_group *tpg, u32 authentication)
 	unsigned char buf1[256], buf2[256], *none = NULL;
-	int len;
 	struct iscsi_param *param;
 	struct iscsi_tpg_attrib *a = &tpg->tpg_attrib;

 <at>  <at>  -626,34 +625,33  <at>  <at>  int iscsit_ta_authentication(struct iscsi_portal_group *tpg, u32 authentication)
 		return -EINVAL;

 	if (authentication) {
-		snprintf(buf1, sizeof(buf1), "%s", param->value);
+		strlcpy(buf1, param->value, sizeof(buf1));
 		none = strstr(buf1, NONE);
 		if (!none)
 			goto out;
(Continue reading)