Using the raid-create iprconfig command line option would sometimes
result in commands getting sent to the secondary adapter rather than
the primary adapter. This fixes that up.

Signed-off-by: Brian King <brk...@linux.vnet.ibm.com>
---

 iprlib.c |    9 ++++++++-
 iprlib.h |    1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff -puN iprlib.h~iprutils_sysfs_with_ioa iprlib.h
--- iprutils.patched/iprlib.h~iprutils_sysfs_with_ioa   2016-09-12 
08:19:09.364861412 -0500
+++ iprutils.patched-bjking1/iprlib.h   2016-09-12 08:19:09.375861366 -0500
@@ -298,6 +298,7 @@ extern enum system_p_mode power_cur_mode
 
 struct sysfs_dev {
        u64 device_id;
+       char ioa_pci_addr[16];
        struct sysfs_dev *next, *prev;
 };
 
diff -puN iprlib.c~iprutils_sysfs_with_ioa iprlib.c
--- iprutils.patched/iprlib.c~iprutils_sysfs_with_ioa   2016-09-12 
08:19:09.369861391 -0500
+++ iprutils.patched-bjking1/iprlib.c   2016-09-16 16:08:50.673227115 -0500
@@ -569,8 +569,11 @@ struct sysfs_dev * ipr_find_sysfs_dev(st
                return NULL;
 
        for (sdev = head; sdev; sdev = sdev->next) {
-               if (sdev->device_id == dev->scsi_dev_data->device_id)
+               if (sdev->device_id != dev->scsi_dev_data->device_id)
+                       continue;
+               if (!memcmp(sdev->ioa_pci_addr, dev->ioa->pci_address, 
sizeof(sdev->ioa_pci_addr)))
                        break;
+
        }
 
        return sdev;
@@ -589,6 +592,9 @@ struct ipr_dev *ipr_sysfs_dev_to_dev(str
        struct ipr_ioa *ioa;
 
        for_each_ioa(ioa) {
+               if (memcmp(sdev->ioa_pci_addr, ioa->pci_address, 
sizeof(sdev->ioa_pci_addr)))
+                       continue;
+
                for_each_dev(ioa, dev) {
                        if (!dev->scsi_dev_data)
                                continue;
@@ -646,6 +652,7 @@ void ipr_add_sysfs_dev(struct ipr_dev *d
        if (!sdev) {
                sdev = calloc(1, sizeof(struct sysfs_dev));
                sdev->device_id = dev->scsi_dev_data->device_id;
+               memcpy(sdev->ioa_pci_addr, dev->ioa->pci_address, 
sizeof(sdev->ioa_pci_addr));
 
                if (!(*head)) {
                        *tail = *head = sdev;
_


------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Iprdd-devel mailing list
Iprdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iprdd-devel

Reply via email to