Whamcloud - gitweb
LU-10802 nrs: mismatch problem for wildcard in jobid TBF 62/29162/7
authorQian Yingjin <qian@ddn.com>
Fri, 22 Sep 2017 03:02:24 +0000 (11:02 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 9 Apr 2018 19:47:18 +0000 (19:47 +0000)
When set the NRS JOBID rule
"start runas jobid={*.500} rate=10", run the dd with user 500,
the RPC rate is not under control.
This patch fix this mismatch problem for wildcard in TBF JOBID.

Test-Parameters: trivial testlist=sanityn
Change-Id: I39a8e691c9dc8273ed9fce686eeef71be1ac3e43
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/29162
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lprocfs_status.h
lustre/obdclass/lprocfs_status.c
lustre/ptlrpc/nrs_tbf.c
lustre/tests/sanityn.sh

index 863afd9..50b8c11 100644 (file)
@@ -617,6 +617,8 @@ extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
 extern int lprocfs_str_with_units_to_s64(const char __user *buffer,
                                         unsigned long count, __s64 *val,
                                         char defunit);
+
+char *lprocfs_strnstr(const char *s1, const char *s2, size_t len);
 char *lprocfs_find_named_value(const char *buffer, const char *name,
                                size_t *count);
 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
index 5d985fd..d332e4c 100644 (file)
@@ -2173,7 +2173,7 @@ int lprocfs_str_with_units_to_s64(const char __user *buffer,
 }
 EXPORT_SYMBOL(lprocfs_str_with_units_to_s64);
 
-static char *lprocfs_strnstr(const char *s1, const char *s2, size_t len)
+char *lprocfs_strnstr(const char *s1, const char *s2, size_t len)
 {
        size_t l2;
 
@@ -2188,6 +2188,7 @@ static char *lprocfs_strnstr(const char *s1, const char *s2, size_t len)
        }
        return NULL;
 }
+EXPORT_SYMBOL(lprocfs_strnstr);
 
 /**
  * Find the string \a name in the input \a buffer, and return a pointer to the
index 980cff4..fdf409e 100644 (file)
@@ -815,8 +815,7 @@ static int
 nrs_tbf_jobid_list_add(struct cfs_lstr *id, struct list_head *jobid_list)
 {
        struct nrs_tbf_jobid *jobid;
-       struct cfs_lstr res;
-       int rc;
+       char *ptr;
 
        OBD_ALLOC(jobid, sizeof(struct nrs_tbf_jobid));
        if (jobid == NULL)
@@ -829,8 +828,8 @@ nrs_tbf_jobid_list_add(struct cfs_lstr *id, struct list_head *jobid_list)
        }
 
        memcpy(jobid->tj_id, id->ls_str, id->ls_len);
-       rc = cfs_gettok(id, '*', &res);
-       if (rc == 0)
+       ptr = lprocfs_strnstr(id->ls_str, "*", id->ls_len);
+       if (ptr == NULL)
                jobid->tj_match_flag = NRS_TBF_MATCH_FULL;
        else
                jobid->tj_match_flag = NRS_TBF_MATCH_WILDCARD;
index 88e89a2..fad32e9 100755 (executable)
@@ -3744,6 +3744,50 @@ test_77m() {
 }
 run_test 77m "check NRS Delay slows write RPC processing"
 
+test_77n() { #LU-10802
+       if [ $(lustre_version_code ost1) -lt $(version_code 2.10.58) ]; then
+               skip "Need OST version at least 2.10.58"
+               return 0
+       fi
+
+       # Configure jobid_var
+       local saved_jobid_var=$($LCTL get_param -n jobid_var)
+       if [ $saved_jobid_var != procname_uid ]; then
+               set_conf_param_and_check client                 \
+                       "$LCTL get_param -n jobid_var"          \
+                       "$FSNAME.sys.jobid_var" procname_uid
+       fi
+
+       do_nodes $(comma_list $(osts_nodes)) \
+               lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ jobid" \
+                       ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
+                       ost.OSS.ost_io.nrs_tbf_rule="start\ dd_runas\ jobid={*.$RUNAS_ID}\ rate=20"
+
+       nrs_write_read
+       tbf_verify 20 20 "$RUNAS"
+
+       do_nodes $(comma_list $(osts_nodes)) \
+               lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
+                       ost.OSS.ost_io.nrs_tbf_rule="start\ dd_runas\ jobid={dd.*}\ rate=20"
+
+       nrs_write_read
+       tbf_verify 20 20
+
+       do_nodes $(comma_list $(osts_nodes)) \
+               lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
+                       ost.OSS.ost_io.nrs_policies="fifo"
+
+       sleep 3
+
+       local current_jobid_var=$($LCTL get_param -n jobid_var)
+       if [ $saved_jobid_var != $current_jobid_var ]; then
+               set_conf_param_and_check client                 \
+                       "$LCTL get_param -n jobid_var"          \
+                       "$FSNAME.sys.jobid_var" $saved_jobid_var
+       fi
+}
+run_test 77n "check wildcard support for TBF JobID NRS policy"
+
 test_78() { #LU-6673
        local rc