Skip to content

Commit d1e18b8

Browse files
riteshharjanitytso
authored andcommitted
ext4: fix bs < ps issue reported with dioread_nolock mount opt
left shifting m_lblk by blkbits was causing value overflow and hence it was not able to convert unwritten to written extent. So, make sure we typecast it to loff_t before do left shift operation. Also in func ext4_convert_unwritten_io_end_vec(), make sure to initialize ret variable to avoid accidentally returning an uninitialized ret. This patch fixes the issue reported in ext4 for bs < ps with dioread_nolock mount option. Fixes: c8cc881 ("ext4: Add support for blocksize < pagesize in dioread_nolock") Cc: stable@kernel.org Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/af902b5db99e8b73980c795d84ad7bb417487e76.1602168865.git.riteshh@linux.ibm.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent afb585a commit d1e18b8

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎fs/ext4/extents.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4769,7 +4769,7 @@ int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode,
47694769

47704770
int ext4_convert_unwritten_io_end_vec(handle_t *handle, ext4_io_end_t *io_end)
47714771
{
4772-
int ret, err = 0;
4772+
int ret = 0, err = 0;
47734773
struct ext4_io_end_vec *io_end_vec;
47744774

47754775
/*

‎fs/ext4/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2258,7 +2258,7 @@ static int mpage_process_page(struct mpage_da_data *mpd, struct page *page,
22582258
err = PTR_ERR(io_end_vec);
22592259
goto out;
22602260
}
2261-
io_end_vec->offset = mpd->map.m_lblk << blkbits;
2261+
io_end_vec->offset = (loff_t)mpd->map.m_lblk << blkbits;
22622262
}
22632263
*map_bh = true;
22642264
goto out;

0 commit comments

Comments
 (0)