diff options
author | Joseph Qi <joseph.qi@huawei.com> | 2015-10-22 16:32:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-23 04:55:10 -0400 |
commit | b67de018b37a97548645a879c627d4188518e907 (patch) | |
tree | 79593d33b91fa8188454d61af8634dbfe35230b3 | |
parent | bb387002693ed28b2bb0408c5dec65521b71e5f1 (diff) |
ocfs2/dlm: unlock lockres spinlock before dlm_lockres_put
dlm_lockres_put will call dlm_lockres_release if it is the last
reference, and then it may call dlm_print_one_lock_resource and
take lockres spinlock.
So unlock lockres spinlock before dlm_lockres_put to avoid deadlock.
Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index ee5aa4daaea0..ce38b4ccc9ab 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -1658,12 +1658,13 @@ send_response: | |||
1658 | if (ret < 0) { | 1658 | if (ret < 0) { |
1659 | mlog(ML_ERROR, "failed to dispatch assert master work\n"); | 1659 | mlog(ML_ERROR, "failed to dispatch assert master work\n"); |
1660 | response = DLM_MASTER_RESP_ERROR; | 1660 | response = DLM_MASTER_RESP_ERROR; |
1661 | spin_unlock(&res->spinlock); | ||
1661 | dlm_lockres_put(res); | 1662 | dlm_lockres_put(res); |
1662 | } else { | 1663 | } else { |
1663 | dispatched = 1; | 1664 | dispatched = 1; |
1664 | __dlm_lockres_grab_inflight_worker(dlm, res); | 1665 | __dlm_lockres_grab_inflight_worker(dlm, res); |
1666 | spin_unlock(&res->spinlock); | ||
1665 | } | 1667 | } |
1666 | spin_unlock(&res->spinlock); | ||
1667 | } else { | 1668 | } else { |
1668 | if (res) | 1669 | if (res) |
1669 | dlm_lockres_put(res); | 1670 | dlm_lockres_put(res); |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index 3d90ad7ff91f..58eaa5c0d387 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -1723,8 +1723,8 @@ int dlm_master_requery_handler(struct o2net_msg *msg, u32 len, void *data, | |||
1723 | } else { | 1723 | } else { |
1724 | dispatched = 1; | 1724 | dispatched = 1; |
1725 | __dlm_lockres_grab_inflight_worker(dlm, res); | 1725 | __dlm_lockres_grab_inflight_worker(dlm, res); |
1726 | spin_unlock(&res->spinlock); | ||
1726 | } | 1727 | } |
1727 | spin_unlock(&res->spinlock); | ||
1728 | } else { | 1728 | } else { |
1729 | /* put.. incase we are not the master */ | 1729 | /* put.. incase we are not the master */ |
1730 | spin_unlock(&res->spinlock); | 1730 | spin_unlock(&res->spinlock); |