From: Wu Bo Date: Thu, 1 Jun 2023 01:37:59 +0000 (+0800) Subject: f2fs: fix args passed to trace_f2fs_lookup_end X-Git-Tag: v6.6.7~2416^2~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cadfc2f9f8c35ed429a64245a89766961dad49fa;p=platform%2Fkernel%2Flinux-starfive.git f2fs: fix args passed to trace_f2fs_lookup_end The NULL return of 'd_splice_alias' dosen't mean error. Thus the successful case will also return NULL, which makes the tracepoint always print 'err=-ENOENT'. And the different cases of 'new' & 'err' are list as following: 1) dentry exists: err(0) with new(NULL) --> dentry, err=0 2) dentry exists: err(0) with new(VALID) --> new, err=0 3) dentry exists: err(0) with new(ERR) --> dentry, err=ERR 4) no dentry exists: err(-ENOENT) with new(NULL) --> dentry, err=-ENOENT 5) no dentry exists: err(-ENOENT) with new(VALID) --> new, err=-ENOENT 6) no dentry exists: err(-ENOENT) with new(ERR) --> dentry, err=ERR Signed-off-by: Wu Bo Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 77a7127..3e35eb7 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -576,8 +576,8 @@ out_splice: } #endif new = d_splice_alias(inode, dentry); - err = PTR_ERR_OR_ZERO(new); - trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); + trace_f2fs_lookup_end(dir, !IS_ERR_OR_NULL(new) ? new : dentry, + ino, IS_ERR(new) ? PTR_ERR(new) : err); return new; out_iput: iput(inode);