summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/space-info.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 9c118af363de..fd9eff51e5b4 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -1399,13 +1399,16 @@ int btrfs_reserve_data_bytes(struct btrfs_fs_info *fs_info, u64 bytes,
struct btrfs_space_info *data_sinfo = fs_info->data_sinfo;
u64 used;
int ret = -ENOSPC;
+ bool pending_tickets;
ASSERT(!current->journal_info || flush != BTRFS_RESERVE_FLUSH_DATA);
spin_lock(&data_sinfo->lock);
used = btrfs_space_info_used(data_sinfo, true);
+ pending_tickets = !list_empty(&data_sinfo->tickets) ||
+ !list_empty(&data_sinfo->priority_tickets);
- if (used + bytes > data_sinfo->total_bytes) {
+ if (pending_tickets || used + bytes > data_sinfo->total_bytes) {
struct reserve_ticket ticket;
init_waitqueue_head(&ticket.wait);