summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge2019-09-15 14:09:33 +0200
committerDavid Runge2019-09-15 14:09:33 +0200
commite33c4069f97cf6fc52336299859e1f3e3dd82d7c (patch)
tree06c723fe920470085210ffeb2f5ce2404f378661
parent10a838b7cff65f65ca0eedddf438428c44a8f0ac (diff)
downloadaur-e33c4069f97cf6fc52336299859e1f3e3dd82d7c.tar.gz
PKGBUILD: Upgrading to 5.2.14_rt7. Adding fix for btrfs related issues (leading to system hangs or worst case: file corruption) on high load.
-rw-r--r--.SRCINFO18
-rw-r--r--0003-Btrfs-fix-unwritten-extent-buffers-and-hangs-on-futu.patch145
-rw-r--r--PKGBUILD14
-rw-r--r--config2
4 files changed, 164 insertions, 15 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a7437a365f62..464fcd5d2efe 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
pkgbase = linux-rt
- pkgver = 5.2.10_rt5
+ pkgver = 5.2.14_rt7
pkgrel = 1
url = https://git.archlinux.org/linux.git/log/?h=v
arch = x86_64
@@ -11,32 +11,34 @@ pkgbase = linux-rt
makedepends = libelf
makedepends = xmlto
options = !strip
- source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.2.10.tar.xz
- source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.2.10.tar.sign
- source = https://www.kernel.org/pub/linux/kernel/projects/rt/5.2/older/patch-5.2.10-rt5.patch.xz
- source = https://www.kernel.org/pub/linux/kernel/projects/rt/5.2/older/patch-5.2.10-rt5.patch.sign
+ source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.2.14.tar.xz
+ source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.2.14.tar.sign
+ source = https://www.kernel.org/pub/linux/kernel/projects/rt/5.2/older/patch-5.2.14-rt7.patch.xz
+ source = https://www.kernel.org/pub/linux/kernel/projects/rt/5.2/older/patch-5.2.14-rt7.patch.sign
source = config
source = 60-linux-rt.hook
source = 90-linux-rt.hook
source = linux-rt.preset
source = 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
source = 0002-ZEN-Add-CONFIG-for-unprivileged_userns_clone.patch
+ source = 0003-Btrfs-fix-unwritten-extent-buffers-and-hangs-on-futu.patch
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
validpgpkeys = 8218F88849AAC522E94CF470A5E9288C4FA415FA
validpgpkeys = 64254695FFF0AA4466CC19E67B96E8162A8CF5D1
validpgpkeys = 5ED9A48FC54C0A22D1D0804CEBC26CDB5A56DE73
validpgpkeys = E644E2F1D45FA0B2EAA02F33109F098506FF0B14
- sha256sums = 6096c4387c2a296de9136080942d11ae3f1bd28129b6952f7133c570e43bfc49
+ sha256sums = c64d36477fee6a864a734ec417407768e60040a13f144c33208fa9622fd0ce8c
sha256sums = SKIP
- sha256sums = 28b95929be17b450890ab7b00655940ef6ff019bbc4bd41241fd6b91bdc92bc4
+ sha256sums = 33b5123ab190e8b525149ac416787e2c3325269d34350dc2045dd68ba1f95154
sha256sums = SKIP
- sha256sums = cf4ef9d0b61efb7a27215fc4ec77a8a07ef67d9cf53a1ab14a07882a6c7613f9
+ sha256sums = e1214bcad1f31c83d3688874865e3bce034eca0ec37a5248fbfd856fe32b16dc
sha256sums = ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21
sha256sums = 75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919
sha256sums = ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65
sha256sums = 75aa8dd708ca5a0137fbf7cddc9cafefe6aac6b8e0638c06c156d412d05af4bc
sha256sums = 187fa8d9a6c5777a8930dcecfafdd9d6e9095d4bf96ec060e756fb7c6a88b74d
+ sha256sums = a4802ecb2b75bb1711f050a0370bcc38754478170ed1bebe9aa89d1572762590
pkgname = linux-rt
pkgdesc = The Linux-rt kernel and modules
diff --git a/0003-Btrfs-fix-unwritten-extent-buffers-and-hangs-on-futu.patch b/0003-Btrfs-fix-unwritten-extent-buffers-and-hangs-on-futu.patch
new file mode 100644
index 000000000000..42c4fbc0e979
--- /dev/null
+++ b/0003-Btrfs-fix-unwritten-extent-buffers-and-hangs-on-futu.patch
@@ -0,0 +1,145 @@
+From 45fc8773f47b7cbe56caab0e14abf26d1e044e63 Mon Sep 17 00:00:00 2001
+From: Filipe Manana <fdmanana@suse.com>
+Date: Wed, 11 Sep 2019 17:42:00 +0100
+Subject: [PATCH 2/3] Btrfs: fix unwritten extent buffers and hangs on future
+ writeback attempts
+
+The lock_extent_buffer_io() returns 1 to the caller to tell it everything
+went fine and the callers needs to start writeback for the extent buffer
+(submit a bio, etc), 0 to tell the caller everything went fine but it does
+not need to start writeback for the extent buffer, and a negative value if
+some error happened.
+
+When it's about to return 1 it tries to lock all pages, and if a try lock
+on a page fails, and we didn't flush any existing bio in our "epd", it
+calls flush_write_bio(epd) and overwrites the return value of 1 to 0 or
+an error. The page might have been locked elsewhere, not with the goal
+of starting writeback of the extent buffer, and even by some code other
+than btrfs, like page migration for example, so it does not mean the
+writeback of the extent buffer was already started by some other task,
+so returning a 0 tells the caller (btree_write_cache_pages()) to not
+start writeback for the extent buffer. Note that epd might currently have
+either no bio, so flush_write_bio() returns 0 (success) or it might have
+a bio for another extent buffer with a lower index (logical address).
+
+Since we return 0 with the EXTENT_BUFFER_WRITEBACK bit set on the
+extent buffer and writeback is never started for the extent buffer,
+future attempts to writeback the extent buffer will hang forever waiting
+on that bit to be cleared, since it can only be cleared after writeback
+completes. Such hang is reported with a trace like the following:
+
+ [49887.347053] INFO: task btrfs-transacti:1752 blocked for more than 122 seconds.
+ [49887.347059] Not tainted 5.2.13-gentoo #2
+ [49887.347060] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
+ [49887.347062] btrfs-transacti D 0 1752 2 0x80004000
+ [49887.347064] Call Trace:
+ [49887.347069] ? __schedule+0x265/0x830
+ [49887.347071] ? bit_wait+0x50/0x50
+ [49887.347072] ? bit_wait+0x50/0x50
+ [49887.347074] schedule+0x24/0x90
+ [49887.347075] io_schedule+0x3c/0x60
+ [49887.347077] bit_wait_io+0x8/0x50
+ [49887.347079] __wait_on_bit+0x6c/0x80
+ [49887.347081] ? __lock_release.isra.29+0x155/0x2d0
+ [49887.347083] out_of_line_wait_on_bit+0x7b/0x80
+ [49887.347084] ? var_wake_function+0x20/0x20
+ [49887.347087] lock_extent_buffer_for_io+0x28c/0x390
+ [49887.347089] btree_write_cache_pages+0x18e/0x340
+ [49887.347091] do_writepages+0x29/0xb0
+ [49887.347093] ? kmem_cache_free+0x132/0x160
+ [49887.347095] ? convert_extent_bit+0x544/0x680
+ [49887.347097] filemap_fdatawrite_range+0x70/0x90
+ [49887.347099] btrfs_write_marked_extents+0x53/0x120
+ [49887.347100] btrfs_write_and_wait_transaction.isra.4+0x38/0xa0
+ [49887.347102] btrfs_commit_transaction+0x6bb/0x990
+ [49887.347103] ? start_transaction+0x33e/0x500
+ [49887.347105] transaction_kthread+0x139/0x15c
+
+So fix this by not overwriting the return value (ret) with the result
+from flush_write_bio(). We also need to clear the EXTENT_BUFFER_WRITEBACK
+bit in case flush_write_bio() returns an error, otherwise it will hang
+any future attempts to writeback the extent buffer, and undo all work
+done before (set back EXTENT_BUFFER_DIRTY, etc).
+
+This is a regression introduced in the 5.2 kernel.
+
+Fixes: 2e3c25136adfb ("btrfs: extent_io: add proper error handling to lock_extent_buffer_for_io()")
+Fixes: f4340622e0226 ("btrfs: extent_io: Move the BUG_ON() in flush_write_bio() one level up")
+Reported-by: Zdenek Sojka <zsojka@seznam.cz>
+Link: https://lore.kernel.org/linux-btrfs/GpO.2yos.3WGDOLpx6t%7D.1TUDYM@seznam.cz/T/#u
+Reported-by: Stefan Priebe - Profihost AG <s.priebe@profihost.ag>
+Link: https://lore.kernel.org/linux-btrfs/5c4688ac-10a7-fb07-70e8-c5d31a3fbb38@profihost.ag/T/#t
+Reported-by: Drazen Kacar <drazen.kacar@oradian.com>
+Link: https://lore.kernel.org/linux-btrfs/DB8PR03MB562876ECE2319B3E579590F799C80@DB8PR03MB5628.eurprd03.prod.outlook.com/
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204377
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+---
+ fs/btrfs/extent_io.c | 35 ++++++++++++++++++++++++++---------
+ 1 file changed, 26 insertions(+), 9 deletions(-)
+
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
+index db337e53aab3..93900ff87df7 100644
+--- a/fs/btrfs/extent_io.c
++++ b/fs/btrfs/extent_io.c
+@@ -3591,6 +3591,13 @@ void wait_on_extent_buffer_writeback(struct extent_buffer *eb)
+ TASK_UNINTERRUPTIBLE);
+ }
+
++static void end_extent_buffer_writeback(struct extent_buffer *eb)
++{
++ clear_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags);
++ smp_mb__after_atomic();
++ wake_up_bit(&eb->bflags, EXTENT_BUFFER_WRITEBACK);
++}
++
+ /*
+ * Lock eb pages and flush the bio if we can't the locks
+ *
+@@ -3662,8 +3669,11 @@ static noinline_for_stack int lock_extent_buffer_for_io(struct extent_buffer *eb
+
+ if (!trylock_page(p)) {
+ if (!flush) {
+- ret = flush_write_bio(epd);
+- if (ret < 0) {
++ int err;
++
++ err = flush_write_bio(epd);
++ if (err < 0) {
++ ret = err;
+ failed_page_nr = i;
+ goto err_unlock;
+ }
+@@ -3678,16 +3688,23 @@ static noinline_for_stack int lock_extent_buffer_for_io(struct extent_buffer *eb
+ /* Unlock already locked pages */
+ for (i = 0; i < failed_page_nr; i++)
+ unlock_page(eb->pages[i]);
++ /*
++ * Clear EXTENT_BUFFER_WRITEBACK and wake up anyone waiting on it.
++ * Also set back EXTENT_BUFFER_DIRTY so future attempts to this eb can
++ * be made and undo everything done before.
++ */
++ btrfs_tree_lock(eb);
++ spin_lock(&eb->refs_lock);
++ set_bit(EXTENT_BUFFER_DIRTY, &eb->bflags);
++ end_extent_buffer_writeback(eb);
++ spin_unlock(&eb->refs_lock);
++ percpu_counter_add_batch(&fs_info->dirty_metadata_bytes, eb->len,
++ fs_info->dirty_metadata_batch);
++ btrfs_clear_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
++ btrfs_tree_unlock(eb);
+ return ret;
+ }
+
+-static void end_extent_buffer_writeback(struct extent_buffer *eb)
+-{
+- clear_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags);
+- smp_mb__after_atomic();
+- wake_up_bit(&eb->bflags, EXTENT_BUFFER_WRITEBACK);
+-}
+-
+ static void set_btree_ioerr(struct page *page)
+ {
+ struct extent_buffer *eb = (struct extent_buffer *)page->private;
+--
+2.23.0
+
diff --git a/PKGBUILD b/PKGBUILD
index 12f4b767a4e1..d6becb839f61 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,8 +8,8 @@
#pkgbase=linux # Build stock -ARCH kernel
pkgbase=linux-rt # Build kernel with a different name
-_pkgver=5.2.10
-_rtpatchver=rt5
+_pkgver=5.2.14
+_rtpatchver=rt7
pkgver="${_pkgver}_${_rtpatchver}"
pkgrel=1
arch=('x86_64')
@@ -29,6 +29,7 @@ source=(
${pkgbase}.preset # standard config files for mkinitcpio ramdisk
0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
0002-ZEN-Add-CONFIG-for-unprivileged_userns_clone.patch
+ 0003-Btrfs-fix-unwritten-extent-buffers-and-hangs-on-futu.patch
)
validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
@@ -38,16 +39,17 @@ validpgpkeys=(
'5ED9A48FC54C0A22D1D0804CEBC26CDB5A56DE73' # Steven Rostedt
'E644E2F1D45FA0B2EAA02F33109F098506FF0B14' # Thomas Gleixner
)
-sha256sums=('6096c4387c2a296de9136080942d11ae3f1bd28129b6952f7133c570e43bfc49'
+sha256sums=('c64d36477fee6a864a734ec417407768e60040a13f144c33208fa9622fd0ce8c'
'SKIP'
- '28b95929be17b450890ab7b00655940ef6ff019bbc4bd41241fd6b91bdc92bc4'
+ '33b5123ab190e8b525149ac416787e2c3325269d34350dc2045dd68ba1f95154'
'SKIP'
- 'cf4ef9d0b61efb7a27215fc4ec77a8a07ef67d9cf53a1ab14a07882a6c7613f9'
+ 'e1214bcad1f31c83d3688874865e3bce034eca0ec37a5248fbfd856fe32b16dc'
'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
'75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919'
'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65'
'75aa8dd708ca5a0137fbf7cddc9cafefe6aac6b8e0638c06c156d412d05af4bc'
- '187fa8d9a6c5777a8930dcecfafdd9d6e9095d4bf96ec060e756fb7c6a88b74d')
+ '187fa8d9a6c5777a8930dcecfafdd9d6e9095d4bf96ec060e756fb7c6a88b74d'
+ 'a4802ecb2b75bb1711f050a0370bcc38754478170ed1bebe9aa89d1572762590')
_kernelname=${pkgbase#linux}
: ${_kernelname:=-ARCH}
diff --git a/config b/config
index ad1dcc06487a..d1a72a356ab6 100644
--- a/config
+++ b/config
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
-# Linux/x86 5.2.10 Kernel Configuration
+# Linux/x86 5.2.14 Kernel Configuration
#
#