Bug 124651
Summary: | ext4 bugon panic when I mmap a file | ||
---|---|---|---|
Product: | File System | Reporter: | wangguang (35445233) |
Component: | ext4 | Assignee: | fs_ext4 (fs_ext4) |
Status: | NEW --- | ||
Severity: | normal | CC: | 35445233, tytso |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 3.10.0-229.el7.x86_64 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
test
systemstap file |
Description
wangguang
2016-07-13 02:09:35 UTC
This is a Red Hat kernel, so ideally you should be reporting this to Red Hat. Because it's a Red Hat kernel, I can't easily determine what's on line 2263 of fs/ext4/inode.c: [55359.508185] kernel BUG at fs/ext4/inode.c:2263! If you have access to Red Hat sources, can you give me an indication of what's on that line? One of the reasons why I ask is if I look at the upstream sources, the only BUG_ON in mpage_prepare_extent_to_map is this one: wait_on_page_writeback(page); BUG_ON(PageWriteback(page)); And that's clearly a bug outside of ext4, because we've locked the page, so once the page writeback flag is cleared, it shouldn't be set again. So either someone woke up the page without clearing the PageWriteback flag, or some other racing process attempted to set the PageWriteback flag without holding the page lock. But this is assuming I'm looking at the correct BUG_ON --- and since this is a Red Hat kernel, I can't be sure. fs/ext4/inode.c:2263:mpage_prepare_extent_to_map: 2261: lblk = ((ext4_lblk_t)page->index) << (PAGE_CACHE_SHIFT - blkbits); 2263: head = page_buffers(page); EXT4 BUG_ON page_buffers() because a page goes to writeback without buffer-heads attached. I think unmap_page_range set the page dirty again Cause the problem。 I can recurrent the bug by: (1) mmap a file addr = (char *)mmap(NULL, MAPLEN, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); memset(addr, 'i', MAPLEN); (2) return err 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 case warning: WARNING: at fs/buffer.c:661 __set_page_dirty+0xaa/0xc0() (4) wait for sync,then bugon see the attachment please. Created attachment 224251 [details]
test
Created attachment 224261 [details]
systemstap file
|