From 2bf854af07a37bb37a16b05789407f2c9e1b39b7 Mon Sep 17 00:00:00 2001 From: shadow Date: Tue, 5 Feb 2008 11:52:01 +0000 Subject: [PATCH] Don't allow skipping OSTs if index has been specified. b=13196 i=adilger i=green --- lustre/ChangeLog | 7 +++++++ lustre/include/obd.h | 2 +- lustre/include/obd_class.h | 4 ++-- lustre/lov/lov_qos.c | 13 ++++++------- lustre/osc/osc_create.c | 19 ++++++++++--------- lustre/osc/osc_internal.h | 2 +- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index a4b0cdd..831cf30 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -17,6 +17,13 @@ tbd Sun Microsystems, Inc. * RHEL 4 and RHEL 5/SLES 10 clients behaves differently on 'cd' to a removed cwd "./" (refer to Bugzilla 14399). +Severity : minor +Frequency : rare on shutdown ost +Bugzilla : 13196 +Description: Don't allow skipping OSTs if index has been specified. +Details : Don't allow skipping OSTs if index has been specified, make locking + in internal create lots better. + Severity : normal Bugzilla : 12228 Description: LBUG in ptlrpc_check_set() bad phase ebc0de00 diff --git a/lustre/include/obd.h b/lustre/include/obd.h index cf80b7a..03a6c78 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -921,7 +921,7 @@ struct obd_ops { struct lov_stripe_md *mem_tgt); int (*o_preallocate)(struct lustre_handle *, obd_count *req, obd_id *ids); - int (*o_precreate)(struct obd_export *exp, int need_create); + int (*o_precreate)(struct obd_export *exp); int (*o_create)(struct obd_export *exp, struct obdo *oa, struct lov_stripe_md **ea, struct obd_trans_info *oti); int (*o_destroy)(struct obd_export *exp, struct obdo *oa, diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 08672a9..a6bdb9c 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -487,7 +487,7 @@ static inline int obd_checkmd(struct obd_export *exp, RETURN(rc); } -static inline int obd_precreate(struct obd_export *exp, int need_create) +static inline int obd_precreate(struct obd_export *exp) { int rc; ENTRY; @@ -495,7 +495,7 @@ static inline int obd_precreate(struct obd_export *exp, int need_create) EXP_CHECK_OP(exp, precreate); OBD_COUNTER_INCREMENT(exp->exp_obd, precreate); - rc = OBP(exp->exp_obd, precreate)(exp, need_create); + rc = OBP(exp->exp_obd, precreate)(exp); RETURN(rc); } diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index fd136f3..2bf5761 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -517,7 +517,7 @@ static int alloc_rr(struct lov_obd *lov, int *idx_arr, int *stripe_cnt, /* If we have allocated from all of the OSTs, slowly precess the next start */ lov->lov_start_idx %= ost_count; - if (*stripe_cnt > 1 && (ost_active_count % (*stripe_cnt) != 1)) + if (*stripe_cnt > 1 && (ost_active_count % (*stripe_cnt)) != 1) ++lov->lov_offset_idx; } down_read(&lov->lov_qos.lq_rw_sem); @@ -552,8 +552,7 @@ repeat_find : continue; /* Drop slow OSCs if we can */ - if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp, speed == 0) > - speed) + if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp) > speed) continue; *idx_pos = ost_idx; @@ -598,9 +597,9 @@ repeat_find: if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_PRECREATE) && ost_idx == 0) continue; - /* Drop slow OSCs if we can */ - if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp, speed == 0) > - speed) + /* Drop slow OSCs if we can, but not for requested start idx */ + if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp) > speed && + (i != 0 || speed < 2)) continue; *idx_pos = ost_idx; @@ -691,7 +690,7 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt, if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_PRECREATE) && i == 0) continue; - if (obd_precreate(lov->lov_tgts[i]->ltd_exp, 1) > 2) + if (obd_precreate(lov->lov_tgts[i]->ltd_exp) > 2) continue; lov->lov_tgts[i]->ltd_qos.ltq_usable = 1; diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c index 71c8986..c26d2e3 100644 --- a/lustre/osc/osc_create.c +++ b/lustre/osc/osc_create.c @@ -130,7 +130,8 @@ static int oscc_internal_create(struct osc_creator *oscc) int size[] = { sizeof(struct ptlrpc_body), sizeof(*body) }; ENTRY; - spin_lock(&oscc->oscc_lock); + LASSERT_SPIN_LOCKED(&oscc->oscc_lock); + if (oscc->oscc_grow_count < OST_MAX_PRECREATE && !(oscc->oscc_flags & (OSCC_FLAG_LOW | OSCC_FLAG_RECOVERING)) && (__s64)(oscc->oscc_last_id - oscc->oscc_next_id) <= @@ -185,10 +186,12 @@ static int oscc_has_objects(struct osc_creator *oscc, int count) int have_objs; spin_lock(&oscc->oscc_lock); have_objs = ((__s64)(oscc->oscc_last_id - oscc->oscc_next_id) >= count); - spin_unlock(&oscc->oscc_lock); - if (!have_objs) + if (!have_objs) { oscc_internal_create(oscc); + } else { + spin_unlock(&oscc->oscc_lock); + } return have_objs; } @@ -252,7 +255,7 @@ int oscc_recovering(struct osc_creator *oscc) a potentially very long time 1000 : unusable */ -int osc_precreate(struct obd_export *exp, int need_create) +int osc_precreate(struct obd_export *exp) { struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc; struct obd_import *imp = exp->exp_imp_reverse; @@ -276,13 +279,11 @@ int osc_precreate(struct obd_export *exp, int need_create) spin_unlock(&oscc->oscc_lock); RETURN(2); } - spin_unlock(&oscc->oscc_lock); - - if (oscc->oscc_flags & OSCC_FLAG_CREATING) - RETURN(1); - if (!need_create) + if (oscc->oscc_flags & OSCC_FLAG_CREATING) { + spin_unlock(&oscc->oscc_lock); RETURN(1); + } oscc_internal_create(oscc); RETURN(1); diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index eb9c79d..2f0f41b 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -57,7 +57,7 @@ struct osc_cache_waiter { #define OSCC_FLAG_LOW 0x10 #define OSCC_FLAG_EXITING 0x20 -int osc_precreate(struct obd_export *exp, int need_create); +int osc_precreate(struct obd_export *exp); int osc_create(struct obd_export *exp, struct obdo *oa, struct lov_stripe_md **ea, struct obd_trans_info *oti); int osc_real_create(struct obd_export *exp, struct obdo *oa, -- 1.8.3.1