From ac1afaf60944e9fa8c50b5c7cdd472807f95f6e1 Mon Sep 17 00:00:00 2001 From: wangdi Date: Fri, 24 Nov 2006 12:39:18 +0000 Subject: [PATCH] Branch: b_new_cmd We should try to retrieve the MEA from MDS anyway in getattr --- lustre/mdc/mdc_locks.c | 2 +- lustre/mdt/mdt_handler.c | 34 ++++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 1a2f3ac..90223c7 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -367,7 +367,7 @@ int mdc_enqueue(struct obd_export *exp, } else if (it->it_op & (IT_GETATTR | IT_LOOKUP)) { obd_valid valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE | OBD_MD_FLMODEASIZE | OBD_MD_FLDIREA | - OBD_MD_FLMDSCAPA; + OBD_MD_FLMDSCAPA | OBD_MD_MEA;; valid |= client_is_remote(exp) ? OBD_MD_FLRMTPERM : OBD_MD_FLACL; size[DLM_INTENT_REC_OFF] = sizeof(struct mdt_body); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 87c9456..a7ca30b 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -428,19 +428,9 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, repbody = req_capsule_server_get(pill, &RMF_MDT_BODY); - if (reqbody->valid & OBD_MD_MEA) { - /* Assumption: MDT_MD size is enough for lmv size FIXME */ - ma->ma_lmv = req_capsule_server_get(pill, &RMF_MDT_MD); - ma->ma_lmv_size = req_capsule_get_size(pill, &RMF_MDT_MD, - RCL_SERVER); - ma->ma_need = MA_INODE | MA_LMV; - } else { - ma->ma_need = MA_INODE | MA_LOV ; - ma->ma_lmm = req_capsule_server_get(pill, &RMF_MDT_MD); - ma->ma_lmm_size = req_capsule_get_size(pill, &RMF_MDT_MD, - RCL_SERVER); - } + /* First got the inode attr */ ma->ma_valid = 0; + ma->ma_need = MA_INODE; rc = mo_attr_get(env, next, ma); if (rc == -EREMOTE) { /* This object is located on remote node.*/ @@ -458,6 +448,26 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, else RETURN(-EFAULT); + /* If it is dir object and client require MEA, then we got MEA */ + if (S_ISDIR(la->la_mode) && reqbody->valid & OBD_MD_MEA) { + /* Assumption: MDT_MD size is enough for lmv size FIXME */ + ma->ma_lmv = req_capsule_server_get(pill, &RMF_MDT_MD); + ma->ma_lmv_size = req_capsule_get_size(pill, &RMF_MDT_MD, + RCL_SERVER); + ma->ma_need = MA_LMV; + } else { + ma->ma_lmm = req_capsule_server_get(pill, &RMF_MDT_MD); + ma->ma_lmm_size = req_capsule_get_size(pill, &RMF_MDT_MD, + RCL_SERVER); + ma->ma_need = MA_LOV; + } + rc = mo_attr_get(env, next, ma); + if (rc) { + CERROR("getattr error for "DFID": %d\n", + PFID(mdt_object_fid(o)), rc); + RETURN(rc); + } + if (mdt_body_has_lov(la, reqbody)) { if (ma->ma_valid & MA_LOV) { LASSERT(ma->ma_lmm_size); -- 1.8.3.1