]> err.no Git - linux-2.6/blobdiff - fs/ocfs2/cluster/tcp.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[linux-2.6] / fs / ocfs2 / cluster / tcp.c
index 0b229a9c7952612e2f30098c3085accbb8b167f9..685c18065c82ed3b844fca3226d61b850cb01d66 100644 (file)
@@ -261,14 +261,12 @@ out:
 
 static void o2net_complete_nodes_nsw(struct o2net_node *nn)
 {
-       struct list_head *iter, *tmp;
+       struct o2net_status_wait *nsw, *tmp;
        unsigned int num_kills = 0;
-       struct o2net_status_wait *nsw;
 
        assert_spin_locked(&nn->nn_lock);
 
-       list_for_each_safe(iter, tmp, &nn->nn_status_list) {
-               nsw = list_entry(iter, struct o2net_status_wait, ns_node_item);
+       list_for_each_entry_safe(nsw, tmp, &nn->nn_status_list, ns_node_item) {
                o2net_complete_nsw_locked(nn, nsw, O2NET_ERR_DIED, 0);
                num_kills++;
        }
@@ -764,13 +762,10 @@ EXPORT_SYMBOL_GPL(o2net_register_handler);
 
 void o2net_unregister_handler_list(struct list_head *list)
 {
-       struct list_head *pos, *n;
-       struct o2net_msg_handler *nmh;
+       struct o2net_msg_handler *nmh, *n;
 
        write_lock(&o2net_handler_lock);
-       list_for_each_safe(pos, n, list) {
-               nmh = list_entry(pos, struct o2net_msg_handler,
-                                nh_unregister_item);
+       list_for_each_entry_safe(nmh, n, list, nh_unregister_item) {
                mlog(ML_TCP, "unregistering handler func %p type %u key %08x\n",
                     nmh->nh_func, nmh->nh_msg_type, nmh->nh_key);
                rb_erase(&nmh->nh_node, &o2net_handler_tree);
@@ -859,17 +854,25 @@ static void o2net_sendpage(struct o2net_sock_container *sc,
        struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
        ssize_t ret;
 
-
-       mutex_lock(&sc->sc_send_lock);
-       ret = sc->sc_sock->ops->sendpage(sc->sc_sock,
-                                        virt_to_page(kmalloced_virt),
-                                        (long)kmalloced_virt & ~PAGE_MASK,
-                                        size, MSG_DONTWAIT);
-       mutex_unlock(&sc->sc_send_lock);
-       if (ret != size) {
+       while (1) {
+               mutex_lock(&sc->sc_send_lock);
+               ret = sc->sc_sock->ops->sendpage(sc->sc_sock,
+                                                virt_to_page(kmalloced_virt),
+                                                (long)kmalloced_virt & ~PAGE_MASK,
+                                                size, MSG_DONTWAIT);
+               mutex_unlock(&sc->sc_send_lock);
+               if (ret == size)
+                       break;
+               if (ret == (ssize_t)-EAGAIN) {
+                       mlog(0, "sendpage of size %zu to " SC_NODEF_FMT
+                            " returned EAGAIN\n", size, SC_NODEF_ARGS(sc));
+                       cond_resched();
+                       continue;
+               }
                mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT 
                     " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret);
                o2net_ensure_shutdown(nn, sc, 0);
+               break;
        }
 }
 
@@ -1638,8 +1641,8 @@ static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num,
 
 void o2net_unregister_hb_callbacks(void)
 {
-       o2hb_unregister_callback(&o2net_hb_up);
-       o2hb_unregister_callback(&o2net_hb_down);
+       o2hb_unregister_callback(NULL, &o2net_hb_up);
+       o2hb_unregister_callback(NULL, &o2net_hb_down);
 }
 
 int o2net_register_hb_callbacks(void)
@@ -1651,9 +1654,9 @@ int o2net_register_hb_callbacks(void)
        o2hb_setup_callback(&o2net_hb_up, O2HB_NODE_UP_CB,
                            o2net_hb_node_up_cb, NULL, O2NET_HB_PRI);
 
-       ret = o2hb_register_callback(&o2net_hb_up);
+       ret = o2hb_register_callback(NULL, &o2net_hb_up);
        if (ret == 0)
-               ret = o2hb_register_callback(&o2net_hb_down);
+               ret = o2hb_register_callback(NULL, &o2net_hb_down);
 
        if (ret)
                o2net_unregister_hb_callbacks();