Re: [PATCH stable-4.14.y] btrfs: always wait on ordered extents at fsync time

From: Greg KH
Date: Wed Oct 20 2021 - 08:32:53 EST


On Tue, Oct 19, 2021 at 06:38:20PM +0800, Anand Jain wrote:
> From: Josef Bacik <jbacik@xxxxxx>
>
> Commit b5e6c3e170b77025b5f6174258c7ad71eed2d4de upstream.
>
> There's a priority inversion that exists currently with btrfs fsync. In
> some cases we will collect outstanding ordered extents onto a list and
> only wait on them at the very last second. However this "very last
> second" falls inside of a transaction handle, so if we are in a lower
> priority cgroup we can end up holding the transaction open for longer
> than needed, so if a high priority cgroup is also trying to fsync()
> it'll see latency.
>
> Signed-off-by: Josef Bacik <jbacik@xxxxxx>
> Reviewed-by: Filipe Manana <fdmanana@xxxxxxxx>
> Signed-off-by: David Sterba <dsterba@xxxxxxxx>
> Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
> ---
> fs/btrfs/file.c | 56 ++++---------------------------------------------
> 1 file changed, 4 insertions(+), 52 deletions(-)

Now applied, thanks.

greg k-h