iprutils: fix wrong secondary status
In some scenarios the adapters can be wrongly identified as secondaries, despite the fact that they are not connected to other adapters. The function get_dual_ioa_state() relies on the information from the cur_state field of the ipr_dual_ioa_entry struct to set the is_secondary flag, even though the query multiple adapter status returns 0 as the number of multiple adapter entries. In this case, if we use the ioa_entry struct we can wrongly change the is_secondary flag. This patch fix this issue by not changing the default multi adapter configuration when the number of multiple adapter entries is 0. Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
This commit is contained in:
parent
7801347ad0
commit
d60f920fd8
1 changed files with 9 additions and 8 deletions
17
iprlib.c
17
iprlib.c
|
|
@ -5681,6 +5681,7 @@ static void get_dual_ioa_state(struct ipr_ioa *ioa)
|
|||
|
||||
sprintf(ioa->dual_state, "Primary");
|
||||
sprintf(ioa->preferred_dual_state, "No Preference");
|
||||
ioa->is_secondary = 0;
|
||||
|
||||
if (!ioa->dual_raid_support)
|
||||
return;
|
||||
|
|
@ -5690,15 +5691,15 @@ static void get_dual_ioa_state(struct ipr_ioa *ioa)
|
|||
if (rc)
|
||||
return;
|
||||
|
||||
ioa_entry = (struct ipr_dual_ioa_entry *)
|
||||
(((unsigned long)&ioa->ioa_status.cap) + ntohl(ioa->ioa_status.cap.length));
|
||||
if (ntohl(ioa->ioa_status.num_entries))
|
||||
print_ioa_state(ioa->dual_state, ioa_entry->cur_state);
|
||||
print_ioa_state(ioa->preferred_dual_state, ioa->ioa_status.cap.preferred_role);
|
||||
if (ioa_entry->cur_state == IPR_IOA_STATE_SECONDARY)
|
||||
ioa->is_secondary = 1;
|
||||
else
|
||||
ioa->is_secondary = 0;
|
||||
|
||||
if (ntohl(ioa->ioa_status.num_entries)) {
|
||||
ioa_entry = (struct ipr_dual_ioa_entry *)
|
||||
(((unsigned long)&ioa->ioa_status.cap) + ntohl(ioa->ioa_status.cap.length));
|
||||
print_ioa_state(ioa->dual_state, ioa_entry->cur_state);
|
||||
if (ioa_entry->cur_state == IPR_IOA_STATE_SECONDARY)
|
||||
ioa->is_secondary = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue