Re: the second open(2) call to file in samba 2.0 cifs mountpoint hang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 26, 2018 at 12:28:40PM +1000, ronnie sahlberg wrote:
> I have also built on linus current master and can not reprroduce there
> either. The oplocks are broken correctly.

You can run the reproducer miltiple times. It does not reproduce everytime.

> 
> Xiong,  since you can reproduce, can you try to git bisect and find
> which commit this failure started at ?

The oldest kernel I can reproduce this on is v4.2 Linus tree.
I got boot issue with v4.1. 

Thanks,
XIong

> 
snip..

----------------------------------------------------------

#! /bin/bash

err_exit() { echo -e $1; exit 1; }

setup_cifs()
{
	local cifs_tst_export=/export/cifstest
	local cifs_sch_export=/export/cifsscratch
	mkdir -p $cifs_tst_export $cifs_sch_export

	\cp -f /etc/samba/smb.conf{,.bak}
	cat > /etc/samba/smb.conf << EOF
[test]
    path = $cifs_tst_export
    writeable = yes
[scratch]
    path = $cifs_sch_export
    writeable = yes
EOF
	which systemctl && systemctl restart smb > /dev/null 2>&1
	service stop smb > /dev/null 2>&1
	restorecon /etc/samba/smb.conf
	testparm -s
	chcon -t samba_share_t $cifs_sch_export
	chcon -t samba_share_t $cifs_tst_export
	echo -e "redhat\nredhat" | smbpasswd -a root
	service start smb > /dev/null 2>&1
}

preset_cifs()
{
	local vers=${1:-3.0}
	echo Testing $vers
	TEST_DEV=//localhost/test
	SCRATCH_DEV=//localhost/scratch
	TEST_DIR=/cifsmnt
	SCRATCH_MNT=/cifssch
	umount $TEST_DEV $SCRATCH_DEV $TEST_DIR $SCRATCH_MNT > /dev/null 2>&1
	mkdir -p $TEST_DIR $SCRATCH_MNT
	MOUNT_OPTIONS="-o vers=${vers},username=root,password=redhat"
	TEST_FS_MOUNT_OPTS="-o vers=${vers},username=root,password=redhat"

	mount.cifs $TEST_DEV $TEST_DIR $MOUNT_OPTIONS || err_exit "cifs mount $TEST_DEV failed"
	mount.cifs $SCRATCH_DEV $SCRATCH_MNT $MOUNT_OPTIONS || err_exit "cifs mount $SCRATCH_DEV failed"
}

cleanup_cifs()
{
	killall open_wait open
	echo cnt=$cnt
	umount $TEST_DEV $SCRATCH_DEV $TEST_DIR $SCRATCH_MNT > /dev/null 2>&1
	\cp -f /etc/samba/smb.conf{.bak,}
	which systemctl && systemctl restart smb
	service stop smb > /dev/null 2>&1
	service start smb > /dev/null 2>&1
}

trap "cleanup_cifs; exit" 2

do_test()
{
	touch $SCRATCH_MNT/testfile
	mount | grep $SCRATCH_MNT
	cnt=0
	while true ; do
		while killall open_wait open ; do sleep 1; done
		./open_wait $SCRATCH_MNT/testfile &
		./open $SCRATCH_MNT/testfile 2>&1 | tee log
		grep -E "2\..* seconds" log && { echo reproduced; break; }
		((cnt++))
		[ $cnt -gt 100 ] && break
	done
	echo "cnt=$cnt"
}

start_debug()
{
	dmesg -C
	modprobe cifs
	echo 7 > /proc/fs/cifs/cifsFYI
	echo 'module cifs +p' > /sys/kernel/debug/dynamic_debug/control
	echo 'file fs/cifs/* +p' > /sys/kernel/debug/dynamic_debug/control
	tcpdump -i lo -s0 -w cifs-traffic.pcap host localhost and port 445 &
	pid=$!
	echo $pid
}

stop_debug()
{
	echo 0 > /proc/fs/cifs/cifsFYI
	echo 'module cifs -p' > /sys/kernel/debug/dynamic_debug/control
	echo 'file fs/cifs/* -p' > /sys/kernel/debug/dynamic_debug/control
	while kill -2 $pid ; do sleep 1; done
	dmesg > dmesg
	tcpdump -r cifs-traffic.pcap > pcap.log
	sleep 1
}

rpm -qv cifs-utils || yum intsall -y cifs-utils
rpm -qv samba || yum intsall -y samba samba-client
uname -r

cleanup_cifs
setup_cifs
cc open_wait.c -o open_wait
cc open.c -o open

preset_cifs 2.0
do_test

cleanup_cifs
rm -f open_wait open a.out
exit
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux