From: Jinshan Xiong Date: Thu, 13 Oct 2011 23:27:08 +0000 (-0700) Subject: LU-760 obdecho: initialization and awk problem X-Git-Tag: 2.1.51~18 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a08b190a278e952e1c303eb49233b542189656e6;hp=60c6d854fbcadce00edf1543317ab229dd7ce3a9 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 --- 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 aa53e3c..e54a142 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7628,8 +7628,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