Whamcloud - gitweb
LU-760 obdecho: initialization and awk problem
authorJinshan Xiong <jay@whamcloud.com>
Thu, 13 Oct 2011 23:27:08 +0000 (16:27 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 18 Oct 2011 00:37:43 +0000 (20:37 -0400)
echo_client registers obd type and then initializes kmem cache, this is
problematic because echo_key will be immidiately accessed after obd type
is registered. This will cause kernel fault.

Also, an awk problem is fixed. If the length of output buffer is longer
than 1024 bytes, awk will run into problem.

Change-Id: Ief287e8f4eeb6a39bc336e7a9f5c21e921b79a58
Signed-off-by: Jinshan Xiong <jay@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/1521
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/obdecho/echo_client.c
lustre/tests/sanity.sh

index 9eba69e..41e6214 100644 (file)
@@ -2104,10 +2104,16 @@ int echo_client_init(void)
         int rc;
 
         lprocfs_echo_init_vars(&lvars);
         int rc;
 
         lprocfs_echo_init_vars(&lvars);
-        rc = class_register_type(&echo_obd_ops, NULL, lvars.module_vars,
-                                 LUSTRE_ECHO_CLIENT_NAME, &echo_device_type);
+
+        rc = lu_kmem_init(echo_caches);
         if (rc == 0)
         if (rc == 0)
-                lu_kmem_init(echo_caches);
+                rc = class_register_type(&echo_obd_ops, NULL,
+                                         lvars.module_vars,
+                                         LUSTRE_ECHO_CLIENT_NAME,
+                                         &echo_device_type);
+        if (rc)
+                lu_kmem_fini(echo_caches);
+
         return rc;
 }
 
         return rc;
 }
 
index aa53e3c..e54a142 100644 (file)
@@ -7628,8 +7628,10 @@ test_180a() {
         fi
 
         local osc=$($LCTL dl | grep -v mdt | awk '$3 == "osc" {print $4; exit}')
         fi
 
         local osc=$($LCTL dl | grep -v mdt | awk '$3 == "osc" {print $4; exit}')
-        local host=$(awk '/current_connection:/ {print $2}' /proc/fs/lustre/osc/$osc/import)
-        local target=$(awk '/target:/ {print $2}' /proc/fs/lustre/osc/$osc/import)
+        local host=$(lctl get_param -n osc.$osc.import |
+                             awk '/current_connection:/ {print $2}' )
+        local target=$(lctl get_param -n osc.$osc.import |
+                             awk '/target:/ {print $2}' )
         target=${target%_UUID}
 
         [[ -n $target ]]  && { setup_obdecho_osc $host $target || rc=1; } || rc=1
         target=${target%_UUID}
 
         [[ -n $target ]]  && { setup_obdecho_osc $host $target || rc=1; } || rc=1