btrfs: fix one bug that process may endlessly wait for ticket in wait_reserve_ticket()
authorWang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Wed, 31 Aug 2016 11:46:16 +0000 (19:46 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 1 Sep 2016 15:23:24 +0000 (17:23 +0200)
commite0af24849efb0eea572cf22d22bb65d164cb8a6f
tree0b8cc1019a229ceea587b72c29811d1d72b22879
parenta9b1fc851db054ddec703dc7951ed00620600b26
btrfs: fix one bug that process may endlessly wait for ticket in wait_reserve_ticket()

If can_overcommit() in btrfs_calc_reclaim_metadata_size() returns true,
btrfs_async_reclaim_metadata_space() will not reclaim metadata space, just
return directly and also forget to wake up process which are waiting for
their tickets, so these processes will wait endlessly.

Fstests case generic/172 with mount option "-o compress=lzo" have revealed
this bug in my test machine. Here if we have tickets to handle, we must
handle them first.

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c