Message ID | 20230524100812.80741-1-bo.wu@vivo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2740498vqo; Wed, 24 May 2023 03:31:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/qScItMOtnmuIbcvI+Dbr9bCKQsb7+MJMYp4zpbkqiWprv5geJKCtcnOeDd77sSmWOXnM X-Received: by 2002:a17:902:e5c8:b0:1aa:e425:2527 with SMTP id u8-20020a170902e5c800b001aae4252527mr17939210plf.21.1684924302574; Wed, 24 May 2023 03:31:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684924302; cv=pass; d=google.com; s=arc-20160816; b=HHPfB33Pn+al59l/t3jeCDwYzY6ZdLbEKE1OdK746a6YeVnK27n3On0Q4cm1CXYo5t WjhbFJIOGeWj0+5fARdpQTW+/CTmzTkM8MmBf++XVO/VExJOerR0xvOv8hXdz4li7WnC vnsqGFrVxe6e0SxGe1eJ0eWX7f286EK5tCz2pwI9wwcxby+8U3lUU5bHymATBMQfcEEi QhKdaBTb4WleV0Cwlln615yLTjHWjO8bXAObUrMZBv1E9wFulfL12s4K/c/0N0lJVC15 /zbKhVf7k1vSHRHhNQ1/p+A35d3jeJGrrGF3n/3UzhLMv3fqVAn19oQrGRQerw1WpKql hODA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=cbWJl+unvZxSbAGq8mOhN1a2E2HqCJMHd8IlLW533MQ=; b=p9MxWvvVsAWj502Di0aL+jgzPCrPXB/lm4cVlSIo39imxgqpr2OdLGJXn6vW04FBf2 +e529OtECSGxmR0xVflBvKHjYEyv47sNuXEXj29kJTBe/JeEMRXMaTttKMMc786DwDrY AyOVdMf44qHr7eWpO4hNrS45l5tDvp7hStTbvzIdWfb8bnGEW3XGo/zPWkTQ6PDYGyDY ZnsiIlLR5VL9pwfo0v7sls2kcfc0CEfxiOAatQuT2Q2Fkeepf9Ud5OJdXVESUNhxiUY8 OLMdYJrY3og9Oke+DBiTWL38o0qSHAhFopK28Uy2VkKyiFEDqE6nPln3FW4lnlGocJcG AADQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b="MiP6iE/M"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jk14-20020a170903330e00b001a99ace3e76si932920plb.554.2023.05.24.03.31.29; Wed, 24 May 2023 03:31:42 -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=@vivo.com header.s=selector2 header.b="MiP6iE/M"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232148AbjEXKId (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Wed, 24 May 2023 06:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbjEXKIa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 24 May 2023 06:08:30 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2133.outbound.protection.outlook.com [40.107.215.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2079EBF for <linux-kernel@vger.kernel.org>; Wed, 24 May 2023 03:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ePaiVVm5Zd0ndBNJeeGNgk4Uj/bLdGkoikdWzKDRnWQmIGj1RVqG7/bG0FTlkjNnWDbctpy/gF7iFd52DgroyI1mf1oVH10+YuXLo5wxLY40f805jfWq0xEhTQJrFwUnQao+gYEz47JigfgNkZ8tZVLnArXZFfvXwnoMTbN8qEYT94Y/PMo+PkWPRJwDw0gJx7YXVHS81BnHYdiMfWzy4b5+AiPvNPCXOJVESJGK0HnD6qs0gk2rDkkPx8L1+xaHE+BYnD7iQebifuMKw8UOMjErjEi2SHPStPPSgTvPwlF2+8BOHi7ai2buKDLey6Mf+QZvpZOUFRwFSKMsl83Dxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cbWJl+unvZxSbAGq8mOhN1a2E2HqCJMHd8IlLW533MQ=; b=byyZK/pYYFclGel60E2TbMEuds+/J/zWqYdDt1NwmZ3amp5y9vuyfiKeJm4tR5ivFaGrLngDMCK2gDAvJEZs3RQzG+ScRASr3NETIA/MbXP1RVHE/7XWrIS2jTluSqUW15DbLxYJV+3sImrIxfnlvLM/DnjTEK6iHO/LMMITcYxKiGcxSj3ZorSYbwvm20be7zJKrRKqkPRG+zm6ZHob/u+LT3UQQ9McDA9hWMiXlKKXWZ2UkTSEskaBKlnAarLIJDxcdt+J0aZGmTyM6Z2xRLUiEhUV8ZecetoO5uang6b6Pu59OYm90n6/JXwiuV/M8hr7IQPXt/MLjNpc/Pkarw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cbWJl+unvZxSbAGq8mOhN1a2E2HqCJMHd8IlLW533MQ=; b=MiP6iE/MtwmkZdaDpcjQphtew0jOS6XgMiGJbWD1pRfXq3xyUBZwKe2er32UYiAEb/I+dbY+9NFGMF4mjKlW8J0F07r8hFjpZEeygRoYQZYDJomVhBQAf/3I5EOQEHjvGABgcU3gEKRRUB4Z2qgh+qz3h+BO8c8OLm5Ejmr79Y+fqLyCJhxTCNZCHB4nTIoWNNA+kXSVj1yHMYs2LkqAO2BI2v88H0X+jJ6qQ/VwO7Eaj0Fb2yPLbxyorcgu0gxd4PCW0g8tMFGjhHEqjrddwP8yJ5w3oLJDA171b3DuFmFcBY7DfxKW6/wfgOxmvocoXhse3jJ67reKEBs39bCv0w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) by PSAPR06MB3925.apcprd06.prod.outlook.com (2603:1096:301:2b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Wed, 24 May 2023 10:08:23 +0000 Received: from SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::b895:d992:299e:32d4]) by SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::b895:d992:299e:32d4%7]) with mapi id 15.20.6411.028; Wed, 24 May 2023 10:08:23 +0000 From: Wu Bo <bo.wu@vivo.com> To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org> Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, wubo.oduw@gmail.com, Wu Bo <bo.wu@vivo.com> Subject: [PATCH 1/1] f2fs: fix args passed to trace_f2fs_lookup_end Date: Wed, 24 May 2023 18:08:12 +0800 Message-Id: <20230524100812.80741-1-bo.wu@vivo.com> X-Mailer: git-send-email 2.35.3 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR04CA0004.apcprd04.prod.outlook.com (2603:1096:4:197::22) To SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SL2PR06MB3017:EE_|PSAPR06MB3925:EE_ X-MS-Office365-Filtering-Correlation-Id: 8aba4389-1a8e-4983-d37e-08db5c3eceb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dDaCyEsQUz3Ow1jGM6yHa6HQl4dFJxryVH+lLurIZGdV5hDOXuYIKXMkQa8/cqDyhttkd/inelq6n/IYIWZal66LnlkeJofMZuEUps1YfdMkyvzrfUIGMU1oaqdsuHBaMA54GP1At9aPF+3mVwF2n+ceBlhIdysdEwqhIIqRnYQkON2tLms3S0zm1dEl8T4Rzi2zeDzaftl5y3Ydg/ip8lfAPC4KdJ1lnh3BRghvfuzkNgb1WE2neOIlxhudemk8eXdtfjacJoD7pVFloNyhYXIqiXx9ZZ/mqd8aLrmnAT1/a0RFCiieHjM/jwy8kTDBKIQDgazBtG+9XiPMmJW73d8UP3CyN80OOHq9e9bzyQgrIZwTB3gOYoWJgOU/hVyvhdzCJIRstxO6YS0sF2BH1VZu09olP1L1CUBHzChNG55kF4Um1i3gJcd5o5DgpmSg9bWSNJNv8eWy6h/KGxmwrF5zbSNVhGB/nzL4xk59m1KBGMYgNtNE8Vk8SkkOa2VJSCYL0FTLy8qK2yBv3aBqjKkMjeW74ZeGWcBjEi25oCMnqGh3vnGSxXubzDHiCt+WNq3LiQ/FHaxGwSxsAJ95h17Fo8YDGInr3ywgKdTs5lMo0S9f35nq6jgrvzyjr7JZ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SL2PR06MB3017.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(366004)(376002)(396003)(346002)(39860400002)(451199021)(5660300002)(8676002)(8936002)(2906002)(186003)(4744005)(36756003)(83380400001)(2616005)(86362001)(38100700002)(38350700002)(6512007)(6506007)(26005)(1076003)(107886003)(316002)(66476007)(66556008)(66946007)(4326008)(6666004)(110136005)(478600001)(6486002)(52116002)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zc5kEGYdyuIZPEB1/VbZUbQRJaTHIe57CTVByr9ZhETP2DT6pEHq/d4UhzOCKNFISnuDRZrF0KpDPknsj0Mcv8v0YEvecBNBpqam96AnC5VKUvTKhbfjn/i1d5p0U/00ACU7Jgy1PRiYi0wCBedkfgRgiCkfrz0WdWC9N1DzHuZYRDw2wAiWbXID0kWFuvOIzyuUjnPTTBu9YqtSd2zpK88FV9SxAA6PKQO3eRew4xIuaDiotDNNHuz9uhmtKLvHEy54fewFpDs72ldoKnr82H3Bk8MhNJH5aWOtAGknlcAecidxBG10A6qizr7jVIMNZwt7kJ2iRjB3ltKQaCiDLoe2AV/urTioli0BCHJJYNJdMA4koIw8surj+2pg/PzYCdeAyJfkiBTwC/Z+mfVHOlbxDkLRM5OqHaM136gXmkjVuis5fL8qPnTytZYwvT34wDqhkB/MYr75lb2ht1Qy4ti9YdfLahWl/h3g4NxURelZAIFLBVYubNLslkq6/UMUobdS4xkAeNTqttI5GwanarlIKsHfc5GLVM74cHlJE/Jhew3h1kaayZeZsnXvrTUGAX0AN2sM0SY47VDH8dla5/UnhBGI++oEFk+pzVtxFaZ+3mXDkvTGtYBpvl+lyx0CH+dvj+awuBwASL+XmSU8Qhl60l1LiYSdXijPOaNRXHiF/RCz1P9ghEoLY8RzIXmCCe/7vSQGkguSLMpPhYtrc26E0sxb/wH5o1MBpkK2V5/11ddCITV25LJk0UQbEglxz6r7tWAx8wN00f9nsSarMYNf2G2aJ2MFalxKLgKhXbOoYVgTVYRC71yKlGZY0a7mBpZrtXT8+KCQQKpKkDRXtYAYCz3g0mp7vSGEJsqO02R1mFyJSiK4y3Z34RlSNv3fFVUGLaamVOTXoWrPmv/ItN+g+XcqkL19TCfJlkr4F34YtlOQOz8/L1Pg+Cd+6T2xTgepxQUO4E/NMDmz8sV+Od5QOBKKSFpqZi8ft72Bc6g4JU0RkL62s9WObXCvkFD004ffa50jHTyTR2FB75IA5I9pK7yciboSh2T++mYydKnNkrjoD2BPPB+dSET9BYkoxPNrtFhFdrs/FF2DEwq0WYWADLjSCvrnu//UoTBAVdrWUF3ZIc2ASUePQ2AXPclYKB4Sd1GDI6u2JWP6XU7VGPfYDb8h9L9enzJSKfJwsupVG9+1xIZ3qHkRFC0n7u/K/TFbKTgYVCeGXo1s8pk5oJokXKN4ySdSSS6CP1BMpcx7GMKdr/Xs1LHEQjmj82hlPcJu/xqsHpPK0T00NlbQNLoH8/IlQ9hnbGXTx0z4kd0PXa7e9aVB1MalFV1n68aViv7PD5VVVWTPI76MN5czXeCvZ00ZTPenXh8iiRX+65VirU/jIq6KyVMjShrUfmqsuGMfsGnjVvA3I58FrcG9XW6vZH3twvA9jgXxfBu6E+Q7g50irkzU+/OWFdSxIWDVHXzPN99TzxJ0ee13A7GiojgSwqpU2eWCk39XtW3ISV5LO6HD4WIoy0InvQJVnkEtng5euVkd0uAxxv91WROxGBcBhMh3Tll1Mr39wrbcg8+qpDjeNoQv1kuDKKyL2raU X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8aba4389-1a8e-4983-d37e-08db5c3eceb2 X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3017.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 10:08:23.3844 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vWpr08kPzoSSaPdZytltp6QrLVRBAu2gA40/casTtq7GshLbxST18Jc1l/Ddv60C1w4C3f26Usg8/HGrg1M8xg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR06MB3925 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766771185505679870?= X-GMAIL-MSGID: =?utf-8?q?1766771185505679870?= |
Series |
[1/1] f2fs: fix args passed to trace_f2fs_lookup_end
|
|
Commit Message
Wu Bo
May 24, 2023, 10:08 a.m. UTC
The NULL return of 'd_splice_alias' dosen't mean error.
Signed-off-by: Wu Bo <bo.wu@vivo.com>
---
fs/f2fs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 05/24, Wu Bo wrote: > The NULL return of 'd_splice_alias' dosen't mean error. > > Signed-off-by: Wu Bo <bo.wu@vivo.com> > --- > 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
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 <bo.wu@vivo.com> >> --- >> 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") > > >> return new; >> out_iput: >> iput(inode); >> -- >> 2.35.3
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 <bo.wu@vivo.com> > > > --- > > > 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. > > > > > > > > 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
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 <bo.wu@vivo.com> >>>> --- >>>> 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
On 2023/5/29 18:18, Chao Yu wrote: > 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 <bo.wu@vivo.com> >>>>> --- >>>>> 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, > Yes, this will be better. >>> >>>> >>>> >>>>> 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
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); return new; out_iput: iput(inode);