From fcb0ebe13fbbf8f4ed9d593387164482a806672c Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Thu, 12 Apr 2012 16:20:59 -0700 Subject: [PATCH] LU-1319 mdt: increment MDT getattr stats Move increment of MDT getattr stat from mdt_getattr() to mdt_getattr_internal() so we don't miss other call paths that may service getattr requests. Signed-off-by: Ned Bass Change-Id: I45ae7a73eaf81fbe56775725d07ec275b4261f1f Reviewed-on: http://review.whamcloud.com/2526 Reviewed-by: Yang Sheng Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_handler.c | 10 ++++++---- lustre/tests/sanity.sh | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index b0a150d..e2f4c3c 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -519,7 +519,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, /* This object is located on remote node.*/ repbody->fid1 = *mdt_object_fid(o); repbody->valid = OBD_MD_FLID | OBD_MD_MDS; - RETURN(0); + GOTO(out, rc = 0); } buffer->lb_buf = req_capsule_server_get(pill, &RMF_MDT_MD); @@ -661,6 +661,11 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, RETURN(rc); repbody->valid |= OBD_MD_FLMDSCAPA; } + +out: + if (rc == 0) + mdt_counter_incr(req->rq_export, LPROC_MDT_GETATTR); + RETURN(rc); } @@ -698,7 +703,6 @@ static int mdt_renew_capa(struct mdt_thread_info *info) static int mdt_getattr(struct mdt_thread_info *info) { - struct ptlrpc_request *req = mdt_info_req(info); struct mdt_object *obj = info->mti_object; struct req_capsule *pill = info->mti_pill; struct mdt_body *reqbody; @@ -758,8 +762,6 @@ static int mdt_getattr(struct mdt_thread_info *info) mdt_exit_ucred(info); EXIT; out_shrink: - if (rc == 0) - mdt_counter_incr(req->rq_export, LPROC_MDT_GETATTR); mdt_client_compatibility(info); rc2 = mdt_fix_reply(info); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 1a47857..f8d3123 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7354,6 +7354,9 @@ test_133b() { # extra mdt stats verification. chmod 444 ${testdir}/${tfile} || error "chmod failed" check_stats $SINGLEMDS "setattr" 1 + do_facet $SINGLEMDS $LCTL set_param mdt.*.md_stats=clear + ls -l ${testdir}/${tfile} > /dev/null|| error "ls failed" + check_stats $SINGLEMDS "getattr" 1 $LFS df || error "lfs failed" check_stats $SINGLEMDS "statfs" 1 -- 1.8.3.1