From: Qian Yingjin Date: Fri, 22 Sep 2017 03:02:24 +0000 (+0800) Subject: LU-10802 nrs: mismatch problem for wildcard in jobid TBF X-Git-Tag: 2.11.51~56 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=96f5cc0eb36c0bc799016cb3c6f11c3ddf475157;p=fs%2Flustre-release.git LU-10802 nrs: mismatch problem for wildcard in jobid TBF 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 Reviewed-on: https://review.whamcloud.com/29162 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 863afd9..50b8c11 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -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); diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 5d985fd..d332e4c 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -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 diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c index 980cff4..fdf409e 100644 --- a/lustre/ptlrpc/nrs_tbf.c +++ b/lustre/ptlrpc/nrs_tbf.c @@ -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; diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 88e89a2..fad32e9 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -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