Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp321810rwb; Thu, 18 Aug 2022 04:38:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR4iockLt4hmoJaMPygVHl+YjghTeOOuWKLy+CuFKqpuP6JcNF3sus27ZnIsl6/Jo6073NGS X-Received: by 2002:a05:6a00:1706:b0:52f:6f75:991b with SMTP id h6-20020a056a00170600b0052f6f75991bmr2585497pfc.34.1660822736295; Thu, 18 Aug 2022 04:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660822736; cv=none; d=google.com; s=arc-20160816; b=KM3sdyLlS4ufVgVI/7k9L7U9DUWDwVcv1J1vayNoLKk/Gz9iPJbT5wjhLuY/QZcMo2 5JzQwj46WYtZv48FFh8FCURz1ox++nP7tvomPR0fRW8BRNREXTRGy/ibxOX8x2xS0v5V gXWQ7FWy/2Zb+njOS0hIGdSo2cuztyjXDWzbMg93dgF1riR5mR8n3ob7+f1GKvhkAhMz HtYMm2NlJYZ2NfR/YSM/x8A/FxFaLaKFkg11Z8uUyzDBNXuOH9HlgISD1/9fgZ8B//O2 ps0PVBUWJ7PRbekkviKUblgpSSXYwCWVYa3x8JMVuZaqO90WNy6TI02mU4qv0EIU5GNc bVHw== 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=3mlUaGgdMGFFbZ6sMy7Az9p61Nz2UgCxh80sh7aUpsI=; b=nljZZskTOobm1FXbko2Z8F1Q7ye3KepQzVUGjoLp2NtsLEoKKnP3zvPZlweANYtwKP 5osQgPHzWQwLQdcUp15bYXmbR1tTUY9t1A4ZIFEYuZTIEdP7iejcpIdgpzsjBNMtJdJy ISGMQsC0ZPSPq/abgrTVNPtHHgJHTZ8+jektOEFEnD14Va2V5ZFTpH1+sXOYjhUDeb8U O6vTmWNuGmGafpZp60C7FAjUb56LAlrofkp/9KtyAIgnaN1+WmC29U/4dHauW0UpARsI Zk+0EszuSneykZz1Bc/vcQ8nrB6ZhEvUm6xsrj85acYaqpX7oKxfXsKcJZPEioofa1MD 3eYA== 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 k185-20020a6384c2000000b00419f2d09e77si1291477pgd.99.2022.08.18.04.38.45; Thu, 18 Aug 2022 04:38:56 -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 S244422AbiHRL2K (ORCPT + 99 others); Thu, 18 Aug 2022 07:28:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231675AbiHRL2F (ORCPT ); Thu, 18 Aug 2022 07:28:05 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC2AF5E337; Thu, 18 Aug 2022 04:28:02 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4M7jJM30FDzGpc5; Thu, 18 Aug 2022 19:26:27 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by dggemv704-chm.china.huawei.com (10.3.19.47) 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:28:00 +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:28:00 +0800 Subject: Re: [v2] cachefiles: fix error return code in cachefiles_ondemand_copen() To: JeffleXu , CC: , , , "linux-fsdevel@vger.kernel.org" References: <20220818111935.1683062-1-sunke32@huawei.com> From: Sun Ke Message-ID: Date: Thu, 18 Aug 2022 19:27:59 +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: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.31] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) 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 19:14, JeffleXu 写道: > > > On 8/18/22 7:19 PM, Sun Ke wrote: >> If size < 0; open request will fail, but cachefiles_ondemand_copen return 0. >> Fix to return a negative error code. > > Could you please also update the commit log? 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, return 0 is indeed unexpected when cache_size is an invalid error code. Fix to return a negative error code. right? > > Otherwise LGTM. > > Reviewed-by: Jingbo Xu > > > BTW, also cc linux-fsdevel@vger.kernel.org > >> >> Fixes: c8383054506c ("cachefiles: notify the user daemon when looking up cookie") >> Signed-off-by: Sun Ke >> --- >> fs/cachefiles/ondemand.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c >> index 1fee702d5529..ea8a1e8317d9 100644 >> --- a/fs/cachefiles/ondemand.c >> +++ b/fs/cachefiles/ondemand.c >> @@ -159,7 +159,7 @@ 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; >> + ret = size = -EINVAL; >> req->error = size; >> goto out; >> } >