[PATCH v2] common/rc: cleanup old .kmemleak files

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



I've spent a non-negligible amount of time looking into a kmemleak that
didn't exist in the code I was testing because there was an old .kmemleak
file in the results directory.  I don't think this is an intended behaviour,
so I'm proposing to remove these files everytime we capture the result of a
new scan.

Signed-off-by: Luís Henriques <lhenriques@xxxxxxx>
---
 common/rc | 2 ++
 1 file changed, 2 insertions(+)

Changes since v1:
I realised that _capture_kmemleak() is called with /dev/null as argument, so
this version is probably better.

diff --git a/common/rc b/common/rc
index 741579af82d2..6850889e815e 100644
--- a/common/rc
+++ b/common/rc
@@ -4433,6 +4433,8 @@ _capture_kmemleak()
 	local kern_knob="$DEBUGFS_MNT/kmemleak"
 	local leak_file="$1"
 
+	[ -f "$leak_file" ] && rm -f "$leak_file"
+
 	# Tell the kernel to scan for memory leaks.  Apparently the write
 	# returns before the scan is complete, so do it twice in the hopes
 	# that twice is enough to capture all the leaks.



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux