Blob Blame History Raw
From: Hannes Reinecke <hare@suse.de>
Subject: aacraid: Add module param to export disks as 'fixed'
Patch-mainline: Never, compability with Netware
References: bnc#667226

aacraid: Add 'aac_export_fixed' module param to export disks as
'fixed' instead of 'removable'.

Adaptec controllers set the removable flag on devices to
allow for reconfiguration. The fear is that _not_ setting this
flag would inhibit the OS from detecting any device reconfiguration.

This manifested itself in a bug where Paravirtualized NetWare
was not able to boot with more than one PHY disk attached to a Xen
VM. NetWare sees two removable disks (and not CD-ROM), which is
an unsupported configuration.

The module parameter allows overriding that flag.

This patch was not accepted by upstream. The corresponding change
there will make this a default behavior, instead of having this
module parameter.

NOTE: Should be dropped for SLES13.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Ankit Jain <jankit@suse.de>
---
 drivers/scsi/aacraid/aachba.c  | 15 +++++++++++----
 drivers/scsi/aacraid/aacraid.h |  1 +
 drivers/scsi/aacraid/linit.c   |  2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index e4c2437..8320ea4 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -315,6 +315,11 @@ MODULE_PARM_DESC(wwn, "Select a WWN type for the arrays:\n"
 	"\t1 - Array Meta Data Signature (default)\n"
 	"\t2 - Adapter Serial Number");
 
+int aac_export_fixed;
+module_param_named(export_fixed, aac_export_fixed, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(export_fixed, "Export disks as 'fixed' instead of"
+		 " removable.");
+
 
 static inline int aac_valid_context(struct scsi_cmnd *scsicmd,
 		struct fib *fibptr) {
@@ -2539,8 +2544,9 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 			scsi_set_resid(scsicmd,
 				       scsi_bufflen(scsicmd) - alloc_len);
 
-		/* Do not cache partition table for arrays */
-		scsicmd->device->removable = 1;
+		if (!aac_export_fixed)
+			/* Do not cache partition table for arrays */
+			scsicmd->device->removable = 1;
 
 		scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
 		scsicmd->scsi_done(scsicmd);
@@ -2568,8 +2574,9 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 		cp[6] = (fsa_dev_ptr[cid].block_size >> 8) & 0xff;
 		cp[7] = (fsa_dev_ptr[cid].block_size) & 0xff;
 		scsi_sg_copy_from_buffer(scsicmd, cp, sizeof(cp));
-		/* Do not cache partition table for arrays */
-		scsicmd->device->removable = 1;
+		if (!aac_export_fixed)
+			/* Do not cache partition table for arrays */
+			scsicmd->device->removable = 1;
 		scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 |
 		  SAM_STAT_GOOD;
 		scsicmd->scsi_done(scsicmd);
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 074878b..409f2cf 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2173,3 +2173,4 @@ extern int aac_commit;
 extern int update_interval;
 extern int check_interval;
 extern int aac_check_reset;
+extern int aac_export_fixed;
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 3b6e5c6..017093b 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -402,7 +402,7 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
 static int aac_slave_configure(struct scsi_device *sdev)
 {
 	struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata;
-	if (aac->jbod && (sdev->type == TYPE_DISK))
+	if (!aac_export_fixed && aac->jbod && (sdev->type == TYPE_DISK))
 		sdev->removable = 1;
 	if ((sdev->type == TYPE_DISK) &&
 			(sdev_channel(sdev) != CONTAINER_CHANNEL) &&
-- 
1.8.5.6