[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <gluj62pw5pu7ag2juf5ejwsr3ghvckag7wh4zunwyk57slcrmg@42of57gybigz>
Date: Tue, 3 Feb 2026 15:50:43 +0100
From: Jan Kara <jack@...e.cz>
To: Gerald Yang <gerald.yang@...onical.com>
Cc: Jan Kara <jack@...e.cz>, tytso@....edu, adilger.kernel@...ger.ca,
linux-ext4@...r.kernel.org, gerald.yang.tw@...il.com
Subject: Re: [PATCH] ext4: Fix call trace when remounting to read only in
data=journal mode
Hello,
On Fri 30-01-26 19:38:55, Gerald Yang wrote:
> Thanks for sharing the findings, I'd also like to share some findings:
> I tried to figure out why the buffer is dirty after calling sync_filesystem,
> in mpage_prepare_extent_to_map, first I printed folio_test_dirty(folio):
>
> while (index <= end)
> ...
> for (i = 0; i < nr_folios; i++) {
> ...
> (print if folio is dirty here)
>
> and actually all folios are clean:
> if (!folio_test_dirty(folio) ||
> ...
> folio_unlock(folio);
> continue; <==== continue here without writing anything
>
> Because the call trace happens before going into the above while loop:
>
> if (ext4_should_journal_data(mpd->inode)) {
> handle = ext4_journal_start(mpd->inode, EXT4_HT_WRITE_PAGE,
>
> it checks if the file system is read only and dumps the call trace in
> ext4_journal_check_start, but it doesn't check if there are any real writes
> that will happen later in the loop.
>
> To confirm this, first I added 2 more lines in the reproduce script before
> remounting read only:
> sync <==== it calls ext4_sync_fs to flush all dirty data same as what's
> called during remount read only
> echo 1 > /proc/sys/vm/drop_caches <==== drop clean page cache
> mount -o remount,ro ext4disk mnt
>
> Then I can no longer reproduce the call trace.
OK, but ext4_do_writepages() has a check at the beginning:
if (!mapping->nrpages || !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
goto out_writepages;
So if there are no dirty pages, mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)
should be false and so we shouldn't go further?
It all looks like some kind of a race because I'm not always able to
reproduce the problem... I'll try to look more into this.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists