Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1766309lqa; Mon, 29 Apr 2024 20:29:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW2fsBDOI6gYhAZbDzOiqMJHgD+v2COuobACX1ST1y3TdSaHOE+dML60aOcQk7AC318RCaiJIt47INmgpQd8CUCCKFplfnE/KjoXcIMdA== X-Google-Smtp-Source: AGHT+IHBUkPnYxMfIUkRWMdL5JDyfjm/tuJL8oJW8u/7KVotvd4l9HhkJO8Pp6VQWdnjjH9YC7VH X-Received: by 2002:ac8:5f4b:0:b0:43b:18e:b874 with SMTP id y11-20020ac85f4b000000b0043b018eb874mr3600661qta.0.1714447770819; Mon, 29 Apr 2024 20:29:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714447770; cv=pass; d=google.com; s=arc-20160816; b=SNXyEVPK6TmzEirZs1hQGuCLhSI4+DI64G9Hq8qh4eNEOZBqGGLntnVH3PxgShM2CH t8uQVH2iL0yidyvRp+Y4bpv5GhJ5AEM/mxtIVVZjg28+ftOUgqywEjXvZepG3sLlZ+rq 93taghiDX7fQSqGp/eY42YSSEi/VU/MGJtWrNjMTmDDaUQ0sV1qM3eFxOZctAySkYW1W MrxzmEpXPfSPHwqGdIS1r8FGG2TJy11PxQ47OFcaXemu46zMMAG0B7j0HvN5j0OSw0qW 2Nzh6QDsrvaQMyJ1Xb7eSbci30ORtphXkdMAaHIY5BTlI2XL8cDv14BQ9PjFUEsNLh5A wjcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=rT1B236ATkF+Ygc2oPrbUXgNg8LDfbudCEbrCvlSDsk=; fh=uRRo/bsVkkMz4T1a2t0y0xSNbzWg22XBPvnHoLuz/8k=; b=vuMpeXLxI2MmSzOj9V9S5Rx0S8UUE4IT/MjpllI8Y/ZdNV8w6Vf5Z7Q+Ro+Ra9FUjo r+ao0i9TzUWMUzRxsqGJIsAAvtUJvZYK40gZKGOkmt70bSDKjwgXzmHM+L5HGL+L3z4h /IlXadIVArARphPHtriInn+Jx1n3Pqy+vLQ1FLAlqk9adYOLoXXZpxuhk8fhWPUgTMbS gRC9yuGq9VhsnvhBqrpQ7rX/EYdQIykuwz2sadddAew3qF9YOnhGRpE6gdSx52cQh28O Bj8W5pHF9Sok9o7wq0m2A7op6YnBOepCJrr+8zMB5jqVHeRvTgEed00rTQdPIZLfYu04 jTqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vqLaqusM; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-163293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v5-20020a05622a144500b0043add259b1fsi4338267qtx.49.2024.04.29.20.29.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 20:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vqLaqusM; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-163293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 891EA1C21B03 for ; Tue, 30 Apr 2024 03:29:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C29611190; Tue, 30 Apr 2024 03:29:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vqLaqusM" Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 A02DC10A0C for ; Tue, 30 Apr 2024 03:29:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714447760; cv=none; b=BSgy5v4tuGeEB004Uzz4LZTUDWKDRcMI7/NpUvNEDwof2kMmv8U3nB/R3q6sK0m2yQ/gFAqvGvZJpkkM9PANdiFyp+LbrnO4ZfhMBnKk47sWlNe2za1z/T+d4qaBbubeirL1PCUg01yR2I0bNuceQDLW+7Sb0atC5fkWrB+EAVY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714447760; c=relaxed/simple; bh=VnRQqHRFLfqPj2Ruvuw9m2DS64Doca7tfk1HEDj7DHA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=FXF71N+8PULSGbXLjLJvQpDX53Um4z0oUV9C8tWPjA7Pf1wHbcsmzZzoAIm30MhpXA9qaj4RNTGIE1sUhBy4tEF8SDrJp7AJgp4mGbB132IQCU6aqTzQgLMXQ3uRZLlTikkxdDEkyZAlKGr8AQ5PBDo6bFg1af4ijgHHRywcbhA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=vqLaqusM; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714447754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=rT1B236ATkF+Ygc2oPrbUXgNg8LDfbudCEbrCvlSDsk=; b=vqLaqusMXP++rirvu4u2Sm1t9uhp7geyDr7eFEcy4hSiMKnM2JlmMlnQKO6wF/5mnw8hJZ JczWH9fVezQBgUZ5KxJeyP8z6Xrbh+0HCR3YaXtbfIkWLUx7yT3kpDm3MGkVMDihb0YnPc bQc9xot/qqpNojQMUmL3S2Jb/J0x6s4= From: Youling Tang To: Kent Overstreet Cc: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org, Youling Tang Subject: [PATCH] bcachefs: Fix error path of bch2_link_trans() Date: Tue, 30 Apr 2024 11:28:39 +0800 Message-Id: <20240430032839.948404-1-youling.tang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Youling Tang In bch2_link_trans(), if bch2_inode_nlink_inc() fails, it needs to call bch2_trans_iter_exit() in the error path. Signed-off-by: Youling Tang --- fs/bcachefs/fs-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/bcachefs/fs-common.c b/fs/bcachefs/fs-common.c index 6c737def357e..508d029ac53d 100644 --- a/fs/bcachefs/fs-common.c +++ b/fs/bcachefs/fs-common.c @@ -200,12 +200,12 @@ int bch2_link_trans(struct btree_trans *trans, ret = bch2_inode_peek(trans, &inode_iter, inode_u, inum, BTREE_ITER_intent); if (ret) - goto err; + return ret; inode_u->bi_ctime = now; ret = bch2_inode_nlink_inc(inode_u); if (ret) - return ret; + goto err; ret = bch2_inode_peek(trans, &dir_iter, dir_u, dir, BTREE_ITER_intent); if (ret) -- 2.34.1