提交 961cecbe 编写于 作者: S Sunil Mushran 提交者: Mark Fasheh

[PATCH] ocfs2: Fix oops when racing files truncates with writes into an mmap region

This patch fixes an oops that is reproduced when one races writes to a mmap-ed
region with another process truncating the file.
Signed-off-by: NSunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: NMark Fasheh <mfasheh@suse.com>
上级 539d8264
......@@ -1073,13 +1073,16 @@ static void ocfs2_write_failure(struct inode *inode,
for(i = 0; i < wc->w_num_pages; i++) {
tmppage = wc->w_pages[i];
if (page_has_buffers(tmppage)) {
if (ocfs2_should_order_data(inode))
walk_page_buffers(wc->w_handle, page_buffers(tmppage),
walk_page_buffers(wc->w_handle,
page_buffers(tmppage),
from, to, NULL,
ocfs2_journal_dirty_data);
block_commit_write(tmppage, from, to);
}
}
}
static int ocfs2_prepare_page_for_write(struct inode *inode, u64 *p_blkno,
......@@ -1901,13 +1904,15 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
to = PAGE_CACHE_SIZE;
}
if (page_has_buffers(tmppage)) {
if (ocfs2_should_order_data(inode))
walk_page_buffers(wc->w_handle, page_buffers(tmppage),
walk_page_buffers(wc->w_handle,
page_buffers(tmppage),
from, to, NULL,
ocfs2_journal_dirty_data);
block_commit_write(tmppage, from, to);
}
}
out_write_size:
pos += copied;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册