2019-01-05 18:20:04 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Simplified xfstests generic/273
|
2019-01-23 22:14:31 +01:00
|
|
|
#
|
|
|
|
# Fails with
|
|
|
|
#
|
|
|
|
# cp: cannot create regular file 'sub_49/file_773': No such file or directory
|
|
|
|
#
|
|
|
|
# If you cannot reproduce, try running this in the background:
|
|
|
|
#
|
|
|
|
# while sleep 0.1 ; do echo 3 > /proc/sys/vm/drop_caches ; done"
|
|
|
|
#
|
|
|
|
# See https://github.com/rfjakob/gocryptfs/issues/322 for details.
|
2019-01-05 18:20:04 +01:00
|
|
|
|
2019-10-06 22:34:19 +02:00
|
|
|
if [[ -z $TMPDIR ]]; then
|
|
|
|
TMPDIR=/var/tmp
|
|
|
|
export TMPDIR
|
|
|
|
fi
|
|
|
|
|
2019-02-17 16:02:30 +01:00
|
|
|
cd "$(dirname "$0")"
|
2021-08-31 19:01:47 +02:00
|
|
|
MYNAME=$(basename "$0")
|
2019-02-17 16:02:30 +01:00
|
|
|
source ../fuse-unmount.bash
|
|
|
|
|
|
|
|
# Set the GOPATH variable to the default if it is empty
|
|
|
|
GOPATH=$(go env GOPATH)
|
|
|
|
|
|
|
|
# Backing directory
|
2021-08-31 19:01:47 +02:00
|
|
|
DIR=$(mktemp -d "$TMPDIR/$MYNAME.XXX")
|
|
|
|
$GOPATH/bin/gocryptfs -q -init -extpass "echo test" -scryptn=10 "$DIR"
|
2019-02-17 16:02:30 +01:00
|
|
|
|
|
|
|
# Mountpoint
|
|
|
|
MNT="$DIR.mnt"
|
2021-08-31 19:01:47 +02:00
|
|
|
mkdir "$MNT"
|
|
|
|
$GOPATH/bin/gocryptfs -q -extpass "echo test" -nosyslog "$DIR" "$MNT"
|
2019-02-17 16:02:30 +01:00
|
|
|
echo "Mounted gocryptfs $DIR at $MNT"
|
|
|
|
|
|
|
|
# Cleanup trap
|
|
|
|
trap "cd / ; fuse-unmount -z $MNT ; rm -rf $DIR $MNT" EXIT
|
|
|
|
|
2021-08-31 19:01:47 +02:00
|
|
|
cd "$MNT"
|
2019-01-05 18:20:04 +01:00
|
|
|
|
|
|
|
SECONDS=0
|
|
|
|
echo "creating files with dd"
|
|
|
|
mkdir -p origin
|
|
|
|
for i in $(seq 1 778) ; do
|
2021-08-31 19:01:47 +02:00
|
|
|
dd if=/dev/zero of="origin/file_$i" bs=8192 count=1 status=none
|
2019-01-05 18:20:04 +01:00
|
|
|
done
|
2019-01-23 22:14:31 +01:00
|
|
|
# Perform the shell expansion only once and store the list
|
|
|
|
ORIGIN_FILES=origin/*
|
2019-01-05 18:20:04 +01:00
|
|
|
|
|
|
|
echo -n "cp starting: "
|
|
|
|
for i in $(seq 1 100) ; do
|
|
|
|
echo -n "$i "
|
2021-08-31 19:01:47 +02:00
|
|
|
(mkdir "sub_$i" && cp $ORIGIN_FILES "sub_$i" ; echo -n "$i ") &
|
2019-01-05 18:20:04 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo -n "cp finished: "
|
|
|
|
wait
|
|
|
|
echo
|
|
|
|
echo "Runtime was $SECONDS seconds"
|