Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1167529lqh; Sun, 5 May 2024 21:03:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHlB/v/Xvy2DZTZh7RW2qnlBQ4xeZld5a1ktFXlwfoycM/UazhnfJVkevN7YY+T4SGcvOzBYOr1CFZz9CbGXQppYn0M5duxyy658bIqQ== X-Google-Smtp-Source: AGHT+IF+3ZFaJQpmHTktQRoUqLdux/1pas0vGJdJh/zWp20Mo6nfDYx5NdvppQBk1jArYOpBAzqF X-Received: by 2002:a17:906:a40b:b0:a59:a866:15a9 with SMTP id l11-20020a170906a40b00b00a59a86615a9mr3282915ejz.35.1714968189989; Sun, 05 May 2024 21:03:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714968189; cv=pass; d=google.com; s=arc-20160816; b=q+mgqShxpGCa2KgHlLKs9K+OPXmnetn49opCMHqAQIlzQgNbOtCcV+MtwL2IGGKmrz szr10t2MJkDxN4Kdomf4KhSTMeAL8jVWgH5J/4iwUr4xCjcczgvp/0lzrsxiIPJ6vk+9 Ho3l5LXSscSffse08oirV/02sXtf2p9vGqbySn9Nw2YS8IHl9f57GlfG0bYEJlXI9MLU iZvj6wxF46Hj544J4umWNbrCUCSFSFk33kO70NZK/YGmbQy9onLR3lGS9GqeY2KmPfCZ wiT0RmU/OMUOvzMTXcLoichUgfXSzs1m8yvV64WHhffHi1LcTDS9315/mgxWpyUBzrGS Czgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=dW0dHIfDc+Ciue6XK4i1X+7G8NQP/b9DHe1p+2PxJ8E=; fh=KzDZjXUYsyQi8jiAtuIBbUJALfGcqLCridvgcb7mSyo=; b=SbXS3cYIHBT6RL8eH6Ms3kuMUHktSyBnpIbSkav/3hTsCk0/bUi86PHWYWvqZyaorw zmmnhYroblB+FwgVwMZbZwCyRvrFycs+Y1WOVcFbWe0BUvQ39jO4HZhmL072A/82PXMN dbmk7f6cvfdrGerq40lq12VKI6G6lE/dtF7a9hyqCh0DtvEKLt6Fd1GfZLKCBK0S6R4e BCCyjOxbWulHy9kWQKT43EVX7S4OA0fr6AqeEd1Z4PTVkbTcupUFN8tdgohGgE45nWTZ VnV/KT8IrM9kuDCd5LCfkS4t8exE0y1XI1TXLGJCnJeqfmFCErzuw70mg59024BUJTDQ 6duw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-169290-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169290-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d21-20020a1709067f1500b00a599d8e2187si2802129ejr.209.2024.05.05.21.03.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 21:03:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169290-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-169290-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169290-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B5C001F2141F for ; Mon, 6 May 2024 04:03:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58A9D4642B; Mon, 6 May 2024 04:02:57 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46E9A41A81; Mon, 6 May 2024 04:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714968176; cv=none; b=CGREmJcdkhpxw2p2HBmNJ2cRwxml4awdPVg7CqPj/tbwGb4hkE788GgXMOAwCpJZQqCC6gedXn8kYEJltsVUSRbURa79DL36wPT3focJFIAltL0Cyee5sgeg+gGU21alIuD8LH6ORoHiAoymwYWxgaUkiv49h2ulMAbdi9N7Iac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714968176; c=relaxed/simple; bh=w2mIEHb1FX0xHYK9nCgdIaQaDhdD7nnojVP4YG3F/dc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=loqYZTJmFRxQy1QydGDlA6iSj6qJgsUDJjTJ/u8gMDzIUxgB8AUaendSEDd2polN5sOf5kkM5WD/ya+nApsa7GNpv/vMb00+UF/ipfFwGeUhhHWRUDu6Ue+l1Tm15eKGZ7eRbAUy5a5M62h9dkW9bcB7fNTVQ12FdJyFOroKZnA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VXnn14b42z4f3kkF; Mon, 6 May 2024 12:02:45 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id DAD741A016E; Mon, 6 May 2024 12:02:50 +0800 (CST) Received: from [10.174.177.174] (unknown [10.174.177.174]) by APP1 (Coremail) with SMTP id cCh0CgAX6RFoVjhmHoqLLw--.43088S3; Mon, 06 May 2024 12:02:50 +0800 (CST) Message-ID: Date: Mon, 6 May 2024 12:02:48 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH 02/12] cachefiles: remove err_put_fd tag in cachefiles_ondemand_daemon_read() Content-Language: en-US To: Jingbo Xu , netfs@lists.linux.dev Cc: dhowells@redhat.com, jlayton@kernel.org, zhujia.zj@bytedance.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, libaokun@huaweicloud.com, yangerkun References: <20240424033916.2748488-1-libaokun@huaweicloud.com> <20240424033916.2748488-3-libaokun@huaweicloud.com> <795cd804-f7a1-44ba-99ac-01070edd5a9a@linux.alibaba.com> From: Baokun Li In-Reply-To: <795cd804-f7a1-44ba-99ac-01070edd5a9a@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID:cCh0CgAX6RFoVjhmHoqLLw--.43088S3 X-Coremail-Antispam: 1UD129KBjvJXoW7uw1kCFW7ur4DCr4kWr13XFb_yoW8Wr4xpF WSya43Kr109F13ur97Aas8X3ySy395JFnrWwnYqws3A3Zagr1rZr48Kw45ZFyDurs3GF4I q3W2gF97G34jy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9214x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWUuVWrJwAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2ka 0xkIwI1lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7x kEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E 67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCw CI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWr Zr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYx BIdaVFxhVjvjDU0xZFpf9x0JUZa9-UUUUU= X-CM-SenderInfo: 5olet0hnxqqx5xdzvxpfor3voofrz/ On 2024/5/6 11:55, Jingbo Xu wrote: > > On 4/24/24 11:39 AM, libaokun@huaweicloud.com wrote: >> From: Baokun Li >> >> The err_put_fd tag is only used once, so remove it to make the code more >> readable. > I think it's a conventional style to put error handling in the bottom of > the function so that it could be reused. Indeed currently err_put_fd > has only one caller but IMHO it's only styling issues. > > By the way it seems that this is not needed anymore if patch 9 is applied. This is just to make patch 3 look clearer, if you insist on dropping it I will drop it in the next revision. Cheers, Baokun >> --- >> fs/cachefiles/ondemand.c | 7 +++---- >> 1 file changed, 3 insertions(+), 4 deletions(-) >> >> diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c >> index 4ba42f1fa3b4..fd49728d8bae 100644 >> --- a/fs/cachefiles/ondemand.c >> +++ b/fs/cachefiles/ondemand.c >> @@ -347,7 +347,9 @@ ssize_t cachefiles_ondemand_daemon_read(struct cachefiles_cache *cache, >> >> if (copy_to_user(_buffer, msg, n) != 0) { >> ret = -EFAULT; >> - goto err_put_fd; >> + if (msg->opcode == CACHEFILES_OP_OPEN) >> + close_fd(((struct cachefiles_open *)msg->data)->fd); >> + goto error; >> } >> >> /* CLOSE request has no reply */ >> @@ -358,9 +360,6 @@ ssize_t cachefiles_ondemand_daemon_read(struct cachefiles_cache *cache, >> >> return n; >> >> -err_put_fd: >> - if (msg->opcode == CACHEFILES_OP_OPEN) >> - close_fd(((struct cachefiles_open *)msg->data)->fd); >> error: >> xa_erase(&cache->reqs, id); >> req->error = ret;