Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp691575rwe; Thu, 25 Aug 2022 07:38:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR6r020/XVpCKgT9d8iWkynCQBEf3Y/CWuv9Cfxh+hB06RHqUm5CIEfZ1xTGKoI5dh030NAd X-Received: by 2002:a05:6a00:1687:b0:518:6c6b:6a9a with SMTP id k7-20020a056a00168700b005186c6b6a9amr4313247pfc.81.1661438324250; Thu, 25 Aug 2022 07:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661438324; cv=none; d=google.com; s=arc-20160816; b=IriKwQ+xyJU9JlDCYHtcVSwrOnkkssGBY8PrLBZCbbQlUfoAP0L4+is0Wy4mYqI+Qb GzyQI9xCN85mN0gZV2xFoLoAbiW4aWYg1+30vV7V+4ybC0QEiWCd2ZI2Xx3303bIO0Tz Q9Ioxcc/LLKL1oZFUwMXSUnnslbO3CU2QEtlTpwYCIxKpsuvZjXkU+hMLBWQCnPqtm4S 7KGHtUMrLkOLCIjxxmU8iuYwNHANqQgT/p7JroPPTy/FkqCDmwU4H1hvuZJYhWIG79b3 EVtQBQA6wm3FUQ2/XvVMwGwjZtN/xE7h0tGBrpgNwcGjWh+VWsCjHicT3LSaBrQ2/XoC Mitg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date; bh=Z9SGMnirxFAObWnkf6ITzhn16hWWZ6D0WZkXP0dd0PA=; b=j7ZB2Lff+3zOk9Ux+JoqfJmql5ADgXQh+FSHJt3ybrmnX6hlHJdQ9IjvmR0MnKawCP Xi2EVfkQbM0PAKOvMRHrFuj9RJk+o49XG9VkNbkfxnhlVX0KbYFVfiQqGj5Fi24TdlqE w5zxGPqgsS/3ciZ8qmgT5o6JjloCvF8NsD0PZcQKzN2jQkYmjQVfgtFwHRvP32Er3tZi QN8uEF4tZk8UqSce5X1bXOP/7j83Wj1T9xTdHBMrU5oi9w4fyh94yDUOpevZok7wJdq4 CJ3mft/PAwPLl1LP5HkD3C8z3/IdmIDsMQo9iBCLgJ82oXcfXwctzdEugFbY+FNd1nC9 QIbA== ARC-Authentication-Results: i=1; mx.google.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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r29-20020a638f5d000000b0041bdaffb9e0si17868370pgn.468.2022.08.25.07.38.21; Thu, 25 Aug 2022 07:38:44 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241116AbiHYN7A (ORCPT + 99 others); Thu, 25 Aug 2022 09:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237468AbiHYN67 (ORCPT ); Thu, 25 Aug 2022 09:58:59 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A47B29DFA5; Thu, 25 Aug 2022 06:58:55 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R871e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VNDo9.X_1661435929; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VNDo9.X_1661435929) by smtp.aliyun-inc.com; Thu, 25 Aug 2022 21:58:52 +0800 Date: Thu, 25 Aug 2022 21:58:49 +0800 From: Gao Xiang To: Sun Ke , Dan Carpenter Cc: JeffleXu , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org Subject: Re: [Linux-cachefs] [PATCH v3] cachefiles: fix error return code in cachefiles_ondemand_copen() Message-ID: Mail-Followup-To: Sun Ke , Dan Carpenter , JeffleXu , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org References: <20220818125038.2247720-1-sunke32@huawei.com> <3700079.1661336363@warthog.procyon.org.uk> <20220825133620.GB2071@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220825133620.GB2071@kadam> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 Thu, Aug 25, 2022 at 04:36:20PM +0300, Dan Carpenter wrote: > 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: > Yeah, the following code looks much better. Ke, would you mind sending a version like below instead? Thanks, Gao Xiang > 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; > } > > > -- > Linux-cachefs mailing list > Linux-cachefs@redhat.com > https://listman.redhat.com/mailman/listinfo/linux-cachefs