[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: Sunil Mushran <sunil.mushran@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
This commit is contained in:
parent
539d826409
commit
961cecbee6
1 changed files with 16 additions and 11 deletions
|
@ -1073,12 +1073,15 @@ static void ocfs2_write_failure(struct inode *inode,
|
||||||
for(i = 0; i < wc->w_num_pages; i++) {
|
for(i = 0; i < wc->w_num_pages; i++) {
|
||||||
tmppage = wc->w_pages[i];
|
tmppage = wc->w_pages[i];
|
||||||
|
|
||||||
if (ocfs2_should_order_data(inode))
|
if (page_has_buffers(tmppage)) {
|
||||||
walk_page_buffers(wc->w_handle, page_buffers(tmppage),
|
if (ocfs2_should_order_data(inode))
|
||||||
from, to, NULL,
|
walk_page_buffers(wc->w_handle,
|
||||||
ocfs2_journal_dirty_data);
|
page_buffers(tmppage),
|
||||||
|
from, to, NULL,
|
||||||
|
ocfs2_journal_dirty_data);
|
||||||
|
|
||||||
block_commit_write(tmppage, from, to);
|
block_commit_write(tmppage, from, to);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1901,12 +1904,14 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
|
||||||
to = PAGE_CACHE_SIZE;
|
to = PAGE_CACHE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ocfs2_should_order_data(inode))
|
if (page_has_buffers(tmppage)) {
|
||||||
walk_page_buffers(wc->w_handle, page_buffers(tmppage),
|
if (ocfs2_should_order_data(inode))
|
||||||
from, to, NULL,
|
walk_page_buffers(wc->w_handle,
|
||||||
ocfs2_journal_dirty_data);
|
page_buffers(tmppage),
|
||||||
|
from, to, NULL,
|
||||||
block_commit_write(tmppage, from, to);
|
ocfs2_journal_dirty_data);
|
||||||
|
block_commit_write(tmppage, from, to);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out_write_size:
|
out_write_size:
|
||||||
|
|
Loading…
Add table
Reference in a new issue