]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/ocfs2/cluster/heartbeat.c
Merge branch 'akpm-current/current'
[karo-tx-linux.git] / fs / ocfs2 / cluster / heartbeat.c
index e404386bd93e8535a32152fcc5936ede9ac5fa41..709fbbd44c65366ce1e31aebce0904b5966d53a6 100644 (file)
@@ -219,7 +219,8 @@ struct o2hb_region {
        unsigned                hr_unclean_stop:1,
                                hr_aborted_start:1,
                                hr_item_pinned:1,
-                               hr_item_dropped:1;
+                               hr_item_dropped:1,
+                               hr_node_deleted:1;
 
        /* protected by the hr_callback_sem */
        struct task_struct      *hr_task;
@@ -1078,7 +1079,13 @@ static int o2hb_thread(void *data)
        set_user_nice(current, MIN_NICE);
 
        /* Pin node */
-       o2nm_depend_this_node();
+       ret = o2nm_depend_this_node();
+       if (ret) {
+               mlog(ML_ERROR, "Node has been deleted, ret = %d\n", ret);
+               reg->hr_node_deleted = 1;
+               wake_up(&o2hb_steady_queue);
+               return 0;
+       }
 
        while (!kthread_should_stop() &&
               !reg->hr_unclean_stop && !reg->hr_aborted_start) {
@@ -1789,7 +1796,8 @@ static ssize_t o2hb_region_dev_store(struct config_item *item,
        spin_unlock(&o2hb_live_lock);
 
        ret = wait_event_interruptible(o2hb_steady_queue,
-                               atomic_read(&reg->hr_steady_iterations) == 0);
+                               atomic_read(&reg->hr_steady_iterations) == 0 ||
+                               reg->hr_node_deleted);
        if (ret) {
                atomic_set(&reg->hr_steady_iterations, 0);
                reg->hr_aborted_start = 1;
@@ -1800,6 +1808,11 @@ static ssize_t o2hb_region_dev_store(struct config_item *item,
                goto out3;
        }
 
+       if (reg->hr_node_deleted) {
+               ret = -EINVAL;
+               goto out3;
+       }
+
        /* Ok, we were woken.  Make sure it wasn't by drop_item() */
        spin_lock(&o2hb_live_lock);
        hb_task = reg->hr_task;