Commit 83e32d90 authored by Wengang Wang's avatar Wengang Wang Committed by Joel Becker

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: default avatarWengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
parent d92bc512
...@@ -212,14 +212,18 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm, ...@@ -212,14 +212,18 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm,
spin_lock(&dlm->spinlock); spin_lock(&dlm->spinlock);
} }
spin_lock(&res->spinlock);
if (!list_empty(&res->purge)) { if (!list_empty(&res->purge)) {
mlog(0, "removing lockres %.*s:%p from purgelist, " mlog(0, "removing lockres %.*s:%p from purgelist, "
"master = %d\n", res->lockname.len, res->lockname.name, "master = %d\n", res->lockname.len, res->lockname.name,
res, master); res, master);
list_del_init(&res->purge); list_del_init(&res->purge);
spin_unlock(&res->spinlock);
dlm_lockres_put(res); dlm_lockres_put(res);
dlm->purge_count--; dlm->purge_count--;
} } else
spin_unlock(&res->spinlock);
__dlm_unhash_lockres(res); __dlm_unhash_lockres(res);
/* lockres is not in the hash now. drop the flag and wake up /* lockres is not in the hash now. drop the flag and wake up
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment