Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Iliopoulos <ailiopoulos@suse.com>2019-06-12 16:20:49 +0200
committerAnthony Iliopoulos <ailiopoulos@suse.com>2019-06-12 16:20:49 +0200
commit237bb05762fe36b2e9a36a5b28f8b394438d0243 (patch)
tree4276923a8db34b3789a1b9a0934446a3697e9a18
parentac8a63b2c5acf6a2dcd4d9e2730a89321804b51e (diff)
xfs: eof trim writeback mapping as soon as it is cached
(bsc#1138019).
-rw-r--r--patches.fixes/xfs-eof-trim-writeback-mapping-as-soon-as-it-is-cach.patch64
-rw-r--r--series.conf1
2 files changed, 65 insertions, 0 deletions
diff --git a/patches.fixes/xfs-eof-trim-writeback-mapping-as-soon-as-it-is-cach.patch b/patches.fixes/xfs-eof-trim-writeback-mapping-as-soon-as-it-is-cach.patch
new file mode 100644
index 0000000000..00e34e863c
--- /dev/null
+++ b/patches.fixes/xfs-eof-trim-writeback-mapping-as-soon-as-it-is-cach.patch
@@ -0,0 +1,64 @@
+From aa6ee4ab69293969867ab09b57546d226ace3d7a Mon Sep 17 00:00:00 2001
+From: Brian Foster <bfoster@redhat.com>
+Date: Fri, 1 Feb 2019 09:36:36 -0800
+Subject: [PATCH] xfs: eof trim writeback mapping as soon as it is cached
+Git-commit: aa6ee4ab69293969867ab09b57546d226ace3d7a
+Patch-mainline: v5.0-rc6
+References: bsc#1138019
+
+The cached writeback mapping is EOF trimmed to try and avoid races
+between post-eof block management and writeback that result in
+sending cached data to a stale location. The cached mapping is
+currently trimmed on the validation check, which leaves a race
+window between the time the mapping is cached and when it is trimmed
+against the current inode size.
+
+For example, if a new mapping is cached by delalloc conversion on a
+blocksize == page size fs, we could cycle various locks, perform
+memory allocations, etc. in the writeback codepath before the
+associated mapping is eventually trimmed to i_size. This leaves
+enough time for a post-eof truncate and file append before the
+cached mapping is trimmed. The former event essentially invalidates
+a range of the cached mapping and the latter bumps the inode size
+such the trim on the next writepage event won't trim all of the
+invalid blocks. fstest generic/464 reproduces this scenario
+occasionally and causes a lost writeback and stale delalloc blocks
+warning on inode inactivation.
+
+To work around this problem, trim the cached writeback mapping as
+soon as it is cached in addition to on subsequent validation checks.
+This is a minor tweak to tighten the race window as much as possible
+until a proper invalidation mechanism is available.
+
+Fixes: 40214d128e07 ("xfs: trim writepage mapping to within eof")
+Cc: <stable@vger.kernel.org> # v4.14+
+Signed-off-by: Brian Foster <bfoster@redhat.com>
+Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
+Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
+Acked-by: Anthony Iliopoulos <ailiopoulos@suse.com>
+
+---
+ fs/xfs/xfs_aops.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/xfs/xfs_aops.c
++++ b/fs/xfs/xfs_aops.c
+@@ -495,6 +495,7 @@
+ }
+
+ wpc->imap = imap;
++ xfs_trim_extent_eof(&wpc->imap, ip);
+ trace_xfs_map_blocks_found(ip, offset, count, wpc->io_type, &imap);
+ return 0;
+ allocate_blocks:
+@@ -502,6 +503,7 @@
+ if (error)
+ return error;
+ wpc->imap = imap;
++ xfs_trim_extent_eof(&wpc->imap, ip);
+ trace_xfs_map_blocks_alloc(ip, offset, count, wpc->io_type, &imap);
+ return 0;
+ }
+
diff --git a/series.conf b/series.conf
index 86a7422f9e..5de05eb153 100644
--- a/series.conf
+++ b/series.conf
@@ -21145,6 +21145,7 @@
patches.drm/0001-drm-vmwgfx-Fix-setting-of-dma-masks.patch
patches.drm/drm-modes-Prevent-division-by-zero-htotal.patch
patches.drm/drm-sun4i-tcon-Prepare-and-enable-TCON-channel-0-clo.patch
+ patches.fixes/xfs-eof-trim-writeback-mapping-as-soon-as-it-is-cach.patch
patches.drivers/usb-gadget-musb-fix-short-isoc-packets-with-inventra.patch
patches.drivers/usb-dwc3-gadget-Handle-0-xfer-length-for-OUT-EP.patch
patches.drivers/usb-gadget-udc-net2272-Fix-bitwise-and-boolean-opera.patch