Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-01-18 07:53:27 +0100
committerJiri Slaby <jslaby@suse.cz>2019-01-18 07:53:41 +0100
commit98e9b5e2ea85bcb58e85844436be4bbc6b2a8265 (patch)
tree1fe9e4d8486919d37cde362b15f687380f75879b
parent8eb3266aac8b7e87242decea5602a3e3700a91ca (diff)
ext4: use ext4_write_inode() when fsyncing w/o a journal
-rw-r--r--patches.kernel.org/4.20.3-050-ext4-use-ext4_write_inode-when-fsyncing-w-o-a-.patch58
-rw-r--r--series.conf1
2 files changed, 59 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.3-050-ext4-use-ext4_write_inode-when-fsyncing-w-o-a-.patch b/patches.kernel.org/4.20.3-050-ext4-use-ext4_write_inode-when-fsyncing-w-o-a-.patch
new file mode 100644
index 0000000000..a6b7898048
--- /dev/null
+++ b/patches.kernel.org/4.20.3-050-ext4-use-ext4_write_inode-when-fsyncing-w-o-a-.patch
@@ -0,0 +1,58 @@
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Mon, 31 Dec 2018 00:10:48 -0500
+Subject: [PATCH] ext4: use ext4_write_inode() when fsyncing w/o a journal
+References: bnc#1012628
+Patch-mainline: 4.20.3
+Git-commit: ad211f3e94b314a910d4af03178a0b52a7d1ee0a
+
+commit ad211f3e94b314a910d4af03178a0b52a7d1ee0a upstream.
+
+In no-journal mode, we previously used __generic_file_fsync() in
+no-journal mode. This triggers a lockdep warning, and in addition,
+it's not safe to depend on the inode writeback mechanism in the case
+ext4. We can solve both problems by calling ext4_write_inode()
+directly.
+
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Cc: stable@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ fs/ext4/fsync.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
+index 26a7fe5c4fd3..87a7ff00ef62 100644
+--- a/fs/ext4/fsync.c
++++ b/fs/ext4/fsync.c
+@@ -116,8 +116,16 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
+ goto out;
+ }
+
++ ret = file_write_and_wait_range(file, start, end);
++ if (ret)
++ return ret;
++
+ if (!journal) {
+- ret = __generic_file_fsync(file, start, end, datasync);
++ struct writeback_control wbc = {
++ .sync_mode = WB_SYNC_ALL
++ };
++
++ ret = ext4_write_inode(inode, &wbc);
+ if (!ret)
+ ret = ext4_sync_parent(inode);
+ if (test_opt(inode->i_sb, BARRIER))
+@@ -125,9 +133,6 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
+ goto out;
+ }
+
+- ret = file_write_and_wait_range(file, start, end);
+- if (ret)
+- return ret;
+ /*
+ * data=writeback,ordered:
+ * The caller's filemap_fdatawrite()/wait will sync the data.
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index edc80f6e45..5e7c94e54a 100644
--- a/series.conf
+++ b/series.conf
@@ -287,6 +287,7 @@
patches.kernel.org/4.20.3-047-ext4-make-sure-enough-credits-are-reserved-for.patch
patches.kernel.org/4.20.3-048-ext4-fix-a-potential-fiemap-page-fault-deadloc.patch
patches.kernel.org/4.20.3-049-ext4-avoid-kernel-warning-when-writing-the-sup.patch
+ patches.kernel.org/4.20.3-050-ext4-use-ext4_write_inode-when-fsyncing-w-o-a-.patch
########################################################
# Build fixes that apply to the vanilla kernel too.