diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index cff6277f7a9ff4b9c4d15f8a239b82ceee2b0b93..a0c94c365a4c0a72ea0155a007ca0377019d47a9 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4265,6 +4265,15 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) trace_ext4_punch_hole(inode, offset, length, 0); + ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); + if (ext4_has_inline_data(inode)) { + down_write(&EXT4_I(inode)->i_mmap_sem); + ret = ext4_convert_inline_data(inode); + up_write(&EXT4_I(inode)->i_mmap_sem); + if (ret) + return ret; + } + /* * Write out all dirty pages to avoid race conditions * Then release them.