Skip to contentSkip to conversation

dm-raid: Do not call BUG() in __rdev_sectors()

PATCH Superseded Hannes Reinecke 2 participants 3 messages Jun 28, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-raid: Do not call BUG() in __rdev_sectors()

__rdev_sectors() might be called for an invalid/non-existing RAID set during raid_ctr(), which is perfectly fine and no reason to panic.

---
 drivers/md/dm-raid.c          | 3 ++-
 drivers/scsi/pmcraid.c        | 2 +-
 drivers/scsi/qla4xxx/ql4_os.c | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/md/dm-raid.c +2 -1
index 7d89322..9bbb596 100644
@@ -1571,7 +1571,8 @@ static sector_t __rdev_sectors(struct raid_set *rs)
 			return rdev->sectors;
 	}
 
-	BUG(); /* Constructor ensures we got some. */
+	/* No valid raid devices */
+	return 0;
 }
 
 /* Calculate the sectors per device and per array used for @rs */
drivers/scsi/pmcraid.c +1 -1
index 56928d6..4b66b92 100644
@@ -3089,7 +3089,7 @@ static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd)
 /**
  * pmcraid_eh_host_reset_handler - adapter reset handler callback
  *
- * @scmd: pointer to scsi_cmd that was sent to a resource of adapter
+ * @shost: pointer to scsi_host
  *
  * Initiates adapter reset to bring it up to operational state
  *
drivers/scsi/qla4xxx/ql4_os.c +1 -1
index 5d55de5..11bd2da 100644
@@ -9367,7 +9367,7 @@ static int qla4xxx_is_eh_active(struct Scsi_Host *shost)
 
 /**
  * qla4xxx_eh_host_reset - kernel callback
- * @cmd: Pointer to Linux's SCSI command structure
+ * @host: Pointer to Linux's SCSI host structure
  *
  * This routine is invoked by the Linux kernel to perform fatal error
  * recovery on the specified adapter.
Signature · 1 line
1.8.5.6
#1 lore raw
Quoted 9 lines · Hannes Reinecke

__rdev_sectors() might be called for an invalid/non-existing RAID set during raid_ctr(), which is perfectly fine and no reason to panic.

---
 drivers/md/dm-raid.c          | 3 ++-
 drivers/scsi/pmcraid.c        | 2 +-
 drivers/scsi/qla4xxx/ql4_os.c | 2 +-

Ahm, accidential git commit -a?

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#2 lore raw
In reply to Hannes Reinecke
Quoted 11 lines · Hannes Reinecke

__rdev_sectors() might be called for an invalid/non-existing RAID set during raid_ctr(), which is perfectly fine and no reason to panic.

---
 drivers/md/dm-raid.c          | 3 ++-
 drivers/scsi/pmcraid.c        | 2 +-
 drivers/scsi/qla4xxx/ql4_os.c | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

Gnaa. Those bits shouldn't be here.
Will be resending.

Cheers,

Hannes

Signature · 10 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel