From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF85FC77B73 for ; Tue, 30 May 2023 23:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233558AbjE3Xcl (ORCPT ); Tue, 30 May 2023 19:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231828AbjE3Xci (ORCPT ); Tue, 30 May 2023 19:32:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D08FAEC for ; Tue, 30 May 2023 16:32:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C88D632EF for ; Tue, 30 May 2023 23:32:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B92AC433EF; Tue, 30 May 2023 23:32:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685489556; bh=JXz0xI70zuYpYZsltrSyZalooGB27OtEMdKKeiDcQNU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tXcGh5VxJseqUJCs/l1tb6YMnkYiaCyHEJTbJqUThtjcDapGkcJac485k3iwsuBrJ SdqnqflN+cQvNFYN+X1ewgC1UEYScO3QvVLLxMZvRn/P+VzwJmuG3jsV5DcJnqPR9e veyKyUJlQCnr5v3vsOg+e9djeOGIprE4lt9SJ3sF8g/IsnW/3PeQHDkL06aKLTG5ml zjQwucwHtmy5cbW9CStYnaZd+lGyaZGsgaGWmEpKpAvISP+5LcTF2Q8QAHvuOqbQpu J//q6QKPKLT4b9ZC0qupD41JPo8h6SBsGiv6sx4mL1auDdcJb6WAPzzwg6Md8zlXel wVzjEwbX49w6g== Date: Tue, 30 May 2023 16:32:34 -0700 From: Jaegeuk Kim To: Wu Bo Cc: Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, wubo.oduw@gmail.com Subject: Re: [PATCH v2 1/1] f2fs: fix args passed to trace_f2fs_lookup_end Message-ID: References: <20230530012118.74228-1-bo.wu@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230530012118.74228-1-bo.wu@vivo.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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