From d965d3446a4fd2ef0e251a75b406b19093bdc3f9 Mon Sep 17 00:00:00 2001 From: shadow Date: Tue, 5 Feb 2008 11:49:53 +0000 Subject: [PATCH 1/1] 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 | 15 +++++++-------- lustre/osc/osc_create.c | 19 ++++++++++--------- lustre/osc/osc_internal.h | 2 +- 6 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index ad8473c..870d100 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -12,6 +12,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 +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 : enhancement Bugzilla : 14482 Description: Add rhel5 support to HEAD. diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 1515bab..7ef0ee7 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -1095,7 +1095,7 @@ struct obd_ops { int (*o_preallocate)(struct lustre_handle *, obd_count *req, obd_id *ids); /* FIXME: add fid capability support for create & destroy! */ - 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 94cd618..8915c2a 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -642,7 +642,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; @@ -650,7 +650,7 @@ static inline int obd_precreate(struct obd_export *exp, int need_create) EXP_CHECK_DT_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 37ce370..c21f8b0 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -566,8 +566,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; @@ -613,8 +612,8 @@ 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) && + (i != 0 || speed < 2)) continue; *idx_pos = ost_idx; @@ -682,9 +681,9 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt, GOTO(out_up_write, rc = -EAGAIN); rc = qos_calc_ppo(exp->exp_obd); - if (rc) + if (rc) GOTO(out_up_write, rc); - + total_bavail = 0; good_osts = 0; /* Warn users about zero available space/inode every 30 min */ @@ -693,7 +692,7 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt, /* Find all the OSTs that are valid stripe candidates */ for (i = 0; i < ost_count; i++) { __u64 bavail; - + if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) continue; bavail = TGT_BAVAIL(i); @@ -719,7 +718,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 d79be2f..a781b22 100644 --- a/lustre/osc/osc_create.c +++ b/lustre/osc/osc_create.c @@ -125,7 +125,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) <= @@ -181,10 +182,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; } @@ -248,7 +251,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; @@ -272,13 +275,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 e81d54f..89f341c 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -54,7 +54,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