From 65debc32365a179b36847d12118e2ec6e1b5805f Mon Sep 17 00:00:00 2001 From: Alexander Boyko Date: Sun, 20 Aug 2023 19:58:35 -0400 Subject: [PATCH] LU-16830 lod: accurate OSTs iteration for the last speed The first fix removed lqr->lqr_start_idx from calculation of ost_idx for the last speed loop. It was not enough because lqr->lqr_offset_idx is used at calculation and also could be changed by another thread. And it leads to the same OST index during a loop. 1694009994: lod_ost_alloc_rr()) #0 strt 2166 act 0 strp 0 ary 0 idx 0 1694010094: lod_ost_alloc_rr()) #1 strt 2167 act 0 strp 0 ary 0 idx 0 1694010197: lod_ost_alloc_rr()) rc -28 Fixes: cacdaa9251 ("LU-16830 lod: improve rr allocation") Signed-off-by: Alexander Boyko Change-Id: Idf4b528dfbf3995cd03580a4214aff9206a52378 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52393 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alexander Zarochentsev Reviewed-by: Oleg Drokin --- lustre/lod/lod_qos.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 2244cbb..da645a9 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -778,13 +778,16 @@ repeat_find: for (i = 0, idx = 0; i < osts->op_count * stripes_per_ost && stripe_idx < stripe_count; i++) { - if (likely(speed < 2) || i == 0) - idx = atomic_inc_return(&lqr->lqr_start_idx); - else + if (likely(speed < 2) || i == 0) { + idx = atomic_inc_return(&lqr->lqr_start_idx) + + lqr->lqr_offset_idx; + } else { + /* + * For last speed, use OSTs one by one + */ idx++; - - array_idx = (idx + lqr->lqr_offset_idx) % - osts->op_count; + } + array_idx = idx % osts->op_count; ost_idx = lqr->lqr_pool.op_array[array_idx]; CDEBUG(D_OTHER, "#%d strt %d act %d strp %d ary %d idx %d\n", -- 1.8.3.1