From patchwork Sat Sep 22 15:23:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10611457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 132145A4 for ; Sat, 22 Sep 2018 15:23:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03AB12AB3E for ; Sat, 22 Sep 2018 15:23:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC60B2AD15; Sat, 22 Sep 2018 15:23:49 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97DF82AB3E for ; Sat, 22 Sep 2018 15:23:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728983AbeIVVRp (ORCPT ); Sat, 22 Sep 2018 17:17:45 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39523 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728764AbeIVVRp (ORCPT ); Sat, 22 Sep 2018 17:17:45 -0400 Received: by mail-wr1-f67.google.com with SMTP id s14-v6so15544737wrw.6 for ; Sat, 22 Sep 2018 08:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=eowGmTZZKS42KyZBxhmr82OXoBmqaZh89mV01a5vm9o=; b=XQxPbehOJEXZheOeJ49TInZNFJZ7nWuv0p9skrY8XfmE/JLqr/A+0ZmUM/yUTF5zSv 5VMHwVuBzUElpb3NOJzjIAlCA+6GOur5BZp+ptTpk7AvC4OJdoyw3/vR6WcC2LvxHeyO DkYrBx4f+Vcj5XGVTB2/oPDJWM+2NUiVPJLG2BRe7apyylaeO1Xhs4Lf9SE8zbUDyYof Q0o7CCJ+TjiYjzqTDDyiM/ds1NDdLMhgtyc8Ej/33twYTiKm0Xk4r1gDkrQktTTOOqNP ckpeZXLIoZ+s21p0wqzXgmxW9KOA00aRIKoV6HyRjbz826LbNH+MmzngC+D0ys8283XP 0ctA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eowGmTZZKS42KyZBxhmr82OXoBmqaZh89mV01a5vm9o=; b=FNB/PuqNQbaYQ3HKONSwqQqaFmP5kcFldgNy/VirdABMj9cazCB5wP6iG3M4KJLfjE DIFgcS77VeEAMRmwIxr7kouAr3dbiy5ShVly6Tft/WbDQZLQtl2BUUDj75i6gt60gYfp 6LzE+xCnHRQbF2KFaLhhLd2RuJiY+bZJyN9n19RFY8gFb/inr+1frmI/2UykgZ/XzwdK Rx+b1GRgQllTr8SqPWC+Ck13trx/MgcSyIGezVmQMPEfd0NpnOgEyPAwS46OvJBJkuqw 4WnVlL9Xv+/LVjBxN7YmqlSy2HNvTZgt1j48PKnFI+KNFvBcE3SE9aUQWaeX3jFp9hGL LgcQ== X-Gm-Message-State: ABuFfohzXqur/ggbI5G6tjMStEnj6l4eEQuMFccNWZvKMfodcxa/T8XQ iRKB6Hf8bqDnopG4tdh1vOA= X-Google-Smtp-Source: ACcGV60Em7mT0UI6WVgZKUdqlOdMp5ZfE6ielU3kL2r0gyMV7DsYfUTPL93DnrdztHO+dZXdYnDLyQ== X-Received: by 2002:a5d:6782:: with SMTP id v2-v6mr2311276wru.245.1537629827180; Sat, 22 Sep 2018 08:23:47 -0700 (PDT) Received: from localhost.localdomain ([141.226.14.107]) by smtp.gmail.com with ESMTPSA id h73-v6sm21388329wma.11.2018.09.22.08.23.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Sep 2018 08:23:45 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: fstests@vger.kernel.org Subject: [PATCH v2] common/rc: fix check for disabled kmemleak Date: Sat, 22 Sep 2018 18:23:39 +0300 Message-Id: <20180922152339.32023-1-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With kernel commit b353756b2b71 ("kmemleak: always register debugfs file") that was merged to v4.19-rc3, the kmemleak debugfs knob exists even if kmemleak is disabled, but returns EBUSY on write. Suppress EBUSY errors in tests by disabling _check_kmemleak() calls if the write to kmemleak knob failed on _init_kmemleak(). Signed-off-by: Amir Goldstein --- Eryu, Good suggestion. This approach is much better and also works. Thanks, Amir. Changes from v1: - Use a file to disable checks instead of hacky chmod a-w common/rc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/common/rc b/common/rc index ec631ad9..d5bb1fee 100644 --- a/common/rc +++ b/common/rc @@ -3508,14 +3508,23 @@ _init_kmemleak() { local kern_knob="${DEBUGFS_MNT}/kmemleak" + # Since kernel v4.19-rc3, the kmemleak knob exists even if kmemleak is + # disabled, but returns EBUSY on write. So instead of relying on + # existance of writable knob file, we use a test file to indicate that + # _check_kmemleak() is enabled only if we actually managed to write to + # the knob file. + rm -f ${RESULT_BASE}/check_kmemleak + if [ ! -w "$kern_knob" ]; then return 0 fi # Disable the automatic scan so that we can control it completely, # then dump all the leaks recorded so far. - echo "scan=off" > "$kern_knob" - _capture_kmemleak /dev/null + if echo "scan=off" > "$kern_knob" 2>/dev/null; then + _capture_kmemleak /dev/null + touch ${RESULT_BASE}/check_kmemleak + fi } # check kmemleak log @@ -3524,7 +3533,7 @@ _check_kmemleak() local kern_knob="${DEBUGFS_MNT}/kmemleak" local leak_file="${seqres}.kmemleak" - if [ ! -w "$kern_knob" ]; then + if [ ! -f ${RESULT_BASE}/check_kmemleak ]; then return 0 fi