]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Apr 2018 10:13:41 +0000 (12:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Apr 2018 10:13:41 +0000 (12:13 +0200)
added patches:
ext4-bugfix-for-mmaped-pages-in-mpage_release_unused_pages.patch

queue-4.4/ext4-bugfix-for-mmaped-pages-in-mpage_release_unused_pages.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/ext4-bugfix-for-mmaped-pages-in-mpage_release_unused_pages.patch b/queue-4.4/ext4-bugfix-for-mmaped-pages-in-mpage_release_unused_pages.patch
new file mode 100644 (file)
index 0000000..43a8b74
--- /dev/null
@@ -0,0 +1,72 @@
+From 4e800c0359d9a53e6bf0ab216954971b2515247f Mon Sep 17 00:00:00 2001
+From: wangguang <wang.guang55@zte.com.cn>
+Date: Thu, 15 Sep 2016 11:32:46 -0400
+Subject: ext4: bugfix for mmaped pages in mpage_release_unused_pages()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: wangguang <wang.guang55@zte.com.cn>
+
+commit 4e800c0359d9a53e6bf0ab216954971b2515247f upstream.
+
+Pages clear buffers after ext4 delayed block allocation failed,
+However, it does not clean its pte_dirty flag.
+if the pages unmap ,in cording to the pte_dirty ,
+unmap_page_range may try to call __set_page_dirty,
+
+which may lead to the bugon at
+mpage_prepare_extent_to_map:head = page_buffers(page);.
+
+This patch just call clear_page_dirty_for_io to clean pte_dirty
+at mpage_release_unused_pages for pages mmaped.
+
+Steps to reproduce the bug:
+
+(1) mmap a file in ext4
+       addr = (char *)mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED,
+                           fd, 0);
+       memset(addr, 'i', 4096);
+
+(2) return EIO at
+
+       ext4_writepages->mpage_map_and_submit_extent->mpage_map_one_extent
+
+which causes this log message to be print:
+
+                ext4_msg(sb, KERN_CRIT,
+                        "Delayed block allocation failed for "
+                        "inode %lu at logical offset %llu with"
+                        " max blocks %u with error %d",
+                        inode->i_ino,
+                        (unsigned long long)map->m_lblk,
+                        (unsigned)map->m_len, -err);
+
+(3)Unmap the addr cause warning at
+
+       __set_page_dirty:WARN_ON_ONCE(warn && !PageUptodate(page));
+
+(4) wait for a minute,then bugon happen.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: wangguang <wangguang03@zte.com>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+[@nathanchance: Resolved conflict from lack of 09cbfeaf1a5a6]
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/inode.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -1515,6 +1515,8 @@ static void mpage_release_unused_pages(s
+                       BUG_ON(!PageLocked(page));
+                       BUG_ON(PageWriteback(page));
+                       if (invalidate) {
++                              if (page_mapped(page))
++                                      clear_page_dirty_for_io(page);
+                               block_invalidatepage(page, 0, PAGE_CACHE_SIZE);
+                               ClearPageUptodate(page);
+                       }
index 81bcbb5f2cb830bfe6466c3900ae83e3d531ab9e..2d0271516ba2847fdbc1d2342454ebd3526e20d0 100644 (file)
@@ -92,3 +92,4 @@ don-t-leak-mnt_internal-away-from-internal-mounts.patch
 autofs-mount-point-create-should-honour-passed-in-mode.patch
 mm-allow-gfp_-fs-io-for-page_cache_read-page-cache-allocation.patch
 mm-filemap.c-fix-null-pointer-in-page_cache_tree_insert.patch
+ext4-bugfix-for-mmaped-pages-in-mpage_release_unused_pages.patch