From 5036ab8df278f9879d8958679bd043e32515a3e4 Mon Sep 17 00:00:00 2001 From: Wang Jianchao Date: Mon, 30 Aug 2021 15:52:46 +0800 Subject: ext4: flush background discard kwork when retry allocation The background discard kwork tries to mark blocks used and issue discard. This can make filesystem suffer from NOSPC error, xfstest generic/371 can fail due to it. Fix it by flushing discard kwork in ext4_should_retry_alloc. At the same time, give up discard at the moment. Signed-off-by: Wang Jianchao Link: https://lore.kernel.org/r/20210830075246.12516-6-jianchao.wan9@gmail.com Signed-off-by: Theodore Ts'o --- fs/ext4/ext4.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/ext4/ext4.h') diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 6b678b968d84..d71dcac3b97f 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1538,6 +1538,7 @@ struct ext4_sb_info { after commit completed */ struct list_head s_discard_list; struct work_struct s_discard_work; + atomic_t s_retry_alloc_pending; struct rb_root s_mb_avg_fragment_size_root; rwlock_t s_mb_rb_lock; struct list_head *s_mb_largest_free_orders; -- cgit