Reviewed-by: Steven Dake <sd...@redhat.com> On 07/27/2011 05:49 AM, Jan Friesse wrote: > This reverts commit 2167 > > Reversion is needed to remove overflow of receive buffers and dropping > messages. > > Signed-off-by: Jan Friesse <jfrie...@redhat.com> > --- > 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, 115 insertions(+), 1 deletions(-) > > diff --git a/branches/whitetank/exec/totemnet.c > b/branches/whitetank/exec/totemnet.c > index b5c4293..154aa4f 100644 > --- a/branches/whitetank/exec/totemnet.c > +++ b/branches/whitetank/exec/totemnet.c > @@ -148,6 +148,8 @@ 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; > @@ -215,6 +217,9 @@ 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 > @@ -629,7 +634,11 @@ static int net_deliver_fn ( > unsigned char *msg_offset; > unsigned int size_delv; > > - iovec = &instance->totemnet_iov_recv; > + if (instance->flushing == 1) { > + iovec = &instance->totemnet_iov_recv_flush; > + } else { > + iovec = &instance->totemnet_iov_recv; > + } > > /* > * Receive datagram > @@ -1310,6 +1319,40 @@ 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 521743a..f4788ab 100644 > --- a/branches/whitetank/exec/totemnet.h > +++ b/branches/whitetank/exec/totemnet.h > @@ -88,6 +88,8 @@ 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 9864a88..f471c5b 100644 > --- a/branches/whitetank/exec/totemrrp.c > +++ b/branches/whitetank/exec/totemrrp.c > @@ -131,6 +131,9 @@ struct rrp_algo { > struct iovec *iovec, > unsigned int iov_len); > > + void (*recv_flush) ( > + struct totemrrp_instance *instance); > + > void (*send_flush) ( > struct totemrrp_instance *instance); > > @@ -241,6 +244,9 @@ 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); > > @@ -296,6 +302,9 @@ 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); > > @@ -351,6 +360,9 @@ 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); > > @@ -389,6 +401,7 @@ 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, > @@ -404,6 +417,7 @@ 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, > @@ -419,6 +433,7 @@ 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, > @@ -504,6 +519,11 @@ 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]); > @@ -802,6 +822,19 @@ 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; > @@ -1140,6 +1173,19 @@ 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; > @@ -1480,6 +1526,25 @@ 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 24f70e7..fad81d7 100644 > --- a/branches/whitetank/exec/totemrrp.h > +++ b/branches/whitetank/exec/totemrrp.h > @@ -97,6 +97,8 @@ 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 c4284ab..279dfb2 100644 > --- a/branches/whitetank/exec/totemsrp.c > +++ b/branches/whitetank/exec/totemsrp.c > @@ -3360,6 +3360,8 @@ static int message_handler_orf_token ( > } > #endif > > + totemrrp_recv_flush (instance->totemrrp_handle); > + > /* > * Determine if we should hold (in reality drop) the token > */
_______________________________________________ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais