#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2019 Tencent.  All Rights Reserved.
#
# FS QA Test No. 585
#
# Regression test for:
#    bc56ad8c74b8: ("xfs: Fix deadlock between AGI and AGF with RENAME_WHITEOUT")
#
. ./common/preamble
_begin_fstest auto rename

# Import common functions.
. ./common/filter
. ./common/renameat2

# real QA test starts here
_supported_fs generic
_require_scratch
_require_renameat2 whiteout

_scratch_mkfs > $seqres.full 2>&1 || _fail "mkfs failed"
_scratch_mount >> $seqres.full 2>&1

# start a create and rename(rename_whiteout) workload. These processes
# occur simultaneously may cause the deadlock between AGI and AGF with
# RENAME_WHITEOUT.
$FSSTRESS_PROG -z -n 150 -p 100 \
		-f mknod=5 \
		-f rwhiteout=5 \
		-d $SCRATCH_MNT/fsstress >> $seqres.full 2>&1

echo Silence is golden

# Failure comes in the form of a deadlock.

# success, all done
status=0
exit
