mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: LKML <linux-kernel@vger.kernel.org>,
	linux-scsi <linux-scsi@vger.kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mike Christie <michaelc@cs.wisc.edu>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	Hannes Reinecke <hare@suse.de>
Subject: [PATCH 2/2] [Target_Core_Mod/Persistent_Reservations]: Allow non WRITE CDBs from unregistered initiators
Date: Tue, 17 Mar 2009 18:50:45 -0700	[thread overview]
Message-ID: <1237341045.4214.53.camel@haakon2.linux-iscsi.org> (raw)

>From 669b1b2d3d69a5a31eae803f85baa1fe4295b190 Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@linux-iscsi.org>
Date: Tue, 17 Mar 2009 16:34:38 -0700
Subject: [PATCH 2/2] [Target_Core_Mod/Persistent_Reservations]: Allow non WRITE CDBs from unregistered initiators

This patch allows unregistered initiators to issue non WRITE CDBs when a PR_TYPE_WRITE_EXCLUSIVE,
PR_TYPE_WRITE_EXCLUSIVE_REGONLY or PR_TYPE_WRITE_EXCLUSIVE_ALLREG reservation is held for a
given Logical Unit.

Previously we expected initiators to PROUT REGISTER before allowing a LUN to accept any CDBs beyond
the explictly allowed CDBs list (as defined by spc4r17, table 45) when a reservation was held by
another initiator port in core_scsi3_pr_seq_non_holder().

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 drivers/lio-core/target_core_pr.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/lio-core/target_core_pr.c b/drivers/lio-core/target_core_pr.c
index a76535f..82dde64 100644
--- a/drivers/lio-core/target_core_pr.c
+++ b/drivers/lio-core/target_core_pr.c
@@ -191,6 +191,8 @@ static int core_scsi3_pr_seq_non_holder(
 		 * Some commands are only allowed for the persistent reservation
 		 * holder.
 		 */
+		if (se_deve->deve_flags & DEF_PR_REGISTERED)
+			registered_nexus = 1;
 		break;
 	case PR_TYPE_WRITE_EXCLUSIVE_REGONLY:
 		we = 1;
@@ -350,14 +352,22 @@ static int core_scsi3_pr_seq_non_holder(
 				" to %s reservation\n", cdb[0],
 				core_scsi3_pr_dump_type(pr_reg_type));
 			return 1;
-		} else if (registered_nexus) {
+		} else {
 			/*
-			 * Allow non WRITE CDBs for PR_*_REG_ONLY and
-			 * PR_*_ALL_REG to pass for registered_nexuxes.
+			 * Allow non WRITE CDBs for all Write Exclusive
+			 * PR TYPEs to pass for registered and
+			 * non-registered_nexuxes NOT holding the reservation.
+			 *
+			 * We only make noise for the unregisterd nexuses,
+			 * as we expect registered non-reservation holding
+			 * nexuses to issue CDBs.
 			 */
-			printk(KERN_INFO "Allowing implict CDB: 0x%02x for %s"
-				" reservation\n", cdb[0],
-				core_scsi3_pr_dump_type(pr_reg_type));
+			if (!(registered_nexus)) {
+				printk(KERN_INFO "Allowing implict CDB: 0x%02x"
+					" for %s reservation on unregistered"
+					" nexus\n", cdb[0],
+					core_scsi3_pr_dump_type(pr_reg_type));
+			}
 			return 0;
 		}
 	} else if (all_reg) {
-- 
1.5.4.1





                 reply	other threads:[~2009-03-18  1:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1237341045.4214.53.camel@haakon2.linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=hare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michaelc@cs.wisc.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome