btrfs: wake up async_delalloc_pages waiters after submit
authorJosef Bacik <josef@toxicpanda.com>
Wed, 14 Jul 2021 18:47:17 +0000 (14:47 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:40:06 +0000 (13:40 +0200)
commit0901af53da8f4cfee3bb364a35f66d0d4a9b93ba
tree19c8c0bdaaf7638a9ce09c7ca28047d7dfbdc3d8
parent9ac218642dfc1309682baa708e81935e5cec5ff3
btrfs: wake up async_delalloc_pages waiters after submit

commit ac98141d140444fe93e26471d3074c603b70e2ca upstream.

We use the async_delalloc_pages mechanism to make sure that we've
completed our async work before trying to continue our delalloc
flushing.  The reason for this is we need to see any ordered extents
that were created by our delalloc flushing.  However we're waking up
before we do the submit work, which is before we create the ordered
extents.  This is a pretty wide race window where we could potentially
think there are no ordered extents and thus exit shrink_delalloc
prematurely.  Fix this by waking us up after we've done the work to
create ordered extents.

CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/inode.c