#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2021 Christian Brauner.  All Rights Reserved.
#
# FS QA Test 645
#
# Test that idmapped mounts behave correctly with complex user namespaces.
#
. ./common/preamble
_begin_fstest auto quick idmapped mount

# get standard environment, filters and checks
. ./common/filter


_require_idmapped_mounts
_require_test
_require_chown
_wants_kernel_commit dacfd001eaf2 \
	"fs/mnt_idmapping.c: Return -EINVAL when no map is written"

echo "Silence is golden"

$here/src/vfs/vfstest --test-nested-userns \
	--device "$TEST_DEV" --mount "$TEST_DIR" --fstype "$FSTYP" \
	> $tmp.vfstest 2>&1

if grep -q "No space left on device" $tmp.vfstest; then
	_notrun "$TEST_DEV ran out of free blocks/inodes"
fi

cat $tmp.vfstest
status=$?
exit
