linux/fs/nilfs2
Ryusuke Konishi db3e24a02e nilfs2: make block erasure safe in nilfs_finish_roll_forward()
The implementation of writing a zero-fill block in
nilfs_finish_roll_forward() is not safe.  The buffer is being cleared
without acquiring a lock or setting the uptodate flag, so theoretically,
between the time the buffer's data is cleared and the time it is written
back to the block device using sync_dirty_buffer(), that zero data can be
undone by concurrent block device reads.

Since this buffer points to a location that has been read from disk once,
the uptodate flag will most likely remain, but since it was obtained with
__getblk(), that is not guaranteed.  In other words, this is exceptional,
and this function itself is not normally called (only once when mounting
after a specific pattern of unclean shutdown), so it is highly unlikely
that this will actually cause a problem.

Anyway, eliminate this potential race issue by protecting the clearing of
buffer data with a buffer lock and setting the buffer's uptodate flag
within the protected section.

Link: https://lkml.kernel.org/r/20240511002942.9608-1-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-05-19 14:36:21 -07:00
..
alloc.c nilfs2: convert persistent object allocator to use kmap_local 2024-02-22 15:38:53 -08:00
alloc.h
bmap.c nilfs2: do not acquire rwsem in nilfs_bmap_write() 2024-02-22 15:38:53 -08:00
bmap.h
btnode.c nilfs2: convert nilfs_page_bug() to nilfs_folio_bug() 2023-12-10 17:21:48 -08:00
btnode.h fs/nilfs2: Use the enum req_op and blk_opf_t types 2022-07-14 12:14:33 -06:00
btree.c nilfs2: add kernel-doc comments to nilfs_btree_convert_and_insert() 2024-04-25 21:07:08 -07:00
btree.h
cpfile.c nilfs2: use div64_ul() instead of do_div() 2024-03-12 13:09:23 -07:00
cpfile.h nilfs2: remove nilfs_cpfile_{get,put}_checkpoint() 2024-02-22 15:38:53 -08:00
dat.c nilfs2: use div64_ul() instead of do_div() 2024-03-12 13:09:23 -07:00
dat.h
dir.c Mainly singleton patches, documented in their respective changelogs. 2024-05-19 14:02:03 -07:00
direct.c nilfs2: fix failure to detect DAT corruption in btree and direct mappings 2024-03-14 09:17:29 -07:00
direct.h
export.h
file.c nilfs2: fix hang in nilfs_lookup_dirty_data_buffers() 2024-02-07 21:20:36 -08:00
gcinode.c nilfs2: add kernel-doc comments to nilfs_remove_all_gcinodes() 2024-04-25 21:07:08 -07:00
ifile.c nilfs2: localize highmem mapping for checkpoint reading within cpfile 2024-02-22 15:38:53 -08:00
ifile.h nilfs2: localize highmem mapping for checkpoint reading within cpfile 2024-02-22 15:38:53 -08:00
inode.c nilfs2: prevent kernel bug at submit_bh_wbc() 2024-03-14 09:17:30 -07:00
ioctl.c nilfs2: fix out-of-range warning 2024-04-09 10:52:12 +02:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile
mdt.c nilfs2: convert metadata file common code to use kmap_local 2024-02-22 15:38:53 -08:00
mdt.h nilfs2: fix lockdep warnings during disk space reclamation 2022-04-01 11:46:09 -07:00
namei.c misc cleanups (the part that hadn't been picked by individual fs trees) 2024-01-11 20:23:50 -08:00
nilfs.h nilfs2: convert to use the new mount API 2024-05-08 08:41:27 -07:00
page.c nilfs2: convert nilfs_copy_buffer() to use kmap_local 2024-02-22 15:38:53 -08:00
page.h nilfs2: convert nilfs_page_bug() to nilfs_folio_bug() 2023-12-10 17:21:48 -08:00
recovery.c nilfs2: make block erasure safe in nilfs_finish_roll_forward() 2024-05-19 14:36:21 -07:00
segbuf.c nilfs2: convert segment buffer to use kmap_local 2024-02-22 15:38:53 -08:00
segbuf.h
segment.c nilfs2: remove calls to folio_set_error() and folio_clear_error() 2024-05-11 15:51:43 -07:00
segment.h
sufile.c nilfs2: use div64_ul() instead of do_div() 2024-03-12 13:09:23 -07:00
sufile.h
super.c nilfs2: convert to use the new mount API 2024-05-08 08:41:27 -07:00
sysfs.c
sysfs.h
the_nilfs.c nilfs2: make superblock data array index computation sparse friendly 2024-05-08 08:41:28 -07:00
the_nilfs.h nilfs2: convert to use the new mount API 2024-05-08 08:41:27 -07:00