From c868fbaf21e10a94dd2b5730030dadc6228d8470 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Thu, 13 Oct 2011 16:27:08 -0700 Subject: [PATCH] LU-760 obdecho: initialization and awk problem 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 Reviewed-on: http://review.whamcloud.com/1521 Reviewed-by: Oleg Drokin Tested-by: Hudson Tested-by: Maloo --- lustre/obdecho/echo_client.c | 12 +++++++++--- lustre/tests/sanity.sh | 6 ++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 9eba69e..41e6214 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -2104,10 +2104,16 @@ int echo_client_init(void) 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) - 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; } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index cd3d734..9d01649 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7629,8 +7629,10 @@ test_180a() { 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 -- 1.8.3.1