From patchwork Fri Apr 7 08:34:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ander Conselvan de Oliveira X-Patchwork-Id: 9669049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 60A07602B3 for ; Fri, 7 Apr 2017 08:34:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DA9125F31 for ; Fri, 7 Apr 2017 08:34:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4237A285CB; Fri, 7 Apr 2017 08:34:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E42BA25F31 for ; Fri, 7 Apr 2017 08:34:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7985F6EA7A; Fri, 7 Apr 2017 08:34:42 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 625F36EA7A for ; Fri, 7 Apr 2017 08:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491554081; x=1523090081; h=from:to:cc:subject:date:message-id; bh=rNiAHJq2/SVIOxiO75uG/MIE5TNEjuhJWvRwrDgsLR4=; b=XMcmVZ2TpVJihg+KtnDmrd1ToTijqLlDDxjP8kYlVteoz6rDfjg7Y9Gz rBAffiCCPDKxO1jRf/za+6XV0Kb1mQ==; Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Apr 2017 01:34:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,164,1488873600"; d="scan'208";a="953279578" Received: from linux.intel.com ([10.54.29.200]) by orsmga003.jf.intel.com with ESMTP; 07 Apr 2017 01:34:42 -0700 Received: from localhost (aconselv-mobl3.fi.intel.com [10.237.66.54]) by linux.intel.com (Postfix) with ESMTP id D38766A4080; Fri, 7 Apr 2017 01:34:31 -0700 (PDT) From: Ander Conselvan de Oliveira To: intel-gfx@lists.freedesktop.org Date: Fri, 7 Apr 2017 11:34:34 +0300 Message-Id: <20170407083434.28466-1-ander.conselvan.de.oliveira@intel.com> X-Mailer: git-send-email 2.9.3 Cc: Ander Conselvan de Oliveira Subject: [Intel-gfx] [PATCH i-g-t] lib/debugfs: Close dir before returning open debugs file X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Ander Conselvan de Oliveira Reviewed-by: Chris Wilson --- 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; } /**