1 From: Sunil Mushran <sunil.mushran@oracle.com>
2 Date: Thu, 26 Feb 2009 15:00:48 -0800
3 Subject: ocfs2/dlm: Do not purge lockres that is being migrated dlm_purge_lockres()
7 This patch attempts to fix a fine race between purging and migration.
9 Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
10 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
12 fs/ocfs2/dlm/dlmthread.c | 20 ++++++++++++++++++--
13 1 files changed, 18 insertions(+), 2 deletions(-)
15 Index: linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmthread.c
16 ===================================================================
17 --- linux-2.6.27-sle11_ocfs2_update.orig/fs/ocfs2/dlm/dlmthread.c
18 +++ linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmthread.c
19 @@ -162,12 +162,28 @@ static int dlm_purge_lockres(struct dlm_
21 spin_lock(&res->spinlock);
22 if (!__dlm_lockres_unused(res)) {
23 - spin_unlock(&res->spinlock);
24 mlog(0, "%s:%.*s: tried to purge but not unused\n",
25 dlm->name, res->lockname.len, res->lockname.name);
27 + __dlm_print_one_lock_resource(res);
28 + spin_unlock(&res->spinlock);
32 + if (res->state & DLM_LOCK_RES_MIGRATING) {
33 + mlog(0, "%s:%.*s: Delay dropref as this lockres is "
34 + "being remastered\n", dlm->name, res->lockname.len,
35 + res->lockname.name);
36 + /* Re-add the lockres to the end of the purge list */
37 + if (!list_empty(&res->purge)) {
38 + list_del_init(&res->purge);
39 + list_add_tail(&res->purge, &dlm->purge_list);
41 + spin_unlock(&res->spinlock);
45 master = (res->owner == dlm->node_num);
48 res->state |= DLM_LOCK_RES_DROPPING_REF;
49 spin_unlock(&res->spinlock);