Commit bb2b6d19ec8b593b66402e2895c4314955b19833

Authored by Ian Abbott
Committed by Jan Kara
1 parent ddf343f635

udf: fix udf_setsize() for file data in ICB

If the new size is larger than the old size and the old file data was
stored in the ICB (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) and the
new size still fits in the ICB, skip the call to udf_extend_file() as it
does not handle this i_alloc_type value (it calls BUG()).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Jan Kara <jack@suse.cz>

Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff

... ... @@ -1124,14 +1124,17 @@
1124 1124 if (err)
1125 1125 return err;
1126 1126 down_write(&iinfo->i_data_sem);
1127   - } else
  1127 + } else {
1128 1128 iinfo->i_lenAlloc = newsize;
  1129 + goto set_size;
  1130 + }
1129 1131 }
1130 1132 err = udf_extend_file(inode, newsize);
1131 1133 if (err) {
1132 1134 up_write(&iinfo->i_data_sem);
1133 1135 return err;
1134 1136 }
  1137 +set_size:
1135 1138 truncate_setsize(inode, newsize);
1136 1139 up_write(&iinfo->i_data_sem);
1137 1140 } else {