# Re: \[PATCH 1/2\] tracing/selftests: Fix instance test to actually test races

- From: Steven Rostedt \<rostedt@kernel.org\>
- Date: 2026-10-30 01:21:11 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/10/17830182
- Thread: https://ratatoskr.run/linux-trace-kernel/2026/10/17829360/t.md

```text
On Fri, 30 Oct 2026 10:01:19 +0900
"Masami Hiramatsu (Google)" [ref] wrote:

> >  instance_slam() {
> > -        while :; do
> > -                mkdir foo 2> /dev/null
> > -                rmdir foo 2> /dev/null
> > -        done
> > +	mkdir foo 2> /dev/null
> > +	while ! rmdir foo; do
> > +		echo could not rmdir foo  
> 
> nit: If we retry this, do we need to warn it?
> (maybe we can add a limitation of continuous failure and make the
> test fail if the failure exceeds it.)

Retrying is actually quite normal. The rmdir *should* fail if one of
the instance files is open.

Now perhaps we can add a counter to make it fail if it exceeds a large
threshold?

	let x=0
	while ! rmdir  foo; do
		let x=$x+1
		if [ $x -gt 10000 ]; then
			exit_fail
		fi
	done

?

-- Steve
```
