aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@sandeen.net>2010-06-23 19:45:30 -0400
committerAlex Elder <aelder@sgi.com>2010-07-26 14:16:40 -0400
commit3d9b02e3c76531687ab5314e0edf266256f13c2d (patch)
treef730a4da55eb1536227ebe0f976f878f0e08181b /fs
parentb4e9181e772b0c8b9038c5822ead368b96c2b533 (diff)
xfs: fix corruption case for block size < page size
xfstests 194 first truncats a file back and then extends it again by truncating it to a larger size. This causes discard_buffer to drop the mapped, but not the uptodate bit and thus creates something that xfs_page_state_convert takes for unmapped space created by mmap because it doesn't check for the dirty bit, which also gets cleared by discard_buffer and checked by other ->writepage implementations like block_write_full_page. Handle this kind of buffers early, and unlike Eric's first version of the patch simply ASSERT that the buffers is dirty, given that the mmap write case can't happen anymore since the introduction of ->page_mkwrite. The now dead code dealing with that will be deleted in a follow on patch. Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index b25d11a3d84e..bd5e1cf5428d 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1125,6 +1125,16 @@ xfs_page_state_convert(
1125 continue; 1125 continue;
1126 } 1126 }
1127 1127
1128 /*
1129 * A hole may still be marked uptodate because discard_buffer
1130 * leaves the flag set.
1131 */
1132 if (!buffer_mapped(bh) && buffer_uptodate(bh)) {
1133 ASSERT(!buffer_dirty(bh));
1134 imap_valid = 0;
1135 continue;
1136 }
1137
1128 if (imap_valid) 1138 if (imap_valid)
1129 imap_valid = xfs_imap_valid(inode, &imap, offset); 1139 imap_valid = xfs_imap_valid(inode, &imap, offset);
1130 1140