From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB371C369D5 for ; Mon, 28 Apr 2025 23:08:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC6866B000E; Mon, 28 Apr 2025 19:08:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C75AD6B0011; Mon, 28 Apr 2025 19:08:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B64766B0012; Mon, 28 Apr 2025 19:08:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9A11E6B000E for ; Mon, 28 Apr 2025 19:08:55 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CA1DF1CE0A9 for ; Mon, 28 Apr 2025 23:08:56 +0000 (UTC) X-FDA: 83384994672.25.DB208CF Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf02.hostedemail.com (Postfix) with ESMTP id 361A38000E for ; Mon, 28 Apr 2025 23:08:55 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iAo2m5kD; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of mcgrof@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=mcgrof@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745881735; a=rsa-sha256; cv=none; b=bXR4Qa8y+Uy78zFeuJoX6wL687yKdFBAU8TfB7TMGVwvqi1fPeoIA3Fw/ijS/2nUvnOSlJ W8M+WM5ap/tKInUeTjyRbpJBvtb4l9JSxZrDhOERAsMj8oYDL3RJMqljkBq3OTdzCjBT4X QiV7AgTHbUmy28aaXzFfvwV+3yWppD8= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iAo2m5kD; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of mcgrof@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=mcgrof@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1745881735; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gCzRvCxsZB643Pkzd9cPUxAhlkOxwMpXP7KIfRll4XU=; b=04Bt6jNjYPm24kU8Bz57RKTY2f5/VbIj8HTgrTn6ppF186mkvTAXb1JBNVRftss0w1v9JB Odf2AGpXitoLhnTOJKuj4t7X8VccdypkV57Wb3tVipUET6mKL8PYoabdkIPWmdL87aDOZg +0j/vlsUXn1OQiM2LJhtGxBDwCiAIDs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 83742A4B86D; Mon, 28 Apr 2025 23:03:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 758BEC4CEEA; Mon, 28 Apr 2025 23:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745881734; bh=vqxx5ITJdSbi8gq6eMAJPI6323cJXEPOZV0uX68kTH8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iAo2m5kDb/pyyuC1rocXxoL0N1J5litPpu4IU4vvH9RlaSurRgMiRuC0StJYwJ6ZX Q1I0GxiJP02d1MFtoUl9pIlXptXQyJ2X9XqF6jAH++8FsnuYu4V36TsMG3GG5HMK3k n91FsddH55UK4FiM12V+6iRlQTSUXLjGuCw4MVwqScW6T0TSxTl1vsJ9MWlHNasAUJ q/Jaw/mD4HJtSHOu5rpx/hNziVnnZCnj6+RcGXaNcueNqwzfTTCKL32m2Doe0t5fnV AUhQ6ESgl/O4EI59CoEIXtx/PIZ7OnE590VpI1x6QJ1rLGuowPdRY28JebcVDePVNg 0xMYFw45xkBpw== Date: Mon, 28 Apr 2025 16:08:52 -0700 From: Luis Chamberlain To: Jan Kara Cc: dave@stgolabs.net, brauner@kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, riel@surriel.com, willy@infradead.org, hannes@cmpxchg.org, oliver.sang@intel.com, david@redhat.com, axboe@kernel.dk, hare@suse.de, david@fromorbit.com, djwong@kernel.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, gost.dev@samsung.com, p.raghav@samsung.com, da.gomez@samsung.com, syzbot+f3c6fda1297c748a7076@syzkaller.appspotmail.com Subject: Re: [PATCH v2 1/8] migrate: fix skipping metadata buffer heads on migration Message-ID: References: <20250410014945.2140781-1-mcgrof@kernel.org> <20250410014945.2140781-2-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 361A38000E X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: zafjh8sy8fb5mudqphjb7gewi163hauf X-HE-Tag: 1745881735-310583 X-HE-Meta: U2FsdGVkX189Y/wPBx/Nu+7u5m5WvqwvVaZ9Z3/iz4ooVWpSips7Hp20stVycY+MWZVx+ooEP2YjtJQHSZtuLSXakXteO/sS8KK32HGiTT2vbW0i8w1HWAGBjaHbiTdgXY6Ng2lHxXf7f6f5nhIo61a5rT2UhTMLrRCd0m22RmA9927YAuFVsMD162fPMaktqzKn7Wivk2oHjmevj2MD5MeMZ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n0AZZ0xmUTR3NAYs3XmwtNtr/26T58IcVEhjJmxbefqfSVqglZdebEvIP+RJUR+GQ0Yt/QW1eqknUmi8+TWNa7P18yQz5FtVKrvL6vuOr4b3ieJJIRFCx5VQoWgn1Xzo9pN/sGC10jGdCzIlWIGaxkpxPo+eJEXMx4CArPTXosOEaecB9TjxoQDx7 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Apr 25, 2025 at 03:51:55PM -0700, Luis Chamberlain wrote: > On Wed, Apr 23, 2025 at 01:30:29PM -0700, Luis Chamberlain wrote: > > On Wed, Apr 23, 2025 at 07:09:28PM +0200, Jan Kara wrote: > > > On Wed 16-04-25 09:58:30, Luis Chamberlain wrote: > > > > On Tue, Apr 15, 2025 at 06:28:55PM +0200, Jan Kara wrote: > > > > > > So I tried: > > > > > > > > > > > > root@e1-ext4-2k /var/lib/xfstests # fsck /dev/loop5 -y 2>&1 > log > > > > > > e2fsck 1.47.2 (1-Jan-2025) > > > > > > root@e1-ext4-2k /var/lib/xfstests # wc -l log > > > > > > 16411 log > > > > > > > > > > Can you share the log please? > > > > > > > > Sure, here you go: > > > > > > > > https://github.com/linux-kdevops/20250416-ext4-jbd2-bh-migrate-corruption > > > > > > > > The last trace-0004.txt is a fresh one with Davidlohr's patches > > > > applied. It has trace-0004-fsck.txt. > > > > > > Thanks for the data! I was staring at them for some time and at this point > > > I'm leaning towards a conclusion that this is actually not a case of > > > metadata corruption but rather a bug in ext4 transaction credit computation > > > that is completely independent of page migration. > > > > > > Based on the e2fsck log you've provided the only damage in the filesystem > > > is from the aborted transaction handle in the middle of extent tree growth. > > > So nothing points to a lost metadata write or anything like that. And the > > > credit reservation for page writeback is indeed somewhat racy - we reserve > > > number of transaction credits based on current tree depth. However by the > > > time we get to ext4_ext_map_blocks() another process could have modified > > > the extent tree so we may need to modify more blocks than we originally > > > expected and reserved credits for. > > > > > > Can you give attached patch a try please? > > > > > > Honza > > > -- > > > Jan Kara > > > SUSE Labs, CR > > > > > From 4c53fb9f4b9b3eb4a579f69b7adcb6524d55629c Mon Sep 17 00:00:00 2001 > > > From: Jan Kara > > > Date: Wed, 23 Apr 2025 18:10:54 +0200 > > > Subject: [PATCH] ext4: Fix calculation of credits for extent tree modification > > > > > > Luis and David are reporting that after running generic/750 test for 90+ > > > hours on 2k ext4 filesystem, they are able to trigger a warning in > > > jbd2_journal_dirty_metadata() complaining that there are not enough > > > credits in the running transaction started in ext4_do_writepages(). > > > > > > Indeed the code in ext4_do_writepages() is racy and the extent tree can > > > change between the time we compute credits necessary for extent tree > > > computation and the time we actually modify the extent tree. Thus it may > > > happen that the number of credits actually needed is higher. Modify > > > ext4_ext_index_trans_blocks() to count with the worst case of maximum > > > tree depth. > > > > > > Link: https://lore.kernel.org/all/20250415013641.f2ppw6wov4kn4wq2@offworld > > > Reported-by: Davidlohr Bueso > > > Reported-by: Luis Chamberlain > > > Signed-off-by: Jan Kara > > > > I kicked off tests! Let's see after ~ 90 hours! > > Tested-by: kdevops@lists.linux.dev > > I have run the test over 3 separate guests and each one has tested this > over 48 hours each. There is no ext4 fs corruption reported, all is > good, so I do believe thix fixes the issue. One of the guests was on > Linus't tree which didn't yet have Davidlorh's fixes for folio migration. > And so I believe this patch should have a stable tag fix so stable gets it. Jan, my testing has passed 120 hours now on multiple guests. This is certainly a fixed bug with your patch. Luis