Backport of Corosync 336741ee96caf3ae435b609ee8a76788902c9edf

The recv_flush code is no longer necessary because of the miss_count_count
addition.  It can in some cases lead to register corruption because of
interactions with -fstack-protector, the recursive nature of how this code
works, and interactions with the optimizer in some versions of gcc.

Signed-off-by: Jan Friesse <[email protected]>
---
 branches/whitetank/exec/totemnet.c |   45 +------------------------
 branches/whitetank/exec/totemnet.h |    2 -
 branches/whitetank/exec/totemrrp.c |   65 ------------------------------------
 branches/whitetank/exec/totemrrp.h |    2 -
 branches/whitetank/exec/totemsrp.c |    2 -
 5 files changed, 1 insertions(+), 115 deletions(-)

diff --git a/branches/whitetank/exec/totemnet.c 
b/branches/whitetank/exec/totemnet.c
index 154aa4f..b5c4293 100644
--- a/branches/whitetank/exec/totemnet.c
+++ b/branches/whitetank/exec/totemnet.c
@@ -148,8 +148,6 @@ struct totemnet_instance {
 
        struct iovec totemnet_iov_recv;
 
-       struct iovec totemnet_iov_recv_flush;
-
        struct totemnet_socket totemnet_sockets;
 
        struct totem_ip_address mcast_address;
@@ -217,9 +215,6 @@ static void totemnet_instance_initialize (struct 
totemnet_instance *instance)
        instance->totemnet_iov_recv.iov_base = instance->iov_buffer;
 
        instance->totemnet_iov_recv.iov_len = FRAME_SIZE_MAX; //sizeof 
(instance->iov_buffer);
-       instance->totemnet_iov_recv_flush.iov_base = instance->iov_buffer_flush;
-
-       instance->totemnet_iov_recv_flush.iov_len = FRAME_SIZE_MAX; //sizeof 
(instance->iov_buffer);
 
        /*
         * There is always atleast 1 processor
@@ -634,11 +629,7 @@ static int net_deliver_fn (
        unsigned char *msg_offset;
        unsigned int size_delv;
 
-       if (instance->flushing == 1) {
-               iovec = &instance->totemnet_iov_recv_flush;
-       } else {
-               iovec = &instance->totemnet_iov_recv;
-       }
+       iovec = &instance->totemnet_iov_recv;
 
        /*
         * Receive datagram
@@ -1319,40 +1310,6 @@ error_exit:
        return (res);
 }
 
-int totemnet_recv_flush (totemnet_handle handle)
-{
-       struct totemnet_instance *instance;
-       struct pollfd ufd;
-       int nfds;
-       int res = 0;
-
-       res = hdb_handle_get (&totemnet_instance_database, handle,
-               (void *)&instance);
-       if (res != 0) {
-               res = ENOENT;
-               goto error_exit;
-       }
-
-       instance->flushing = 1;
-
-       do {
-               ufd.fd = instance->totemnet_sockets.mcast_recv;
-               ufd.events = POLLIN;
-               nfds = poll (&ufd, 1, 0);
-               if (nfds == 1 && ufd.revents & POLLIN) {
-               net_deliver_fn (0, instance->totemnet_sockets.mcast_recv,
-                       ufd.revents, instance);
-               }
-       } while (nfds == 1);
-
-       instance->flushing = 0;
-
-       hdb_handle_put (&totemnet_instance_database, handle);
-
-error_exit:
-       return (res);
-}
-
 int totemnet_send_flush (totemnet_handle handle)
 {
        struct totemnet_instance *instance;
diff --git a/branches/whitetank/exec/totemnet.h 
b/branches/whitetank/exec/totemnet.h
index f4788ab..521743a 100644
--- a/branches/whitetank/exec/totemnet.h
+++ b/branches/whitetank/exec/totemnet.h
@@ -88,8 +88,6 @@ extern int totemnet_mcast_noflush_send (
        struct iovec *iovec,
        unsigned int iov_len);
 
-extern int totemnet_recv_flush (totemnet_handle handle);
-
 extern int totemnet_send_flush (totemnet_handle handle);
 
 extern int totemnet_iface_check (totemnet_handle handle);
diff --git a/branches/whitetank/exec/totemrrp.c 
b/branches/whitetank/exec/totemrrp.c
index f471c5b..9864a88 100644
--- a/branches/whitetank/exec/totemrrp.c
+++ b/branches/whitetank/exec/totemrrp.c
@@ -131,9 +131,6 @@ struct rrp_algo {
                struct iovec *iovec,
                unsigned int iov_len);  
 
-       void (*recv_flush) (
-               struct totemrrp_instance *instance);
-
        void (*send_flush) (
                struct totemrrp_instance *instance);
 
@@ -244,9 +241,6 @@ static void none_token_send (
        struct iovec *iovec,
        unsigned int iov_len);  
 
-static void none_recv_flush (
-       struct totemrrp_instance *instance);
-
 static void none_send_flush (
        struct totemrrp_instance *instance);
 
@@ -302,9 +296,6 @@ static void passive_token_send (
        struct iovec *iovec,
        unsigned int iov_len);  
 
-static void passive_recv_flush (
-       struct totemrrp_instance *instance);
-
 static void passive_send_flush (
        struct totemrrp_instance *instance);
 
@@ -360,9 +351,6 @@ static void active_token_send (
        struct iovec *iovec,
        unsigned int iov_len);  
 
-static void active_recv_flush (
-       struct totemrrp_instance *instance);
-
 static void active_send_flush (
        struct totemrrp_instance *instance);
 
@@ -401,7 +389,6 @@ struct rrp_algo none_algo = {
        .mcast_flush_send       = none_mcast_flush_send,
        .token_recv             = none_token_recv,
        .token_send             = none_token_send,
-       .recv_flush             = none_recv_flush,
        .send_flush             = none_send_flush,
        .iface_check            = none_iface_check,
        .processor_count_set    = none_processor_count_set,
@@ -417,7 +404,6 @@ struct rrp_algo passive_algo = {
        .mcast_flush_send       = passive_mcast_flush_send,
        .token_recv             = passive_token_recv,
        .token_send             = passive_token_send,
-       .recv_flush             = passive_recv_flush,
        .send_flush             = passive_send_flush,
        .iface_check            = passive_iface_check,
        .processor_count_set    = passive_processor_count_set,
@@ -433,7 +419,6 @@ struct rrp_algo active_algo = {
        .mcast_flush_send       = active_mcast_flush_send,
        .token_recv             = active_token_recv,
        .token_send             = active_token_send,
-       .recv_flush             = active_recv_flush,
        .send_flush             = active_send_flush,
        .iface_check            = active_iface_check,
        .processor_count_set    = active_processor_count_set,
@@ -519,11 +504,6 @@ static void none_token_send (
                iovec, iov_len);
 }
 
-static void none_recv_flush (struct totemrrp_instance *instance)
-{
-       totemnet_recv_flush (instance->net_handles[0]);
-}
-
 static void none_send_flush (struct totemrrp_instance *instance)
 {
        totemnet_send_flush (instance->net_handles[0]);
@@ -822,19 +802,6 @@ static void passive_token_send (
 
 }
 
-static void passive_recv_flush (struct totemrrp_instance *instance)
-{
-       struct passive_instance *rrp_algo_instance = (struct passive_instance 
*)instance->rrp_algo_instance;
-       unsigned int i;
-
-       for (i = 0; i < instance->interface_count; i++) {
-               if (rrp_algo_instance->faulty[i] == 0) {
-
-                       totemnet_recv_flush (instance->net_handles[i]);
-               }
-       }
-}
-
 static void passive_send_flush (struct totemrrp_instance *instance)
 {
        struct passive_instance *rrp_algo_instance = (struct passive_instance 
*)instance->rrp_algo_instance;
@@ -1173,19 +1140,6 @@ static void active_token_send (
        }
 }
 
-static void active_recv_flush (struct totemrrp_instance *instance)
-{
-       struct active_instance *rrp_algo_instance = (struct active_instance 
*)instance->rrp_algo_instance;
-       unsigned int i;
-
-       for (i = 0; i < instance->interface_count; i++) {
-               if (rrp_algo_instance->faulty[i] == 0) {
-
-                       totemnet_recv_flush (instance->net_handles[i]);
-               }
-       }
-}
-
 static void active_send_flush (struct totemrrp_instance *instance)
 {
        struct active_instance *rrp_algo_instance = (struct active_instance 
*)instance->rrp_algo_instance;
@@ -1526,25 +1480,6 @@ int totemrrp_token_target_set (
 error_exit:
        return (res);
 }
-int totemrrp_recv_flush (totemrrp_handle handle)
-{
-       struct totemrrp_instance *instance;
-       int res = 0;
-
-       res = hdb_handle_get (&totemrrp_instance_database, handle,
-               (void *)&instance);
-       if (res != 0) {
-               res = ENOENT;
-               goto error_exit;
-       }
-
-       instance->rrp_algo->recv_flush (instance);
-
-       hdb_handle_put (&totemrrp_instance_database, handle);
-
-error_exit:
-       return (res);
-}
 
 int totemrrp_send_flush (totemrrp_handle handle)
 {
diff --git a/branches/whitetank/exec/totemrrp.h 
b/branches/whitetank/exec/totemrrp.h
index fad81d7..24f70e7 100644
--- a/branches/whitetank/exec/totemrrp.h
+++ b/branches/whitetank/exec/totemrrp.h
@@ -97,8 +97,6 @@ extern int totemrrp_mcast_flush_send (
        struct iovec *iovec,
        unsigned int iov_len);
 
-extern int totemrrp_recv_flush (totemrrp_handle handle);
-
 extern int totemrrp_send_flush (totemrrp_handle handle);
 
 extern int totemrrp_token_target_set (
diff --git a/branches/whitetank/exec/totemsrp.c 
b/branches/whitetank/exec/totemsrp.c
index 9fe79e7..4d6ee9e 100644
--- a/branches/whitetank/exec/totemsrp.c
+++ b/branches/whitetank/exec/totemsrp.c
@@ -3332,8 +3332,6 @@ static int message_handler_orf_token (
        }
 #endif
 
-       totemrrp_recv_flush (instance->totemrrp_handle);
-
        /*
         * Determine if we should hold (in reality drop) the token
         */
-- 
1.7.3.4

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to