Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp787670lqo; Wed, 8 May 2024 15:15:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWfx5yXGWxTB08xaMTDI5/rNOUSWboAisLAPjY5c/G/NbPgFcvAEi2iCq+5h8s54tJYYKmbe/889aDFXxfI3VxS6dLdhRd7QRbrMBGQSg== X-Google-Smtp-Source: AGHT+IFqSiDpg7QIrPrDkLTV8f6xgRbaTwJ8C3Mn6BWZyOsZKjXkhoNbVMsZv9SZOVtE0wUES/12 X-Received: by 2002:a17:902:daca:b0:1e3:c4c2:efa9 with SMTP id d9443c01a7336-1eeb059745emr50075115ad.31.1715206544807; Wed, 08 May 2024 15:15:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715206544; cv=pass; d=google.com; s=arc-20160816; b=c2LM8IekTxTFBhVrdDRO/bP4FfL8CxtvVIHYPmO/aQ2XlKAq7BNFPLccll2gzVexLG klZGW6Ps3woTtZKy3zUZiS+tdCVQAb6WPtPiNtAE1idpAOHwj83EW/5SLEBk+KEbvGjz yvGW9sCLFHMa4+vBT/kkGHVQOoTA2HLKlhlHPvqQ13svkBCkMbuQ+jK6lowLDGU2eqvx qNQfi69l587uylEG2/TTRj3in2os17J9fK+cQ26g+wvI7UqYS3SXx8AokQWV9oGNoZ0C C2ax9IMYd74P8Jrcv2jynkZS7ovcE+qLRKuPPquXkSd18jntaUZiVME5vSHmnDaJFxpk mXvg== 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=OvRrvqgNHBwilgARP9eErTNvt8papjTXT1DLOpLacEo=; fh=egla1FjAUWiLReRzh/k4I6DBrEPnFeQVcMYn3m0hi/E=; b=A8RcfHZPL2ThPC+WQ55Hgt8nA4pOyyoNqtNjuayeKjKyYUs29K+q8YoOKNC6MaqaxV S1H3anSaxg2jM5kddnjMd0s11c13TiauAGAPOyze5Oz38osORZP/CfGo74bJl+86redw NS6/eyhn2jDItnH6+y60f+zi+ACepjXDiUV3VeKcU3QDMqXdY9HBCA7TRka/9Qpt7BuA CztSEH2xr5E06j5VoVZwOOxhgVbj00RHr1DnuX1S5nGdk1rI4jen43BNL278nEhcLU78 6PrWNVnS5gIBSRfHGtpLK7xZIDySsUIE62QI0bqw3Yf8YbM1KvGaUyPIJAivGQQrAvI7 J4IA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eXKI4NuU; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-173888-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173888-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c03863fsi723335ad.347.2024.05.08.15.15.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 15:15:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173888-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eXKI4NuU; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-173888-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173888-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 9B499B214D9 for ; Wed, 8 May 2024 22:15:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B067413329E; Wed, 8 May 2024 22:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eXKI4NuU" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D5621E89A; Wed, 8 May 2024 22:15:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715206532; cv=none; b=KU2iZpiZy3P0+Pp70YJsM7M7hwOsD5TsVFXhgaFIkGm+hOm23L7VFOBbrkSLfb6IAmvyhRFQC0lmT/n6qnlWID0q/b28SR6Qqb9BGka7OW9Pv1ioyXWk5lSHnW5hCwwWdjOamPKq5HHgUVeJwMI36ogKWGrPBPNyaf3i2ODCQeM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715206532; c=relaxed/simple; bh=zYvmqBYytu5lrRG063ZNZe74anNEulI5cB5MgQaGA1o=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=XY/BgaqUVx4bT0rH981tRf5lOsMiVMy8yuDCVd+JICa8tJ4AHGm+SbuPIrpbvqC9bufosrEDEwtxQyifbVfJ9zfMSsE5owtDq2aUdxZTK+4hS6+8wHsG5/eT+RrNh9bMlLQ2Fizk1VSDyIko52hIAM8VfxgSujGbfO+L06xiz2A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eXKI4NuU; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6f4521ad6c0so279129b3a.0; Wed, 08 May 2024 15:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715206530; x=1715811330; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OvRrvqgNHBwilgARP9eErTNvt8papjTXT1DLOpLacEo=; b=eXKI4NuU2kYWfCrlw+SUgqMyyKcDvV4/vEn/xp0zO24fncLFa7F5H5nqZBjPPj9FNY WHaBNQSeiGWf1kWRkKsM31zKOho484tUKumKMPugcR9+B2up97INpY653XrRwEl3PJZt c2W2/k17HK9F88GghtZoh6jNBzb05sMTMG/Nps9yft+/8M2GtYBuabsfX8rq8ZZFzGcF tRaZ6bs0FeA0Yz6civPPWmHZdvT0j87+y/FxwcHmacytG3G7myRDTVIS2OxK7990nD23 qmz3ORv6JHuoRfsoyE6z5QWqxnW7cMU+xyvstaOEH+bZUr1R39WNryt16fxZhmrRbX5j /hnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715206530; x=1715811330; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OvRrvqgNHBwilgARP9eErTNvt8papjTXT1DLOpLacEo=; b=dDAkwHfl9K5o6ygqWS1EWEmI3hdiVK1obd4iQT/AtWgkpkCoM02N1WQdGyvyD5pph4 3ZIMaL+FWAhWTJEAPgFRzLK3v4tc2IrXDopvxY0f6vFmzkPmeEaRa8/YF26uTG4VLMy6 VSXPazJXlPz/5feY/wGt2+GR43kjvGuohvp5rje2gsmOgr1O7533d1CjkuPZwl6Gp/F1 9bfA5wDQ3q7vMdN5ZoobpDyg6FOXmfF3/sqQWbesdTQJknvr6GouXU1Hp+EYQXUkvXyC OL7T64Las6HRIO5IZrkVux3/J+XO6xyoDc2+NsJaF3RyqTpzppK+EWJtcj9ic4IQ3+6y TtzA== X-Forwarded-Encrypted: i=1; AJvYcCViWvLCKUKV7739NO09V5Hbw8+zwFY7NRQgXMkRLZONr85av1c3Ljiz3BaDHjkhsWPpeSILINowbX/Gl1pyAVb8wDjZCZgsdGizy9Hl X-Gm-Message-State: AOJu0YxWHYNj4M6Olh1QIKeSstjH+hputr/L6Huqt5E45pNsjYiZWf0D TTP3pCM3coBxsq59fTcwZaH+xD2r5yVxfCHSL6N8C9NtFjsLN9tECYesmg== X-Received: by 2002:a05:6a20:9494:b0:1af:c0f9:b155 with SMTP id adf61e73a8af0-1afc8d8eb58mr4085639637.38.1715206530400; Wed, 08 May 2024 15:15:30 -0700 (PDT) Received: from carrot.. (i223-218-106-142.s42.a014.ap.plala.or.jp. [223.218.106.142]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2b628ea59absm1938826a91.47.2024.05.08.15.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 15:15:29 -0700 (PDT) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH -mm] nilfs2: convert BUG_ON() in nilfs_finish_roll_forward() to WARN_ON() Date: Thu, 9 May 2024 07:14:29 +0900 Message-Id: <20240508221429.7559-1-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.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 The BUG_ON check performed on the return value of __getblk() in nilfs_finish_roll_forward() assumes that a buffer that has been successfully read once is retrieved with the same parameters and does not fail (__getblk() does not return an error due to memory allocation failure). Also, nilfs_finish_roll_forward() is called at most once during mount. Taking these into consideration, rewrite the check to use WARN_ON() to avoid using BUG_ON(). Signed-off-by: Ryusuke Konishi --- Andrew, please add this to the queue for the next cycle (if it's not late). This is a change to reduce BUG_ONs in legacy usage. fs/nilfs2/recovery.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index e48372618ac4..020f304c600e 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c @@ -699,7 +699,9 @@ static void nilfs_finish_roll_forward(struct the_nilfs *nilfs, return; bh = __getblk(nilfs->ns_bdev, ri->ri_lsegs_start, nilfs->ns_blocksize); - BUG_ON(!bh); + if (WARN_ON(!bh)) + return; /* should never happen */ + memset(bh->b_data, 0, bh->b_size); set_buffer_dirty(bh); err = sync_dirty_buffer(bh); -- 2.34.1