From fb545c50acdec54691ef623eb6e146b8d9ad054b Mon Sep 17 00:00:00 2001 From: yury Date: Sun, 10 Dec 2006 12:26:33 +0000 Subject: [PATCH] - disable not used label in lmv; - fixed two possible races in lov about checking lov_qos.lq_dirty_rr. --- lustre/lmv/lmv_obd.c | 8 +++++--- lustre/lov/lov_qos.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 2264e4c..ca7e751 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -743,9 +743,9 @@ static int lmv_nid_policy(struct lmv_obd *lmv) { struct obd_import *imp = class_exp2cliimp(lmv->tgts[0].ltd_exp); __u32 id; - /* - * XXX Hack: to get nid we assume that underlying obd device is mdc. - */ + /* + * XXX Hack: to get nid we assume that underlying obd device is mdc. + */ id = imp->imp_connection->c_self ^ (imp->imp_connection->c_self >> 32); return id % lmv->desc.ld_tgt_count; } @@ -831,7 +831,9 @@ static int lmv_placement_policy(struct obd_device *obd, rc = 0; } EXIT; +#if 0 out: +#endif if (rc) { CERROR("Can't choose MDS, err = %d\n", rc); } else { diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index 616b2b8..5980721 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -341,6 +341,17 @@ static int qos_calc_rr(struct lov_obd *lov) /* Do actuall allocation. */ down_write(&lov->lov_qos.lq_rw_sem); + + /* + * Check again. While we were sleeping on @lq_rw_sem something could + * change. + */ + if (!lov->lov_qos.lq_dirty_rr) { + LASSERT(lov->lov_qos.lq_rr_size); + up_write(&lov->lov_qos.lq_rw_sem); + RETURN(0); + } + ost_count = lov->desc.ld_tgt_count; if (lov->lov_qos.lq_rr_size) @@ -593,6 +604,15 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt) /* Do actuall allocation, use write lock here. */ down_write(&lov->lov_qos.lq_rw_sem); + + /* + * Check again, while we were sleeping on @lq_rw_sem things could + * change. + */ + if (!lov->lov_qos.lq_dirty) { + up_write(&lov->lov_qos.lq_rw_sem); + GOTO(out, rc = -EAGAIN); + } ost_count = lov->desc.ld_tgt_count; if (lov->desc.ld_active_tgt_count < 2) -- 1.8.3.1