3 # Test terminating an smbclient connection with outstanding
6 # Note this is designed to be run against
7 # the aio_delay_inject share which is preconfigured
8 # with 2 second delays on pread/pwrite.
11 echo Usage: test_aio_outstanding.sh \
12 SERVERCONFFILE SMBCLIENT IP aio_delay_inject_sharename
21 # Do not let deprecated option warnings muck this up
22 SAMBA_DEPRECATED_SUPPRESS=1
23 export SAMBA_DEPRECATED_SUPPRESS
25 incdir=$(dirname $0)/../../../testprogs/blackbox
30 cd $SELFTEST_TMPDIR || exit 1
33 # Note if we already have any panics in the smbd log.
35 panic_count_0=$(grep -c PANIC $SMBD_TEST_LOG)
37 # Create the smbclient communication pipes.
38 rm -f smbclient-stdin smbclient-stdout smbclient-stderr
39 mkfifo smbclient-stdin smbclient-stdout smbclient-stderr
41 # Create a large-ish testfile
42 rm aio_outstanding_testfile
43 head -c 20MB /dev/zero >aio_outstanding_testfile
45 CLI_FORCE_INTERACTIVE=1
46 export CLI_FORCE_INTERACTIVE
48 ${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \
49 <smbclient-stdin >smbclient-stdout 2>smbclient-stderr &
54 exec 100>smbclient-stdin 101<smbclient-stdout 102<smbclient-stderr
56 # consume the smbclient startup messages
59 # Ensure we're putting a fresh file.
60 echo "del aio_outstanding_testfile" >&100
61 echo "put aio_outstanding_testfile" >&100
65 # Terminate the smbclient write to the aio_delay_inject share whilst
66 # we have outstanding writes.
71 # Ensure the panic count didn't change.
73 # BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
76 panic_count_1=$(grep -c PANIC $SMBD_TEST_LOG)
78 # Rerun smbclient to remove the testfile on the server.
79 rm -f smbclient-stdin smbclient-stdout smbclient-stderr aio_outstanding_testfile
80 mkfifo smbclient-stdin smbclient-stdout
82 ${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \
83 <smbclient-stdin >smbclient-stdout &
87 exec 100>smbclient-stdin 101<smbclient-stdout
89 echo "del aio_outstanding_testfile" >&100
94 rm -f smbclient-stdin smbclient-stdout aio_outstanding_testfile
96 testit "check_panic" test $panic_count_0 -eq $panic_count_1 ||
97 failed=$(expr $failed + 1)