f2fs: fix args passed to trace_f2fs_lookup_end
PATCH 1/1 f2fs: fix args passed to trace_f2fs_lookup_end
The NULL return of 'd_splice_alias' dosen't mean error.
--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/namei.c +1 -1
@@ -577,7 +577,7 @@ 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); +trace_f2fs_lookup_end (dir, new ? new : dentry, ino, err);return new; out_iput:iput (inode);
Signature · 1 line
2.35.3
Jaegeuk Kim
maintainerQuoted 12 lines · Wu Bo
The NULL return of '
d_splice_alias' dosen't mean error.Signed-off-by Wu Bo <[email protected]>--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/namei.c +0
-0
fs/f2fs/namei.c static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, · line 580
Quoted 5 lines
fs/f2fs/namei.c +1
-1@@ -577,7 +577,7 @@ 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); +trace_f2fs_lookup_end (dir, new ? new : dentry, ino, err);
Shouldn't give an error pointer to the dentry field.
How about just giving the err?
- err = PTR_ERR_OR_ZERO(new); - trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); + trace_f2fs_lookup_end(dir, dentry, ino, PTR_ERR_OR_ZERO(new));
Quoted 5 lines
fs/f2fs/namei.c +0
-0return new; out_iput:iput (inode);Signature · 1 line
2.35.3
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 23 lines · Jaegeuk Kim
Quoted 12 lines · Wu Bo
The NULL return of '
d_splice_alias' dosen't mean error.Signed-off-by Wu Bo <[email protected]>--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/namei.c +0
-0fs/f2fs/namei.c static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, · line 580
Quoted 5 lines
fs/f2fs/namei.c +1
-1@@ -577,7 +577,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,#endif new =c (inode, dentry); err =PTR_ERR_OR_ZERO (new); -trace_f2fs_lookup_end (dir, dentry, ino, !new ? -ENOENT : err); +trace_f2fs_lookup_end (dir, new ? new : dentry, ino, err);Shouldn't give an error pointer to the dentry field.
How about just giving the err?
Review
Quoted 3 lines
(quoted diff) +1
-2- err = PTR_ERR_OR_ZERO(new); - trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); + trace_f2fs_lookup_end(dir, dentry, ino, PTR_ERR_OR_ZERO(new));
static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
{
if (IS_ERR(ptr))
return PTR_ERR(ptr);
else
return 0;
}For below two cases, PTR_ERR_OR_ZERO(new) will return zero:
a) f2fs_lookup found existed dentry
b) f2fs_lookup didn't find existed dentry (-ENOENT case)
So in below commit, I passed -ENOENT to tracepoint for case b), so we can distinguish result of f2fs_lookup in tracepoint, actually, -ENOENT is expected value when we create a new file/directory.
Commit 84597b1f9b05 ("f2fs: fix wrong value of tracepoint parameter")
Quoted 7 lines
Quoted 7 lines
fs/f2fs/namei.c +0
-0return new; out_iput:iput (inode);Signature · 1 line
2.35.3
Quoted 40 lines · Chao Yu
Quoted 23 lines · Jaegeuk Kim
Quoted 12 lines · Wu Bo
The NULL return of '
d_splice_alias' dosen't mean error.Signed-off-by Wu Bo <[email protected]>--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/namei.c +0
-0fs/f2fs/namei.c static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, · line 580
Quoted 5 lines
fs/f2fs/namei.c +1
-1@@ -577,7 +577,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,#endif new =c (inode, dentry); err =PTR_ERR_OR_ZERO (new); -trace_f2fs_lookup_end (dir, dentry, ino, !new ? -ENOENT : err); +trace_f2fs_lookup_end (dir, new ? new : dentry, ino, err);Shouldn't give an error pointer to the dentry field.
How about just giving the err?
Review
Quoted 3 lines
(quoted diff) +1
-2- err = PTR_ERR_OR_ZERO(new); - trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); + trace_f2fs_lookup_end(dir, dentry, ino, PTR_ERR_OR_ZERO(new));static inline int
__must_checkPTR_ERR_OR_ZERO(__force const void *ptr){ if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; }For below two cases,
PTR_ERR_OR_ZERO(new)will return zero:
a)f2fs_lookupfound existed dentry
b)f2fs_lookupdidn't find existed dentry (-ENOENTcase)
Quoted 5 lines
So in below commit, I passed
-ENOENTto tracepoint for case b), so we can distinguish result off2fs_lookupin tracepoint, actually,-ENOENTis expected value when we create a new file/directory.Commit
84597b1f9b05("f2fs: fix wrong value of tracepoint parameter")
I can see this commit is try to distinguish the dentry not existed case. But a normal case which dentry is exactly found will also go through 'd_splice_alias', and its return is also NULL. This makes the tracepoint always print 'err:-2' like the following:
ls-11676 [004] .... 329281.943118: f2fs_lookup_end: dev = (254,39), pino = 4451, name:Alarms, ino:7093, err:-2
ls-11676 [004] .... 329281.943145: f2fs_lookup_end: dev = (254,39), pino = 4451, name:Notifications, ino:7094, err:-2
ls-11676 [004] .... 329281.943172: f2fs_lookup_end: dev = (254,39), pino = 4451, name:Pictures, ino:7095, err:-2Even these lookup are acctually successful, this is a bit strange.
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/namei.c +0
-0return new; out_iput:iput (inode);Signature · 1 line
2.35.3
Quoted 4 lines
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 46 lines · Wu Bo
Quoted 40 lines · Chao Yu
Quoted 23 lines · Jaegeuk Kim
Quoted 12 lines · Wu Bo
The NULL return of '
d_splice_alias' dosen't mean error.Signed-off-by Wu Bo <[email protected]>--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/namei.c +0
-0fs/f2fs/namei.c static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, · line 580
Quoted 5 lines
fs/f2fs/namei.c +1
-1@@ -577,7 +577,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,#endif new =c (inode, dentry); err =PTR_ERR_OR_ZERO (new); -trace_f2fs_lookup_end (dir, dentry, ino, !new ? -ENOENT : err); +trace_f2fs_lookup_end (dir, new ? new : dentry, ino, err);Shouldn't give an error pointer to the dentry field.
How about just giving the err?
Review
Quoted 3 lines
(quoted diff) +1
-2- err = PTR_ERR_OR_ZERO(new); - trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); + trace_f2fs_lookup_end(dir, dentry, ino, PTR_ERR_OR_ZERO(new));static inline int
__must_checkPTR_ERR_OR_ZERO(__force const void *ptr){ if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; }For below two cases,
PTR_ERR_OR_ZERO(new)will return zero:
a)f2fs_lookupfound existed dentry
b)f2fs_lookupdidn't find existed dentry (-ENOENTcase)Quoted 5 lines
So in below commit, I passed
-ENOENTto tracepoint for case b), so we can distinguish result off2fs_lookupin tracepoint, actually,-ENOENTis expected value when we create a new file/directory.Commit
84597b1f9b05("f2fs: fix wrong value of tracepoint parameter")
Quoted 8 lines
I can see this commit is try to distinguish the dentry not existed case. But a normal case which dentry is exactly found will also go through '
d_splice_alias', and its return is also NULL. This makes the tracepoint always print 'err:-2' like the following:ls-11676 [004] .... 329281.943118: f2fs_lookup_end: dev = (254,39), pino = 4451, name:Alarms, ino:7093, err:-2 ls-11676 [004] .... 329281.943145: f2fs_lookup_end: dev = (254,39), pino = 4451, name:Notifications, ino:7094, err:-2 ls-11676 [004] .... 329281.943172: f2fs_lookup_end: dev = (254,39), pino = 4451, name:Pictures, ino:7095, err:-2Even these lookup are acctually successful, this is a bit strange.
Ah, I misunderstand return value's meaning of .lookup.
So, how about this? it only update err if d_splice_alias() returns a negative value?
if (IS_ERR(new))
err = PTR_ERR(new);
trace_f2fs_lookup_end(dir, new ? new : dentry, ino, err);
Thanks,
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/namei.c +0
-0return new; out_iput:iput (inode);Signature · 1 line
2.35.3
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 59 lines · Chao Yu
Quoted 47 lines · Wu Bo
Quoted 41 lines · Chao Yu
Quoted 22 lines · Jaegeuk Kim
Quoted 12 lines · Wu Bo
The NULL return of '
d_splice_alias' dosen't mean error.Signed-off-by Wu Bo <[email protected]>---
fs/f2fs/namei.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/namei.c +0
-0fs/f2fs/namei.c static struct dentry *f2fs_lookup(struct inode · line 581
Quoted 6 lines
fs/f2fs/namei.c +1
-1@@ -577,7 +577,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, #endif new = c(inode, dentry); err = PTR_ERR_OR_ZERO(new); - trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); + trace_f2fs_lookup_end(dir, new ? new : dentry, ino, err);Shouldn't give an error pointer to the dentry field.
Quoted 5 lines
How about just giving the err?
- err =
PTR_ERR_OR_ZERO(new);
-trace_f2fs_lookup_end(dir, dentry, ino, !new ? -ENOENT : err); +trace_f2fs_lookup_end(dir, dentry, ino, PTR_ERR_OR_ZERO(new));static inline int
__must_checkPTR_ERR_OR_ZERO(__force const void *ptr){
if (IS_ERR(ptr))
returnPTR_ERR(ptr);
else
return 0;
}For below two cases,
PTR_ERR_OR_ZERO(new)will return zero:
a)f2fs_lookupfound existed dentry
b)f2fs_lookupdidn't find existed dentry (-ENOENTcase)Quoted 5 lines
So in below commit, I passed
-ENOENTto tracepoint for case b), so we can distinguish result off2fs_lookupin tracepoint, actually,-ENOENTis expected value when we create a new file/directory.Commit
84597b1f9b05("f2fs: fix wrong value of tracepoint parameter")Quoted 8 lines
I can see this commit is try to distinguish the dentry not existed case.
But a normal case which dentry is exactly found will also go through
'd_splice_alias', and its return is also NULL. This makes the tracepoint always
print 'err:-2' like the following:
ls-11676 [004] .... 329281.943118:f2fs_lookup_end: dev = (254,39), pino = 4451, name:Alarms, ino:7093, err:-2 ls-11676 [004] .... 329281.943145:f2fs_lookup_end: dev = (254,39), pino = 4451, name:Notifications, ino:7094, err:-2 ls-11676 [004] .... 329281.943172:f2fs_lookup_end: dev = (254,39), pino = 4451, name:Pictures, ino:7095, err:-2 Even these lookup are acctually successful, this is a bit strange.Ah, I misunderstand return value's meaning of .lookup.
Quoted 9 lines
So, how about this? it only update err if
d_splice_alias()returns a negative value?if (
IS_ERR(new))
err =PTR_ERR(new);trace_f2fs_lookup_end(dir, new ? new : dentry, ino, err);Thanks,
Yes, this will be better.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/namei.c +0
-0return new;
out_iput:
iput(inode);Signature · 1 line
2.35.3_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel