Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp318430rwb; Thu, 18 Aug 2022 04:35:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR6B8inKNJeq/qkYOXRy1pfUjebo93CakbULfHlvfUJ206zwxMYFaJeM6MCuNMpsZYqyljnI X-Received: by 2002:a17:90a:c402:b0:1f2:ca71:93a5 with SMTP id i2-20020a17090ac40200b001f2ca7193a5mr2701649pjt.34.1660822505686; Thu, 18 Aug 2022 04:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660822505; cv=none; d=google.com; s=arc-20160816; b=SckXGS+viCX3ilCqVp7ibDnWh06c0epEwH/46l91mFZPDyEu2bz0axBMfAIziixn2D O0nLXj2EQUhEvfcSZIwSPVIoQQOq0f0udB5wDutTV8JjhBUQpJpsWBLFrLYbSRQX6BL3 CqrYuxnjg6fDfsOIDvYDDg2NTPpK9fs+RPyKk9bg6r6HoaUfBpc7l3m2NyKSJmiHdA/6 gjU+YIHzndSrnXkL5Yxv1cOeGZxkUzaK0SaWe1JJ7D6Q5Knou5xZYy/pQRGBuyQX1FHf ueyJ+zEb88XlSpLsj/bSgJWj8kuDfGO05LMFx/evWc8bLblTiFQ6ZlCRLN97QwrvJYYV cuCQ== 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 :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=wmzZAV76/g3DP1UjlKvjAZ4GO9ZrDDquzKevfBZ8XCk=; b=ubl65xEJNXNrk1CzwdrV9Qkg/v5BP7rqBGE4V8iTxzDji5YNJR6GQ9B/Dt58Jjx6ji cO9ZjwgiZlCAzAA4gIe9gZTKtWcJnGLg1gl5ymgejeAhPRQNRl8AqBz35h9UGloM4rgI x5g+IY/bB5mGGfl73mCl1SRNwpAoHl1/2wQA8DC/N3BL0FGTcvOnQscYbmzR1F2VIqWR 8wzofAo9WK7x8uw6tyBsGXlsZb1qa0QZSw409+9MduFWaWEcTwZEcupRA/fUFo3zU4wZ iuB5phLXHV5cvRA6qK/KQfrN2EiVN+t28M/8Dtm0tP1AZbcthJzSHEWebIGG2RlysQlC gwAg== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m11-20020a65438b000000b0041d3e033ab4si1229785pgp.847.2022.08.18.04.34.54; Thu, 18 Aug 2022 04:35:05 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244241AbiHRLCz (ORCPT + 99 others); Thu, 18 Aug 2022 07:02:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243220AbiHRLCx (ORCPT ); Thu, 18 Aug 2022 07:02:53 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF0D898D09; Thu, 18 Aug 2022 04:02:51 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4M7hlJ2JbxzGpc4; Thu, 18 Aug 2022 19:01:16 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 18 Aug 2022 19:02:47 +0800 Received: from [10.174.178.31] (10.174.178.31) by kwepemm600010.china.huawei.com (7.193.23.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 18 Aug 2022 19:02:47 +0800 Subject: Re: [PATCH] cachefiles: fix error return code in cachefiles_ondemand_copen() To: JeffleXu , CC: , , , "linux-fsdevel@vger.kernel.org" References: <20220818094939.1548183-1-sunke32@huawei.com> <0cc3f6d6-ac89-05f6-23f3-68446a32d8b2@linux.alibaba.com> From: Sun Ke Message-ID: <1ee8458c-9200-7ad8-8497-a142df2bbe0b@huawei.com> Date: Thu, 18 Aug 2022 19:02:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <0cc3f6d6-ac89-05f6-23f3-68446a32d8b2@linux.alibaba.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.31] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600010.china.huawei.com (7.193.23.86) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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 在 2022/8/18 18:47, JeffleXu 写道: > > > On 8/18/22 5:49 PM, Sun Ke wrote: >> If size < 0; open request will fail, but cachefiles_ondemand_copen return 0. > > Hi, this is a deliberate design. 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. > >> Fix to return a negative error code. >> >> Fixes: c8383054506c ("cachefiles: notify the user daemon when looking up cookie") >> Signed-off-by: Sun Ke >> --- >> fs/cachefiles/ondemand.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c >> index 1fee702d5529..a31d3ff0ce5f 100644 >> --- a/fs/cachefiles/ondemand.c >> +++ b/fs/cachefiles/ondemand.c >> @@ -161,6 +161,7 @@ int cachefiles_ondemand_copen(struct cachefiles_cache *cache, char *args) >> if (!IS_ERR_VALUE(size)) >> size = -EINVAL; > > However, it is indeed unexpected when cache_size is an invalid error > code. How about: > > if (!IS_ERR_VALUE(size)) > - size= -EINVAL; > + ret = size = -EINVAL; > req->error = size; > goto out; > } OK, I will send a v2 patch. Thanks, Sun Ke > >> req->error = size; >> + ret = -EINVAL; >> goto out; >> } >> >