aboutsummaryrefslogtreecommitdiff
path: root/tools/test/stress2/misc/rename18.sh
blob: a835cd10e65d93fdc22f58db232c05483d8d2e01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# Test scenario from:
# Bug 295826 - kern_renameat() infinite loop
# D57453: Avoid infinite loop in renameat(2)

set -u
root=/root
cd $root
mkdir -p $root/test_loop/a
mkdir -p $root/test_loop/b
echo '123' > $root/test_loop/b/file
touch $root/test_loop/a/file
mount_nullfs -o rw -o nocache -o noatime -o noexec -o nosuid $root/test_loop/b/file $root/test_loop/a/file
echo '123' > /tmp/file

# The "mv" would spin
mv /tmp/file $root/test_loop/a/file

umount $root/test_loop/a/file
rm -rf /tmp/file $root/test_loop
exit