Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp669385rwe; Thu, 25 Aug 2022 07:17:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR6yviXUuQFXdJ2G7Ay+L80e6/nY8xVHHjZlvt4OBum3Vg6o1JMih3Nv1GyN75akb3GTkOOK X-Received: by 2002:a17:906:99c1:b0:6fe:b01d:134 with SMTP id s1-20020a17090699c100b006feb01d0134mr2578521ejn.598.1661437023769; Thu, 25 Aug 2022 07:17:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661437023; cv=pass; d=google.com; s=arc-20160816; b=txevjn4o0fjCGnDRp+h4QZNkCRjaAzAq1D1xLpFVrCuw24tMlvvdgvnIjMXdJeF5Qx pXzA+aGei3HTrw89OWMNiaFuUJCDguRLckGBsWpJPtdoK290hH6Q7eVL4r/+7jaBs9z+ NqhOsOhL5lUv2t6nj/fBTASS7GoBxNr07mAaRm+X4RNUmoptHPtvqXArrRX9aI7U3m3L D23VvXfGS6SqFpwOXLG8D1FkgNSAlJV20GitVnTOGLzW1HPBW6Vn6JKarp6MXbEQHGbw xWh5JBDLR7ybn+IiO2t41GaLnEsu5Hj5ry32uuqTiUfs1gsEZaQ/eQTqdUKZyJv9pJPq etrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:in-reply-to :content-disposition:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=tSrn+HliidosAeKxrDT4IN3ULs6iPW7RaGjrBgaIun0=; b=dIjK99fCq1yUUVSXumcFSyQpS7atTuxy8DcQe+AeBBJVNUmgIc5wjTDJGK4Wi4CkNb gO1rEw2u8qhAjVIAy/L2ClXW8L+GK4/++O94OGEAyIKuD5EI44V3qLb8+YpSudJZ0jCd jEf2sDzVc0AzEPPV/muOSUeVZ3BZAz0mzn/WlK52vOP/vT8SWBSuhzjmEds3GKiflUKm smrebenNZ4e4/cG5vLhL76UVAEgODt7Nflx11Sg1/lpT5M3xUz8oBo3P/qbVU6V0kefY 13r2vnkngxiDpv4u+06LLtymVdb6dI23N9umIHmLgT9edv+XVed5piGlObKppNvGJKXv FPIw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=npesD+1q; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wRAKZmZi; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di16-20020a170906731000b00732f74ed931si4581740ejc.793.2022.08.25.07.16.36; Thu, 25 Aug 2022 07:17:03 -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=@oracle.com header.s=corp-2022-7-12 header.b=npesD+1q; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wRAKZmZi; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241095AbiHYNhD (ORCPT + 99 others); Thu, 25 Aug 2022 09:37:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229657AbiHYNhB (ORCPT ); Thu, 25 Aug 2022 09:37:01 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F0CB2499; Thu, 25 Aug 2022 06:37:00 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27PD9Po5004590; Thu, 25 Aug 2022 13:36:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=corp-2022-7-12; bh=tSrn+HliidosAeKxrDT4IN3ULs6iPW7RaGjrBgaIun0=; b=npesD+1qcvlM4sNsaLVHK3lRf4WSIaz8qMHW2h1RpKwZEcHSGn0sjUn4SjlcEXes7pwh 7wShBQOpDa622abGzIC9DYG6xda+P2ToAoiqFOhddx/oemvpzSnC7uEYzO8zwtOMQjXX bgMak9x8Ag1NVIQWPrFaO6PKonWDDc/PrUkkt9n9/fMAFkmPjWhsvlvXMZwRgc6C3zeS aNAf5mBoUhjll52Uf+/AKE1oVPrFTnMIJaLF/D9CAzTRxGaOffa5AAEqwc0XeulGlqMu JSDY/lsiqeicrsi8gRBAvh8cErYNHgYRZ1SmqfWtgNhTVmwHQ6MFLAempwcx4Dz5vbpD 4w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3j55nycv0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Aug 2022 13:36:45 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27PBEBkA021748; Thu, 25 Aug 2022 13:36:44 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3j5n5pax7x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Aug 2022 13:36:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YTYv4jk6+R8QQpmJ2gLk3ke2usS01+O7WVRngvkpb1m1Q6Se/q3Kfr5mMXIO15WWw6illQqfXrwvLeUe/v06cFf3PUCkCSy69NoL0qyK3KQ+K4hs3x38y8GhMvVgScCYwMGn8RAGOH/FXZQwUzDPdbvzU7LO3rfdqSHHv9H5+zFcjPJzkiUbWOnM4G2Sp4nH6M5CHTsU2mmHtyVTD+82D71LLeutP+NxFqgb6vDgZd3eK3Bu4K+WFiE+E3mP2MVfp9bAQQPksw+kG5h0qozPOKFqG1068CO5noxHSgaaAvj8TqWbLMaeUvH7Hq9erqjWQy8VlwtJ7h1+hznZvGUL+w== 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=tSrn+HliidosAeKxrDT4IN3ULs6iPW7RaGjrBgaIun0=; b=cLYZTkobfFgwRPV/IAYi3cZywPk8s2GYnCEu9V4ld+MdsNdH8uuyPlrwNTQ4H3tJj5zAmvfF4s9hIw7+hpCj2bii8S0OZwADUqgiZDzbArduw22YiOOWgVdXtgLmUIHxXa26r+CpsPqVky3ubVCTFKoPkWj9AHx09q0B9+MDAvSNZIjMeMHc9iwna+QIyLkKMsVZMJgAJS5Ok5/0YPLm4hJnfxSuigEt2RfGO3vxX4xN1kAHlwaKjB093ae/IAT0bkXHNs/XyyFSXJPRyYqanLZ4CDYA7YL8SZU7j4yarMZRZ8NVlKvtQn7HObdZc+J73wy3ioxFESVA+/Au/g7OQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tSrn+HliidosAeKxrDT4IN3ULs6iPW7RaGjrBgaIun0=; b=wRAKZmZi/vtUlapufSz8aKDGxDZaKV6i6aHzgOkFoSBZ8mYQewm39q9TnrIMSr5sGtQuH5ChWUUp1eqlLgQAJnjxJsJ5QH90/pJrFC+7O1h3vlupsZ0AwNhPdAsLky58GZxA5AIatktdfDTU6H0sx60MCh1qCaqKRpP2qeJT6No= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by CY4PR10MB1957.namprd10.prod.outlook.com (2603:10b6:903:127::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14; Thu, 25 Aug 2022 13:36:42 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::209e:de4d:68ea:c026]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::209e:de4d:68ea:c026%3]) with mapi id 15.20.5546.024; Thu, 25 Aug 2022 13:36:42 +0000 Date: Thu, 25 Aug 2022 16:36:20 +0300 From: Dan Carpenter To: JeffleXu Cc: David Howells , Sun Ke , linux-cachefs@redhat.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v3] cachefiles: fix error return code in cachefiles_ondemand_copen() Message-ID: <20220825133620.GB2071@kadam> References: <20220818125038.2247720-1-sunke32@huawei.com> <3700079.1661336363@warthog.procyon.org.uk> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: JNAP275CA0072.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4f::23) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f963b080-6aa8-4897-599c-08da869ed763 X-MS-TrafficTypeDiagnostic: CY4PR10MB1957:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ESa3BahihUCpZhb0Lpt54ipEmAGtjyoaYuGI47bmJkVzzRBAr+pjTNi1wVbRv3qyJUQP73ggldcjglgSRgRoPyKxPEvmIClGPKEJosBd50wAu6QBQA08txA5cpCS1iNg5JoFVhEC0lEg3zPnxT6bqYnRmKwLrgCuLVxLvCaraoq4ScDF3ZIqMFgQ0/1ssVcgz8ZdVkd4xRx/eesRN0s00vkSU6TD4bwAj7r9ZIy4woDwuRgn9hZMkKF6gTNkK+GXvMydlrbVyZeDCacXv1OAavVA62ZL6EusRHZ01ovGVcebZMXMBh7EyLWp+sb5phpX2LB1tP+HULpje1ywyiDgEbIyLYc/DeIbNmWtlOmYh5V9RN8miq5g37iqJ6JVnNKqs6qhFwDU/b0LaaNaVrDEZ5RfKFoA5L8Xplg5iVCYZfDo8mhHss2oZGRk7JkYahyLJo/RY+3FBYh9l6L3R/cu/D3Yuv2YtxoG2v70vEzCsO1vCeg3JOIhsITy8YrFtzPgOzKUl30158IDU59rlsc4Qdrvqtw+bZmWoi7FyOEx4zWYIvI5UlYUcC1xiS7/kFvqtxpGclS2d+S5pk/Pcs/OrDCWlbkPbqhTDngFA4KvuM4f2emK3zCOsBAXEFHPjYTTN2YU9wd3LolnEiV1HF7IzfeyInNdYXgdZ+DhJztxCD+h2xu6BVXbIIo7FZW0Nh83fpYPeHwrEfGAu+sVzwoIVSAQP2rlv+Hcqsz1kyPMA91bwLFquCgCPvtyikJaXE+RfYs1nte5b9qs8yTM3JwFmA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2365.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(7916004)(396003)(346002)(366004)(39860400002)(136003)(376002)(33656002)(86362001)(38100700002)(6486002)(52116002)(83380400001)(478600001)(6512007)(186003)(41300700001)(9686003)(6666004)(26005)(6506007)(38350700002)(6916009)(33716001)(316002)(8676002)(5660300002)(66476007)(54906003)(1076003)(66556008)(2906002)(66946007)(8936002)(44832011)(4326008)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xamxPXlmRb05EiOU/LHJl14sDwrMDAUbSFyjZCJ37zFr2YSjT6PLQwyTMeHX?= =?us-ascii?Q?hDK9wWPY1bmQSLECDQo31U7xYe8DPEULgY/Yee+aH89sxtvHpQUCUrE1dOXU?= =?us-ascii?Q?O/SEwtX4LqQppmbBeRlSYajLM9R7yr7mmgy61GkCJLKYWncC2C8odhP3WiF4?= =?us-ascii?Q?VyBMmxwFMI9EhlJbBoSsTlC0VopCgcodj7QTqsdyjSTHCRZe1z0htCqhvYkz?= =?us-ascii?Q?b3JFOohVLHcVlb1MoQt5a9emVe3fetHktl2WmxdJP8rTXqyOFpo31K1Ex57d?= =?us-ascii?Q?LavLFo9Jo6B/C42aiwr2DFMCrv9X7CXVvLn4Q71RbewkHQTgKAvVu9PRT/X4?= =?us-ascii?Q?R0aYq00CRH6DNK99JfEOE1Vh5i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Q?W0K66jvGyMjkT/bm2R16qqOaMDW8qxFwiOzT3jj/1i/kJeVDqnfXSX0NDUFX?= =?us-ascii?Q?/FknZoYlpuMBxg4GahUqOcJqE0LMFfMH1aE/IBMpOcAuwqC8RJc1eOkbLJSx?= =?us-ascii?Q?tcSpqN1DjGd4ItZXwqBZ3U2+F0HpNYr51gxkAZv62qj8FVEWmAvKpOmNObEh?= =?us-ascii?Q?/D3VNVonpwEvu7UkOL0xeKD+s+blg+cxgzcN+jrydDoARhwOj3J4vzvcqyqw?= =?us-ascii?Q?kw8k4zWiPdOeFKRw+yBcU3a7jDXOkUMLc+sispXDrtYDDVLvKOuDXzJDoCHF?= =?us-ascii?Q?dUNuRnQtntiRzNSU3Rnns3hU+QJMBB7kK8EGpOn9JEgXtt4s77Rf0ZfUkWWc?= =?us-ascii?Q?Rg=3D=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f963b080-6aa8-4897-599c-08da869ed763 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 13:36:42.4630 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eDEuHUopfsypHcaNFwgG0u+HyrGbwCdeFu05JxdUmFbEVzlOi1nFrJaOnaSALcLh6tcaIb9GspHctJdXLnQiVAGxtcT7HRMgxEsutb4SpCI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR10MB1957 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-25_05,2022-08-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208250051 X-Proofpoint-ORIG-GUID: tNUt_tbhSYzIjonqQY57M3xJBJ1lxwCg X-Proofpoint-GUID: tNUt_tbhSYzIjonqQY57M3xJBJ1lxwCg X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 I spent a long time looking at this as well... It's really inscrutable code. It would be more readable if we just spelled things out in the most pedantic way possible: diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c index 1fee702d5529..7e1586bd5cf3 100644 --- a/fs/cachefiles/ondemand.c +++ b/fs/cachefiles/ondemand.c @@ -158,9 +158,13 @@ int cachefiles_ondemand_copen(struct cachefiles_cache *cache, char *args) /* fail OPEN request if daemon reports an error */ if (size < 0) { - if (!IS_ERR_VALUE(size)) - size = -EINVAL; - req->error = size; + if (!IS_ERR_VALUE(size)) { + req->error = -EINVAL; + ret = -EINVAL; + } else { + req->error = size; + ret = 0; + } goto out; }