Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

udf: Fix reading of in-ICB files

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: 37a8a39f7ad3 ("udf: Switch to single address_space_operations")
Signed-off-by: Jan Kara <jack@suse.cz>

Jan Kara cecb1f06 49854d3c

+9
+9
fs/udf/inode.c
··· 241 241 242 242 static void udf_readahead(struct readahead_control *rac) 243 243 { 244 + struct udf_inode_info *iinfo = UDF_I(rac->mapping->host); 245 + 246 + /* 247 + * No readahead needed for in-ICB files and udf_get_block() would get 248 + * confused for such file anyway. 249 + */ 250 + if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) 251 + return; 252 + 244 253 mpage_readahead(rac, udf_get_block); 245 254 } 246 255