Commit 6ca2425c authored by Wang Shilong's avatar Wang Shilong Committed by Oleg Drokin
Browse files

LU-11198 utils: propagate errors for read_param



Steps to reproduce:

 $ lctl get_param -n ost.OSS.ost_io.nrs_tbf_rule
 error: get_param: reading 'ost.OSS.ost_io.nrs_tbf_rule': No such device
 $ echo $?
 0

read_param() might return errors, fix to return errors to
caller.

Change-Id: Id165424342be3109669f173b9b72c16aa8c83425
Signed-off-by: default avatarWang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/32925


Tested-by: Jenkins
Tested-by: default avatarMaloo <hpdd-maloo@intel.com>
Reviewed-by: default avatarAndreas Dilger <adilger@whamcloud.com>
Reviewed-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-by: default avatarOleg Drokin <green@whamcloud.com>
parent cf503e04
......@@ -8075,6 +8075,15 @@ test_116() {
}
run_test 116 "big size MDT support"
test_117() {
setup
do_facet ost1 "$LCTL set_param ost.OSS.ost_io.nrs_policies=fifo"
do_facet ost1 "$LCTL get_param -n ost.OSS.ost_io.nrs_tbf_rule" &&
error "get_param should fail"
cleanup || error "cleanup failed with rc $?"
}
run_test 117 "lctl get_param return errors properly"
test_122() {
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
[[ $(lustre_version_code ost1) -ge $(version_code 2.11.53) ]] ||
......
......@@ -1804,8 +1804,7 @@ test_24() {
nodemap_test_setup
trap nodemap_test_cleanup EXIT
do_nodes $(comma_list $(all_server_nodes)) $LCTL get_param -R nodemap ||
error "proc readable file read failed"
do_nodes $(comma_list $(all_server_nodes)) $LCTL get_param -R nodemap
nodemap_test_cleanup
}
......
......@@ -11015,7 +11015,7 @@ test_133f() {
find $proc_dirs -exec cat '{}' \; &> /dev/null
 
# Second verifying readability.
$LCTL get_param -R '*' &> /dev/null || error "proc file read failed"
$LCTL get_param -R '*' &> /dev/null
 
# Verifing writability with badarea_io.
find $proc_dirs \
......
......@@ -1031,8 +1031,12 @@ param_display(struct param_opts *popt, char *pattern, char *value,
switch (mode) {
case GET_PARAM:
/* Read the contents of file to stdout */
if (S_ISREG(st.st_mode))
read_param(paths.gl_pathv[i], param_name, popt);
if (S_ISREG(st.st_mode)) {
rc2 = read_param(paths.gl_pathv[i], param_name,
popt);
if (rc2 < 0 && rc == 0)
rc = rc2;
}
break;
case SET_PARAM:
if (S_ISREG(st.st_mode)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment