Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=de986e859a29097fb9211b052d86a9a2c868f6cd
Commit:     de986e859a29097fb9211b052d86a9a2c868f6cd
Parent:     16615be18cadf53ee6f8a4f0bdd647f0753421b1
Author:     Wendy Cheng <[EMAIL PROTECTED]>
AuthorDate: Tue Sep 18 09:19:13 2007 -0400
Committer:  Steven Whitehouse <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 08:56:26 2007 +0100

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Steven Whitehouse <[EMAIL PROTECTED]>
---
 fs/gfs2/meta_io.c     |    8 ++++----
 fs/gfs2/ops_address.c |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 1d80f2d..4da4239 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)
 
        for (x = 0; x < GFS2_MAX_META_HEIGHT; x++) {
                bh_slot = &ip->i_cache[x];
-               if (!*bh_slot)
-                       break;
-               brelse(*bh_slot);
-               *bh_slot = NULL;
+               if (*bh_slot) {
+                       brelse(*bh_slot);
+                       *bh_slot = NULL;
+               }
        }
 
        spin_unlock(&ip->i_spin);
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index b7baf18..4002f41 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,
        error = gfs2_block_map(inode, lblock, 0, bh_result);
        if (error)
                return error;
-       if (bh_result->b_blocknr == 0)
+       if (!buffer_mapped(bh_result))
                return -EIO;
        return 0;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to