* [f2fs-dev] [PATCH v2 1/1] f2fs: fix args passed to trace_f2fs_lookup_end @ 2023-05-30 1:21 Wu Bo via Linux-f2fs-devel 2023-05-30 1:51 ` Chao Yu 2023-05-30 23:32 ` Jaegeuk Kim 0 siblings, 2 replies; 4+ messages in thread From: Wu Bo via Linux-f2fs-devel @ 2023-05-30 1:21 UTC (permalink / raw) To: Jaegeuk Kim, Chao Yu; +Cc: wubo.oduw, linux-kernel, Wu Bo, linux-f2fs-devel 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'. Signed-off-by: Wu Bo <bo.wu@vivo.com> --- fs/f2fs/namei.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 77a71276ecb1..0c5e4c424eab 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -576,8 +576,9 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, } #endif new = d_splice_alias(inode, dentry); - err = PTR_ERR_OR_ZERO(new); - trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); + if (IS_ERR(new)) + err = PTR_ERR(new); + trace_f2fs_lookup_end(dir, new ? new : dentry, ino, err); return new; out_iput: iput(inode); -- 2.35.3 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH v2 1/1] f2fs: fix args passed to trace_f2fs_lookup_end 2023-05-30 1:21 [f2fs-dev] [PATCH v2 1/1] f2fs: fix args passed to trace_f2fs_lookup_end Wu Bo via Linux-f2fs-devel @ 2023-05-30 1:51 ` Chao Yu 2023-05-30 23:32 ` Jaegeuk Kim 1 sibling, 0 replies; 4+ messages in thread From: Chao Yu @ 2023-05-30 1:51 UTC (permalink / raw) To: Wu Bo, Jaegeuk Kim; +Cc: wubo.oduw, linux-kernel, linux-f2fs-devel On 2023/5/30 9:21, Wu Bo wrote: > 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'. > > Signed-off-by: Wu Bo <bo.wu@vivo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH v2 1/1] f2fs: fix args passed to trace_f2fs_lookup_end 2023-05-30 1:21 [f2fs-dev] [PATCH v2 1/1] f2fs: fix args passed to trace_f2fs_lookup_end Wu Bo via Linux-f2fs-devel 2023-05-30 1:51 ` Chao Yu @ 2023-05-30 23:32 ` Jaegeuk Kim 2023-05-31 1:11 ` Chao Yu 1 sibling, 1 reply; 4+ messages in thread From: Jaegeuk Kim @ 2023-05-30 23:32 UTC (permalink / raw) To: Wu Bo; +Cc: wubo.oduw, linux-kernel, linux-f2fs-devel On 05/30, Wu Bo wrote: > 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'. > > Signed-off-by: Wu Bo <bo.wu@vivo.com> > --- > fs/f2fs/namei.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c > index 77a71276ecb1..0c5e4c424eab 100644 > --- a/fs/f2fs/namei.c > +++ b/fs/f2fs/namei.c > @@ -576,8 +576,9 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, > } > #endif > new = d_splice_alias(inode, dentry); > - err = PTR_ERR_OR_ZERO(new); > - trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); > + if (IS_ERR(new)) > + err = PTR_ERR(new); > + trace_f2fs_lookup_end(dir, new ? new : dentry, ino, err); Again, new can be an error pointer, and the previous err was supposed to be zero or -ENOENT. case 1) dentry exists: err (0) with new (NULL) --> dentry, err=0 case 2) dentry exists: err (0) with new (VALID) --> new, err=0 case 3) dentry exists: err (0) with new (ERR) --> dentry, err=ERR case 4) no dentry exists: err (-ENOENT) with new (NULL) --> dentry, err=-ENOENT case 4) no dentry exists: err (-ENOENT) with new (VALID) --> new, err=-ENOENT case 5) no dentry exists: err (-ENOENT) with new (ERR) --> dentry, err=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); > -- > 2.35.3 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH v2 1/1] f2fs: fix args passed to trace_f2fs_lookup_end 2023-05-30 23:32 ` Jaegeuk Kim @ 2023-05-31 1:11 ` Chao Yu 0 siblings, 0 replies; 4+ messages in thread From: Chao Yu @ 2023-05-31 1:11 UTC (permalink / raw) To: Jaegeuk Kim, Wu Bo; +Cc: wubo.oduw, linux-kernel, linux-f2fs-devel On 2023/5/31 7:32, Jaegeuk Kim wrote: > On 05/30, Wu Bo wrote: >> 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'. >> >> Signed-off-by: Wu Bo <bo.wu@vivo.com> >> --- >> fs/f2fs/namei.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c >> index 77a71276ecb1..0c5e4c424eab 100644 >> --- a/fs/f2fs/namei.c >> +++ b/fs/f2fs/namei.c >> @@ -576,8 +576,9 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, >> } >> #endif >> new = d_splice_alias(inode, dentry); >> - err = PTR_ERR_OR_ZERO(new); >> - trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); >> + if (IS_ERR(new)) >> + err = PTR_ERR(new); >> + trace_f2fs_lookup_end(dir, new ? new : dentry, ino, err); > > Again, new can be an error pointer, and the previous err was supposed to be > zero or -ENOENT. > > case 1) dentry exists: err (0) with new (NULL) --> dentry, err=0 > case 2) dentry exists: err (0) with new (VALID) --> new, err=0 > case 3) dentry exists: err (0) with new (ERR) --> dentry, err=ERR > case 4) no dentry exists: err (-ENOENT) with new (NULL) --> dentry, err=-ENOENT > case 4) no dentry exists: err (-ENOENT) with new (VALID) --> new, err=-ENOENT > case 5) no dentry exists: err (-ENOENT) with new (ERR) --> dentry, err=ERR > > trace_f2fs_lookup_end(dir, !IS_ERR_OR_NULL(new) ? new : dentry, > ino, IS_ERR(new) ? PTR_ERR(new) : err); Agreed, could you please add above description in commit message? Thanks, > > >> return new; >> out_iput: >> iput(inode); >> -- >> 2.35.3 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-31 1:12 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-05-30 1:21 [f2fs-dev] [PATCH v2 1/1] f2fs: fix args passed to trace_f2fs_lookup_end Wu Bo via Linux-f2fs-devel 2023-05-30 1:51 ` Chao Yu 2023-05-30 23:32 ` Jaegeuk Kim 2023-05-31 1:11 ` Chao Yu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).