Whamcloud - gitweb
LU-11198 utils: propagate errors for read_param 25/32925/9
authorWang Shilong <wshilong@ddn.com>
Fri, 28 Sep 2018 17:31:29 +0000 (13:31 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 5 Oct 2018 22:28:10 +0000 (22:28 +0000)
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: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/32925
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/conf-sanity.sh
lustre/tests/sanity-sec.sh
lustre/tests/sanity.sh
lustre/utils/lustre_cfg.c

index ff62ecb..b54a558 100644 (file)
@@ -8075,6 +8075,15 @@ test_116() {
 }
 run_test 116 "big size MDT support"
 
 }
 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) ]] ||
 test_122() {
        [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
        [[ $(lustre_version_code ost1) -ge $(version_code 2.11.53) ]] ||
index dfd07fa..8d77c32 100755 (executable)
@@ -1804,8 +1804,7 @@ test_24() {
        nodemap_test_setup
 
        trap nodemap_test_cleanup EXIT
        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
 }
 
        nodemap_test_cleanup
 }
index 1b0dfab..0166c90 100755 (executable)
@@ -11015,7 +11015,7 @@ test_133f() {
        find $proc_dirs -exec cat '{}' \; &> /dev/null
 
        # Second verifying readability.
        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 \
 
        # Verifing writability with badarea_io.
        find $proc_dirs \
index cb60057..9879bf4 100644 (file)
@@ -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 */
                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)) {
                        break;
                case SET_PARAM:
                        if (S_ISREG(st.st_mode)) {