Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp273782lqh; Mon, 6 May 2024 20:31:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXq5M7aOdb0JEAKn49rrWhw7347dwclPlUZo5jQPFSdMBy2P7SiIr/Igcxmd0QP+rh7E2s8JM3Fh+v4aH+5ROZzn4xvSfxCoZt07G+UqA== X-Google-Smtp-Source: AGHT+IFlOSTxO+tB4i7kALpJQehuCpW5upm3P312P0IXTdWTbeMJ7sRkf0lO/RE7BVk0z9qtjMgD X-Received: by 2002:a05:6e02:152f:b0:36c:513c:e7f1 with SMTP id i15-20020a056e02152f00b0036c513ce7f1mr15144655ilu.31.1715052673793; Mon, 06 May 2024 20:31:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715052673; cv=pass; d=google.com; s=arc-20160816; b=hpm2YkbzkzJ3uH3rJ+4cQ2cKFgCGCI+ub/LDq30CU1kz1AhSZ+uM/AtRydG4N/hWBu ms4mMVlXN0tKmshtTaCHwK6UsyNXBX3g8OFPmxMU5YPfuRqombKRC9Gs2Y3k7UMQrHp0 hIsa8D/ogpKN/oJCAWtFCpM6shuOdxz61E5ne1D5Ww7la9AXgX+TceKBZkERtUAYMYrk dj5tNXqh0prOYYolruY5y2D/v6zM56+id3cqDivIQGaLRvijTL249Foi9l9872MnDEXu ABP6ESdmKEvQgSVfxSyC6ciTJ65Ns6s/KZ4BSP3hB3MYJ9ce1N7GVkKm29zhYzzsPvkz ZyCQ== 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=pq0+KuPhkV91D5i7EEnuryOU/nXKDDatKqCGN3ReHhg=; fh=X1/oBJvTGJUQ0YtRp03u+3tPfRw/dXXALWynfOSlfQQ=; b=dWuUmXqToTl2efBZ8i726BrpKbrZ+O5MfXWiWYfoe0dm0Ia7FxzTkcWPCusJbQZ46b XqdfSucs4AdcAZ7/tsoYidwSSLQJPvM4Owfx4/DOV5Flv0zdIWfVlsLK8i5NaBHm19gu Rmi+xVk7u3bYNY4EoTR3rHKhV7DK3qr0CAEkM1Vr80oQmEkx4xmVPGqZFP+kRIrR3bqG GbbjYBFugKTjN4dG5gXzvBNKR1xkhBwsAGAuLIY20MjeTk0pBk0QbE5lAJPIszU3YRPf 3yCthEtKxZuT6T89RCRP16qTIoTT8nTx5HiVvrPSJ2KTtD/bgnrMsJvwdK/bsULhwSbv IIgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uMlsUM0o; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-170616-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170616-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b8-20020a056a00114800b006e0945e03fasi8924535pfm.162.2024.05.06.20.31.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 20:31:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170616-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uMlsUM0o; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-170616-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170616-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 000E32849D1 for ; Tue, 7 May 2024 03:31:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 759674F8BD; Tue, 7 May 2024 03:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uMlsUM0o" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8A1D34EB55 for ; Tue, 7 May 2024 03:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715052668; cv=none; b=jmsmClAQcgmlqgnhiQwmuZEK1tTvJkZS3/f7GXlmqE5PGrz75CtVmRSU0FfkUzhdM7zyqSr4sDk/PXZncRJZGLie3Es5w6O9vJfB1oeIUfg+E3TQtVoT7OOOOBoT0+aSAw5TagAxHVycOuoXdpxQMJ1yswOxCdvCxi/8Kb/98d0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715052668; c=relaxed/simple; bh=WEn57ZpMPjcw1lMUxGYEU0m2DwBeLhYddgmX6aoQ1nM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=pc5wXniy+fCEwzo/CAgGA1ktgLKjMQn0ZTxlnnTgLFMzQjpTG7tjH5lEackRQLWewDiYiK0hxxOBgF1CeLRKYq3QzdygKR9cGMWVUlFNqWe22xKqIwDvK4798ckbhhtKyMGWA21+JZOlPhjLPHDLzNGryAGaWJCvY+4A+6/c5Zw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uMlsUM0o; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9719C2BBFC; Tue, 7 May 2024 03:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715052668; bh=WEn57ZpMPjcw1lMUxGYEU0m2DwBeLhYddgmX6aoQ1nM=; h=From:To:Cc:Subject:Date:From; b=uMlsUM0oWh47ThJBil5c2EetKK0vGVlcuipp91NLbvzVr/malBRi/8qcDmZ+lXl5r cit/OxCDcuY0hlmc09NoP4A72ppqnHkdnKWdMy6IrAUHzACSTj66tGwLbHRCHvWLK+ duX16sVoiecHSxu8WoLkcmt2jvtF7EJnNRblec/PAkhS/u1y9bYuOA1IBvYv2tn9aa Ejm5BFUFsTGTGRawYDH5osVPkyaeTr13c10R2C8W+JvGXF65rupgro1IeFUbKQdwS2 5M8Ontb+7rN83I77Z1XwFcqXNHR0TpzeiGPq5kr6OlxmDx7kF07W2jKqaN1t9MCmCy 6mE0s6DqFZVmA== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH v2 1/3] f2fs: fix to release node block count in error path of f2fs_new_node_page() Date: Tue, 7 May 2024 11:31:00 +0800 Message-Id: <20240507033100.1044884-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit It missed to call dec_valid_node_count() to release node block count in error path, fix it. Fixes: 141170b759e0 ("f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()") Signed-off-by: Chao Yu --- v2: - avoid comppile warning if CONFIG_F2FS_CHECK_FS is off. fs/f2fs/node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index b3de6d6cdb02..7df5ad84cb5e 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1319,6 +1319,7 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) } if (unlikely(new_ni.blk_addr != NULL_ADDR)) { err = -EFSCORRUPTED; + dec_valid_node_count(sbi, dn->inode, !ofs); set_sbi_flag(sbi, SBI_NEED_FSCK); f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR); goto fail; @@ -1345,7 +1346,6 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) if (ofs == 0) inc_valid_inode_count(sbi); return page; - fail: clear_node_page_dirty(page); f2fs_put_page(page, 1); -- 2.40.1