* [RESEND PATCH]ext4: bugfix for mmaped pages in mpage_release_unused_pages()
@ 2016-09-06 8:36 wang.guang55
0 siblings, 0 replies; 3+ messages in thread
From: wang.guang55 @ 2016-09-06 8:36 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4
ext4: bugfix for mmaped pages in mpage_release_unused_pages()
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
Cause the log:
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.
Signed-off-by: wangguang <wangguang03@zte.com>
--- old/fs/ext4/inode.c 2016-08-29 12:15:25.150764447 -0400
+++ new/fs/ext4/inode.c 2016-08-29 13:01:58.683559198 -0400
@@ -1649,6 +1649,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_SIZE);
ClearPageUptodate(page);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH]ext4: bugfix for mmaped pages in mpage_release_unused_pages()
2016-09-06 8:49 wang.guang55
@ 2016-09-15 15:34 ` Theodore Ts'o
0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2016-09-15 15:34 UTC (permalink / raw)
To: wang.guang55; +Cc: linux-ext4
On Tue, Sep 06, 2016 at 04:49:17PM +0800, wang.guang55@zte.com.cn wrote:
> ext4: bugfix for mmaped pages in mpage_release_unused_pages()
>
> 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
> Cause the log:
> 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.
>
> Signed-off-by: wangguang <wangguang03@zte.com>
Thanks, applied. Apologies for the delay.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RESEND PATCH]ext4: bugfix for mmaped pages in mpage_release_unused_pages()
@ 2016-09-06 8:49 wang.guang55
2016-09-15 15:34 ` Theodore Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: wang.guang55 @ 2016-09-06 8:49 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4
ext4: bugfix for mmaped pages in mpage_release_unused_pages()
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
Cause the log:
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.
Signed-off-by: wangguang <wangguang03@zte.com>
--- old/fs/ext4/inode.c 2016-08-29 12:15:25.150764447 -0400
+++ new/fs/ext4/inode.c 2016-08-29 13:01:58.683559198 -0400
@@ -1649,6 +1649,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_SIZE);
ClearPageUptodate(page);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-15 15:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06 8:36 [RESEND PATCH]ext4: bugfix for mmaped pages in mpage_release_unused_pages() wang.guang55
2016-09-06 8:49 wang.guang55
2016-09-15 15:34 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.