Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-02-15 10:23:48 +0100
committerJiri Slaby <jslaby@suse.cz>2019-02-15 10:24:15 +0100
commit2e826657dc5cc2a0e33b86eb31b23e1e728b6931 (patch)
tree8baf755c3d9a049c4b078fa0354acf5424ff4900
parentfa5527e79d4a6b1d3a0f6cfaa14496c0d89b7143 (diff)
Revert "ext4: use ext4_write_inode() when fsyncing w/o a
journal" (bnc#1012628).
-rw-r--r--patches.kernel.org/4.20.9-046-Revert-ext4-use-ext4_write_inode-when-fsyncing.patch73
-rw-r--r--series.conf1
2 files changed, 74 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.9-046-Revert-ext4-use-ext4_write_inode-when-fsyncing.patch b/patches.kernel.org/4.20.9-046-Revert-ext4-use-ext4_write_inode-when-fsyncing.patch
new file mode 100644
index 0000000000..1f52af4252
--- /dev/null
+++ b/patches.kernel.org/4.20.9-046-Revert-ext4-use-ext4_write_inode-when-fsyncing.patch
@@ -0,0 +1,73 @@
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Thu, 31 Jan 2019 23:41:11 -0500
+Subject: [PATCH] Revert "ext4: use ext4_write_inode() when fsyncing w/o a
+ journal"
+References: bnc#1012628
+Patch-mainline: 4.20.9
+Git-commit: 8fdd60f2ae3682caf2a7258626abc21eb4711892
+
+commit 8fdd60f2ae3682caf2a7258626abc21eb4711892 upstream.
+
+This reverts commit ad211f3e94b314a910d4af03178a0b52a7d1ee0a.
+
+As Jan Kara pointed out, this change was unsafe since it means we lose
+the call to sync_mapping_buffers() in the nojournal case. The
+original point of the commit was avoid taking the inode mutex (since
+it causes a lockdep warning in generic/113); but we need the mutex in
+order to call sync_mapping_buffers().
+
+The real fix to this problem was discussed here:
+
+https://lore.kernel.org/lkml/20181025150540.259281-4-bvanassche@acm.org
+
+The proposed patch was to fix a syzbot complaint, but the problem can
+also demonstrated via "kvm-xfstests -c nojournal generic/113".
+Multiple solutions were discused in the e-mail thread, but none have
+landed in the kernel as of this writing. Anyway, commit
+ad211f3e94b314 is absolutely the wrong way to suppress the lockdep, so
+revert it.
+
+Fixes: ad211f3e94b314a910d4af03178a0b52a7d1ee0a ("ext4: use ext4_write_inode() when fsyncing w/o a journal")
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Reported: Jan Kara <jack@suse.cz>
+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, 4 insertions(+), 9 deletions(-)
+
+diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
+index 712f00995390..5508baa11bb6 100644
+--- a/fs/ext4/fsync.c
++++ b/fs/ext4/fsync.c
+@@ -116,16 +116,8 @@ 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) {
+- struct writeback_control wbc = {
+- .sync_mode = WB_SYNC_ALL
+- };
+-
+- ret = ext4_write_inode(inode, &wbc);
++ ret = __generic_file_fsync(file, start, end, datasync);
+ if (!ret)
+ ret = ext4_sync_parent(inode);
+ if (test_opt(inode->i_sb, BARRIER))
+@@ -133,6 +125,9 @@ 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 af1bf0b985..7ace198f37 100644
--- a/series.conf
+++ b/series.conf
@@ -1128,6 +1128,7 @@
patches.kernel.org/4.20.9-043-drm-vmwgfx-Return-error-code-from-vmw_execbuf_.patch
patches.kernel.org/4.20.9-044-xfrm-Make-set-mark-default-behavior-backward-c.patch
patches.kernel.org/4.20.9-045-drm-i915-Try-to-sanitize-bogus-DPLL-state-left.patch
+ patches.kernel.org/4.20.9-046-Revert-ext4-use-ext4_write_inode-when-fsyncing.patch
########################################################
# Build fixes that apply to the vanilla kernel too.