aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorWendy Cheng <wcheng@redhat.com>2007-09-18 09:19:13 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2007-10-10 03:56:26 -0400
commitde986e859a29097fb9211b052d86a9a2c868f6cd (patch)
tree85c97fe22e0eafb3c7440c8ff21fe73d8c456960 /fs/gfs2
parent16615be18cadf53ee6f8a4f0bdd647f0753421b1 (diff)
[GFS2] Data corruption fix
* GFS2 has been using i_cache array to store its indirect meta blocks. Its flush routine doesn't correctly clean up all the entries. The problem would show while multiple nodes do simultaneous writes to the same file. Upon glock exclusive lock transfer, if the file is a sparse file with large file size where the indirect meta blocks span multiple array entries with "zero" entries in between. The flush routine prematurely stops the flushing that leaves old (stale) entries around. This leads to several nasty issues, including data corruption. * Fix gfs2_get_block_noalloc checking to correctly return EIO upon unmapped buffer. Signed-off-by: Wendy Cheng <wcheng@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/meta_io.c8
-rw-r--r--fs/gfs2/ops_address.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 1d80f2d42122..4da423985e4f 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -374,10 +374,10 @@ void gfs2_meta_cache_flush(struct gfs2_inode *ip)
374 374
375 for (x = 0; x < GFS2_MAX_META_HEIGHT; x++) { 375 for (x = 0; x < GFS2_MAX_META_HEIGHT; x++) {
376 bh_slot = &ip->i_cache[x]; 376 bh_slot = &ip->i_cache[x];
377 if (!*bh_slot) 377 if (*bh_slot) {
378 break; 378 brelse(*bh_slot);
379 brelse(*bh_slot); 379 *bh_slot = NULL;
380 *bh_slot = NULL; 380 }
381 } 381 }
382 382
383 spin_unlock(&ip->i_spin); 383 spin_unlock(&ip->i_spin);
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index b7baf1831912..4002f417dc19 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -90,7 +90,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock,
90 error = gfs2_block_map(inode, lblock, 0, bh_result); 90 error = gfs2_block_map(inode, lblock, 0, bh_result);
91 if (error) 91 if (error)
92 return error; 92 return error;
93 if (bh_result->b_blocknr == 0) 93 if (!buffer_mapped(bh_result))
94 return -EIO; 94 return -EIO;
95 return 0; 95 return 0;
96} 96}