[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH 4/8] mdev: re-initialize if uevent messages were lost
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2020-11-22 13:45:29
Message-ID: CAK1hOcNGBerTkUifv35z+90gzmL9sn4m_8mF0+Z-gg_q3=Yh5w () mail ! gmail ! com
[Download RAW message or body]

Applied, thanks

On Mon, Dec 16, 2019 at 10:57 PM Jan Klötzke <jan@kloetzke.net> wrote:
>
> If the netlink read() failed with ENOBUFS we know that we have missed at
> least one message due to a socket receive buffer overrun. The only way
> how to recover is to drop the old socket, open a fresh one and make a
> cold-plug scan of the current system state.
>
> Signed-off-by: Jan Klötzke <jan@kloetzke.net>
> ---
>  util-linux/mdev.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/util-linux/mdev.c b/util-linux/mdev.c
> index cfc1a38bc..91c4ff466 100644
> --- a/util-linux/mdev.c
> +++ b/util-linux/mdev.c
> @@ -1206,6 +1206,16 @@ static void daemon_loop(char *temp, int fd)
>
>                 len = safe_read(fd, netbuf, sizeof(netbuf) - 1);
>                 if (len < 0) {
> +                       if (errno == ENOBUFS) {
> +                               /*
> +                                * We ran out of socket receive buffer space.
> +                                * Start from scratch.
> +                                */
> +                               dbg1s("uevent overrun! Rescanning...");
> +                               close(fd);
> +                               fd = daemon_init(temp);
> +                               continue;
> +                       }
>                         bb_simple_perror_msg_and_die("read");
>                 }
>                 end = netbuf + len;
> --
> 2.20.1
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic