xref: /freebsd/tools/test/stress2/misc/nullfs35.sh (revision ff6574d2508d6bc72247993787963dd84c4ff9dd)
1#!/bin/sh
2
3#
4# Copyright (c) 2026 Peter Holm <pho@FreeBSD.org>
5#
6# SPDX-License-Identifier: BSD-2-Clause
7#
8
9# "nullfs mount over a file" scenario, see D58178 and D58191
10
11set -u
12prog=$(basename "$0" .sh)
13
14file=/tmp/$prog.file
15mp=/tmp/$prog.mp
16sleep=/tmp/$prog.sleep
17rm -f $file
18touch $mp
19
20# Mounting and running a program
21cp /bin/date $file
22mount_nullfs $file $mp || exit 1
23$mp
24umount $mp
25
26# Display binary information for the process
27rm -f $file
28cp /bin/sleep $file
29mount_nullfs $file $mp || exit 1
30$mp 60 &
31sleep .2
32# "panic: condition vp->v_type == VDIR || VN_IS_DOOMED(vp) not met at vfs_cache.c:3547 (vn_fullpath_dir)" seen.
33procstat -b $!
34kill $!
35umount $mp
36
37# Mounting a link
38rm $file
39cp /bin/sleep $sleep
40ln $sleep $file
41mount_nullfs $file $mp || exit 1
42$mp 60 &
43sleep .2
44procstat -b $!
45kill $!
46umount $mp
47rm $sleep
48
49# Mounting a symbolic link
50rm $file
51ln -s /bin/sleep $file
52mount_nullfs $file $mp || exit 1
53$mp 60 &
54sleep .2
55procstat -b $!
56kill $!
57umount $mp
58
59# Mounting a fifo must fail
60rm $file
61mkfifo $file
62mount_nullfs $file $mp 2>/dev/null && exit 1
63
64rm -f $file $mp
65exit 0
66