Re: [PATCH 1/1] f2fs: fix args passed to trace_f2fs_lookup_end

From: Jaegeuk Kim
Date: Fri May 26 2023 - 13:21:23 EST


On 05/24, Wu Bo wrote:
> The NULL return of 'd_splice_alias' dosen't mean error.
>
> Signed-off-by: Wu Bo <bo.wu@xxxxxxxx>
> ---
> fs/f2fs/namei.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 77a71276ecb1..e5a3e39ce90c 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -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));


> return new;
> out_iput:
> iput(inode);
> --
> 2.35.3