From a531ab5f38a6da1de7948df979ae839aa847a370 Mon Sep 17 00:00:00 2001 From: Sergey Cheremencev Date: Wed, 29 Aug 2018 22:20:36 +0300 Subject: [PATCH 1/1] LU-11605 osp: max_create_count and create_count changes Setting max_create_count to 0 causes setting create_count to 0. Set create_count to OST_MIN_PRECREATE when setting back max_create_count. Without the patch create_count remains equal to 0 despite on changing max_create_count to something != 0. This causes create to stuck in osp_precreate_reserve because osp_precreate_send doesn't send new request to OST. To understand the number of objects to precreate(grow) it uses opd_pre_create_count that is equal to 0. Cray-bug-id: LUS-6435 Change-Id: I940c48f91e9c7d49b766bd85ea271ce229424c7f Signed-off-by: Sergey Cheremencev Reviewed-on: https://es-gerrit.dev.cray.com/153888 Reviewed-by: Alexander Zarochentsev Reviewed-by: Artem Blagodarenko Tested-by: Elena Gryaznova Reviewed-on: https://review.whamcloud.com/33559 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/osp/lproc_osp.c | 9 ++++++--- lustre/tests/sanity.sh | 25 ++++++++++++------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c index 59c90e2..75b7f07 100644 --- a/lustre/osp/lproc_osp.c +++ b/lustre/osp/lproc_osp.c @@ -415,14 +415,17 @@ static ssize_t max_create_count_store(struct kobject *kobj, if (rc) return rc; - if (val < 0 || val > INT_MAX) - return -ERANGE; - if (val > OST_MAX_PRECREATE) + if (val && (val < OST_MIN_PRECREATE || + val > OST_MAX_PRECREATE)) return -ERANGE; if (osp->opd_pre_create_count > val) osp->opd_pre_create_count = val; + /* Can be 0 after setting max_create_count to 0 */ + if (osp->opd_pre_create_count == 0 && val != 0) + osp->opd_pre_create_count = OST_MIN_PRECREATE; + osp->opd_pre_max_create_count = val; return count; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 6591772..1fe5b64 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -6657,7 +6657,7 @@ test_65j() { # bug6367 } run_test 65j "set default striping on root directory (bug 6367)=" -cleaup_65k() { +cleanup_65k() { rm -rf $DIR/$tdir wait_delete_completed do_facet $SINGLEMDS "lctl set_param -n \ @@ -18467,6 +18467,7 @@ test_311() { remote_mds_nodsh && skip "remote MDS with nodsh" local old_iused=$($LFS df -i | grep OST0000 | awk '{ print $3 }') + local mdts=$(comma_list $(mdts_nodes)) mkdir -p $DIR/$tdir $LFS setstripe -i 0 -c 1 $DIR/$tdir @@ -18475,14 +18476,11 @@ test_311() { # statfs data is not real time, let's just calculate it old_iused=$((old_iused + 1000)) - local count=$(do_facet $SINGLEMDS "lctl get_param -n \ + local count=$(do_facet $SINGLEMDS "$LCTL get_param -n \ osp.*OST0000*MDT0000.create_count") - local max_count=$(do_facet $SINGLEMDS "lctl get_param -n \ + local max_count=$(do_facet $SINGLEMDS "$LCTL get_param -n \ osp.*OST0000*MDT0000.max_create_count") - for idx in $(seq $MDSCOUNT); do - do_facet mds$idx "lctl set_param -n \ - osp.*OST0000*MDT000?.max_create_count=0" - done + do_nodes $mdts "$LCTL set_param -n osp.*OST0000*.max_create_count=0" $LFS setstripe -i 0 $DIR/$tdir/$tfile || error "setstripe failed" local index=$($LFS getstripe -i $DIR/$tdir/$tfile) @@ -18490,12 +18488,13 @@ test_311() { unlinkmany $DIR/$tdir/$tfile. 1000 - for idx in $(seq $MDSCOUNT); do - do_facet mds$idx "lctl set_param -n \ - osp.*OST0000*MDT000?.max_create_count=$max_count" - do_facet mds$idx "lctl set_param -n \ - osp.*OST0000*MDT000?.create_count=$count" - done + do_nodes $mdts "$LCTL set_param -n \ + osp.*OST0000*.max_create_count=$max_count" + [ $(lustre_version_code $facet) -lt $(version_code 2.11.56) ] && + do_nodes $mdts "$LCTL set_param -n \ + osp.*OST0000*.create_count=$count" + do_nodes $mdts "$LCTL get_param osp.*OST0000*.create_count" | + grep "=0" && error "create_count is zero" local new_iused for i in $(seq 120); do -- 1.8.3.1