Skip to contentSkip to conversation

testdisplay: Don't double-close udev fd

PATCH In review Petri Latvala 4 participants 5 messages Sep 23, 2019 – Sep 24, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testdisplay: Don't double-close udev fd

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.

Cc Jani Saarinen <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
---
 tests/testdisplay_hotplug.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/testdisplay_hotplug.c +4 -2
index 581d987e..cd784895 100644
@@ -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)
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for testdisplay: Don't double-close udev fd

== Series Details ==

== Series Details ==

Series: testdisplay: Don't double-close udev fd
URL : https://patchwork.freedesktop.org/series/67106/
State : success

== Summary ==

CI Bug Log - changes from IGT_5197 -> IGTPW_3491
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/67106/revisions/1/mbox/

Known issues
------------

Here are the changes found in IGTPW_3491 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_chamelium@dp-edid-read:
- fi-kbl-7500u: [PASS][1] -> [FAIL][2] ([fdo#109483] / [fdo#109635 ])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/fi-kbl-7500u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/fi-kbl-7500u/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u2: [PASS][3] -> [FAIL][4] ([fdo#103167])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/fi-icl-u2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/fi-icl-u2/igt@[email protected]

* igt@prime_busy@basic-before-default:
- fi-icl-u3: [PASS][5] -> [DMESG-WARN][6] ([fdo#107724]) +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/fi-icl-u3/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/fi-icl-u3/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_param@basic:
- fi-icl-u3: [DMESG-WARN][7] ([fdo#107724]) -> [PASS][8] +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/fi-icl-u3/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/fi-icl-u3/igt@[email protected]

* igt@kms_chamelium@hdmi-crc-fast:
- fi-icl-u2: [FAIL][9] ([fdo#109635 ]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/fi-icl-u2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/fi-icl-u2/igt@[email protected]

#### Warnings ####

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][11] ([fdo#111407]) -> [FAIL][12] ([fdo#111045] / [fdo#111096])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/fi-kbl-7500u/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/fi-kbl-7500u/igt@[email protected]

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#109483]: https://bugs.freedesktop.org/show_bug.cgi?id=109483
[fdo#109635 ]: https://bugs.freedesktop.org/show_bug.cgi?id=109635
[fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407

Participating hosts (54 -> 39)
------------------------------

Missing (15): fi-hsw-4770r fi-cml-u2 fi-icl-u4 fi-tgl-u fi-cml-h fi-ilk-m540 fi-tgl-u2 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-snb-2520m fi-icl-y fi-icl-guc fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_5197 -> IGTPW_3491

CI-20190529: 20190529
CI_DRM_6939: f839fe27dcaf8e4e0716c0b83a9481df3a1de27e @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3491: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/
IGT_5197: aa534ff47fd2f455c8be9e59eae807695b87fcdd @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Tested-by on v1 1/1
#2 lore raw
In reply to Petri Latvala

Hi,

Quoted 15 lines

-----Original Message-----
From: Latvala, Petri
Sent: maanantai 23. syyskuuta 2019 16.06
To: [email protected]
Cc: Latvala, Petri <[email protected]>; Saarinen, Jani <[email protected]>; Hiler, Arkadiusz <[email protected]>
Subject: [PATCH i-g-t] testdisplay: Don't double-close udev fd

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.

Quoted 7 lines

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.

Cc Jani Saarinen <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Quoted 22 lines
---
 tests/testdisplay_hotplug.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/testdisplay_hotplug.c index renamed from tests/testdisplay_hotplug.c +0 -0

581d987e..cd784895 100644

tests/testdisplay_hotplug.c +4 -3
@@ -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)
--
Quoted 1 line

2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for testdisplay: Don't double-close udev fd

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: testdisplay: Don't double-close udev fd
URL : https://patchwork.freedesktop.org/series/67106/
State : success

== Summary ==

CI Bug Log - changes from IGT_5197_full -> IGTPW_3491_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/67106/revisions/1/mbox/

Known issues
------------

Here are the changes found in IGTPW_3491_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_isolation@bcs0-s3:
- shard-apl: [PASS][1] -> [DMESG-WARN][2] ([fdo#108566]) +3 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-apl4/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-apl1/igt@[email protected]

* igt@gem_ctx_switch@legacy-bsd2-heavy:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#109276]) +9 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb5/igt@[email protected]

* igt@gem_exec_schedule@deep-bsd:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#111325]) +6 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb6/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb1/igt@[email protected]

* igt@gem_exec_schedule@preemptive-hang-vebox:
- shard-iclb: [PASS][7] -> [INCOMPLETE][8] ([fdo#107713]) +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb1/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb7/igt@[email protected]

* igt@i915_suspend@sysfs-reader:
- shard-kbl: [PASS][9] -> [DMESG-WARN][10] ([fdo#108566])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-kbl1/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-kbl4/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-256x85-sliding:
- shard-kbl: [PASS][11] -> [FAIL][12] ([fdo#103232])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-kbl1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-kbl1/igt@[email protected]
- shard-apl: [PASS][13] -> [FAIL][14] ([fdo#103232])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-apl8/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-apl6/igt@[email protected]

* igt@kms_cursor_legacy@cursor-vs-flip-legacy:
- shard-hsw: [PASS][15] -> [FAIL][16] ([fdo#103355])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-hsw4/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-hsw8/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-move:
- shard-iclb: [PASS][17] -> [FAIL][18] ([fdo#103167]) +5 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb6/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb2/igt@[email protected]

* igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: [PASS][19] -> [FAIL][20] ([fdo#103166])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb7/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb5/igt@[email protected]

* igt@kms_psr@psr2_basic:
- shard-iclb: [PASS][21] -> [SKIP][22] ([fdo#109441]) +1 similar issue
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb2/igt@kms_psr@psr2_basic.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb8/igt@kms_psr@psr2_basic.html

* igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend:
- shard-kbl: [PASS][23] -> [INCOMPLETE][24] ([fdo#103665])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-kbl6/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-kbl4/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_shared@exec-single-timeline-bsd:
- shard-iclb: [SKIP][25] ([fdo#110841]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb4/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb5/igt@[email protected]

* igt@gem_exec_schedule@preempt-other-bsd1:
- shard-iclb: [SKIP][27] ([fdo#109276]) -> [PASS][28] +17 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb7/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb4/igt@[email protected]

* igt@gem_exec_schedule@preemptive-hang-bsd:
- shard-iclb: [SKIP][29] ([fdo#111325]) -> [PASS][30] +4 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb4/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb6/igt@[email protected]

* igt@gem_exec_suspend@basic-s4-devices:
- shard-iclb: [FAIL][31] ([fdo#111699]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb4/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb1/igt@[email protected]

* igt@gem_tiled_swapping@non-threaded:
- shard-apl: [DMESG-WARN][33] ([fdo#108686]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-apl4/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-apl1/igt@[email protected]

* igt@gem_workarounds@suspend-resume-context:
- shard-apl: [DMESG-WARN][35] ([fdo#108566]) -> [PASS][36] +5 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-apl2/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-apl2/igt@[email protected]

* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-kbl: [DMESG-WARN][37] ([fdo#108566]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-kbl4/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-kbl7/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-kbl: [FAIL][39] ([fdo#105363]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-kbl4/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-kbl1/igt@[email protected]

* igt@kms_flip@wf_vblank-ts-check:
- shard-apl: [INCOMPLETE][41] ([fdo#103927]) -> [PASS][42] +2 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-apl1/igt@kms_flip@wf_vblank-ts-check.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-apl7/igt@kms_flip@wf_vblank-ts-check.html

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite:
- shard-apl: [FAIL][43] ([fdo#103167]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-apl3/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-apl4/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite.html
- shard-kbl: [FAIL][45] ([fdo#103167]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-kbl7/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-kbl3/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite.html

* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-cpu:
- shard-glk: [FAIL][47] ([fdo#103167]) -> [PASS][48] +1 similar issue
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-glk7/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-cpu.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-glk4/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-cpu.html

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-indfb-pgflip-blt:
- shard-iclb: [FAIL][49] ([fdo#103167]) -> [PASS][50] +4 similar issues
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb8/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-indfb-pgflip-blt.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-indfb-pgflip-blt.html

* igt@kms_psr2_su@frontbuffer:
- shard-iclb: [SKIP][51] ([fdo#109642] / [fdo#111068]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb3/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb2/igt@[email protected]

* igt@kms_psr@psr2_suspend:
- shard-iclb: [SKIP][53] ([fdo#109441]) -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb3/igt@kms_psr@psr2_suspend.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb2/igt@kms_psr@psr2_suspend.html

#### Warnings ####

* igt@gem_mocs_settings@mocs-settings-bsd2:
- shard-iclb: [FAIL][55] ([fdo#111330]) -> [SKIP][56] ([fdo#109276])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5197/shard-iclb4/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/shard-iclb6/igt@[email protected]

[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103355]: https://bugs.freedesktop.org/show_bug.cgi?id=103355
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#110841]: https://bugs.freedesktop.org/show_bug.cgi?id=110841
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330
[fdo#111699]: https://bugs.freedesktop.org/show_bug.cgi?id=111699

Participating hosts (7 -> 6)
------------------------------

Missing (1): shard-skl

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_5197 -> IGTPW_3491

CI-20190529: 20190529
CI_DRM_6939: f839fe27dcaf8e4e0716c0b83a9481df3a1de27e @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3491: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/
IGT_5197: aa534ff47fd2f455c8be9e59eae807695b87fcdd @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3491/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Reviewed-by on v1 1/1
#4 lore raw
In reply to Petri Latvala
Quoted 5 lines · Petri Latvala

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.

Quoted 9 lines

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.

Quoted 15 lines
Cc Jani Saarinen <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
---
 tests/testdisplay_hotplug.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/testdisplay_hotplug.c +0 -0
index 581d987e..cd784895 100644
@@ -117,8 +117,10 @@ out:
 
 void testdisplay_cleanup_hotplug(void)

tests/testdisplay_hotplug.c out: · line 126

Quoted 10 lines
tests/testdisplay_hotplug.c +4 -2
 {
-	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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev