Wang Shilong f2f6ed3d54 Btrfs: introduce a mutex lock for btrfs quota operations
The original code has one spin_lock 'qgroup_lock' to protect quota
configurations in memory. If we want to add a BTRFS_QGROUP_INFO_KEY,
it will be added to Btree firstly, and then update configurations in
memory,however, a race condition may happen between these operations.
For example:
	->add_qgroup_info_item()
		->add_qgroup_rb()

For the above case, del_qgroup_info_item() may happen just before
add_qgroup_rb().

What's worse, when we want to add a qgroup relation:
	->add_qgroup_relation_item()
		->add_qgroup_relations()

We don't have any checks whether 'src' and 'dst' exist before
add_qgroup_relation_item(), a race condition can also happen for
the above case.

To avoid race condition and have all the necessary checks, we introduce
a mutex lock 'qgroup_ioctl_lock', and we make all the user change operations
protected by the mutex lock.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
2013-05-06 15:54:38 -04:00
..
2013-04-09 14:08:16 -04:00
2013-03-11 22:05:56 +01:00
2013-03-12 18:55:21 -07:00
2013-04-05 17:55:13 +01:00
2013-03-12 18:55:21 -07:00
2013-04-10 10:26:49 -07:00
2013-03-26 16:18:27 -04:00
2013-03-28 15:52:14 -07:00
2013-03-12 18:55:21 -07:00
2013-02-22 23:31:31 -05:00
2013-02-22 23:31:31 -05:00
2013-02-22 23:31:31 -05:00
2013-03-26 18:25:57 -04:00
2013-02-22 23:31:31 -05:00
2013-02-28 13:21:44 -08:00
2013-02-22 23:31:31 -05:00
2013-02-22 23:31:31 -05:00
2013-03-12 08:29:17 -07:00
2013-02-22 23:31:31 -05:00
2013-02-26 02:46:08 -05:00
2013-02-22 23:31:31 -05:00