Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp546877rwe; Wed, 24 Aug 2022 05:33:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR61R0U7EEJ9hh7m5BKchQj8+nJ/+vttdOka2WVSDeAJ+JsQH5HyK63cNRadn70GHnrfDgaj X-Received: by 2002:a17:902:8545:b0:172:ef49:9c6e with SMTP id d5-20020a170902854500b00172ef499c6emr12565973plo.90.1661344416500; Wed, 24 Aug 2022 05:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661344416; cv=none; d=google.com; s=arc-20160816; b=I9qeHpxFepDQGEANxKPGKit7cDlVY27BXzaQkGB/p2JxnCz/ok0xz1W26ti+t5sWVy A5MVVDnkYBo9KzwRWl/V0GtO6+PhTl8XIcxxuT8ZyXWcjFPBnsBcsWNc8r7Wq1RGNNN2 zBEAZxShij5bajtgRb3psR3VhZ0hCuzGdwSF9XAvrw2Yb0pzddh+OvPS29t15eZw8IGC Lki4Uun8pLEgaTDZ6GYJKPC/DDPD33v33KEOvO5cB4MrJU/XJaIBm/q7qkomwtQtlrZX lc7jeTjag6AYIjtohsTKTt1rLMPKwhV1Mpj5aPoqNJNyrJsRvpv5yxy+6Pj3tRmg7LFW /Thw== 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=hWdrjGcqOggSq/pHVHYHQm3u+qTcdKWXb0xZcpnyp5w=; b=rDRmxQXEOx6sL8LKiGvTtozzNQohfZW4oHqCQ3Wu3Z3LMF/ZhiDusrvmb/yUAHxP44 gEPznmTVTzPCnsDVOeBf/XVq0Vg0FiBpJfhG5ac9zG3vRRX6DWNh8z3wnF3JzDoRYO+f GP36PiaM50WaR090gTd81pl8CGiHeb5EFRJFLk1UjlERN6WSLztFEC+TktiiOgIWqoIC u9nXFTiuLrdJpVplOXX/h0qguot8M6XO0pdvZmtjZ82JfaIFNh75orolg+jCtrxYQlXb S7qfzfALoVgsdm44eUcnM4NB274T/5z8+/S4g93qzlUP/mGRWl/9WyJ3eNExcIEVGamL yefg== 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 186-20020a6300c3000000b0042a8c1c9119si11602240pga.410.2022.08.24.05.33.24; Wed, 24 Aug 2022 05:33:36 -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 S237109AbiHXLdi (ORCPT + 99 others); Wed, 24 Aug 2022 07:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236671AbiHXLdg (ORCPT ); Wed, 24 Aug 2022 07:33:36 -0400 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 284927E83D; Wed, 24 Aug 2022 04:33:34 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VN7Iwjc_1661340812; Received: from 30.227.73.144(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VN7Iwjc_1661340812) by smtp.aliyun-inc.com; Wed, 24 Aug 2022 19:33:32 +0800 Message-ID: Date: Wed, 24 Aug 2022 19:33:31 +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 v3] cachefiles: fix error return code in cachefiles_ondemand_copen() Content-Language: en-US To: David Howells , Sun Ke Cc: linux-cachefs@redhat.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20220818125038.2247720-1-sunke32@huawei.com> <3700079.1661336363@warthog.procyon.org.uk> From: JeffleXu In-Reply-To: <3700079.1661336363@warthog.procyon.org.uk> 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,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 Hi David, On 8/24/22 6:19 PM, David Howells wrote: > /* fail OPEN request if copen format is invalid */ > ret = kstrtol(psize, 0, &size); > if (ret) { > req->error = ret; > goto out; > } > > /* fail OPEN request if daemon reports an error */ > if (size < 0) { > if (!IS_ERR_VALUE(size)) > ret = size = -EINVAL; > req->error = size; > goto out; > } > > Should ret get set to the error in size? The user daemon completes the OPEN request by replying with the "copen" command. The format of "copen" is like: "copen ,", where specifies the size of the backing file. Besides, is also reused for specifying the error code when the user daemon thinks it should fail the OPEN request. In this case, the OPEN request will fail, while the copen command (i.e. cachefiles_ondemand_copen()) shall return 0, since the format of the input "copen" command has no problem at all. After all, the error code inside is specified by the user daemon itself, and the fact that the OPEN request will fail totally lies in the expectation of the user daemon. On the other hand, cachefiles_ondemand_copen() needs to return error code when the user daemon specifies the "copen" command in a wrong format, e.g. specifying an invalid error code in . This is exactly what this patch fixes. -- Thanks, Jingbo