ext4: Fix two bugs in journalled writepages rework
Jan Kara
reviewercover ext4: Fix two bugs in journalled writepages rework
Hello!
These two patches fix two problems introduced by the rewrite of journalled writeback path.
Honza
Jan Kara
reviewerPATCH 1/2 ext4: Fix data=journal writeback of DMA pinned page
The condition in ext4_writepages() checking whether the filesystem is frozen had a brown paper bag bug resulting in us never writing back DMA pinned pages. Fix the condition.
--- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
@@ -2436,7 +2436,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)* loop clears them. */ if (ext4_should_journal_data (mpd->inode) && - sb->s_writers.frozen >=SB_FREEZE_FS ) { + sb->s_writers.frozen <SB_FREEZE_FS ) { handle =ext4_journal_start (mpd->inode,EXT4_HT_WRITE_PAGE , bpp);if (IS_ERR (handle))
Signature · 1 line
2.35.3
Jan Kara
reviewerPATCH 2/2 ext4: Fix crash on shutdown filesystem
In reply to Jan KaraTest generic/388 triggered a crash in mpage_release_unused_pages() because a page in mpd->first_page..mpd->next_page range was not locked. This can happen in data=journal mode when we exit from mpage_prepare_extent_to_map() before actually initializing mpd->next_page. Move the initialization to a place before we can exit with error from mpage_prepare_extent_to_map().
--- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/inode.c +2 -2
@@ -2428,6 +2428,8 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)else tag =PAGECACHE_TAG_DIRTY ; + mpd->map.m_len =0 ; + mpd->next_page = index;/* * Start a transaction for writeback of journalled data. We don't start * the transaction if the filesystem is frozen. In that case we
@@ -2443,8 +2445,6 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)return PTR_ERR (handle); }folio_batch_init (&fbatch); - mpd->map.m_len =0 ; - mpd->next_page = index;while (index <= end) { nr_folios =filemap_get_folios_tag (mapping, &index, end, tag, &fbatch);
Signature · 1 line
2.35.3
Theodore Ts'o
maintainerQuoted 4 lines · Jan Kara
Hello!
These two patches fix two problems introduced by the rewrite of journalled writeback path.
I've folded these patches into the "ext4: Covert data=journal writeback to use ext4_writepages()" commit in my tree. Thanks,
- Ted