]>
Commit | Line | Data |
---|---|---|
5de4fc43 | 1 | diff -ruNX /home/jack/.kerndiffexclude linux-2.6.0-test7/fs/dquot.c linux-2.6.0-test7-1-lockfix/fs/dquot.c |
2 | --- linux-2.6.0-test7/fs/dquot.c Tue Oct 14 15:52:08 2003 | |
3 | +++ linux-2.6.0-test7-1-lockfix/fs/dquot.c Tue Oct 14 16:26:28 2003 | |
4 | @@ -826,28 +826,49 @@ | |
5 | } | |
6 | ||
7 | /* | |
8 | - * Release all quota for the specified inode. | |
9 | - * | |
10 | - * Note: this is a blocking operation. | |
11 | + * Remove references to quota from inode | |
12 | + * This function needs dqptr_sem for writing | |
13 | */ | |
14 | -static void dquot_drop_nolock(struct inode *inode) | |
15 | +static void dquot_drop_iupdate(struct inode *inode, struct dquot **to_drop) | |
16 | { | |
17 | int cnt; | |
18 | ||
19 | inode->i_flags &= ~S_QUOTA; | |
20 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | |
21 | - if (inode->i_dquot[cnt] == NODQUOT) | |
22 | - continue; | |
23 | - dqput(inode->i_dquot[cnt]); | |
24 | + to_drop[cnt] = inode->i_dquot[cnt]; | |
25 | inode->i_dquot[cnt] = NODQUOT; | |
26 | } | |
27 | } | |
28 | ||
29 | +/* | |
30 | + * Release all quotas referenced by inode | |
31 | + */ | |
32 | void dquot_drop(struct inode *inode) | |
33 | { | |
34 | + struct dquot *to_drop[MAXQUOTAS]; | |
35 | + int cnt; | |
36 | + | |
37 | down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
38 | - dquot_drop_nolock(inode); | |
39 | + dquot_drop_iupdate(inode, to_drop); | |
40 | up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
41 | + for (cnt = 0; cnt < MAXQUOTAS; cnt++) | |
42 | + if (to_drop[cnt] != NODQUOT) | |
43 | + dqput(to_drop[cnt]); | |
44 | +} | |
45 | + | |
46 | +/* | |
47 | + * Release all quotas referenced by inode. | |
48 | + * This function assumes dqptr_sem for writing | |
49 | + */ | |
50 | +void dquot_drop_nolock(struct inode *inode) | |
51 | +{ | |
52 | + struct dquot *to_drop[MAXQUOTAS]; | |
53 | + int cnt; | |
54 | + | |
55 | + dquot_drop_iupdate(inode, to_drop); | |
56 | + for (cnt = 0; cnt < MAXQUOTAS; cnt++) | |
57 | + if (to_drop[cnt] != NODQUOT) | |
58 | + dqput(to_drop[cnt]); | |
59 | } | |
60 | ||
61 | /* | |
62 | @@ -862,6 +883,10 @@ | |
63 | warntype[cnt] = NOWARN; | |
64 | ||
65 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
66 | + if (IS_NOQUOTA(inode)) { | |
67 | + up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
68 | + return QUOTA_OK; | |
69 | + } | |
70 | spin_lock(&dq_data_lock); | |
71 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | |
72 | if (inode->i_dquot[cnt] == NODQUOT) | |
73 | @@ -894,6 +919,10 @@ | |
74 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) | |
75 | warntype[cnt] = NOWARN; | |
76 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
77 | + if (IS_NOQUOTA(inode)) { | |
78 | + up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
79 | + return QUOTA_OK; | |
80 | + } | |
81 | spin_lock(&dq_data_lock); | |
82 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | |
83 | if (inode->i_dquot[cnt] == NODQUOT) | |
84 | @@ -923,6 +952,10 @@ | |
85 | unsigned int cnt; | |
86 | ||
87 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
88 | + if (IS_NOQUOTA(inode)) { | |
89 | + up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
90 | + return; | |
91 | + } | |
92 | spin_lock(&dq_data_lock); | |
93 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | |
94 | if (inode->i_dquot[cnt] == NODQUOT) | |
95 | @@ -942,6 +975,10 @@ | |
96 | unsigned int cnt; | |
97 | ||
98 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
99 | + if (IS_NOQUOTA(inode)) { | |
100 | + up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | |
101 | + return; | |
102 | + } | |
103 | spin_lock(&dq_data_lock); | |
104 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | |
105 | if (inode->i_dquot[cnt] == NODQUOT) |