diff options
author | Wengang Wang <wen.gang.wang@oracle.com> | 2009-09-03 03:56:33 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-23 04:54:48 -0400 |
commit | 83e32d9044a4510fffdf65c2691a25c0ba84e259 (patch) | |
tree | 69bf3d8c663e51e7527d67341b3bb8d95b33e008 /fs/ocfs2 | |
parent | d92bc5127b27f315ef0ef2c1e1829fd6a5cba54a (diff) |
ocfs2: add spinlock protection when dealing with lockres->purge.
when we check/modify lockres->purge, we should with the protection of lockres->spinlock.
in dlm_purge_lockres(), the checking/modifying is not with the protectin.
this patch fixes it.
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/dlm/dlmthread.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index d490b66ad9d7..98569e86c613 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
@@ -212,14 +212,18 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm, | |||
212 | spin_lock(&dlm->spinlock); | 212 | spin_lock(&dlm->spinlock); |
213 | } | 213 | } |
214 | 214 | ||
215 | spin_lock(&res->spinlock); | ||
215 | if (!list_empty(&res->purge)) { | 216 | if (!list_empty(&res->purge)) { |
216 | mlog(0, "removing lockres %.*s:%p from purgelist, " | 217 | mlog(0, "removing lockres %.*s:%p from purgelist, " |
217 | "master = %d\n", res->lockname.len, res->lockname.name, | 218 | "master = %d\n", res->lockname.len, res->lockname.name, |
218 | res, master); | 219 | res, master); |
219 | list_del_init(&res->purge); | 220 | list_del_init(&res->purge); |
221 | spin_unlock(&res->spinlock); | ||
220 | dlm_lockres_put(res); | 222 | dlm_lockres_put(res); |
221 | dlm->purge_count--; | 223 | dlm->purge_count--; |
222 | } | 224 | } else |
225 | spin_unlock(&res->spinlock); | ||
226 | |||
223 | __dlm_unhash_lockres(res); | 227 | __dlm_unhash_lockres(res); |
224 | 228 | ||
225 | /* lockres is not in the hash now. drop the flag and wake up | 229 | /* lockres is not in the hash now. drop the flag and wake up |