Commit 79b3dbe4 authored by Eric Sandeen's avatar Eric Sandeen Committed by Darrick J. Wong

fs: fix iomap_bmap position calculation

The position calculation in iomap_bmap() shifts bno the wrong way,
so we don't progress properly and end up re-mapping block zero
over and over, yielding an unchanging physical block range as the
logical block advances:

# filefrag -Be file
 ext:   logical_offset:     physical_offset: length:   expected: flags:
   0:      0..       0:      21..        21:      1:             merged
   1:      1..       1:      21..        21:      1:         22: merged
Discontinuity: Block 1 is at 21 (was 22)
   2:      2..       2:      21..        21:      1:         22: merged
Discontinuity: Block 2 is at 21 (was 22)
   3:      3..       3:      21..        21:      1:         22: merged

This breaks the FIBMAP interface for anyone using it (XFS), which
in turn breaks LILO, zipl, etc.
Bug-actually-spotted-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Fixes: 89eb1906 ("iomap: add an iomap-based bmap implementation")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent d4a34e16
...@@ -1443,7 +1443,7 @@ iomap_bmap(struct address_space *mapping, sector_t bno, ...@@ -1443,7 +1443,7 @@ iomap_bmap(struct address_space *mapping, sector_t bno,
const struct iomap_ops *ops) const struct iomap_ops *ops)
{ {
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
loff_t pos = bno >> inode->i_blkbits; loff_t pos = bno << inode->i_blkbits;
unsigned blocksize = i_blocksize(inode); unsigned blocksize = i_blocksize(inode);
if (filemap_write_and_wait(mapping)) if (filemap_write_and_wait(mapping))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment