UDF and ext2 fixes
Jan Kara
reviewerHello Linus,
could you please pull from
git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git fixes_for_v6.3-rc1
to get:
* Rewrite of udf directory iteration code to address multiple syzbot reports
* Fixes to udf extent handling and block mapping code to address several syzbot reports and filesystem corruption issues uncovered by fsx & fsstress
* Convert udf to kmap_local()
* Add sanity checks when loading udf bitmaps
* Drop old VARCONV support which I've never seen used and which was broken for quite some years without anybody noticing
* Finish conversion of ext2 to kmap_local()
* One fix to mpage_writepages() on which other udf fixes depend
Top of the tree is df97f64dfa31. The full shortlog is:
Christoph Hellwig (1):
ext2: propagate errors from ext2_prepare_chunk
Colin Ian King (2):
udf: Fix spelling mistake "lenght" -> "length"
udf: remove redundant variable netype
Fabio M. De Francesco (1):
fs/ext2: Replace kmap_atomic() with kmap_local_page()
Jan Kara (71):
udf: Define EFSCORRUPTED error code
udf: New directory iteration code
udf: Convert udf_readdir() to new directory iteration
udf: Convert udf_expand_dir_adinicb() to new directory iteration
udf: Move udf_expand_dir_adinicb() to its callsite
udf: Implement searching for directory entry using new iteration code
udf: Convert udf_lookup() to use new directory iteration code
udf: Convert udf_get_parent() to new directory iteration code
udf: Convert empty_dir() to new directory iteration code
udf: Provide function to mark entry as deleted using new directory iteration code
udf: Convert udf_rmdir() to new directory iteration code
udf: Convert udf_unlink() to new directory iteration code
udf: Implement adding of dir entries using new iteration code
udf: Convert udf_add_nondir() to new directory iteration
udf: Convert udf_mkdir() to new directory iteration code
udf: Convert udf_link() to new directory iteration code
udf: Convert udf_rename() to new directory iteration code
udf: Remove old directory iteration code
udf: Truncate added extents on failed expansion
udf: Do not bother merging very long extents
udf: Handle error when expanding directory
udf: Handle error when adding extent to symlink
udf: Handle error when adding extent to a file
udf: Allocate name buffer in directory iterator on heap
udf: Move setting of i_lenExtents into udf_do_extend_file()
udf: Keep i_lenExtents consistent with the total length of extents
udf: Do not update file length for failed writes to inline files
udf: Preserve link count of system files
udf: Detect system inodes linked into directory hierarchy
udf: Zero udf name padding
udf: Propagate errors from udf_advance_blk()
udf: Fix directory iteration for longer tail extents
udf: Unify types in anchor block detection
udf: Drop VARCONV support
udf: Move incrementing of goal block directly into inode_getblk()
udf: Factor out block mapping into udf_map_block()
udf: Use udf_bread() in udf_get_pblock_virt15()
udf: Use udf_bread() in udf_load_vat()
udf: Do not call udf_block_map() on ICB files
udf: Convert udf_symlink_filler() to use udf_bread()
udf: Fold udf_block_map() into udf_map_block()
udf: Pass mapping request into inode_getblk()
udf: Add flag to disable block preallocation
udf: Use udf_map_block() in udf_getblk()
udf: Fold udf_getblk() into udf_bread()
udf: Protect rename against modification of moved directory
udf: Push i_data_sem locking into udf_expand_file_adinicb()
udf: Push i_data_sem locking into udf_extend_file()
udf: Simplify error handling in udf_file_write_iter()
udf: Protect truncate and file type conversion with invalidate_lock
udf: Allocate blocks on write page fault
fs: gracefully handle ->get_block not mapping bh in __mpage_writepage
udf: Do not allocate blocks on page writeback
udf: Fix file corruption when appending just after end of preallocated extent
udf: Fix off-by-one error when discarding preallocation
udf: Unify .read_folio for normal and in-ICB files
udf: Convert in-ICB files to use udf_writepages()
udf: Convert in-ICB files to use udf_direct_IO()
udf: Convert in-ICB files to use udf_write_begin()
udf: Convert all file types to use udf_write_end()
udf: Add handling of in-ICB files to udf_bmap()
udf: Switch to single address_space_operations
udf: Mark aops implementation static
udf: Move udf_adinicb_readpage() to inode.c
udf: Switch udf_adinicb_readpage() to kmap_local_page()
udf: Convert udf_adinicb_writepage() to memcpy_to_page()
udf: Convert udf_expand_file_adinicb() to avoid kmap_atomic()
udf: Don't return bh from udf_expand_dir_adinicb()
udf: Limit file size to 4TB
udf: Fix file counting in LVID
udf: Avoid directory type conversion failure due to ENOMEM
Kees Cook (1):
udf: Use unsigned variables for size calculations
Tom Rix (1):
udf: remove reporting loc in debug output
Vladislav Efanov (1):
udf: Check consistency of Space Bitmap Descriptor
The diffstat is
fs/ext2/dir.c | 17 +- fs/ext2/ext2.h | 5 +- fs/ext2/namei.c | 21 +- fs/mpage.c | 2 + fs/udf/balloc.c | 33 +- fs/udf/dir.c | 148 ++----- fs/udf/directory.c | 579 +++++++++++++++++++++------- fs/udf/file.c | 176 ++++----- fs/udf/ialloc.c | 31 +- fs/udf/inode.c | 602 +++++++++++++++-------------- fs/udf/lowlevel.c | 7 +- fs/udf/misc.c | 18 +- fs/udf/namei.c | 1093 +++++++++++++++++++--------------------------------- fs/udf/partition.c | 9 +- fs/udf/super.c | 77 ++-- fs/udf/symlink.c | 28 +- fs/udf/truncate.c | 6 +- fs/udf/udf_i.h | 3 +- fs/udf/udf_sb.h | 3 +- fs/udf/udfdecl.h | 57 ++- 20 files changed, 1362 insertions(+), 1553 deletions(-)
Thanks
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 2 lines · Jan Kara
* One fix to
mpage_writepages()on which other udf fixes depend
I've pulled this, and this doesn't look *wrong* per se, but it really didn't look like a bug in mpage_writepages() to me.
The bug seems to be clearly in the filesystem not returning a proper error code from its "->get_block()" function.
If the VFS layer asks for block creation, and the filesystem returns no error, but then a non-mapped result, that sounds like _clearly_ a filesystem bug to me.
Blaming mpage_writepages() seems entirely wrong.
The extra sanity check in the vfs layer doesn't strike me as wrong, but ...
Maybe it could have been a WARN_ON_ONCE() if "get_block(.., 1)" returns success with an unmapped result?
Linus
Jan Kara
reviewerQuoted 7 lines · Linus Torvalds
Quoted 2 lines · Jan Kara
* One fix to
mpage_writepages()on which other udf fixes dependI've pulled this, and this doesn't look *wrong* per se, but it really didn't look like a bug in
mpage_writepages()to me.
Quoted 6 lines
The bug seems to be clearly in the filesystem not returning a proper error code from its "->get_block()" function.
If the VFS layer asks for block creation, and the filesystem returns no error, but then a non-mapped result, that sounds like _clearly_ a filesystem bug to me.
I agree having saner way to pass information from ->get_block "I cannot write this buffer in the page but please keep writing other buffers in this page" to the VFS is desirable. But this "return unmapped buffer" hack is what happened to work for __block_write_full_page() since ages and I belive it was occasionally used by filesystems so that's why I've made mpage_writepages() compatible with this behavior.
Quoted 6 lines
Blaming
mpage_writepages()seems entirely wrong.The extra sanity check in the vfs layer doesn't strike me as wrong, but ...
Maybe it could have been a
WARN_ON_ONCE()if "get_block(.., 1)" returns success with an unmapped result?
A cleanup in this area would be certainly good but maybe the energy is better invested in the attempt to make filesystems use iomap instead of get_block based interfaces?
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
The pull request you sent on Fri, 17 Feb 2023 12:43:42 +0100:
The pull request you sent on Fri, 17 Feb 2023 12:43:42 +0100:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.gitfixes_for_v6.3-rc1
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/274978f173276c5720a3cd8d0b6047d2c0d3a684
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html