It turns out that commit 3229c18c0d6b2 'Fixes to "Implement iomap for
block_map"' introduced another bug in gfs2_iomap_begin that can cause
gfs2_block_map to set bh->b_size of an actual buffer to 0.  This can
lead to arbitrary incorrect behavior including crashes or disk
corruption.  Revert the incorrect part of that commit.

Signed-off-by: Andreas Gruenbacher <agrue...@redhat.com>
---
 fs/gfs2/bmap.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 86d6a4435c87..51f940e76c5e 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -807,9 +807,6 @@ int gfs2_iomap_begin(struct inode *inode, loff_t pos, 
loff_t length,
                        iomap->length = hole_size(inode, lblock, &mp);
                else
                        iomap->length = size - pos;
-       } else {
-               if (height <= ip->i_height)
-                       iomap->length = hole_size(inode, lblock, &mp);
        }
        goto out_release;
 }
-- 
2.14.3

Reply via email to