From 3cc79c2fb5cdfb8e7a0eef45cf4794923a898493 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 6 Nov 2015 14:50:01 -0700 Subject: [PATCH] LU-1095 mdc: remove console spew from mdc_ioc_fid2path 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 Change-Id: I3cad19d02e8065574b8baf5694e9894e43112318 Reviewed-on: http://review.whamcloud.com/17078 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- lustre/mdc/mdc_request.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index b2227d8..9c106b9 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -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, -- 1.8.3.1