1#!/bin/sh 2 3# Test scenario from: 4# Bug 295826 - kern_renameat() infinite loop 5# D57453: Avoid infinite loop in renameat(2) 6 7set -u 8root=/root 9cd $root 10mkdir -p $root/test_loop/a 11mkdir -p $root/test_loop/b 12echo '123' > $root/test_loop/b/file 13touch $root/test_loop/a/file 14mount_nullfs -o rw -o nocache -o noatime -o noexec -o nosuid $root/test_loop/b/file $root/test_loop/a/file 15echo '123' > /tmp/file 16 17# The "mv" would spin 18mv /tmp/file $root/test_loop/a/file 19 20umount $root/test_loop/a/file 21rm -rf /tmp/file $root/test_loop 22exit 23