[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200423233705.5878-12-mfo@canonical.com>
Date: Thu, 23 Apr 2020 20:37:05 -0300
From: Mauricio Faria de Oliveira <mfo@...onical.com>
To: linux-ext4@...r.kernel.org, "Theodore Y. Ts'o" <tytso@....edu>
Cc: dann frazier <dann.frazier@...onical.com>,
Andreas Dilger <adilger@...ger.ca>, Jan Kara <jack@...e.com>
Subject: [RFC PATCH 11/11] ext4: data=journal: prevent journalled writeback deadlock in ext4_try_to_write_inline_data()
This patch checks for and prevents the deadlock with a page in
journalled writeback in ext4_try_to_write_inline_data().
Finally, add wait_on_page_writeback() if data=journal mode.
Signed-off-by: Mauricio Faria de Oliveira <mfo@...onical.com>
---
fs/ext4/inline.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 3d370b04a740..c55a11f515d3 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -710,6 +710,8 @@ int ext4_try_to_write_inline_data(struct address_space *mapping,
handle = NULL;
goto out;
}
+ if (ext4_should_journal_data(inode))
+ wait_on_page_writeback(page);
unlock_page(page);
/*
@@ -732,9 +734,18 @@ int ext4_try_to_write_inline_data(struct address_space *mapping,
put_page(page);
ext4_journal_stop(handle);
goto retry_grab;
+ } else if (ext4_should_journal_data(inode) &&
+ ext4_check_journalled_writeback(handle, page)) {
+ unlock_page(page);
+ put_page(page);
+ ext4_journal_stop(handle);
+ ext4_start_commit_datasync(inode);
+ goto retry_grab;
}
/* In case writeback began while the page was unlocked */
wait_for_stable_page(page);
+ if (ext4_should_journal_data(inode))
+ wait_on_page_writeback(page);
ret = ext4_prepare_inline_data(handle, inode, pos + len);
if (ret) {
--
2.20.1
Powered by blists - more mailing lists