* [PATCH 0/2] ext4: Fix two bugs in journalled writepages rework
@ 2023-03-23 14:53 Jan Kara
2023-03-23 14:53 ` [PATCH 1/2] ext4: Fix data=journal writeback of DMA pinned page Jan Kara
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jan Kara @ 2023-03-23 14:53 UTC (permalink / raw)
To: Ted Tso; +Cc: linux-ext4, Eric Biggers, Jan Kara
Hello!
These two patches fix two problems introduced by the rewrite of journalled
writeback path.
Honza
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] ext4: Fix data=journal writeback of DMA pinned page
2023-03-23 14:53 [PATCH 0/2] ext4: Fix two bugs in journalled writepages rework Jan Kara
@ 2023-03-23 14:53 ` Jan Kara
2023-03-23 14:53 ` [PATCH 2/2] ext4: Fix crash on shutdown filesystem Jan Kara
2023-04-15 2:15 ` [PATCH 0/2] ext4: Fix two bugs in journalled writepages rework Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2023-03-23 14:53 UTC (permalink / raw)
To: Ted Tso; +Cc: linux-ext4, Eric Biggers, Jan Kara
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.
Reported-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/all/20230319183617.GA896@sol.localdomain
Fixes: 18b7f4107219 ("ext4: Fix warnings when freezing filesystem with journaled data")
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 3e311c85df08..15bac8181798 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -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))
--
2.35.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] ext4: Fix crash on shutdown filesystem
2023-03-23 14:53 [PATCH 0/2] ext4: Fix two bugs in journalled writepages rework Jan Kara
2023-03-23 14:53 ` [PATCH 1/2] ext4: Fix data=journal writeback of DMA pinned page Jan Kara
@ 2023-03-23 14:53 ` Jan Kara
2023-04-15 2:15 ` [PATCH 0/2] ext4: Fix two bugs in journalled writepages rework Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2023-03-23 14:53 UTC (permalink / raw)
To: Ted Tso; +Cc: linux-ext4, Eric Biggers, Jan Kara
Test 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().
Fixes: f7233fb54d18 ("ext4: Convert data=journal writeback to use ext4_writepages()")
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 15bac8181798..dbcc8b48c7ba 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -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);
--
2.35.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] ext4: Fix two bugs in journalled writepages rework
2023-03-23 14:53 [PATCH 0/2] ext4: Fix two bugs in journalled writepages rework Jan Kara
2023-03-23 14:53 ` [PATCH 1/2] ext4: Fix data=journal writeback of DMA pinned page Jan Kara
2023-03-23 14:53 ` [PATCH 2/2] ext4: Fix crash on shutdown filesystem Jan Kara
@ 2023-04-15 2:15 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2023-04-15 2:15 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-ext4, Eric Biggers
On Thu, Mar 23, 2023 at 03:53:57PM +0100, Jan Kara wrote:
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-15 2:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-23 14:53 [PATCH 0/2] ext4: Fix two bugs in journalled writepages rework Jan Kara
2023-03-23 14:53 ` [PATCH 1/2] ext4: Fix data=journal writeback of DMA pinned page Jan Kara
2023-03-23 14:53 ` [PATCH 2/2] ext4: Fix crash on shutdown filesystem Jan Kara
2023-04-15 2:15 ` [PATCH 0/2] ext4: Fix two bugs in journalled writepages rework Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.