Skip to content

Commit

Permalink
ocfs2: add spinlock protection when dealing with lockres->purge.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wengang Wang authored and Joel Becker committed Sep 23, 2009
1 parent d92bc51 commit 83e32d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/ocfs2/dlm/dlmthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,18 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm,
spin_lock(&dlm->spinlock);
}

spin_lock(&res->spinlock);
if (!list_empty(&res->purge)) {
mlog(0, "removing lockres %.*s:%p from purgelist, "
"master = %d\n", res->lockname.len, res->lockname.name,
res, master);
list_del_init(&res->purge);
spin_unlock(&res->spinlock);
dlm_lockres_put(res);
dlm->purge_count--;
}
} else
spin_unlock(&res->spinlock);

__dlm_unhash_lockres(res);

/* lockres is not in the hash now. drop the flag and wake up
Expand Down

0 comments on commit 83e32d9

Please sign in to comment.