linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon
@ 2017-08-25 11:02 Olaf Hering
  2017-08-25 12:27 ` Vitaly Kuznetsov
  0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2017-08-25 11:02 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	open list:Hyper-V CORE AND DRIVERS, open list
  Cc: 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 <olaf@aepfle.de>
---
 tools/hv/hv_fcopy_daemon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index c273dd34d144..574e6bf5865c 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -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);
 		}

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon
  2017-08-25 11:02 [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon Olaf Hering
@ 2017-08-25 12:27 ` Vitaly Kuznetsov
  2017-08-25 12:31   ` Olaf Hering
  0 siblings, 1 reply; 5+ messages in thread
From: Vitaly Kuznetsov @ 2017-08-25 12:27 UTC (permalink / raw)
  To: Olaf Hering
  Cc: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	open list:Hyper-V CORE AND DRIVERS, open list

Olaf Hering <olaf@aepfle.de> writes:

> 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 <olaf@aepfle.de>
> ---
>  tools/hv/hv_fcopy_daemon.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
> index c273dd34d144..574e6bf5865c 100644
> --- a/tools/hv/hv_fcopy_daemon.c
> +++ b/tools/hv/hv_fcopy_daemon.c
> @@ -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?

-- 
  Vitaly

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon
  2017-08-25 12:27 ` Vitaly Kuznetsov
@ 2017-08-25 12:31   ` Olaf Hering
  2017-09-05 18:16     ` KY Srinivasan
  0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2017-08-25 12:31 UTC (permalink / raw)
  To: Vitaly Kuznetsov
  Cc: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
	open list:Hyper-V CORE AND DRIVERS, open list

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

On Fri, Aug 25, Vitaly Kuznetsov wrote:

> Shall we request SA_RESTART with sigaction() in all three daemons instead?

If that works better, probably yes.

Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon
  2017-08-25 12:31   ` Olaf Hering
@ 2017-09-05 18:16     ` KY Srinivasan
  2017-09-05 19:40       ` Olaf Hering
  0 siblings, 1 reply; 5+ messages in thread
From: KY Srinivasan @ 2017-09-05 18:16 UTC (permalink / raw)
  To: Olaf Hering, Vitaly Kuznetsov
  Cc: Haiyang Zhang, Stephen Hemminger,
	open list:Hyper-V CORE AND DRIVERS, open list

Olaf,

Were you planning on sending a patch for this.

K. Y

> -----Original Message-----
> From: Olaf Hering [mailto:olaf@aepfle.de]
> Sent: Friday, August 25, 2017 5:31 AM
> To: Vitaly Kuznetsov <vkuznets@redhat.com>
> Cc: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; open list:Hyper-V CORE AND DRIVERS
> <devel@linuxdriverproject.org>; open list <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon
> 
> On Fri, Aug 25, Vitaly Kuznetsov wrote:
> 
> > Shall we request SA_RESTART with sigaction() in all three daemons instead?
> 
> If that works better, probably yes.
> 
> Olaf

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon
  2017-09-05 18:16     ` KY Srinivasan
@ 2017-09-05 19:40       ` Olaf Hering
  0 siblings, 0 replies; 5+ messages in thread
From: Olaf Hering @ 2017-09-05 19:40 UTC (permalink / raw)
  To: KY Srinivasan
  Cc: Vitaly Kuznetsov, Haiyang Zhang, Stephen Hemminger,
	open list:Hyper-V CORE AND DRIVERS, open list

[-- Attachment #1: Type: text/plain, Size: 141 bytes --]

On Tue, Sep 05, KY Srinivasan wrote:

> Were you planning on sending a patch for this.

No, not yet. I dont know how SA_RESTART works.

Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-05 19:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 11:02 [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon Olaf Hering
2017-08-25 12:27 ` Vitaly Kuznetsov
2017-08-25 12:31   ` Olaf Hering
2017-09-05 18:16     ` KY Srinivasan
2017-09-05 19:40       ` Olaf Hering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).