Fix iprinit dual initiator failover device rescanning code

This commit is contained in:
brking 2007-05-01 21:56:18 +00:00
commit 949967e7ea
4 changed files with 39 additions and 20 deletions

View file

@ -10,7 +10,7 @@
*/
/*
* $Header: /cvsroot/iprdd/iprutils/iprlib.c,v 1.114 2007/04/26 13:32:30 brking Exp $
* $Header: /cvsroot/iprdd/iprutils/iprlib.c,v 1.115 2007/05/01 21:56:18 brking Exp $
*/
#ifndef iprlib_h
@ -678,13 +678,7 @@ static const struct ioa_details *get_ioa_details(struct ipr_ioa *ioa)
int ipr_improper_device_type(struct ipr_dev *dev)
{
struct ipr_ioa *ioa = dev->ioa;
if (ioa->is_secondary && !ioa->was_secondary &&
ipr_is_af_dasd_device(dev) && dev->scsi_dev_data)
return 1;
if (!ioa->is_secondary && ioa->was_secondary &&
ipr_is_af_dasd_device(dev) && !dev->scsi_dev_data)
if (dev->rescan)
return 1;
if (!dev->scsi_dev_data)
return 0;
@ -1176,6 +1170,8 @@ static int same_ioa(struct ipr_ioa *first, struct ipr_ioa *second)
static int same_scsi_dev(struct scsi_dev_data *first, struct scsi_dev_data *second)
{
if (!first || !second)
return 0;
if (first->host != second->host)
return 0;
if (first->channel != second->channel)
@ -1188,8 +1184,6 @@ static int same_scsi_dev(struct scsi_dev_data *first, struct scsi_dev_data *seco
return 0;
if (first->online != second->online)
return 0;
if (first->handle != second->handle)
return 0;
if (strcmp(first->vendor_id, second->vendor_id))
return 0;
if (strcmp(first->product_id, second->product_id))
@ -1203,15 +1197,32 @@ static int same_scsi_dev(struct scsi_dev_data *first, struct scsi_dev_data *seco
return 1;
}
static int same_dev_rcd(struct ipr_dev_record *first, struct ipr_dev_record *second)
{
if (memcmp(&first->resource_addr, &second->resource_addr,
sizeof(first->resource_addr)))
return 0;
if (memcmp(first->vendor_id, second->vendor_id, IPR_VENDOR_ID_LEN))
return 0;
if (memcmp(first->product_id, second->product_id, IPR_PROD_ID_LEN))
return 0;
if (memcmp(first->serial_num, second->serial_num, IPR_SERIAL_NUM_LEN))
return 0;
return 1;
}
static int same_dev(struct ipr_dev *first, struct ipr_dev *second)
{
if (strcmp(first->dev_name, second->dev_name))
return 0;
if (strcmp(first->gen_name, second->gen_name))
return 0;
if (!first->scsi_dev_data || !second->scsi_dev_data)
return 0;
if (!same_scsi_dev(first->scsi_dev_data, second->scsi_dev_data))
if (!first->scsi_dev_data && !second->scsi_dev_data) {
if (!ipr_is_af_dasd_device(first) || !ipr_is_af_dasd_device(second))
return 0;
if (!same_dev_rcd(first->dev_rcd, second->dev_rcd))
return 0;
} else if (!same_scsi_dev(first->scsi_dev_data, second->scsi_dev_data))
return 0;
return 1;
}
@ -1234,6 +1245,12 @@ static void resolve_dev(struct ipr_dev *new, struct ipr_dev *old)
new->init_not_allowed = !dev_init_allowed(new);
if (!old->init_not_allowed || new->init_not_allowed)
new->should_init = 0;
if (new->ioa->is_secondary && !old->ioa->is_secondary &&
ipr_is_af_dasd_device(new) && new->scsi_dev_data)
new->rescan = 1;
if (!new->ioa->is_secondary && old->ioa->is_secondary &&
ipr_is_af_dasd_device(new) && !new->scsi_dev_data)
new->rescan = 1;
}
static void resolve_ioa(struct ipr_ioa *ioa, struct ipr_ioa *old_ioa)
@ -1241,13 +1258,13 @@ static void resolve_ioa(struct ipr_ioa *ioa, struct ipr_ioa *old_ioa)
struct ipr_dev *dev, *old_dev;
ioa->should_init = 0;
ioa->was_secondary = old_ioa->is_secondary;
for_each_dev(ioa, dev) {
for_each_dev(old_ioa, old_dev) {
if (!same_dev(dev, old_dev))
continue;
memcpy(&dev->attr, &old_dev->attr, sizeof(dev->attr));
dev->rescan = old_dev->rescan;
resolve_dev(dev, old_dev);
break;
}
@ -1261,7 +1278,6 @@ static void resolve_old_config()
for_each_ioa(ioa) {
ioa->should_init = 1;
ioa->was_secondary = 0;
for_each_dev(ioa, dev)
dev->should_init = 1;
}
@ -6015,6 +6031,7 @@ static int fixup_improper_devs(struct ipr_ioa *ioa)
if (!dev->local_flag)
continue;
dev->local_flag = 0;
dev->rescan = 0;
ipr_for_each_unique_ra(dev, ipr_scan_ra);
}

View file

@ -12,7 +12,7 @@
*/
/*
* $Header: /cvsroot/iprdd/iprutils/iprlib.h,v 1.97 2007/04/26 13:32:30 brking Exp $
* $Header: /cvsroot/iprdd/iprutils/iprlib.h,v 1.98 2007/05/01 21:56:18 brking Exp $
*/
#include <stdarg.h>
@ -1102,6 +1102,7 @@ struct ipr_dev {
u32 should_init:1;
u32 init_not_allowed:1;
u32 local_flag:1;
u32 rescan:1;
struct scsi_dev_data *scsi_dev_data;
struct ipr_dev *ses[IPR_DEV_MAX_PATHS];
struct ipr_res_addr res_addr[IPR_DEV_MAX_PATHS];
@ -1141,7 +1142,6 @@ struct ipr_ioa {
u8 scsi_id_changeable:1;
u8 dual_raid_support:1;
u8 is_secondary:1;
u8 was_secondary:1;
u8 should_init:1;
u8 is_aux_cache:1;
u8 protect_last_bus:1;

View file

@ -1,6 +1,6 @@
Summary: Utilities for the IBM Power Linux RAID adapters
Name: iprutils
Version: 2.2.5
Version: 2.2.5.cvs
Release: 1
License: CPL
Group: System Environment/Base
@ -60,6 +60,8 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/ha.d/resource.d/iprha
%changelog
* Tue May 1 2007 Brian King <brking@us.ibm.com>
- Fix iprinit dual initiator failover device rescanning code.
* Wed Apr 25 2007 Brian King <brking@us.ibm.com>
- Add iprha init.d script to enable/disable primary adapter mode
for dual initiator configs.

View file

@ -6,9 +6,9 @@
IPR_MAJOR_RELEASE=2
IPR_MINOR_RELEASE=2
IPR_FIX_LEVEL=5
IPR_FIX_LEVEL=5.cvs
IPR_RELEASE=1
IPR_FIX_DATE=(April 26, 2007)
IPR_FIX_DATE=(May 1, 2007)
IPR_VERSION_STR=$(IPR_MAJOR_RELEASE).$(IPR_MINOR_RELEASE).$(IPR_FIX_LEVEL) $(IPR_FIX_DATE)