Message ID | 1584053657-21150-1-git-send-email-pavel.contrib@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Don't return an error when timerfd socket return 0 | expand |
Thu, Mar 12, 2020 at 11:54:17PM CET, pavel.contrib@gmail.com wrote: >It is possible to read 0 bytes from timerfd descriptor >despite the fact that descriptor notified poll() that >it has data. > >It is possible to see such behaviour on some hardware >platforms. > >Solve this by treating such situation as normal. > >Signed-off-by: Pavel Shirshov <pavel.contrib@gmail.com> In the other email you have different address in the Signed-off-by line. Make up your mind please. Otherwise, the patch looks fine to me. >--- > teamd/teamd.c | 4 ++++ > 1 file changed, 4 insertions(+) > >diff --git a/teamd/teamd.c b/teamd/teamd.c >index e035ac5..8cdc16d 100644 >--- a/teamd/teamd.c >+++ b/teamd/teamd.c >@@ -265,6 +265,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 0; >+ } > if (ret != sizeof(uint64_t)) { > teamd_log_err("read() returned unexpected number of bytes."); > return -EINVAL; >-- >2.7.4 >
Thu, Mar 12, 2020 at 11:54:17PM CET, pavel.contrib@gmail.com wrote: >It is possible to read 0 bytes from timerfd descriptor >despite the fact that descriptor notified poll() that >it has data. > >It is possible to see such behaviour on some hardware >platforms. > >Solve this by treating such situation as normal. > >Signed-off-by: Pavel Shirshov <pavel.contrib@gmail.com> applied.
diff --git a/teamd/teamd.c b/teamd/teamd.c index e035ac5..8cdc16d 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c @@ -265,6 +265,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 0; + } if (ret != sizeof(uint64_t)) { teamd_log_err("read() returned unexpected number of bytes."); return -EINVAL;
It is possible to read 0 bytes from timerfd descriptor despite the fact that descriptor notified poll() that it has data. It is possible to see such behaviour on some hardware platforms. Solve this by treating such situation as normal. Signed-off-by: Pavel Shirshov <pavel.contrib@gmail.com> --- teamd/teamd.c | 4 ++++ 1 file changed, 4 insertions(+)