Whamcloud - gitweb
LU-1095 mdc: remove console spew from mdc_ioc_fid2path 78/17078/3
authorAndreas Dilger <andreas.dilger@intel.com>
Fri, 6 Nov 2015 21:50:01 +0000 (14:50 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 30 Nov 2015 17:20:02 +0000 (17:20 +0000)
In some cases with a very long pathname, such as with sanity.sh
test_154c, mdc_ioc_fid2path() would spew long debug messages to
the log, because libcfs_debug_vmsg2() refuses to log messages over
one page in size.

Truncate the debug message to only log the last 512 characters
of the pathname, which is sufficient for most debugging, saves a
bit of space in the debug log, and will prevent the debug logging
from printing to the console in the first place.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I3cad19d02e8065574b8baf5694e9894e43112318
Reviewed-on: http://review.whamcloud.com/17078
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdc/mdc_request.c

index b2227d8..9c106b9 100644 (file)
@@ -1473,17 +1473,20 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf)
        if (rc != 0 && rc != -EREMOTE)
                GOTO(out, rc);
 
-        if (vallen <= sizeof(*gf))
-                GOTO(out, rc = -EPROTO);
-        else if (vallen > sizeof(*gf) + gf->gf_pathlen)
-                GOTO(out, rc = -EOVERFLOW);
+       if (vallen <= sizeof(*gf))
+               GOTO(out, rc = -EPROTO);
+       if (vallen > sizeof(*gf) + gf->gf_pathlen)
+               GOTO(out, rc = -EOVERFLOW);
 
-        CDEBUG(D_IOCTL, "path get "DFID" from "LPU64" #%d\n%s\n",
-               PFID(&gf->gf_fid), gf->gf_recno, gf->gf_linkno, gf->gf_path);
+       CDEBUG(D_IOCTL, "path got "DFID" from "LPU64" #%d: %s\n",
+              PFID(&gf->gf_fid), gf->gf_recno, gf->gf_linkno,
+              gf->gf_pathlen < 512 ? gf->gf_path :
+              /* only log the last 512 characters of the path */
+              gf->gf_path + gf->gf_pathlen - 512);
 
 out:
-        OBD_FREE(key, keylen);
-        return rc;
+       OBD_FREE(key, keylen);
+       return rc;
 }
 
 static int mdc_ioc_hsm_progress(struct obd_export *exp,