Whamcloud - gitweb
LU-10350 lod: adjust stripe count to available ost count 82/43882/4
authorBobi Jam <bobijam@whamcloud.com>
Fri, 28 May 2021 08:25:52 +0000 (16:25 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 14 Jun 2021 16:43:18 +0000 (16:43 +0000)
* When user specifies -1 stripe count or more stripe count than the
  ost count of a pool, we'd adjust the stripe count otherwise we
  cannot alloc enough stripe objects, as LOD reports as follows:

  lod_alloc_specific() can't lstripe objid [obj_fid]: have %d want %u

  where %d is the ost count of a pool, and %u is the total ost count
  if user specifies -1 stripe count of a bigger stripe count value
  than %d as user specifies.

* In ost-pool.sh, reset $MOUNT's stripe offset, so that the created
  diretory will not inherit it from root directory.

* Preserve the root directory layout in replay-single (run before
  ost-pools) to avoid leaving a bad layout on the root dir.
  Lustre-change: https://review.whamcloud.com/43872

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Idf6884faf1271a3864710aeab0ba0eca154bf492
Reviewed-on: https://review.whamcloud.com/43882
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Patrick Farrell <farr0186@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_qos.c
lustre/tests/ost-pools.sh
lustre/tests/replay-single.sh
lustre/tests/sanity.sh

index ef8a581..47857bd 100644 (file)
@@ -1270,6 +1270,10 @@ repeat_find:
                stripes_per_ost =
                        (lod_comp->llc_stripe_count - 1)/ost_count + 1;
 
+       /* user specifies bigger stripe count than available ost count */
+       if (lod_comp->llc_stripe_count > ost_count * stripes_per_ost)
+               lod_comp->llc_stripe_count = ost_count * stripes_per_ost;
+
        for (i = 0; i < ost_count * stripes_per_ost;
                        i++, array_idx = (array_idx + 1) % ost_count) {
                ost_idx = osts->op_array[array_idx];
index dde786e..9a42af5 100755 (executable)
@@ -61,7 +61,7 @@ create_dir() {
        if [[ -n $idx ]]; then
                $LFS setstripe -c $count -p $pool -i $idx $dir
        else
-               $LFS setstripe -c $count -p $pool $dir
+               $LFS setstripe -c $count -p $pool -i -1 $dir
        fi
        [[ $? -eq 0 ]] || error "$LFS setstripe -p $pool $dir failed"
        [[ "$($LFS getstripe --pool $dir)" == "$pool" ]] ||
@@ -209,6 +209,10 @@ ost_pools_init() {
 remote_mds_nodsh && skip "remote MDS with nodsh"
 remote_ost_nodsh && skip "remote OST with nodsh"
 ost_pools_init
+# reset root directory's stripe offset
+$LFS getstripe -d $MOUNT
+save_layout_restore_at_exit $MOUNT
+$LFS setstripe -i -1 $MOUNT
 
 # Tests for new commands added
 test_1a() {
index 9c12920..3f8cdb8 100755 (executable)
@@ -467,6 +467,7 @@ test_20b() { # bug 10480
        local n_attempts=1
 
        sync_all_data
+       save_layout_restore_at_exit $MOUNT
        $LFS setstripe -i 0 -c 1 $DIR
 
        local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
@@ -3328,16 +3329,15 @@ cleanup_90 () {
 }
 
 test_90() { # bug 19494
-    local dir=$DIR/$tdir
-    local ostfail=$(get_random_entry $(get_facets OST))
-
-    if [[ $FAILURE_MODE = HARD ]]; then
-        local affected=$(affected_facets $ostfail);
-        if [[ "$affected" != $ostfail ]]; then
-            skip not functional with FAILURE_MODE=$FAILURE_MODE, affected: $affected
-            return 0
-        fi
-    fi
+       local dir=$DIR/$tdir
+       local ostfail=$(get_random_entry $(get_facets OST))
+
+       if [[ $FAILURE_MODE = HARD ]]; then
+               local affected=$(affected_facets $ostfail);
+
+               [[ "$affected" == $ostfail ]] ||
+                       skip "cannot use FAILURE_MODE=$FAILURE_MODE, affected: $affected"
+       fi
        # ensure all OSTs are active to allow allocations
        wait_osts_up
 
index cfe0193..eebfe73 100755 (executable)
@@ -8821,8 +8821,7 @@ test_65n() {
        which getfattr > /dev/null 2>&1 || skip_env "no getfattr command"
        which setfattr > /dev/null 2>&1 || skip_env "no setfattr command"
 
-       local root_layout=$(save_layout $MOUNT)
-       stack_trap "restore_layout $MOUNT $root_layout" EXIT
+       save_layout_restore_at_exit $MOUNT
 
        # new subdirectory under root directory should not inherit
        # the default layout from root