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 | |
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')
-rw-r--r-- | fs/ocfs2/dlm/dlmcommon.h | 1 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 16 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmthread.c | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index bf873919b009..9e052445b0b5 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -849,6 +849,7 @@ void dlm_clean_master_list(struct dlm_ctxt *dlm, | |||
849 | u8 dead_node); | 849 | u8 dead_node); |
850 | int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock); | 850 | int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock); |
851 | 851 | ||
852 | int __dlm_lockres_unused(struct dlm_lock_resource *res); | ||
852 | 853 | ||
853 | static inline const char * dlm_lock_mode_name(int mode) | 854 | static inline const char * dlm_lock_mode_name(int mode) |
854 | { | 855 | { |
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 | } |
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index 22bb58a514df..71302b90daf5 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
@@ -81,7 +81,7 @@ repeat: | |||
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | static int __dlm_lockres_unused(struct dlm_lock_resource *res) | 84 | int __dlm_lockres_unused(struct dlm_lock_resource *res) |
85 | { | 85 | { |
86 | if (list_empty(&res->granted) && | 86 | if (list_empty(&res->granted) && |
87 | list_empty(&res->converting) && | 87 | list_empty(&res->converting) && |