All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/debugfs: Close dir before returning open debugs file
@ 2017-04-07  8:34 Ander Conselvan de Oliveira
  2017-04-07  8:54 ` Chris Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Ander Conselvan de Oliveira @ 2017-04-07  8:34 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ander Conselvan de Oliveira

The function igt_debugfs_open() would not close the debugfs dir before
returning. Tests that do a lot of pipe CRC comparaions, such as
kms_cursor_crc,  would eventually fail.

(kms_cursor_crc:3853) igt-debugfs-CRITICAL: Test assertion failure function igt_pipe_crc_do_start, file igt_debugfs.c:387:
(kms_cursor_crc:3853) igt-debugfs-CRITICAL: Failed assertion: err == 0
(kms_cursor_crc:3853) igt-debugfs-CRITICAL: Last errno: 24, Too many open files
(kms_cursor_crc:3853) igt-debugfs-CRITICAL: error: -24 != 0

83884e97e187 ("Restore "lib: Open debugfs files for the given DRM device"")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
---
 lib/igt_debugfs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index d64694c..fb6d521 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -212,13 +212,17 @@ int igt_debugfs_dir(int device)
  */
 int igt_debugfs_open(int device, const char *filename, int mode)
 {
-	int dir;
+	int dir, ret;
 
 	dir = igt_debugfs_dir(device);
 	if (dir < 0)
 		return dir;
 
-	return openat(dir, filename, mode);
+	ret = openat(dir, filename, mode);
+
+	close(dir);
+
+	return ret;
 }
 
 /**
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t] lib/debugfs: Close dir before returning open debugs file
  2017-04-07  8:34 [PATCH i-g-t] lib/debugfs: Close dir before returning open debugs file Ander Conselvan de Oliveira
@ 2017-04-07  8:54 ` Chris Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2017-04-07  8:54 UTC (permalink / raw)
  To: Ander Conselvan de Oliveira; +Cc: intel-gfx

On Fri, Apr 07, 2017 at 11:34:34AM +0300, Ander Conselvan de Oliveira wrote:
> The function igt_debugfs_open() would not close the debugfs dir before
> returning. Tests that do a lot of pipe CRC comparaions, such as
> kms_cursor_crc,  would eventually fail.
> 
> (kms_cursor_crc:3853) igt-debugfs-CRITICAL: Test assertion failure function igt_pipe_crc_do_start, file igt_debugfs.c:387:
> (kms_cursor_crc:3853) igt-debugfs-CRITICAL: Failed assertion: err == 0
> (kms_cursor_crc:3853) igt-debugfs-CRITICAL: Last errno: 24, Too many open files
> (kms_cursor_crc:3853) igt-debugfs-CRITICAL: error: -24 != 0

Whoops. Also for any test that repeatedly opens a debugfs, please do
move the igt_debugfs_dir() into the caller so we can cache the lookup
inside the fd.

> 83884e97e187 ("Restore "lib: Open debugfs files for the given DRM device"")
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-04-07  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07  8:34 [PATCH i-g-t] lib/debugfs: Close dir before returning open debugs file Ander Conselvan de Oliveira
2017-04-07  8:54 ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.