Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1719971 > unrolled thread

[PATCH] tools: hv: handle EINTR in hv_fcopy_daemon

Started byOlaf Hering <olaf@aepfle.de>
First post2017-08-25 13:10 +0200
Last post2017-09-05 21:50 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon Olaf Hering <olaf@aepfle.de> - 2017-08-25 13:10 +0200
    Re: [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-25 14:30 +0200
      Re: [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon Olaf Hering <olaf@aepfle.de> - 2017-08-25 14:40 +0200
        RE: [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon KY Srinivasan <kys@microsoft.com> - 2017-09-05 20:20 +0200
          Re: [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon Olaf Hering <olaf@aepfle.de> - 2017-09-05 21:50 +0200

#1719971 — [PATCH] tools: hv: handle EINTR in hv_fcopy_daemon

FromOlaf Hering <olaf@aepfle.de>
Date2017-08-25 13:10 +0200
Subject[PATCH] tools: hv: handle EINTR in hv_fcopy_daemon
Message-ID<uikEW-3hj-13@gated-at.bofh.it>
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);
 		}

[toc] | [next] | [standalone]


#1720029

FromVitaly Kuznetsov <vkuznets@redhat.com>
Date2017-08-25 14:30 +0200
Message-ID<uilUm-3Zi-31@gated-at.bofh.it>
In reply to#1719971
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

[toc] | [prev] | [next] | [standalone]


#1720032

FromOlaf Hering <olaf@aepfle.de>
Date2017-08-25 14:40 +0200
Message-ID<uim41-43d-3@gated-at.bofh.it>
In reply to#1720029

[Multipart message — attachments visible in raw view] — view raw

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

[toc] | [prev] | [next] | [standalone]


#1726911

FromKY Srinivasan <kys@microsoft.com>
Date2017-09-05 20:20 +0200
Message-ID<umqC5-6kM-1@gated-at.bofh.it>
In reply to#1720032
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

[toc] | [prev] | [next] | [standalone]


#1726957

FromOlaf Hering <olaf@aepfle.de>
Date2017-09-05 21:50 +0200
Message-ID<ums1b-7ak-9@gated-at.bofh.it>
In reply to#1726911

[Multipart message — attachments visible in raw view] — view raw

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web