Hi, Do we actually want to fix this bug or not? There are a number of people actually seeing this bug. If you think this is not the right fix, what do you think we should do? If the correct fix is to make ext4 use iomap_swapfile_activate, maybe we should CC the ext4 people too? On Tue, May 5, 2020 at 8:32 PM Darrick J. Wong <darrick.wong@xxxxxxxxxx> wrote: > > On Tue, May 05, 2020 at 07:36:08PM +0100, Yuxuan Shui wrote: > > commit ac58e4fb03f9d111d733a4ad379d06eef3a24705 moved ext4_bmap from > > generic_block_bmap to iomap_bmap, this introduced a regression which > > prevents some user from using previously working swapfiles. The kernel > > will complain about holes while there is none. > > > > What is happening here is that the swapfile has unwritten mappings, > > which is rejected by iomap_bmap, but was accepted by ext4_get_block. > > ...which is why ext4 ought to use iomap_swapfile_activate. > > --D > > > This commit makes sure iomap_bmap would accept unwritten mappings as > > well. > > > > Signed-off-by: Yuxuan Shui <yshuiv7@xxxxxxxxx> > > --- > > fs/iomap/fiemap.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/fs/iomap/fiemap.c b/fs/iomap/fiemap.c > > index d55e8f491a5e..fb488dcfa8c7 100644 > > --- a/fs/iomap/fiemap.c > > +++ b/fs/iomap/fiemap.c > > @@ -115,7 +115,7 @@ iomap_bmap_actor(struct inode *inode, loff_t pos, loff_t length, > > { > > sector_t *bno = data, addr; > > > > - if (iomap->type == IOMAP_MAPPED) { > > + if (iomap->type == IOMAP_MAPPED || iomap->type == IOMAP_UNWRITTEN) { > > addr = (pos - iomap->offset + iomap->addr) >> inode->i_blkbits; > > *bno = addr; > > } > > -- > > 2.26.2 > > -- Regards Yuxuan Shui