mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-07 12:35:28 +00:00
Wait for stdin open in orphan-inodes test
The orphan inode test often uses a trick where it runs sleep in the abckground with a file as stdin as a means of holding files open. This can very rarely fail if the background sleep happens to be first schedled after the unlink of the file it's reading as stdin. A small delay gives it a chance to run and open the file before its unlinked. It's still possible to lose the race, of course, but so far this has been good enough. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -38,6 +38,7 @@ inode_exists $ino || echo "$ino didn't exist"
|
||||
|
||||
echo "== unlinked and opened inodes still exist"
|
||||
sleep 1000000 < "$path" &
|
||||
sleep .1 # wait for background sleep to run and open stdin
|
||||
pid="$!"
|
||||
rm -f "$path"
|
||||
inode_exists $ino || echo "$ino didn't exist"
|
||||
@@ -56,6 +57,7 @@ for nr in $(t_fs_nrs); do
|
||||
touch "$path"
|
||||
inos="$inos $(stat -c %i $path)"
|
||||
sleep 1000000 < "$path" &
|
||||
sleep .1 # wait for background sleep to run and open stdin
|
||||
pids="$pids $!"
|
||||
rm -f "$path"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user