Whamcloud - gitweb
LU-1319 mdt: increment MDT getattr stats
authoryangsheng <ys@whamcloud.com>
Wed, 2 May 2012 14:44:42 +0000 (22:44 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 7 May 2012 15:15:15 +0000 (11:15 -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>
Signed-off-by: yang sheng <ys@whamcloud.com>
Change-Id: I25293fe98567b1250ecc2f9645295c1522345295
Reviewed-on: http://review.whamcloud.com/2637
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_handler.c
lustre/tests/sanity.sh

index 9870cb6..b61170a 100644 (file)
@@ -496,7 +496,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);
@@ -638,6 +638,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);
 }
 
@@ -675,7 +680,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;
@@ -737,8 +741,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_shrink_reply(info);
         return rc;
index 44bc437..af259f5 100644 (file)
@@ -6948,6 +6948,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