fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] common/rc: create $RESULT_BASE before dumping kmemleak leaks
@ 2018-12-20 12:52 Johannes Thumshirn
  2018-12-20 16:30 ` Darrick J. Wong
  2018-12-21  5:13 ` Eryu Guan
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2018-12-20 12:52 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, Johannes Thumshirn

In _init_kmemleak() we're touching a check_kmemleak file in ${RESULT_BASE}
if ${DEBUGFS_MNT/kmemleak} exists as a marker that we have to check for
kmemleak output after running a test.

In 'check' we're calling _init_kmemleak() at around 60% of the file, but
${RESULT_BASE} is created later at around 62% of the file, causing the
'touch' in _init_kmemleak() to fail.

The workaround to this is creating ${RESULT_BASE} before touching
${RESULT_BASE}/check_kmemleak to always have the marker.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 common/rc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/rc b/common/rc
index e5da648466eb..5565b63e07ed 100644
--- a/common/rc
+++ b/common/rc
@@ -3528,6 +3528,7 @@ _init_kmemleak()
 	# then dump all the leaks recorded so far.
 	if echo "scan=off" > "$kern_knob" 2>/dev/null; then
 		_capture_kmemleak /dev/null
+		mkdir -p ${RESULT_BASE}
 		touch ${RESULT_BASE}/check_kmemleak
 	fi
 }
-- 
2.16.4

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

* Re: [PATCH] common/rc: create $RESULT_BASE before dumping kmemleak leaks
  2018-12-20 12:52 [PATCH] common/rc: create $RESULT_BASE before dumping kmemleak leaks Johannes Thumshirn
@ 2018-12-20 16:30 ` Darrick J. Wong
  2018-12-21  5:13 ` Eryu Guan
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2018-12-20 16:30 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Eryu Guan, fstests

On Thu, Dec 20, 2018 at 01:52:22PM +0100, Johannes Thumshirn wrote:
> In _init_kmemleak() we're touching a check_kmemleak file in ${RESULT_BASE}
> if ${DEBUGFS_MNT/kmemleak} exists as a marker that we have to check for
> kmemleak output after running a test.
> 
> In 'check' we're calling _init_kmemleak() at around 60% of the file, but
> ${RESULT_BASE} is created later at around 62% of the file, causing the
> 'touch' in _init_kmemleak() to fail.
> 
> The workaround to this is creating ${RESULT_BASE} before touching
> ${RESULT_BASE}/check_kmemleak to always have the marker.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>

Looks reasonable to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  common/rc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/rc b/common/rc
> index e5da648466eb..5565b63e07ed 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3528,6 +3528,7 @@ _init_kmemleak()
>  	# then dump all the leaks recorded so far.
>  	if echo "scan=off" > "$kern_knob" 2>/dev/null; then
>  		_capture_kmemleak /dev/null
> +		mkdir -p ${RESULT_BASE}
>  		touch ${RESULT_BASE}/check_kmemleak
>  	fi
>  }
> -- 
> 2.16.4
> 

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

* Re: [PATCH] common/rc: create $RESULT_BASE before dumping kmemleak leaks
  2018-12-20 12:52 [PATCH] common/rc: create $RESULT_BASE before dumping kmemleak leaks Johannes Thumshirn
  2018-12-20 16:30 ` Darrick J. Wong
@ 2018-12-21  5:13 ` Eryu Guan
  1 sibling, 0 replies; 3+ messages in thread
From: Eryu Guan @ 2018-12-21  5:13 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: fstests

On Thu, Dec 20, 2018 at 01:52:22PM +0100, Johannes Thumshirn wrote:
> In _init_kmemleak() we're touching a check_kmemleak file in ${RESULT_BASE}
> if ${DEBUGFS_MNT/kmemleak} exists as a marker that we have to check for
> kmemleak output after running a test.
> 
> In 'check' we're calling _init_kmemleak() at around 60% of the file, but
> ${RESULT_BASE} is created later at around 62% of the file, causing the
> 'touch' in _init_kmemleak() to fail.
> 
> The workaround to this is creating ${RESULT_BASE} before touching
> ${RESULT_BASE}/check_kmemleak to always have the marker.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  common/rc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/rc b/common/rc
> index e5da648466eb..5565b63e07ed 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3528,6 +3528,7 @@ _init_kmemleak()
>  	# then dump all the leaks recorded so far.
>  	if echo "scan=off" > "$kern_knob" 2>/dev/null; then
>  		_capture_kmemleak /dev/null
> +		mkdir -p ${RESULT_BASE}

Hmm, hiding the $RESULT_BASE creation here seems odd to me. I'd suggest
create $RESULT_BASE just after setting the default value in
common/config (in get_next_config()), which is sourced by common/rc then
by check, so we get all the environment setup before calling
_init_kmemleak().

Thanks,
Eryu

>  		touch ${RESULT_BASE}/check_kmemleak
>  	fi
>  }
> -- 
> 2.16.4
> 

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

end of thread, other threads:[~2018-12-21  5:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-20 12:52 [PATCH] common/rc: create $RESULT_BASE before dumping kmemleak leaks Johannes Thumshirn
2018-12-20 16:30 ` Darrick J. Wong
2018-12-21  5:13 ` Eryu Guan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).