diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2019-10-14 11:29:40 +0200 |
---|---|---|
committer | Stefan Agner <stefan.agner@toradex.com> | 2019-10-14 11:29:40 +0200 |
commit | f2fbbb0846d4d0737cd5bbf0e7a6a136f0334c5e (patch) | |
tree | bc8a63d51e366fb4d65f6547497e33ad3c3c4869 /fs/ocfs2/dlm/dlmunlock.c | |
parent | 73e1c506b9ffb348af15763d62b3677378bd8d91 (diff) | |
parent | a2fc8ee6676067f27d2f5c6e4d512adff3d9938c (diff) |
Merge tag 'v5.3.6' into toradex_5.3.y
This is the 5.3.6 stable release
Diffstat (limited to 'fs/ocfs2/dlm/dlmunlock.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmunlock.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c index e78657742bd8..3883633e82eb 100644 --- a/fs/ocfs2/dlm/dlmunlock.c +++ b/fs/ocfs2/dlm/dlmunlock.c @@ -90,7 +90,8 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, enum dlm_status status; int actions = 0; int in_use; - u8 owner; + u8 owner; + int recovery_wait = 0; mlog(0, "master_node = %d, valblk = %d\n", master_node, flags & LKM_VALBLK); @@ -193,9 +194,12 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, } if (flags & LKM_CANCEL) lock->cancel_pending = 0; - else - lock->unlock_pending = 0; - + else { + if (!lock->unlock_pending) + recovery_wait = 1; + else + lock->unlock_pending = 0; + } } /* get an extra ref on lock. if we are just switching @@ -229,6 +233,17 @@ leave: spin_unlock(&res->spinlock); wake_up(&res->wq); + if (recovery_wait) { + spin_lock(&res->spinlock); + /* Unlock request will directly succeed after owner dies, + * and the lock is already removed from grant list. We have to + * wait for RECOVERING done or we miss the chance to purge it + * since the removement is much faster than RECOVERING proc. + */ + __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_RECOVERING); + spin_unlock(&res->spinlock); + } + /* let the caller's final dlm_lock_put handle the actual kfree */ if (actions & DLM_UNLOCK_FREE_LOCK) { /* this should always be coupled with list removal */ |