tools: hv: handle EINTR in hv_fcopy_daemon
PATCH 1/1 tools: hv: handle EINTR in hv_fcopy_daemon
If strace attaches to the daemon pread returns with EINTR, and the process exits. Catch this case and continue with the next iteration.
--- tools/hv/hv_fcopy_daemon.c | 2 ++ 1 file changed, 2 insertions(+)
tools/hv/hv_fcopy_daemon.c +2 -0
@@ -201,6 +201,8 @@ int main(int argc, char *argv[])ssize_t len; len =pread (fcopy_fd, &buffer,sizeof (buffer),0 );if (len <0 ) { +if (errno ==EINTR ) +continue ;syslog (LOG_ERR ,"pread failed: %s" ,strerror (errno));exit (EXIT_FAILURE ); }
Quoted 13 lines · Olaf Hering
If strace attaches to the daemon pread returns with EINTR, and the process exits. Catch this case and continue with the next iteration.
Signed-off-by Olaf Hering <[email protected]>--- tools/hv/hv_fcopy_daemon.c | 2 ++ 1 file changed, 2 insertions(+)tools/hv/hv_fcopy_daemon.c +0
-0
tools/hv/hv_fcopy_daemon.c int main(int argc, char *argv[]) · line 208
Quoted 8 lines
tools/hv/hv_fcopy_daemon.c +2
-0@@ -201,6 +201,8 @@ int main(int argc, char *argv[])ssize_t len; len =pread (fcopy_fd, &buffer,sizeof (buffer),0 );if (len <0 ) { +if (errno ==EINTR ) +continue ;syslog (LOG_ERR ,"pread failed: %s" ,strerror (errno));exit (EXIT_FAILURE ); }
Shall we request SA_RESTART with sigaction() in all three daemons instead?
Signature · 1 line
Vitaly
Quoted 1 line · Vitaly Kuznetsov
Shall we request
SA_RESTARTwithsigaction()in all three daemons instead?
If that works better, probably yes.
Olaf
Olaf,
Were you planning on sending a patch for this.
K. Y
Quoted 17 lines
-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Friday, August 25, 2017 5:31 AM
To: Vitaly Kuznetsov <[email protected]>
Cc: KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Stephen Hemminger <[email protected]>; open list:Hyper-V CORE AND DRIVERS <[email protected]>; open list <[email protected]>
Subject: Re: [PATCH] tools: hv: handle EINTR inhv_fcopy_daemonQuoted 1 line · Vitaly Kuznetsov
Shall we request
SA_RESTARTwithsigaction()in all three daemons instead?If that works better, probably yes.
Olaf
Quoted 1 line · KY Srinivasan
Were you planning on sending a patch for this.
No, not yet. I dont know how SA_RESTART works.
Olaf