public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Kahola, Mika" <mika.kahola@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Latvala, Petri" <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] testdisplay: Don't double-close udev fd
Date: Tue, 24 Sep 2019 06:15:41 +0000	[thread overview]
Message-ID: <c64e0593736647913fc11d6efe48d5c6ab327a69.camel@intel.com> (raw)
In-Reply-To: <20190923130613.14805-1-petri.latvala@intel.com>

On Mon, 2019-09-23 at 16:06 +0300, Petri Latvala wrote:
> testdisplay uses GIO for polling the udev fd for events. When
> shutting
> down, both the GIO channel and libudev want to close their respective
> fds, leading to a double close.
> 
> Since version 240 (as used by Ubuntu 19.04), libudev has complained
> loudly if close() fails with EBADF. Previously the error has flown
> under the radar.
> 
> Calling g_io_channel_shutdown() will call close() on the fd
> regardless
> of g_io_channel_set_close_on_unref, so opencode the flush and unref
> instead to avoid double closing.
> 

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Cc: Jani Saarinen <jani.saarinen@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
>  tests/testdisplay_hotplug.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/testdisplay_hotplug.c
> b/tests/testdisplay_hotplug.c
> index 581d987e..cd784895 100644
> --- a/tests/testdisplay_hotplug.c
> +++ b/tests/testdisplay_hotplug.c
> @@ -117,8 +117,10 @@ out:
>  
>  void testdisplay_cleanup_hotplug(void)
>  {
> -	if (udevchannel)
> -		g_io_channel_shutdown(udevchannel, TRUE, NULL);
> +	if (udevchannel) {
> +		g_io_channel_flush(udevchannel, NULL);
> +		g_io_channel_unref(udevchannel);
> +	}
>  	if (uevent_monitor)
>  		udev_monitor_unref(uevent_monitor);
>  	if (udev)
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

      parent reply	other threads:[~2019-09-24  6:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-23 13:06 [igt-dev] [PATCH i-g-t] testdisplay: Don't double-close udev fd Petri Latvala
2019-09-23 13:53 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-09-23 14:47 ` [igt-dev] [PATCH i-g-t] " Saarinen, Jani
2019-09-23 21:11 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
2019-09-24  6:15 ` Kahola, Mika [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c64e0593736647913fc11d6efe48d5c6ab327a69.camel@intel.com \
    --to=mika.kahola@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox