btrfs: always wait on ordered extents at fsync time
authorJosef Bacik <jbacik@fb.com>
Wed, 23 May 2018 15:58:33 +0000 (11:58 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 6 Aug 2018 11:12:30 +0000 (13:12 +0200)
commitb5e6c3e170b77025b5f6174258c7ad71eed2d4de
tree5be5957abc526d16b99d8b43c5913aa9b844cdb1
parent16d1c062c7de2999ea7be61d31070fa4ce3d99c4
btrfs: always wait on ordered extents at fsync time

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@fb.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file.c