* [PATCH v2] common/rc: fix check for disabled kmemleak
@ 2018-09-22 15:23 Amir Goldstein
0 siblings, 0 replies; only message in thread
From: Amir Goldstein @ 2018-09-22 15:23 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests
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 <amir73il@gmail.com>
---
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
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-09-22 21:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-22 15:23 [PATCH v2] common/rc: fix check for disabled kmemleak Amir Goldstein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox