From d755cbc65735a98dbeaf6370aa9af9547d3c877b Mon Sep 17 00:00:00 2001 From: mchristi Date: Tue, 27 Jul 2010 21:12:21 +0000 Subject: [PATCH] Resolves: #589256 --- ...initiator-utils-fix-iface-op-ret-val.patch | 74 +++++++++++++++++++ iscsi-initiator-utils.spec | 8 +- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 iscsi-initiator-utils-fix-iface-op-ret-val.patch diff --git a/iscsi-initiator-utils-fix-iface-op-ret-val.patch b/iscsi-initiator-utils-fix-iface-op-ret-val.patch new file mode 100644 index 0000000..5f03e53 --- /dev/null +++ b/iscsi-initiator-utils-fix-iface-op-ret-val.patch @@ -0,0 +1,74 @@ +diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c +index b7d11b5..fcf2a3a 100644 +--- a/usr/iscsiadm.c ++++ b/usr/iscsiadm.c +@@ -465,7 +465,8 @@ static int iface_fn(void *data, node_rec_t *rec) + return op_data->fn(op_data->data, rec); + } + +-static int for_each_rec(struct node_rec *rec, void *data, idbm_iface_op_fn *fn) ++static int __for_each_rec(int verbose, struct node_rec *rec, ++ void *data, idbm_iface_op_fn *fn) + { + struct rec_op_data op_data; + int nr_found = 0, rc; +@@ -477,16 +478,25 @@ static int for_each_rec(struct node_rec *rec, void *data, idbm_iface_op_fn *fn) + + rc = idbm_for_each_rec(&nr_found, &op_data, iface_fn); + if (rc) { +- log_error("Could not execute operation on all " +- "records. Err %d.", rc); ++ if (verbose) ++ log_error("Could not execute operation on all " ++ "records. Err %d.", rc); + } else if (!nr_found) { +- log_error("no records found!"); ++ if (verbose) ++ log_error("no records found!"); + rc = ENODEV; + } + + return rc; + } + ++static int for_each_rec(struct node_rec *rec, void *data, ++ idbm_iface_op_fn *fn) ++{ ++ return __for_each_rec(1, rec, data, fn); ++} ++ ++ + static int login_portals(struct node_rec *pattern_rec) + { + struct list_head rec_list; +@@ -1098,9 +1108,9 @@ new_fail: + } + + /* logout and delete records using it first */ +- rc = for_each_rec(rec, NULL, delete_node); +- if (rc) +- break; ++ rc = __for_each_rec(0, rec, NULL, delete_node); ++ if (rc && rc != ENODEV) ++ goto delete_fail; + + rc = iface_conf_delete(iface); + if (rc) +@@ -1167,9 +1177,11 @@ delete_fail: + if (rc) + goto update_fail; + +- rc = for_each_rec(rec, &set_param, idbm_node_set_param); +- if (rc) +- break; ++ rc = __for_each_rec(0, rec, &set_param, idbm_node_set_param); ++ if (rc == ENODEV) ++ rc = 0; ++ else if (rc) ++ goto update_fail; + + printf("%s updated.\n", iface->name); + break; +-- +1.6.6.1 + diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec index 60cbd83..21f74b3 100644 --- a/iscsi-initiator-utils.spec +++ b/iscsi-initiator-utils.spec @@ -3,7 +3,7 @@ Summary: iSCSI daemon and utility programs Name: iscsi-initiator-utils Version: 6.2.0.872 -Release: 7%{?dist} +Release: 8%{?dist} Source0: http://people.redhat.com/mchristi/iscsi/rhel6.0/source/open-iscsi-2.0-872-rc4-bnx2i.tar.gz Source1: iscsid.init Source2: iscsidevs.init @@ -28,6 +28,8 @@ Patch7: iscsi-initiator-utils-fix-uip-init-race.patch Patch8: iscsi-initiator-utils-dont-use-static.patch # Fix brcm nic state Patch9: iscsi-initiator-utils-fix-brcm-nic-state.patch +# Fix iface op return value +Patch10: iscsi-initiator-utils-fix-iface-op-ret-val.patch Group: System Environment/Daemons License: GPLv2+ @@ -65,6 +67,7 @@ developing applications that use %{name}. %patch7 -p1 -b .fix-uip-init-race %patch8 -p1 -b .dont-use-static %patch9 -p1 -b .fix-brcm-nic-state +%patch10 -p1 -b .fix-iface-op-ret-val %build cd utils/open-isns @@ -183,6 +186,9 @@ fi %{_includedir}/libiscsi.h %changelog +* Mon Jul 26 2010 Mike Christie 6.2.0.872.8 +- 589256 Re-fix iface update/delete return value. + * Mon Jul 12 2010 Mike Christie 6.2.0.872.7 - 595591 Fix nic state bug in brcm_iscsiuio.