Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2949736rwd; Mon, 29 May 2023 03:33:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6odUey7MwCvqXPEA68+yKFHs57BNtcm88oAUxGvyU8Jm2V34FOuRDVdmWD/ulCGeYvtVbm X-Received: by 2002:a17:902:ea0e:b0:1ac:b0c5:77e5 with SMTP id s14-20020a170902ea0e00b001acb0c577e5mr12067292plg.68.1685356414587; Mon, 29 May 2023 03:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685356414; cv=none; d=google.com; s=arc-20160816; b=NPltvNeMA1qw6ReTyD74Lbj0DhOgY194vCczVcWdzCk0DfH4UPCQdluDk04bXMOut1 Zsu0ZW/lxBZPwK3PLrQH2J+zMLUtqcA4RIvL3huFQjuiPOWZpi48x0yMIGHYmjEXXKlI EZuTQU5ZsoCbTnAYvzCqfhEIzucTGfGeQ6kZsUoISQdwtmppAgxHalgTb6xGXKLVOR7c Ul6QqoLp4IGPj5uDrWBx4EEbCfFtLKhWwjMEU4F2yp1f+AiKWK8DvEPkiFdzWeN0LNGt IT25NQxND6drL8eBPsdh0ZUQT/rgUl/P8Y6uKaAg91UykDa9jk84cnbkWlpv90Cn3Od4 Bl5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Ei7gkhQ8xQsB/1W0iCamTG2atvhy0PytxuE+69p1/Mw=; b=WaWOPvCTpvSKNAFDu0ImPLT7JAhRhivSfOHJ65O/xD9ojFdDCX1LjClGiEQprDdpJ4 nJzEvKpMkvOqLDihwc6AcG0ruSGRCZnScvRe/cvMW6qdVc3bahfWv+Xq/dX1ZLUbPL5E yXJeUyTRq1Gs6VdY9qfE2WnEH3NQbK1W/SM2RgeANPcvgyYiJhb852HF5AmGUcSrT0q4 +3Q9/tBOZM2+t+tdO0Vw8fVUlMsg+lwikm8F1R4BW2kGQntGcwjMyCFw/yVWkd/BNx3Z nRzg163xLcSXnfwJ6axEMsSRtbFie2D9ZQhvqF330zSsbLl6w3FLo17WbTAl/zGnFeoH lqiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EBu2mW4E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jb14-20020a170903258e00b001b04c92cb3fsi271027plb.249.2023.05.29.03.33.18; Mon, 29 May 2023 03:33:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EBu2mW4E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232018AbjE2KS7 (ORCPT + 99 others); Mon, 29 May 2023 06:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbjE2KSz (ORCPT ); Mon, 29 May 2023 06:18:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FB84F1 for ; Mon, 29 May 2023 03:18:48 -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 EBDBB61362 for ; Mon, 29 May 2023 10:18:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12796C433EF; Mon, 29 May 2023 10:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685355527; bh=RkkExfeGgE+dhRU4IGRx6ehNzHPNh6PhoYcLpUyFzMI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=EBu2mW4E1yMU8iIDd4Lsgo3CNSYIPG4uTB/mjzlxd2YqoaGca4QM+mdVQ/qTNc/vF cWUAaT0p7TiBZkLpAnoXjTeePD16OC1NU32Q2lnnOnrGAU1ZtpGb/vLR4Ic2j/HeBC iIjYaeOzE+mj3C69hZB8e+Q2KscKbLuw+XJQUoEP6NUflbUdLXnCuxL+AbQYeDsy4T /+9j4eS+H4Kio8/TAVCSwgj9g5K5b4fEN3uTJ2E3ATnThp43OByH8ujoYHRIsYmYep 10Mle5BiZoD+tFRMmkCqnEnJ2suCWRq01NYGj5NuIfsA/YWMepSyjK5HzGm8rta0GT RIC3Va/1Vlnig== Message-ID: <0c15c662-903c-3504-d502-72f0a3b70cbf@kernel.org> Date: Mon, 29 May 2023 18:18:42 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [f2fs-dev] [PATCH 1/1] f2fs: fix args passed to trace_f2fs_lookup_end Content-Language: en-US To: Wu Bo Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, wubo.oduw@gmail.com References: <2bb05623-9438-3b68-6ac8-4294f9676ff6@kernel.org> <20230529041337.36741-1-bo.wu@vivo.com> From: Chao Yu In-Reply-To: <20230529041337.36741-1-bo.wu@vivo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/5/29 12:13, Wu Bo wrote: > On Sat, May 27, 2023 at 09:01:41AM +0800, Chao Yu wrote: >> On 2023/5/27 1:21, Jaegeuk Kim wrote: >>> On 05/24, Wu Bo wrote: >>>> The NULL return of 'd_splice_alias' dosen't mean error. >>>> >>>> Signed-off-by: Wu Bo >>>> --- >>>> 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 = 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? >>> >>> - 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") > 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. 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, >> >>> >>> >>>> 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