diff options
Diffstat (limited to 'fs/ocfs2/dlm/dlmdomain.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmdomain.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 3fcf205ee900..02d315fef432 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -839,7 +839,7 @@ static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data, | |||
839 | * to back off and try again. This gives heartbeat a chance | 839 | * to back off and try again. This gives heartbeat a chance |
840 | * to catch up. | 840 | * to catch up. |
841 | */ | 841 | */ |
842 | if (!o2hb_check_node_heartbeating(query->node_idx)) { | 842 | if (!o2hb_check_node_heartbeating_no_sem(query->node_idx)) { |
843 | mlog(0, "node %u is not in our live map yet\n", | 843 | mlog(0, "node %u is not in our live map yet\n", |
844 | query->node_idx); | 844 | query->node_idx); |
845 | 845 | ||
@@ -1975,24 +1975,22 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
1975 | 1975 | ||
1976 | dlm = kzalloc(sizeof(*dlm), GFP_KERNEL); | 1976 | dlm = kzalloc(sizeof(*dlm), GFP_KERNEL); |
1977 | if (!dlm) { | 1977 | if (!dlm) { |
1978 | mlog_errno(-ENOMEM); | 1978 | ret = -ENOMEM; |
1979 | mlog_errno(ret); | ||
1979 | goto leave; | 1980 | goto leave; |
1980 | } | 1981 | } |
1981 | 1982 | ||
1982 | dlm->name = kstrdup(domain, GFP_KERNEL); | 1983 | dlm->name = kstrdup(domain, GFP_KERNEL); |
1983 | if (dlm->name == NULL) { | 1984 | if (dlm->name == NULL) { |
1984 | mlog_errno(-ENOMEM); | 1985 | ret = -ENOMEM; |
1985 | kfree(dlm); | 1986 | mlog_errno(ret); |
1986 | dlm = NULL; | ||
1987 | goto leave; | 1987 | goto leave; |
1988 | } | 1988 | } |
1989 | 1989 | ||
1990 | dlm->lockres_hash = (struct hlist_head **)dlm_alloc_pagevec(DLM_HASH_PAGES); | 1990 | dlm->lockres_hash = (struct hlist_head **)dlm_alloc_pagevec(DLM_HASH_PAGES); |
1991 | if (!dlm->lockres_hash) { | 1991 | if (!dlm->lockres_hash) { |
1992 | mlog_errno(-ENOMEM); | 1992 | ret = -ENOMEM; |
1993 | kfree(dlm->name); | 1993 | mlog_errno(ret); |
1994 | kfree(dlm); | ||
1995 | dlm = NULL; | ||
1996 | goto leave; | 1994 | goto leave; |
1997 | } | 1995 | } |
1998 | 1996 | ||
@@ -2002,11 +2000,8 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
2002 | dlm->master_hash = (struct hlist_head **) | 2000 | dlm->master_hash = (struct hlist_head **) |
2003 | dlm_alloc_pagevec(DLM_HASH_PAGES); | 2001 | dlm_alloc_pagevec(DLM_HASH_PAGES); |
2004 | if (!dlm->master_hash) { | 2002 | if (!dlm->master_hash) { |
2005 | mlog_errno(-ENOMEM); | 2003 | ret = -ENOMEM; |
2006 | dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES); | 2004 | mlog_errno(ret); |
2007 | kfree(dlm->name); | ||
2008 | kfree(dlm); | ||
2009 | dlm = NULL; | ||
2010 | goto leave; | 2005 | goto leave; |
2011 | } | 2006 | } |
2012 | 2007 | ||
@@ -2017,14 +2012,8 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
2017 | dlm->node_num = o2nm_this_node(); | 2012 | dlm->node_num = o2nm_this_node(); |
2018 | 2013 | ||
2019 | ret = dlm_create_debugfs_subroot(dlm); | 2014 | ret = dlm_create_debugfs_subroot(dlm); |
2020 | if (ret < 0) { | 2015 | if (ret < 0) |
2021 | dlm_free_pagevec((void **)dlm->master_hash, DLM_HASH_PAGES); | ||
2022 | dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES); | ||
2023 | kfree(dlm->name); | ||
2024 | kfree(dlm); | ||
2025 | dlm = NULL; | ||
2026 | goto leave; | 2016 | goto leave; |
2027 | } | ||
2028 | 2017 | ||
2029 | spin_lock_init(&dlm->spinlock); | 2018 | spin_lock_init(&dlm->spinlock); |
2030 | spin_lock_init(&dlm->master_lock); | 2019 | spin_lock_init(&dlm->master_lock); |
@@ -2085,6 +2074,19 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
2085 | atomic_read(&dlm->dlm_refs.refcount)); | 2074 | atomic_read(&dlm->dlm_refs.refcount)); |
2086 | 2075 | ||
2087 | leave: | 2076 | leave: |
2077 | if (ret < 0 && dlm) { | ||
2078 | if (dlm->master_hash) | ||
2079 | dlm_free_pagevec((void **)dlm->master_hash, | ||
2080 | DLM_HASH_PAGES); | ||
2081 | |||
2082 | if (dlm->lockres_hash) | ||
2083 | dlm_free_pagevec((void **)dlm->lockres_hash, | ||
2084 | DLM_HASH_PAGES); | ||
2085 | |||
2086 | kfree(dlm->name); | ||
2087 | kfree(dlm); | ||
2088 | dlm = NULL; | ||
2089 | } | ||
2088 | return dlm; | 2090 | return dlm; |
2089 | } | 2091 | } |
2090 | 2092 | ||