Whamcloud - gitweb
LU-1319 mdt: increment MDT getattr stats
authorNed Bass <bass6@llnl.gov>
Thu, 12 Apr 2012 23:20:59 +0000 (16:20 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 30 Apr 2012 02:46:23 +0000 (22:46 -0400)
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 <bass6@llnl.gov>
Change-Id: I45ae7a73eaf81fbe56775725d07ec275b4261f1f
Reviewed-on: http://review.whamcloud.com/2526
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_handler.c
lustre/tests/sanity.sh

index b0a150d..e2f4c3c 100644 (file)
@@ -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);
index 1a47857..f8d3123 100644 (file)
@@ -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