aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/dlm/dlmconvert.c5
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c14
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c1
3 files changed, 18 insertions, 2 deletions
diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c
index c764dc8e40a2..42c177444850 100644
--- a/fs/ocfs2/dlm/dlmconvert.c
+++ b/fs/ocfs2/dlm/dlmconvert.c
@@ -428,7 +428,7 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data)
428 struct dlm_lockstatus *lksb; 428 struct dlm_lockstatus *lksb;
429 enum dlm_status status = DLM_NORMAL; 429 enum dlm_status status = DLM_NORMAL;
430 u32 flags; 430 u32 flags;
431 int call_ast = 0, kick_thread = 0, ast_reserved = 0; 431 int call_ast = 0, kick_thread = 0, ast_reserved = 0, wake = 0;
432 432
433 if (!dlm_grab(dlm)) { 433 if (!dlm_grab(dlm)) {
434 dlm_error(DLM_REJECTED); 434 dlm_error(DLM_REJECTED);
@@ -524,8 +524,11 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data)
524 cnv->requested_type, 524 cnv->requested_type,
525 &call_ast, &kick_thread); 525 &call_ast, &kick_thread);
526 res->state &= ~DLM_LOCK_RES_IN_PROGRESS; 526 res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
527 wake = 1;
527 } 528 }
528 spin_unlock(&res->spinlock); 529 spin_unlock(&res->spinlock);
530 if (wake)
531 wake_up(&res->wq);
529 532
530 if (status != DLM_NORMAL) { 533 if (status != DLM_NORMAL) {
531 if (status != DLM_NOTQUEUED) 534 if (status != DLM_NOTQUEUED)
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index b36cce034ea0..6cfbdf282d46 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -1967,6 +1967,7 @@ ok:
1967 spin_unlock(&mle->spinlock); 1967 spin_unlock(&mle->spinlock);
1968 1968
1969 if (res) { 1969 if (res) {
1970 int wake = 0;
1970 spin_lock(&res->spinlock); 1971 spin_lock(&res->spinlock);
1971 if (mle->type == DLM_MLE_MIGRATION) { 1972 if (mle->type == DLM_MLE_MIGRATION) {
1972 mlog(0, "finishing off migration of lockres %.*s, " 1973 mlog(0, "finishing off migration of lockres %.*s, "
@@ -1974,6 +1975,7 @@ ok:
1974 res->lockname.len, res->lockname.name, 1975 res->lockname.len, res->lockname.name,
1975 dlm->node_num, mle->new_master); 1976 dlm->node_num, mle->new_master);
1976 res->state &= ~DLM_LOCK_RES_MIGRATING; 1977 res->state &= ~DLM_LOCK_RES_MIGRATING;
1978 wake = 1;
1977 dlm_change_lockres_owner(dlm, res, mle->new_master); 1979 dlm_change_lockres_owner(dlm, res, mle->new_master);
1978 BUG_ON(res->state & DLM_LOCK_RES_DIRTY); 1980 BUG_ON(res->state & DLM_LOCK_RES_DIRTY);
1979 } else { 1981 } else {
@@ -1981,6 +1983,8 @@ ok:
1981 } 1983 }
1982 spin_unlock(&res->spinlock); 1984 spin_unlock(&res->spinlock);
1983 have_lockres_ref = 1; 1985 have_lockres_ref = 1;
1986 if (wake)
1987 wake_up(&res->wq);
1984 } 1988 }
1985 1989
1986 /* master is known, detach if not already detached. 1990 /* master is known, detach if not already detached.
@@ -2342,7 +2346,7 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
2342 struct list_head *queue, *iter; 2346 struct list_head *queue, *iter;
2343 int i; 2347 int i;
2344 struct dlm_lock *lock; 2348 struct dlm_lock *lock;
2345 int empty = 1; 2349 int empty = 1, wake = 0;
2346 2350
2347 if (!dlm_grab(dlm)) 2351 if (!dlm_grab(dlm))
2348 return -EINVAL; 2352 return -EINVAL;
@@ -2467,6 +2471,7 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
2467 res->lockname.name, target); 2471 res->lockname.name, target);
2468 spin_lock(&res->spinlock); 2472 spin_lock(&res->spinlock);
2469 res->state &= ~DLM_LOCK_RES_MIGRATING; 2473 res->state &= ~DLM_LOCK_RES_MIGRATING;
2474 wake = 1;
2470 spin_unlock(&res->spinlock); 2475 spin_unlock(&res->spinlock);
2471 ret = -EINVAL; 2476 ret = -EINVAL;
2472 } 2477 }
@@ -2525,6 +2530,7 @@ fail:
2525 dlm_put_mle_inuse(mle); 2530 dlm_put_mle_inuse(mle);
2526 spin_lock(&res->spinlock); 2531 spin_lock(&res->spinlock);
2527 res->state &= ~DLM_LOCK_RES_MIGRATING; 2532 res->state &= ~DLM_LOCK_RES_MIGRATING;
2533 wake = 1;
2528 spin_unlock(&res->spinlock); 2534 spin_unlock(&res->spinlock);
2529 goto leave; 2535 goto leave;
2530 } 2536 }
@@ -2567,6 +2573,7 @@ fail:
2567 dlm_put_mle_inuse(mle); 2573 dlm_put_mle_inuse(mle);
2568 spin_lock(&res->spinlock); 2574 spin_lock(&res->spinlock);
2569 res->state &= ~DLM_LOCK_RES_MIGRATING; 2575 res->state &= ~DLM_LOCK_RES_MIGRATING;
2576 wake = 1;
2570 spin_unlock(&res->spinlock); 2577 spin_unlock(&res->spinlock);
2571 goto leave; 2578 goto leave;
2572 } 2579 }
@@ -2595,6 +2602,11 @@ leave:
2595 if (ret < 0) 2602 if (ret < 0)
2596 dlm_kick_thread(dlm, res); 2603 dlm_kick_thread(dlm, res);
2597 2604
2605 /* wake up waiters if the MIGRATING flag got set
2606 * but migration failed */
2607 if (wake)
2608 wake_up(&res->wq);
2609
2598 /* TODO: cleanup */ 2610 /* TODO: cleanup */
2599 if (mres) 2611 if (mres)
2600 free_page((unsigned long)mres); 2612 free_page((unsigned long)mres);
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 8c60ccc7460c..e57636c399f4 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1420,6 +1420,7 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data)
1420 spin_lock(&res->spinlock); 1420 spin_lock(&res->spinlock);
1421 res->state &= ~DLM_LOCK_RES_IN_PROGRESS; 1421 res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
1422 spin_unlock(&res->spinlock); 1422 spin_unlock(&res->spinlock);
1423 wake_up(&res->wq);
1423 1424
1424 /* add an extra ref for just-allocated lockres 1425 /* add an extra ref for just-allocated lockres
1425 * otherwise the lockres will be purged immediately */ 1426 * otherwise the lockres will be purged immediately */