author: Steven J. Magnani <magnani@ieee.org> 2021-01-07 17:41:16 -0600
committer: Jan Kara <jack@suse.cz> 2021-01-25 18:09:25 +0100
commit: 63c9e47a1642fc817654a1bc18a6ec4bbcc0f056
parent: 0a6dc67a6aa45f19bd4ff89b4f468fc50c4b8daa
Commit Summary:
Diffstat:
1 file changed, 6 insertions, 3 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index bb89c3e43212..0dd2f93ac048 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -544,11 +544,14 @@ static int udf_do_extend_file(struct inode *inode,
udf_write_aext(inode, last_pos, &last_ext->extLocation,
last_ext->extLength, 1);
+
/*
- * We've rewritten the last extent but there may be empty
- * indirect extent after it - enter it.
+ * We've rewritten the last extent. If we are going to add
+ * more extents, we may need to enter possible following
+ * empty indirect extent.
*/
- udf_next_aext(inode, last_pos, &tmploc, &tmplen, 0);
+ if (new_block_bytes || prealloc_len)
+ udf_next_aext(inode, last_pos, &tmploc, &tmplen, 0);
}
/* Managed to do everything necessary? */