ocfs2/dlm: clear migration_pending when migration target goes down
PATCH v2 1/1 ocfs2/dlm: clear migration_pending when migration target goes down
We have found a BUG on res->migration_pending when migrating lock resources. The situation is as follows.
dlm_mark_lockres_migration
res->migration_pending = 1;
__dlm_lockres_reserve_ast
dlm_lockres_release_ast returns with res->migration_pending remains
because other threads reserve asts
wait dlm_migration_can_proceed returns 1
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
o2hb found that target goes down and remove target
from domain_map
dlm_migration_can_proceed returns 1 dlm_mark_lockres_migrating returns -ESHOTDOWN with
res->migration_pending still remains.
When reentering dlm_mark_lockres_migrating(), it will trigger the BUG_ON with res->migration_pending. So clear migration_pending when target is down.
--- fs/ocfs2/dlm/dlmmaster.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ocfs2/dlm/dlmmaster.c +2 -0
@@ -2843,6 +2843,8 @@ again: res->state &= ~DLM_LOCK_RES_BLOCK_DIRTY ;if (!ret)BUG_ON (!(res->state &DLM_LOCK_RES_MIGRATING )); +else + res->migration_pending =0 ;spin_unlock (&res->spinlock);/*
Signature · 1 line
1.8.4.3
PATCH v2 1/1 ocfs2/dlm: clear migration_pending when migration target goes down
Quoted 13 lines · xuejiufei
We have found a BUG on
res->migration_pendingwhen migrating lock resources. The situation is as follows.
dlm_mark_lockres_migration
res->migration_pending= 1;
__dlm_lockres_reserve_ast
dlm_lockres_release_astreturns withres->migration_pendingremains
because other threads reserve asts
waitdlm_migration_can_proceedreturns 1Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
o2hb found that target goes down and remove target
from
domain_map
dlm_migration_can_proceedreturns 1dlm_mark_lockres_migratingreturns-ESHOTDOWNwith
Quoted 7 lines
res->migration_pending still remains.When reentering
dlm_mark_lockres_migrating(), it will trigger theBUG_ONwithres->migration_pending. So clearmigration_pendingwhen target is down.Signed-off-by Jiufei Xue <[email protected]>
Quoted 18 lines
--- fs/ocfs2/dlm/dlmmaster.c | 2 ++ 1 file changed, 2 insertions(+)fs/ocfs2/dlm/dlmmaster.c +2
-0@@ -2843,6 +2843,8 @@ again: res->state &= ~DLM_LOCK_RES_BLOCK_DIRTY ;if (!ret)BUG_ON (!(res->state &DLM_LOCK_RES_MIGRATING )); +else + res->migration_pending =0 ;spin_unlock (&res->spinlock);/*