From 57b3da5d4938e38f23593e14cebb3702c9085f3a Mon Sep 17 00:00:00 2001 From: wangdi Date: Sat, 30 Nov 2013 04:22:55 -0800 Subject: [PATCH] LU-2802 lmv: get tgt by checking ltd_idx in lmv_find_target. Currently, lmv_find_target return lmv->tgts[mds] according to mdt_index, which is not correct. LMV index is created by mount sequence, while mdt_index by indicated by --index. So we should check ltd_idx in lmv_find_target. Signed-off-by: Wang Di Change-Id: I67a941cca00eb80ba91af6eb3f3441982d4fcab3 Reviewed-on: http://review.whamcloud.com/5412 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger --- lustre/lmv/lmv_internal.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h index 32efb75..bef090c 100644 --- a/lustre/lmv/lmv_internal.h +++ b/lustre/lmv/lmv_internal.h @@ -113,7 +113,17 @@ static inline int lmv_get_easize(struct lmv_obd *lmv) static inline struct lmv_tgt_desc * lmv_get_target(struct lmv_obd *lmv, mdsno_t mds) { - return lmv->tgts[mds]; + int count = lmv->desc.ld_tgt_count; + int i; + + for (i = 0; i < count; i++) { + if (lmv->tgts[i] == NULL) + continue; + + if (lmv->tgts[i]->ltd_idx == mds) + return lmv->tgts[i]; + } + return NULL; } static inline struct lmv_tgt_desc * -- 1.8.3.1