Re: [PATCH v2] generic/707: Test moving directory while being grown

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



On Tue 31-01-23 00:04:01, Zorro Lang wrote:
> On Mon, Jan 30, 2023 at 03:56:39PM +0100, Jan Kara wrote:
> > +. ./common/preamble
> > +_begin_fstest auto
> > +
> > +_supported_fs generic
> > +_require_scratch
> > +
> > +_scratch_mkfs >>$seqres.full 2>&1
> > +_scratch_mount
> > +
> > +_cleanup()
> > +{
> > +	if [ -n "$BGPID" ]; then
> > +		# Stop background process
> > +		kill -9 $BGPID &>/dev/null
> > +		wait
> > +	fi
> 
> Neet to keep the code in common/preamble:_cleanup(), if you cover it:
> 
>         cd /
>         rm -f $tmp.*
> 
> especially you use pushd and popd.

OK, done.

> I forgot to ask, is this case written for someone known fix or change? If so,
> better to use _fixed_by_kernel_commit or _wants_kernel_commit.

Yes, good point. It tests for UDF & ext4 corruption issue. Ext4 commit is
not yet merged but I'll add there something.

> > +}
> > +
> > +# Loop multiple times trying to hit the race
> > +loops=$((100*TIME_FACTOR))
> > +files=500
> > +moves=500
> > +
> > +create_files()
> > +{
> > +	# We use slightly longer file name to make directory grow faster and
> > +	# hopefully convert between various types
> > +	for (( i = 0; i < $files; i++ )); do
> > +		touch somewhatlongerfilename$i
> > +	done
> > +}
> > +
> > +for (( i = 0; i <= $moves; i++ )); do
> > +	mkdir $SCRATCH_MNT/dir$i
> > +done
> > +
> > +for (( l = 0; l < $loops; l++ )); do
> > +	mkdir $SCRATCH_MNT/dir0/dir
> > +	pushd $SCRATCH_MNT/dir0/dir &>/dev/null
> > +	create_files &
> > +	BGPID=$!
> > +	popd &>/dev/null
> > +	for (( i = 0; i < $moves; i++ )); do
> > +		mv $SCRATCH_MNT/dir$i/dir $SCRATCH_MNT/dir$((i+1))/dir
> > +	done
> > +	wait
> > +	BGPID=""
> 
> unset BGPID might be better, but anyway :)

Yeah, nicer. Done.

								Honza

-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[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