diff options
author | Kurt Hackel <kurt.hackel@oracle.com> | 2006-05-01 13:57:51 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-06-26 17:42:58 -0400 |
commit | 69d72b066cc5971318d9e29e34289b74cf8a9d22 (patch) | |
tree | f8d27fbce0fac31969ff09cdf3c8faa9c9abc56e /fs/ocfs2/dlm/dlmrecovery.c | |
parent | a9ee4c8a67b962db0208addf0e32935aa571af6b (diff) |
ocfs2: dlm recovery / lockres reference count fix
Take a reference on lockres structures while they are on the recovery list.
Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlm/dlmrecovery.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index 81bd2400e221..6ee8b3247129 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -1758,8 +1758,14 @@ void dlm_move_lockres_to_recovery_list(struct dlm_ctxt *dlm, | |||
1758 | struct dlm_lock *lock; | 1758 | struct dlm_lock *lock; |
1759 | 1759 | ||
1760 | res->state |= DLM_LOCK_RES_RECOVERING; | 1760 | res->state |= DLM_LOCK_RES_RECOVERING; |
1761 | if (!list_empty(&res->recovering)) | 1761 | if (!list_empty(&res->recovering)) { |
1762 | mlog(0, | ||
1763 | "Recovering res %s:%.*s, is already on recovery list!\n", | ||
1764 | dlm->name, res->lockname.len, res->lockname.name); | ||
1762 | list_del_init(&res->recovering); | 1765 | list_del_init(&res->recovering); |
1766 | } | ||
1767 | /* We need to hold a reference while on the recovery list */ | ||
1768 | dlm_lockres_get(res); | ||
1763 | list_add_tail(&res->recovering, &dlm->reco.resources); | 1769 | list_add_tail(&res->recovering, &dlm->reco.resources); |
1764 | 1770 | ||
1765 | /* find any pending locks and put them back on proper list */ | 1771 | /* find any pending locks and put them back on proper list */ |
@@ -1848,9 +1854,11 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm, | |||
1848 | spin_lock(&res->spinlock); | 1854 | spin_lock(&res->spinlock); |
1849 | dlm_change_lockres_owner(dlm, res, new_master); | 1855 | dlm_change_lockres_owner(dlm, res, new_master); |
1850 | res->state &= ~DLM_LOCK_RES_RECOVERING; | 1856 | res->state &= ~DLM_LOCK_RES_RECOVERING; |
1851 | __dlm_dirty_lockres(dlm, res); | 1857 | if (!__dlm_lockres_unused(res)) |
1858 | __dlm_dirty_lockres(dlm, res); | ||
1852 | spin_unlock(&res->spinlock); | 1859 | spin_unlock(&res->spinlock); |
1853 | wake_up(&res->wq); | 1860 | wake_up(&res->wq); |
1861 | dlm_lockres_put(res); | ||
1854 | } | 1862 | } |
1855 | } | 1863 | } |
1856 | 1864 | ||
@@ -1883,11 +1891,13 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm, | |||
1883 | dlm->name, res->lockname.len, | 1891 | dlm->name, res->lockname.len, |
1884 | res->lockname.name, res->owner); | 1892 | res->lockname.name, res->owner); |
1885 | list_del_init(&res->recovering); | 1893 | list_del_init(&res->recovering); |
1894 | dlm_lockres_put(res); | ||
1886 | } | 1895 | } |
1887 | spin_lock(&res->spinlock); | 1896 | spin_lock(&res->spinlock); |
1888 | dlm_change_lockres_owner(dlm, res, new_master); | 1897 | dlm_change_lockres_owner(dlm, res, new_master); |
1889 | res->state &= ~DLM_LOCK_RES_RECOVERING; | 1898 | res->state &= ~DLM_LOCK_RES_RECOVERING; |
1890 | __dlm_dirty_lockres(dlm, res); | 1899 | if (!__dlm_lockres_unused(res)) |
1900 | __dlm_dirty_lockres(dlm, res); | ||
1891 | spin_unlock(&res->spinlock); | 1901 | spin_unlock(&res->spinlock); |
1892 | wake_up(&res->wq); | 1902 | wake_up(&res->wq); |
1893 | } | 1903 | } |