Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libteam]: timerfd read() could return 0 fix #3393

Merged
merged 14 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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