From: wangdi Date: Fri, 22 Jun 2012 14:08:35 +0000 (-0700) Subject: LU-1396 osc: control the RPC rate between MDS and OST X-Git-Tag: 2.2.59~26 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=16278b8e4168b45a7ac3abffb1c89530442da9fc LU-1396 osc: control the RPC rate between MDS and OST 1. Limit the RPC rate with setting 50 maxim rpc in flight between MDS and OST. 2. Add specify flag in oa to tell whether the destory from echo_md destory or MDT close/unlink orphan, where we can not throttle the destory RPC, since it might block ptlrpcd thread. See Bug 16006. Signed-off-by: Wang Di Change-Id: Ie3b555eecd2716a82b058f645d002f46d8c4dd36 Reviewed-on: http://review.whamcloud.com/2899 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 5fa66e2..054e025 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -411,6 +411,7 @@ struct timeout_item { }; #define OSC_MAX_RIF_DEFAULT 8 +#define MDS_OSC_MAX_RIF_DEFAULT 50 #define OSC_MAX_RIF_MAX 256 #define OSC_MAX_DIRTY_DEFAULT (OSC_MAX_RIF_DEFAULT * 4) #define OSC_MAX_DIRTY_MB_MAX 2048 /* arbitrary, but < MAX_LONG bytes */ diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 9802ba0..25c56ef 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -223,6 +223,29 @@ void client_destroy_import(struct obd_import *imp) } EXPORT_SYMBOL(client_destroy_import); +/** + * check whether the osc is on MDT or not + * In the config log, + * osc on MDT + * setup 0:{fsname}-OSTxxxx-osc[-MDTxxxx] 1:lustre-OST0000_UUID 2:NID + * osc on client + * setup 0:{fsname}-OSTxxxx-osc 1:lustre-OST0000_UUID 2:NID + * + **/ +static int osc_on_mdt(char *obdname) +{ + char *ptr; + + ptr = strrchr(obdname, '-'); + if (ptr == NULL) + return 0; + + if (strncmp(ptr + 1, "MDT", 3) == 0) + return 1; + + return 0; +} + /* configure an RPC client OBD device * * lcfg parameters: @@ -352,9 +375,11 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) } else if (cfs_num_physpages >> (20 - CFS_PAGE_SHIFT) <= 512 /* MB */) { cli->cl_max_rpcs_in_flight = 4; } else { - cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT; + if (osc_on_mdt(obddev->obd_name)) + cli->cl_max_rpcs_in_flight = MDS_OSC_MAX_RIF_DEFAULT; + else + cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT; } - rc = ldlm_get_ref(); if (rc) { CERROR("ldlm_get_ref failed: %d\n", rc); diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 9e440ba..b87fe6b 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -1074,13 +1074,11 @@ out_trans: stop: mdd_trans_stop(env, mdd, rc, handle); #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2,3,50,0) - if (rc == 0 && ma->ma_valid & MA_COOKIE && ma->ma_valid & MA_LOV && - ma->ma_valid & MA_FLAGS && ma->ma_attr_flags & MDS_UNLINK_DESTROY) - /* Since echo client is incapable of destorying ost object, - * it will destory the object here. */ - rc = mdd_lovobj_unlink(env, mdd, mdd_cobj, la, - ma->ma_lmm, ma->ma_lmm_size, - ma->ma_cookie, 1); + if (rc == 0 && ma->ma_valid & MA_COOKIE && ma->ma_valid & MA_LOV && + ma->ma_valid & MA_FLAGS && ma->ma_attr_flags & MDS_UNLINK_DESTROY) + /* Since echo client is incapable of destorying ost object, + * it will destory the object here. */ + rc = mdd_lovobj_unlink(env, mdd, mdd_cobj, la, ma, 1); #else #warning "please remove this after 2.4 (LOD/OSP)." #endif diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index 18e3f55..161a1c3 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -320,11 +320,10 @@ int mdd_get_cookie_size(const struct lu_env *env, struct mdd_device *mdd, int mdd_lov_setattr_async(const struct lu_env *env, struct mdd_object *obj, struct lov_mds_md *lmm, int lmm_size, struct llog_cookie *logcookies); + int mdd_lovobj_unlink(const struct lu_env *env, struct mdd_device *mdd, - struct mdd_object *obj, struct lu_attr *la, - struct lov_mds_md *lmm, int lmm_size, - struct llog_cookie *logcookies, - int log_unlink); + struct mdd_object *obj, struct lu_attr *la, + struct md_attr *ma, int log_unlink); struct mdd_thread_info *mdd_env_info(const struct lu_env *env); diff --git a/lustre/mdd/mdd_lov.c b/lustre/mdd/mdd_lov.c index 1b874b5..8242307 100644 --- a/lustre/mdd/mdd_lov.c +++ b/lustre/mdd/mdd_lov.c @@ -589,10 +589,8 @@ out_ids: * destroy objects on OSS. */ int mdd_lovobj_unlink(const struct lu_env *env, struct mdd_device *mdd, - struct mdd_object *obj, struct lu_attr *la, - struct lov_mds_md *lmm, int lmm_size, - struct llog_cookie *logcookies, - int log_unlink) + struct mdd_object *obj, struct lu_attr *la, + struct md_attr *ma, int log_unlink) { struct obd_device *obd = mdd2obd_dev(mdd); struct obd_export *lov_exp = obd->u.mds.mds_lov_exp; @@ -600,7 +598,10 @@ int mdd_lovobj_unlink(const struct lu_env *env, struct mdd_device *mdd, struct obd_trans_info *oti = &mdd_env_info(env)->mti_oti; struct obdo *oa = &mdd_env_info(env)->mti_oa; struct lu_site *site = mdd2lu_dev(mdd)->ld_site; - int rc; + struct lov_mds_md *lmm = ma->ma_lmm; + int lmm_size = ma->ma_lmm_size; + struct llog_cookie *logcookies = ma->ma_cookie; + int rc; ENTRY; if (lmm_size == 0) @@ -626,6 +627,9 @@ int mdd_lovobj_unlink(const struct lu_env *env, struct mdd_device *mdd, oti->oti_logcookies = logcookies; } + if (!(ma->ma_attr_flags & MDS_UNLINK_DESTROY)) + oa->o_flags = OBD_FL_DELORPHAN; + CDEBUG(D_INFO, "destroying OSS object "LPU64":"LPU64"\n", oa->o_seq, oa->o_id); @@ -685,11 +689,10 @@ int mdd_lov_destroy(const struct lu_env *env, struct mdd_device *mdd, RETURN(rc); } - if (ma->ma_valid & MA_COOKIE) - rc = mdd_lovobj_unlink(env, mdd, obj, la, - ma->ma_lmm, ma->ma_lmm_size, - ma->ma_cookie, 1); - RETURN(rc); + if (ma->ma_valid & MA_COOKIE) + rc = mdd_lovobj_unlink(env, mdd, obj, la, ma, 1); + + RETURN(rc); } int mdd_declare_unlink_log(const struct lu_env *env, struct mdd_object *obj, diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 24832ea..b52d974 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -760,8 +760,11 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, osc_pack_capa(req, body, (struct obd_capa *)capa); ptlrpc_request_set_replen(req); - /* don't throttle destroy RPCs for the MDT */ - if (!(cli->cl_import->imp_connect_flags_orig & OBD_CONNECT_MDS)) { + /* If osc_destory is for destroying the unlink orphan, + * sent from MDT to OST, which should not be blocked here, + * because the process might be triggered by ptlrpcd, and + * it is not good to block ptlrpcd thread (b=16006)*/ + if (!(oa->o_flags & OBD_FL_DELORPHAN)) { req->rq_interpret_reply = osc_destroy_interpret; if (!osc_can_send_destroy(cli)) { struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP,