Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1165292lqh; Sun, 5 May 2024 20:55:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWoSiA634whfIBx1fcbFYB/BlwDuyAh3BCuEScxTgMzpVjbCCM8cp7tHMQ3zDEZecaacv8XKad6aPVDMsPEfpHhpGP6bu0x+rRv1SbLxw== X-Google-Smtp-Source: AGHT+IGmbujCveVJegEcbJKnSU7vSz1ukvi6sYd+QLByKJSIZ5znJ3CA8dq66Gz4egrg72+zgDfL X-Received: by 2002:a05:6512:2116:b0:51f:850a:c40b with SMTP id q22-20020a056512211600b0051f850ac40bmr4252448lfr.20.1714967740939; Sun, 05 May 2024 20:55:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714967740; cv=pass; d=google.com; s=arc-20160816; b=yeNXPwUVpc2tNlp6St+j+wlFFjN8gnnIqjuPJO/3PV0194o0oCt1KfB14xmCR66uZj nBzQj7Az4Zb+q6KjA6RSYohJrAnIb84i7Zwex+wahKgooq8zXr6BY6YMOX/ed95IlzlD yOMaPWR5d9ClTSE3zX5uw6/UPAtrPL7MR+81sn2Y1Z6jhQSDMziT/aTDr5c9ZVOhax32 WMnjqhIWBMdncWH3BX0Ramw9+Pi7cNqOZ6Vd69uHM0hodt9bBCoEItwavI9ZFFYd7dpX 4xfp/SB5NP3JOdSz4RN7GMyRlnruIlcqrTnTMNhbmo2BWjnZCyTWZnxcWCz1HDat3//e tfuw== 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:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=zXslB2LIBpz38Ehk6jluQligrVVUBz1/x6XUjpfeVMs=; fh=iMK7N1JiksCi/0omnYSDfuai+RJNcbpz1q87dv7YUA4=; b=qzwbCqj4ci0IWIlemcEc3O3tuocu4pC0UIWRhPLx/TeENKAKEX5xQOooa3RJbCj3BJ NzKYJqm+FFNEzfJ713lZjNlDWqbCh4+HFkqyPiK9KgzRdjUIKGF1mHzUjAvA1vjLXeia a5prd5tk64fCeCWTYksPdvwhiJiqhkUsjRvky0+usPqjiFT6vWMo+0qfX5F94UiJXJnW hyhW48oaUq4AVK57vtM4UBr5qM9eo4c3ugsYRrQpJj5gopRhIWoRIpDTZonLru7uGjMM yGwBrqCJJzc2gbRxqsAr6rmyqaf87EL8T7I528hxWytAqIsdIqQ679ZMDkIP+8v7GuBh witQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b="d/BVEp7q"; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-169287-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169287-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w6-20020a056402128600b00572aae836d2si4352461edv.462.2024.05.05.20.55.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 20:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169287-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; dkim=pass header.i=@linux.alibaba.com header.s=default header.b="d/BVEp7q"; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-169287-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169287-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com 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 A4C171F21286 for ; Mon, 6 May 2024 03:55:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0F6E446AC; Mon, 6 May 2024 03:55:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="d/BVEp7q" Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) (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 CADBB40848; Mon, 6 May 2024 03:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.99 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714967728; cv=none; b=l466RRyWdbw8Mu3SYISFVlR8E8N/Tg75T/G/iTeEzD2ydS+Ly1KNz/ttjJav6KOFKaDze2t8s0BcKWMr95j0BXn3DsQme5JDXk0aFBav86dohCcfHuazAFpsroxlX4h0+riRKGY6bHtsUaV87/DWnzFFll84r1W6c8MQYlRXhyE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714967728; c=relaxed/simple; bh=y2geqQG7esbioHge/Oua716DR+VeDMua5Od5GLNV/Ww=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lvyZLB9j4zPvF1/MO1XeN04RhWAxjFnfv3SZ7YXQ+4rKP/aG2fyuauzIQGuvGzgzyNvsIkz9nYimz0d4NwOR4by0JYHLvtwho8dl7Go15VX4xqWNOeFkrKnwtqhPWuWVWxskIr3T3VJCHuvGJHD2FZAiqfwu6WOt7yc7lAxz+Jw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=d/BVEp7q; arc=none smtp.client-ip=115.124.30.99 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1714967718; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=zXslB2LIBpz38Ehk6jluQligrVVUBz1/x6XUjpfeVMs=; b=d/BVEp7q9JT4mYgq+2kov6S5ndtBeoIqtlA4YbBf0waJAwzYrBcWuVdPBzdTnXc2FtrtqkkHOk00yHH1XLyS1fcMNlEvu/BsQUu1nG4igJN4DpIyAib4RlNGzjZeh6xW9PQRJ5X1ET3gWeDy6LkV88L6jFqk34X7i0JAxFnsMOo= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067111;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0W5rxNPa_1714967716; Received: from 30.221.146.217(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0W5rxNPa_1714967716) by smtp.aliyun-inc.com; Mon, 06 May 2024 11:55:17 +0800 Message-ID: <795cd804-f7a1-44ba-99ac-01070edd5a9a@linux.alibaba.com> Date: Mon, 6 May 2024 11:55:15 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 02/12] cachefiles: remove err_put_fd tag in cachefiles_ondemand_daemon_read() To: libaokun@huaweicloud.com, 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, Baokun Li References: <20240424033916.2748488-1-libaokun@huaweicloud.com> <20240424033916.2748488-3-libaokun@huaweicloud.com> Content-Language: en-US From: Jingbo Xu In-Reply-To: <20240424033916.2748488-3-libaokun@huaweicloud.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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. > --- > 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; -- Thanks, Jingbo