-
Notifications
You must be signed in to change notification settings - Fork 0
/
0000-cover-letter.patch
49 lines (39 loc) · 1.89 KB
/
0000-cover-letter.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From a2f5100a47b7ec27d2b621367ec4ab10e69a6f35 Mon Sep 17 00:00:00 2001
From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Date: Fri, 29 Mar 2013 13:47:22 +0800
Subject: [PATCH V2 0/6] add a mutex lock to avoid race condition and
have all the ioctls check
The original code has only one spin_lock 'qgroup_lock' to protect quota
configurations on memory. If we want to add a BTRFS_QGROUP_INFO_KEY,
it will be added to Btree firstly and then update quota configurations
on memory, however,a race condition may happen between these operations.
For example:
->add_qqroup_info_item()
->add_qgroup_rb()
For the above case, del_qgroup_info_item() may happen before add_qgroup_rb().
What's worse, when we want to add a qgroup relations:
->add_qgroup_relation_item()
->add_qgroup_relations()
We don't have any checks whether 'src' and 'dst' exists before
add_qgroup_relation_item(), a race condition can also happen for the above case.
To avoid race conditions and have all the necessay checks, we introduce
a mutex 'quota_lock', and we make all the user change operations protected by
the mutex_lock.
The benefit of mutex_lock is more, with a mutex lock, we can remove
some spin_lock usages thus easing the burden of spin_lock 'qgroup_lock'.
V1->V2:
use quota configurations on memory to speed up ioctl checks
Wang Shilong (6):
Btrfs: introduce a mutex lock for btrfs quota operations
Btrfs: remove some unnecessary spin_lock usages
Btrfs: fix missing check before updating qgroup limit
Btrfs: fix missing check before creating/destroying a qgroup
Btrfs: fix missing check before assigning/removing qgroup relation
Btrfs: fix missing check before btrfs_qgroup_inherit()
fs/btrfs/ctree.h | 10 +++
fs/btrfs/disk-io.c | 1 +
fs/btrfs/ioctl.c | 43 ++++++++++----
fs/btrfs/qgroup.c | 167 +++++++++++++++++++++++++++++++++-------------------
4 files changed, 150 insertions(+), 71 deletions(-)
--
1.7.7.6