[rdma: 8/9] ifup-ib: fix issue with emtpy MTU settings and failed tests

Doug Ledford dledford at fedoraproject.org
Tue Aug 3 06:53:38 UTC 2010


commit eec8b3596f8fcd5ccc0ffdbc992fbce8ddbd7dff
Author: Doug Ledford <dledford at redhat.com>
Date:   Tue Aug 3 01:34:37 2010 -0400

    ifup-ib: fix issue with emtpy MTU settings and failed tests
    
    Because the [ test program does not process arguments in order and
    stop immediately on failure, our test lines would result in the error:
    
    /etc/sysconfig/network-scripts/ifup-ib: line 79: [: too many arguments
    
    when MTU was null.  Fix our test lines to accommodate setting the MTU
    regardless of whether or not an MTU was set in the config file (use
    default values for either connected or unconnected mode, depending
    on which mode the ipoib interface is in)
    
    Signed-off-by: Doug Ledford <dledford at redhat.com>

 rdma.ifup-ib |   10 ++++------
 rdma.spec    |    6 ++++++
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/rdma.ifup-ib b/rdma.ifup-ib
index 29dfad7..1c86c45 100644
--- a/rdma.ifup-ib
+++ b/rdma.ifup-ib
@@ -70,15 +70,13 @@ if [ -e /sys/class/net/${DEVICE}/mode ]; then
     if [ "${CONNECTED_MODE}" = yes ]; then
         echo connected > /sys/class/net/${DEVICE}/mode
 	# cap the MTU where we should based upon mode
-	if [ -n "${MTU}" -a $MTU -gt 65520 ]; then
-	    MTU=65520
-	fi
+	[ -z "$MTU" ] && MTU=65520
+	[ "$MTU" -gt 65520 ] && MTU=65520
     else
         echo datagram > /sys/class/net/${DEVICE}/mode
 	# cap the MTU where we should based upon mode
-	if [ -n "${MTU}" -a $MTU -gt 2044 ]; then
-	    MTU=2044
-	fi
+	[ -z "$MTU" ] && MTU=2044
+	[ "$MTU" -gt 2044 ] && MTU=2044
     fi
 fi
 
diff --git a/rdma.spec b/rdma.spec
index 8d66a80..8ceccd6 100644
--- a/rdma.spec
+++ b/rdma.spec
@@ -70,6 +70,12 @@ fi
 - Add new init script for starting/stopping nfs over rdma support
 - Require that the nfs-rdma service be down before stopping the rdma
   service (bz613437)
+- Change ifup-ib to properly account for the fact that the [ test program
+  does not process tests in order and fail immediately on first failing
+  test, resulting in error messages due to unquoted environment variables
+  that don't need quoting in the second test due to the fact that the
+  first test guarantees they exist.  Or that's how things should be, but
+  they aren't, so rewrite tests to accommodate this fact. (bz612284)
 
 * Thu Feb 25 2010 Doug Ledford <dledford at redhat.com> - 1.0-7
 - Minor tweak to rdma.init to silence udev warnings (bz567981)


More information about the scm-commits mailing list