From: Li Dongyang Date: Thu, 27 Jun 2019 03:25:45 +0000 (+1000) Subject: LU-11956 mdd: do not reset original lu_buf.lb_len X-Git-Tag: 2.12.90~116 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=94a5bc1bcb6c6373ead5b091ff5915dfe452377b LU-11956 mdd: do not reset original lu_buf.lb_len In mdd_iterate_xattrs(), we are resetting the xbuf.lb_len to a smaller value returned by linkea_overflow_shrink(). If that's the last xattr we gonna process, we could deduct less than originally allocated size from obd_memory stats, failing the memleak check later. Signed-off-by: Li Dongyang Change-Id: I6175a91c61ceb0e37ab889d0cfd904f4993ab5cc Reviewed-on: https://review.whamcloud.com/35333 Reviewed-by: Li Xi Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index a8e4b60..d069874 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -3512,6 +3512,7 @@ static int mdd_iterate_xattrs(const struct lu_env *env, struct mdd_thread_info *info = mdd_env_info(env); char *xname; struct lu_buf list_xbuf; + struct lu_buf cbxbuf; struct lu_buf xbuf = { NULL }; int list_xsize; int xlen; @@ -3568,14 +3569,15 @@ static int mdd_iterate_xattrs(const struct lu_env *env, if (rc < 0) GOTO(out, rc); + cbxbuf = xbuf; repeat: - rc = cb(env, tobj, &xbuf, xname, 0, handle); + rc = cb(env, tobj, &cbxbuf, xname, 0, handle); if (unlikely(rc == -ENOSPC && strcmp(xname, XATTR_NAME_LINK) == 0)) { rc = linkea_overflow_shrink( - (struct linkea_data *)(xbuf.lb_buf)); + (struct linkea_data *)(cbxbuf.lb_buf)); if (likely(rc > 0)) { - xbuf.lb_len = rc; + cbxbuf.lb_len = rc; goto repeat; } }