diff options
author | Jan Kara <jack@suse.cz> | 2023-01-19 12:46:09 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2023-01-26 16:46:35 +0100 |
commit | b9a861fd527ab123e76effb492b4eb7e8115d4ca (patch) | |
tree | f51dab17dc5495d57f675b37a7dbd6a131d2daf4 /fs/udf/file.c | |
parent | udf: Simplify error handling in udf_file_write_iter() (diff) | |
download | linux-b9a861fd527ab123e76effb492b4eb7e8115d4ca.tar.xz linux-b9a861fd527ab123e76effb492b4eb7e8115d4ca.zip |
udf: Protect truncate and file type conversion with invalidate_lock
Protect truncate and file type conversion in udf_file_write_iter() with
invalidate lock. That will allow us to serialize these paths with page
faults so that the page fault can determine the file type in a racefree
way.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r-- | fs/udf/file.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c index 596d703fb6c8..cf050bdffd9e 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -150,7 +150,9 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from) if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB && inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) + iocb->ki_pos + iov_iter_count(from))) { + filemap_invalidate_lock(inode->i_mapping); retval = udf_expand_file_adinicb(inode); + filemap_invalidate_unlock(inode->i_mapping); if (retval) goto out; } |