summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunil Mushran2008-07-17 02:22:22 +0200
committerMark Fasheh2008-08-01 01:21:14 +0200
commit961cecbee6786f4b1f1b8f695e87045b583f9f49 (patch)
tree350d8604d04c594463372e3fab0cab2e953c7770
parent[PATCH 2/2] ocfs2: Fix race between mount and recovery (diff)
downloadkernel-qcow2-linux-961cecbee6786f4b1f1b8f695e87045b583f9f49.tar.gz
kernel-qcow2-linux-961cecbee6786f4b1f1b8f695e87045b583f9f49.tar.xz
kernel-qcow2-linux-961cecbee6786f4b1f1b8f695e87045b583f9f49.zip
[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>
-rw-r--r--fs/ocfs2/aops.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 1db080135c6d..506c24fb5078 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -1073,12 +1073,15 @@ static void ocfs2_write_failure(struct inode *inode,
for(i = 0; i < wc->w_num_pages; i++) {
tmppage = wc->w_pages[i];
- if (ocfs2_should_order_data(inode))
- walk_page_buffers(wc->w_handle, page_buffers(tmppage),
- from, to, NULL,
- ocfs2_journal_dirty_data);
-
- block_commit_write(tmppage, from, to);
+ if (page_has_buffers(tmppage)) {
+ if (ocfs2_should_order_data(inode))
+ walk_page_buffers(wc->w_handle,
+ page_buffers(tmppage),
+ from, to, NULL,
+ ocfs2_journal_dirty_data);
+
+ block_commit_write(tmppage, from, to);
+ }
}
}
@@ -1901,12 +1904,14 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
to = PAGE_CACHE_SIZE;
}
- if (ocfs2_should_order_data(inode))
- walk_page_buffers(wc->w_handle, page_buffers(tmppage),
- from, to, NULL,
- ocfs2_journal_dirty_data);
-
- block_commit_write(tmppage, from, to);
+ if (page_has_buffers(tmppage)) {
+ if (ocfs2_should_order_data(inode))
+ 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: