Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp272405rwe; Fri, 26 Aug 2022 04:57:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR62gYpAKki55Db48Adow/hMC2/4KI7p4Wv2ZGAnfSxDWcE1rz6Hez1LdrL8Wcbcpau+0q5T X-Received: by 2002:a17:902:a608:b0:172:ffa5:2ed8 with SMTP id u8-20020a170902a60800b00172ffa52ed8mr3436754plq.164.1661515039458; Fri, 26 Aug 2022 04:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661515039; cv=none; d=google.com; s=arc-20160816; b=Mqxw/mdi7dPMxhMy4woxch4dWXsGtMpZAaVxY71m39LICy7Cw/Kwd40SH5RjPHkUj6 vDZ3PTSs3/a/1tBplYkueAINBNQQuP2nUyozQyHlx35owjSbsM0R3RkQbaVwd7Np6Ka+ 2/RDiupt6RQMjTD9WprrCLoz0R9jDB032V5yP49ATfmvUycHR551J+O1CW4L3yxXv/Yh 2eLamLnjc8Dvo7M6zvutJprOXKCkBdMXlMsUk7+vLUYcnAA+7lviGXHvbE3KJhmKvD5W WFlORWEOsCcRbij2VnXp7yfZOhWsBdQRg2yPXuUxuNFl71z/S1g5JbSP4eO3HDoc7hoi weRw== 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; bh=imHyL/kOztErw2WR/emHsmzCRnkzzeI2QsjuJfNYQZ0=; b=QOqa+l+NiSGyxvfgeA1iempa2PyZsKg2rkIxGUCAgDIYE6b4Z7hhTxW2wuoL4sg9ta sAgkd2LpCFtSoHDEx9lRDfD8HaGDWj/nfKtujapqWdK6O7YkKz60siDZgH2vdyIswa1S mGkjWaxVnX+Ldsau6NqEdtDIBAJQR9MmbkYDnYAWsPbqcx9XCWt2BcKg3vQTLavmWGx4 du70rIYee2UPR08eCDv6gSYR6YT/HyYOfsT8x0anQ7dGRJ9VzA/A+J07+w/BGlC1LzZJ hYqqFrxpFYW/b3ULcbOA/s4vQ9SmZoyva2LB8ETQdS/NnJ3ZtrwkrMgv5QS1L7ezPp/I dBsg== 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 p24-20020a170902a41800b0016a24d76abasi1400668plq.298.2022.08.26.04.57.08; Fri, 26 Aug 2022 04:57:19 -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 S245100AbiHZLcH (ORCPT + 99 others); Fri, 26 Aug 2022 07:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbiHZLcF (ORCPT ); Fri, 26 Aug 2022 07:32:05 -0400 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BECD9C6943; Fri, 26 Aug 2022 04:32:02 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R351e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VNIv.gp_1661513519; Received: from 192.168.31.65(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VNIv.gp_1661513519) by smtp.aliyun-inc.com; Fri, 26 Aug 2022 19:32:00 +0800 Message-ID: <10116646-a12b-05b2-5364-17e078649fab@linux.alibaba.com> Date: Fri, 26 Aug 2022 19:31:59 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v4] cachefiles: fix error return code in cachefiles_ondemand_copen() Content-Language: en-US To: Sun Ke , dhowells@redhat.com Cc: linux-cachefs@redhat.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-fsdevel@vger.kernel.org, dan.carpenter@oracle.com, hsiangkao@linux.alibaba.com References: <20220826023515.3437469-1-sunke32@huawei.com> From: JeffleXu In-Reply-To: <20220826023515.3437469-1-sunke32@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 8/26/22 10:35 AM, Sun Ke wrote: > The cache_size field of copen is specified by the user daemon. > If cache_size < 0, then the OPEN request is expected to fail, > while copen itself shall succeed. However, returning 0 is indeed > unexpected when cache_size is an invalid error code. > > Fix this by returning error when cache_size is an invalid error code. > > Fixes: c8383054506c ("cachefiles: notify the user daemon when looking up cookie") > Signed-off-by: Sun Ke > Suggested-by: Jeffle Xu > Suggested-by: Dan Carpenter Reviewed-by: Jingbo Xu Thanks Sun. Also thanks Dan for the suggestion. Jingbo Xu > --- > v4: update the code suggested by Dan > v3: update the commit log suggested by Jingbo. > fs/cachefiles/ondemand.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > 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; > } > -- Thanks, Jingbo