All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Bogdanov <d.bogdanov@yadro.com>
To: Martin Petersen <martin.petersen@oracle.com>,
	<target-devel@vger.kernel.org>
Cc: Mike Christie <michael.christie@oracle.com>,
	<linux-scsi@vger.kernel.org>, <linux@yadro.com>,
	Dmitry Bogdanov <d.bogdanov@yadro.com>
Subject: [PATCH v2 0/5] scsi: target: make RTPI an TPG identifier
Date: Thu, 6 Oct 2022 13:50:52 +0300	[thread overview]
Message-ID: <20221006105057.30184-1-d.bogdanov@yadro.com> (raw)

SAM-5 4.6.5.2 (Relative Port Identifier attribute) defines the attribute
as unique across SCSI target ports:
 The Relative Port Identifier attribute identifies a SCSI target port or
 a SCSI initiator port relative to other SCSI ports in a SCSI target
 device and any SCSI initiator devices contained within that SCSI target
 device. A SCSI target device may assign relative port identifiers to
 its SCSI target ports and any SCSI initiator ports. If relative port
 identifiers are assigned, the SCSI target device shall assign each of
 its SCSI target ports and any SCSI initiator ports a unique relative
 port identifier from 1 to 65 535. SCSI target ports and SCSI initiator
 ports share the same number space.

In the current TCM implementation, auto-incremented lun_rtpi weakly
follows the model outlined by SAM-5 and SPC-4. In case of multiple SCSI
target ports (se_portal_group's), which is common to scenario with
multiple HBAs or multiple iSCSI/FC targets, it's possible to have two
backstores (se_device's) with different values of lun_rtpi on the same
SCSI target port.

Similar issue happens during re-export. If a LUN of a backstore is
removed from a target port and added again to the same target port, RTPI
is incremented again and will be different from the first time.

The two issues happen because each se_device increments RTPI for its own
LUNs independently.

The behaviour means that a SCSI application client can't reliably make any
sense of RTPI values reported by a LUN as it's not really related to SCSI
target ports. A conforming target implementation must ensure that RTPI field is
unique per port. The patchset resolves the issue.

Make RTPI be part of se_tpg instead of se_lun. Make it configurable.

Changelog:
  v2:
    use XArray for tracking RTPI instead of linked list
    do not allow to change RTPI on enabled target port
    drop not needed patches

Dmitry Bogdanov (2):
  scsi: target: core: Add RTPI field to target port
  scsi: target: core: Add RTPI attribute for target port

Roman Bolshakov (3):
  scsi: target: core: Use RTPI from target port
  scsi: target: core: Drop device-based RTPI
  scsi: target: core: Add common port attributes

 drivers/target/target_core_alua.c            |  4 +-
 drivers/target/target_core_configfs.c        |  9 +-
 drivers/target/target_core_device.c          | 43 +--------
 drivers/target/target_core_fabric_configfs.c | 44 +++++++--
 drivers/target/target_core_internal.h        |  3 +-
 drivers/target/target_core_pr.c              |  8 +-
 drivers/target/target_core_spc.c             |  2 +-
 drivers/target/target_core_stat.c            |  6 +-
 drivers/target/target_core_tpg.c             | 98 ++++++++++++++++++--
 include/target/target_core_base.h            |  6 +-

-- 
2.25.1


             reply	other threads:[~2022-10-06 10:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 10:50 Dmitry Bogdanov [this message]
2022-10-06 10:50 ` [PATCH v2 1/5] scsi: target: core: Add RTPI field to target port Dmitry Bogdanov
2022-10-17  7:38   ` Christoph Hellwig
2022-10-19 14:21     ` Dmitry Bogdanov
2022-10-06 10:50 ` [PATCH v2 2/5] scsi: target: core: Use RTPI from " Dmitry Bogdanov
2022-10-17  7:39   ` Christoph Hellwig
2022-10-06 10:50 ` [PATCH v2 3/5] scsi: target: core: Drop device-based RTPI Dmitry Bogdanov
2022-10-17  7:39   ` Christoph Hellwig
2022-10-06 10:50 ` [PATCH v2 4/5] scsi: target: core: Add common port attributes Dmitry Bogdanov
2022-10-17  7:42   ` Christoph Hellwig
2022-10-19 15:13     ` Dmitry Bogdanov
2022-10-06 10:50 ` [PATCH v2 5/5] scsi: target: core: Add RTPI attribute for target port Dmitry Bogdanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221006105057.30184-1-d.bogdanov@yadro.com \
    --to=d.bogdanov@yadro.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux@yadro.com \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.