handle EINTR when waiting for transmit timestamp (#2123224)
Resolves: #2123224
This commit is contained in:
parent
dc64413066
commit
053d2df82f
30
linuxptp-eintr.patch
Normal file
30
linuxptp-eintr.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
commit b8ecf4ddd6533437020c4589a6f7bcd9a62307ad
|
||||||
|
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
Date: Tue Sep 13 13:44:10 2022 +0200
|
||||||
|
|
||||||
|
sk: Handle EINTR when waiting for transmit timestamp.
|
||||||
|
|
||||||
|
If ptp4l received a signal in poll() waiting for a transmit timestamp,
|
||||||
|
multiple (possibly confusing) error messages are logged before exit.
|
||||||
|
|
||||||
|
If poll() returns with EINTR, call it once again to get the timestamp
|
||||||
|
and avoid logging the errors. Don't call it in a loop to avoid getting
|
||||||
|
stuck in case the timestamp is lost and the signal is repeated before
|
||||||
|
the poll timeout can be reached.
|
||||||
|
|
||||||
|
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/sk.c b/sk.c
|
||||||
|
index 8be0708..3595649 100644
|
||||||
|
--- a/sk.c
|
||||||
|
+++ b/sk.c
|
||||||
|
@@ -349,6 +349,9 @@ int sk_receive(int fd, void *buf, int buflen,
|
||||||
|
if (flags == MSG_ERRQUEUE) {
|
||||||
|
struct pollfd pfd = { fd, sk_events, 0 };
|
||||||
|
res = poll(&pfd, 1, sk_tx_timeout);
|
||||||
|
+ /* Retry once on EINTR to avoid logging errors before exit */
|
||||||
|
+ if (res < 0 && errno == EINTR)
|
||||||
|
+ res = poll(&pfd, 1, sk_tx_timeout);
|
||||||
|
if (res < 1) {
|
||||||
|
pr_err(res ? "poll for tx timestamp failed: %m" :
|
||||||
|
"timed out while polling for tx timestamp");
|
@ -41,6 +41,8 @@ Patch9: linuxptp-zerolength.patch
|
|||||||
Patch10: linuxptp-clockcheck.patch
|
Patch10: linuxptp-clockcheck.patch
|
||||||
# handle PHC read failing with EBUSY in phc2sys
|
# handle PHC read failing with EBUSY in phc2sys
|
||||||
Patch11: linuxptp-phcerr.patch
|
Patch11: linuxptp-phcerr.patch
|
||||||
|
# handle EINTR when waiting for transmit timestamp
|
||||||
|
Patch15: linuxptp-eintr.patch
|
||||||
# don't re-arm fault clearing timer on unrelated netlink events
|
# don't re-arm fault clearing timer on unrelated netlink events
|
||||||
Patch17: linuxptp-faultrearm.patch
|
Patch17: linuxptp-faultrearm.patch
|
||||||
|
|
||||||
@ -68,6 +70,7 @@ Supporting legacy APIs and other platforms is not a goal.
|
|||||||
%patch9 -p1 -b .zerolength
|
%patch9 -p1 -b .zerolength
|
||||||
%patch10 -p1 -b .clockcheck
|
%patch10 -p1 -b .clockcheck
|
||||||
%patch11 -p1 -b .phcerr
|
%patch11 -p1 -b .phcerr
|
||||||
|
%patch15 -p1 -b .eintr
|
||||||
%patch17 -p1 -b .faultrearm
|
%patch17 -p1 -b .faultrearm
|
||||||
mv linuxptp-testsuite-%{testsuite_ver}* testsuite
|
mv linuxptp-testsuite-%{testsuite_ver}* testsuite
|
||||||
mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim
|
mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim
|
||||||
|
Loading…
Reference in New Issue
Block a user