Skip to content

Commit

Permalink
btrfs: qgroup: Fix a regression in qgroup reserved space.
Browse files Browse the repository at this point in the history
During the change to new btrfs extent-oriented qgroup implement, due to
it doesn't use the old __qgroup_excl_accounting() for exclusive extent,
it didn't free the reserved bytes.

The bug will cause limit function go crazy as the reserved space is
never freed, increasing limit will have no effect and still cause
EQOUT.

The fix is easy, just free reserved bytes for newly created exclusive
extent as what it does before.

Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Yang Dongsheng <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
  • Loading branch information
Qu Wenruo authored and Chris Mason committed Aug 6, 2015
1 parent 00d80e3 commit c05f942
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,11 @@ static int qgroup_update_counters(struct btrfs_fs_info *fs_info,
/* Exclusive -> exclusive, nothing changed */
}
}

/* For exclusive extent, free its reserved bytes too */
if (nr_old_roots == 0 && nr_new_roots == 1 &&
cur_new_count == nr_new_roots)
qg->reserved -= num_bytes;
if (dirty)
qgroup_dirty(fs_info, qg);
}
Expand Down

0 comments on commit c05f942

Please sign in to comment.