mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-10-26 10:57:38 +08:00
Pull nilfs2 updates from Viacheslav Dubeyko:
"Fix issues in nilfs_sufile_get_suinfo(), nilfs_scan_dsync_log(), and
nilfs_find_or_create_root() (Aldo Ariel Panzardo):
- If the requested segment number is greater than the total number of
segments, the function may process segment numbers outside the
filesystem.
- nilfs_scan_dsync_log() trusts the block counts in each on-disk file
information entry. If fi_ndatablk is greater than fi_nblocks, the
data block loop can consume excessive summary entries and the later
subtraction used to derive the number of node blocks underflows.
- nilfs_find_or_create_root() links a new checkpoint root into the
checkpoint tree and drops ns_cptree_lock before creating the root's
sysfs group. If nilfs_sysfs_create_snapshot_group() then fails, the
root is freed while it is still reachable from ns_cptree, so a
concurrent nilfs_lookup_root() can dereference freed memory.
Fix typos in comments, reported by scripts/checkpatch.pl using the
misspelling list in scripts/spelling.txt (Hemanth Selam)
Fix issues in nilfs_recover_dsync_blocks() and nilfs_readdir() (Jake
Labelle):
- During roll-forward recovery, nilfs_recover_dsync_blocks() obtains
the inode designated by fi_ino of a dsync log without checking its
type. Regular files, directories, and symlinks are the only inode
types with data blocks to recover; reject anything else before
touching its block mapping.
- nilfs_readdir() uses ctx->pos, which userspace can set to an
arbitrary value via llseek, as an offset into the directory folio
and parses whatever bytes sit there as a directory entry. Snap
unaligned positions onto a valid entry boundary by walking the
rec_len chain from the chunk start before parsing.
Fix issue in logic of clearing the dirty folios. When garbage
collection fails, nilfs2 rolls the DAT metadata file's page cache back
to a shadow copy taken before GC started. nilfs_clear_dirty_pages()
drops the dirty state of the folios in the DAT cache, then
nilfs_copy_back_pages() overwrites them with the saved contents and
warns if one is still dirty. Add a force flag to
nilfs_clear_dirty_pages() and nilfs_clear_folio_dirty() that skips the
busy buffer check, and set it in the two calls from
nilfs_mdt_restore_from_shadow_map() (Jiaming Zhang)
Remove dead code and comment code sections in nilfs_new_inode(),
nilfs_read_inode_common(), and nilfs_setup_super() (Joshua Crofts)
Multiple fixes (Ryusuke Konishi):
- While the recent out-of-bounds memory access issue in
nilfs_direct_propagate() has already been fixed, adds extra checks
to catch and gracefully handle similar potential bugs.
- Fix syzbot reported deadlock between nilfs_evict_inode() and
find_inode() by removing the synchronous log writer trigger from
nilfs_evict_inode().
- Fix an omitted clear of the dirty flag on backing device buffers,
which could cause an abnormal buffer state and potential block
overwriting data corruption.
- Improve stability by preventing errors caused by user interrupts
while waiting for log writes, which are triggered by synchronous
write flags following operations such as rename().
- Refactor the metadata file writeback callback function,
restructuring an inefficient legacy function organization rooted in
the era of aops->writepage() to align with aops->writepages().
- Fix a link count underflow during rmdir on a directory with a
corrupted link count (an issue recently reported by syzbot).
Eliminate blockdev_direct_IO() from nilfs2 entirely. Add iomap.h
with declaration of iomap operations and iomap.c with implementation
of nilfs_iomap_begin(). The nilfs_direct_IO() and the .direct_IO
callback on nilfs_aops are removed. The nilfs_file_read_iter()
dispatches O_DIRECT reads to iomap_dio_rw() using nilfs_iomap_ops.
Everything else still goes through generic_file_read_iter()
(Viacheslav Dubeyko)"
* tag 'nilfs2-v7.4-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/nilfs2:
nilfs2: validate directory position after llseek in readdir
nilfs2: reject non-regular inodes in dsync recovery
nilfs2: fix link count underflow when removing corrupted directory
nilfs2: simplify nilfs_mdt_writeback()
nilfs2: ignore non-fatal signals during synchronous log write wait
nilfs2: clear dirty flag on bdev buffers on log write failure
nilfs2: fix deadlock between nilfs_evict_inode() and find_inode()
nilfs2: fix checkpoint root lifetime on sysfs errors
nilfs2: switch O_DIRECT to iomap based operations
nilfs2: add iomap operations for direct I/O
nilfs2: validate file block counts during recovery
nilfs2: force clear dirty state when restoring from the shadow map
nilfs2: validate segment number in nilfs_sufile_get_suinfo()
nilfs2: fix typos in comments
nilfs2: remove '#if 0' code blocks
nilfs2: strengthen consistency checks in nilfs_direct_propagate()