Message ID | 20180820231002.12037-1-blp@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] socket-util: Rate limit logs for bind attempts. | expand |
Looks good to me, thanks. Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com> On Mon, Aug 20, 2018 at 4:10 PM, Ben Pfaff <blp@ovn.org> wrote: > This reduces the amount of logging when higher-level code retries binding > ports that are in use. > > Signed-off-by: Ben Pfaff <blp@ovn.org> > --- > lib/socket-util.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/socket-util.c b/lib/socket-util.c > index 504f4cd59554..df9b01a9e848 100644 > --- a/lib/socket-util.c > +++ b/lib/socket-util.c > @@ -725,7 +725,8 @@ inet_open_passive(int style, const char *target, int > default_port, > /* Bind. */ > if (bind(fd, (struct sockaddr *) &ss, ss_length(&ss)) < 0) { > error = sock_errno(); > - VLOG_ERR("%s: bind: %s", target, sock_strerror(error)); > + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); > + VLOG_ERR_RL(&rl, "%s: bind: %s", target, sock_strerror(error)); > goto error; > } > > -- > 2.16.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
Thanks, applied to master. On Mon, Aug 20, 2018 at 04:34:37PM -0700, Yifeng Sun wrote: > Looks good to me, thanks. > > Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com> > > On Mon, Aug 20, 2018 at 4:10 PM, Ben Pfaff <blp@ovn.org> wrote: > > > This reduces the amount of logging when higher-level code retries binding > > ports that are in use. > > > > Signed-off-by: Ben Pfaff <blp@ovn.org> > > --- > > lib/socket-util.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/lib/socket-util.c b/lib/socket-util.c > > index 504f4cd59554..df9b01a9e848 100644 > > --- a/lib/socket-util.c > > +++ b/lib/socket-util.c > > @@ -725,7 +725,8 @@ inet_open_passive(int style, const char *target, int > > default_port, > > /* Bind. */ > > if (bind(fd, (struct sockaddr *) &ss, ss_length(&ss)) < 0) { > > error = sock_errno(); > > - VLOG_ERR("%s: bind: %s", target, sock_strerror(error)); > > + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); > > + VLOG_ERR_RL(&rl, "%s: bind: %s", target, sock_strerror(error)); > > goto error; > > } > > > > -- > > 2.16.1 > > > > _______________________________________________ > > dev mailing list > > dev@openvswitch.org > > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > >
diff --git a/lib/socket-util.c b/lib/socket-util.c index 504f4cd59554..df9b01a9e848 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -725,7 +725,8 @@ inet_open_passive(int style, const char *target, int default_port, /* Bind. */ if (bind(fd, (struct sockaddr *) &ss, ss_length(&ss)) < 0) { error = sock_errno(); - VLOG_ERR("%s: bind: %s", target, sock_strerror(error)); + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_ERR_RL(&rl, "%s: bind: %s", target, sock_strerror(error)); goto error; }
This reduces the amount of logging when higher-level code retries binding ports that are in use. Signed-off-by: Ben Pfaff <blp@ovn.org> --- lib/socket-util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)