Skip to content

Commit

Permalink
[libteam]: timerfd read() could return 0 fix (#3393)
Browse files Browse the repository at this point in the history
* Update sonic-quagga submodule

* [libteam]: timerfd read() could return 0
  • Loading branch information
pavel-shirshov authored and yxieca committed Aug 29, 2019
1 parent c6655b8 commit 6b43650
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 038bed6fe3970dc829dbf9a282f7bea7198e7826 Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com.com>
Date: Wed, 28 Aug 2019 16:39:35 -0700
Subject: [PATCH] When read of timerfd returned 0, don't consider this an error

Just skip this event.
---
teamd/teamd.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/teamd/teamd.c b/teamd/teamd.c
index 96794e8..a5ce745 100644
--- a/teamd/teamd.c
+++ b/teamd/teamd.c
@@ -285,6 +285,10 @@ static int handle_period_fd(int fd)
teamd_log_err("read() failed.");
return -errno;
}
+ if (ret == 0) {
+ teamd_log_warn("read() for timer_fd returned 0.");
+ return 1;
+ }
if (ret != sizeof(uint64_t)) {
teamd_log_err("read() returned unexpected number of bytes.");
return -EINVAL;
@@ -345,7 +349,9 @@ static int teamd_run_loop_do_callbacks(struct list_item *lcb_list, fd_set *fds,
continue;
if (lcb->is_period) {
err = handle_period_fd(lcb->fd);
- if (err)
+ if (err == 1)
+ continue; /* timerfd returned 0. Don't do anything */
+ if (err < 0)
return err;
}
err = lcb->func(ctx, events, lcb->priv);
--
2.7.4

1 change: 1 addition & 0 deletions src/libteam/patch/series
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
0007-Send-LACP-PDU-immediately-if-our-state-changed.patch
0008-libteam-Add-warm_reboot-mode.patch
0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch
0010-When-read-of-timerfd-returned-0-don-t-consider-this-.patch

0 comments on commit 6b43650

Please sign in to comment.