]> git.hungrycats.org Git - linux/commit
ext4: make sure allocate pending entry not fail
authorZhang Yi <yi.zhang@huawei.com>
Thu, 24 Aug 2023 09:26:05 +0000 (17:26 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 6 Oct 2023 02:32:14 +0000 (22:32 -0400)
commit8e387c89e96b9543a339f84043cf9df15fed2632
treeeee0562ec32798589fe6f6eb754d40835dd1f461
parent40ea98396a3659062267d1fe5f99af4f7e4f05e3
ext4: make sure allocate pending entry not fail

__insert_pending() allocate memory in atomic context, so the allocation
could fail, but we are not handling that failure now. It could lead
ext4_es_remove_extent() to get wrong reserved clusters, and the global
data blocks reservation count will be incorrect. The same to
extents_status entry preallocation, preallocate pending entry out of the
i_es_lock with __GFP_NOFAIL, make sure __insert_pending() and
__revise_pending() always succeeds.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230824092619.1327976-3-yi.zhang@huaweicloud.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents_status.c