Skip to content

Commit

Permalink
udf: Fix reading of in-ICB files
Browse files Browse the repository at this point in the history
After merging address space operations of normal and in-ICB files,
readahead could get called for in-ICB files which resulted in
udf_get_block() being called for these files. udf_get_block() is not
prepared to be called for in-ICB files and ends up returning garbage
results as it interprets file data as extent list. Fix the problem by
skipping readahead for in-ICB files.

Fixes: 37a8a39 ("udf: Switch to single address_space_operations")
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Mar 6, 2023
1 parent 49854d3 commit cecb1f0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ static int udf_read_folio(struct file *file, struct folio *folio)

static void udf_readahead(struct readahead_control *rac)
{
struct udf_inode_info *iinfo = UDF_I(rac->mapping->host);

/*
* No readahead needed for in-ICB files and udf_get_block() would get
* confused for such file anyway.
*/
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
return;

mpage_readahead(rac, udf_get_block);
}

Expand Down

0 comments on commit cecb1f0

Please sign in to comment.