aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2011-08-09 08:18:01 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-03 11:40:24 -0700
commit38702e860531aa7057fde32dc6e0a3ee3a7b5c69 (patch)
tree97e272904e674d0ee9bff5ad49c75432c156050e /drivers
parent14e09ccdeed3b3b0c173475c323903d9cb1a5b13 (diff)
downloadkernel_samsung_crespo-38702e860531aa7057fde32dc6e0a3ee3a7b5c69.zip
kernel_samsung_crespo-38702e860531aa7057fde32dc6e0a3ee3a7b5c69.tar.gz
kernel_samsung_crespo-38702e860531aa7057fde32dc6e0a3ee3a7b5c69.tar.bz2
hpsa: fix physical device lun and target numbering problem
commit 01350d05539d1c95ef3568d062d864ab76ae7670 upstream. If a physical device exposed to the OS by hpsa is replaced (e.g. one hot plug tape drive is replaced by another, or a tape drive is placed into "OBDR" mode in which it acts like a CD-ROM device) and a rescan is initiated, the replaced device will be added to the SCSI midlayer with target and lun numbers set to -1. After that, a panic is likely to ensue. When a physical device is replaced, the lun and target number should be preserved. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/hpsa.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 30826d9..78c2e20 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -676,6 +676,16 @@ static void hpsa_scsi_replace_entry(struct ctlr_info *h, int hostno,
BUG_ON(entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA);
removed[*nremoved] = h->dev[entry];
(*nremoved)++;
+
+ /*
+ * New physical devices won't have target/lun assigned yet
+ * so we need to preserve the values in the slot we are replacing.
+ */
+ if (new_entry->target == -1) {
+ new_entry->target = h->dev[entry]->target;
+ new_entry->lun = h->dev[entry]->lun;
+ }
+
h->dev[entry] = new_entry;
added[*nadded] = new_entry;
(*nadded)++;