diff options
author | Eric Whitney <enwlinux@gmail.com> | 2022-06-15 19:05:30 +0300 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2022-08-03 06:52:19 +0300 |
commit | 7f0d8e1d607c1a4fa9a27362a108921d82230874 (patch) | |
tree | 7e543b54c94ed02e9bb420acb5f467204f1f5967 /fs/ksmbd/transport_tcp.c | |
parent | a89573ce4ad32f19f43ec669771726817e185be0 (diff) | |
download | linux-7f0d8e1d607c1a4fa9a27362a108921d82230874.tar.xz |
ext4: fix extent status tree race in writeback error recovery path
A race can occur in the unlikely event ext4 is unable to allocate a
physical cluster for a delayed allocation in a bigalloc file system
during writeback. Failure to allocate a cluster forces error recovery
that includes a call to mpage_release_unused_pages(). That function
removes any corresponding delayed allocated blocks from the extent
status tree. If a new delayed write is in progress on the same cluster
simultaneously, resulting in the addition of an new extent containing
one or more blocks in that cluster to the extent status tree, delayed
block accounting can be thrown off if that delayed write then encounters
a similar cluster allocation failure during future writeback.
Write lock the i_data_sem in mpage_release_unused_pages() to fix this
problem. Ext4's block/cluster accounting code for bigalloc relies on
i_data_sem for mutual exclusion, as is found in the delayed write path,
and the locking in mpage_release_unused_pages() is missing.
Cc: stable@kernel.org
Reported-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Link: https://lore.kernel.org/r/20220615160530.1928801-1-enwlinux@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ksmbd/transport_tcp.c')
0 files changed, 0 insertions, 0 deletions