Skip to content

Commit

Permalink
Merge tag 'fs_for_v6.3-rc2' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/jack/linux-fs

Pull udf fixes from Jan Kara:
 "Fix bugs in UDF caused by the big pile of changes that went in during
  the merge window"

* tag 'fs_for_v6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  udf: Warn if block mapping is done for in-ICB files
  udf: Fix reading of in-ICB files
  udf: Fix lost writes in udf_adinicb_writepage()
  • Loading branch information
Linus Torvalds committed Mar 8, 2023
2 parents 55ee664 + 63bceed commit 6a98c9c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static int udf_adinicb_writepage(struct folio *folio,
struct udf_inode_info *iinfo = UDF_I(inode);

BUG_ON(!PageLocked(page));
memcpy_to_page(page, 0, iinfo->i_data + iinfo->i_lenEAttr,
memcpy_from_page(iinfo->i_data + iinfo->i_lenEAttr, page, 0,
i_size_read(inode));
unlock_page(page);
mark_inode_dirty(inode);
Expand Down 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 Expand Up @@ -407,6 +416,9 @@ static int udf_map_block(struct inode *inode, struct udf_map_rq *map)
int err;
struct udf_inode_info *iinfo = UDF_I(inode);

if (WARN_ON_ONCE(iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB))
return -EFSCORRUPTED;

map->oflags = 0;
if (!(map->iflags & UDF_MAP_CREATE)) {
struct kernel_lb_addr eloc;
Expand Down

0 comments on commit 6a98c9c

Please sign in to comment.