NetBSD-Bugs archive

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

bin/51461: Processes hang when attempting to read from an empty file on psshfs mount

>Number:         51461
>Category:       bin
>Synopsis:       Processes hang when attempting to read from an empty file on psshfs mount
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 04 09:40:00 +0000 2016
>Originator:     Mateusz Poszwa
>Release:        NetBSD 7.99.36
System: NetBSD Bell 7.99.36 NetBSD 7.99.36 (GENERIC) #0: Sat Sep 3 13:07:03 CEST 2016 beb@Bell:/home/beb/sysbuild/amd64/obj/home/beb/sysbuild/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
	When a process attempts to read from an empty file originating
	from psshfs mount, it waits indefinitely. Until the hanged
	process is interrupted, the mounted filesystem appears to
	work as expected, except for the directory containing the
	empty file. Processes trying to list that directory also
	hang, and cause misbehaviour of the containing directory.
	It is possible to create a chain of hanged processes trying
	to read directories up to the mount point. At the same
	time, psshfs generates some network traffic (around 5KB/s,
	in my case). Interrupting the first hanged process causes
	emission of â??Device not configuredâ?? error message by all
	other hanged processes, and psshfs ceases to generate
	network traffic. Subsequent trials to list any affected
	directory or â?? if one of the affected directories is the mount
	point â?? to umount the filesystem, fail with the same error.
	A patch for an ATF test follows:
RCS file: /cvsroot/src/tests/fs/psshfs/,v
retrieving revision 1.7
diff -u -r1.7
---	16 Mar 2013 07:54:04 -0000	1.7
+++	3 Sep 2016 20:39:14 -0000
@@ -262,6 +262,26 @@
+atf_test_case read_empty_file cleanup
+read_empty_file_head() {
+	atf_set "descr" "Checks whether an empty file can be read"
+	# This test is supposed to make sure psshfs does not hang
+	# when reading from an empty file, hence the timeout.
+	atf_set "timeout" 8
+read_empty_file_body() {
+	require_puffs
+	start_ssh
+	atf_check mkdir root mnt
+	atf_check -x ': > root/empty'
+	mount_psshfs root mnt
+	atf_check cat mnt/empty
+read_empty_file_cleanup() {
+	umount mnt
+	stop_ssh
 # -------------------------------------------------------------------------
 # Initialization.
 # -------------------------------------------------------------------------
@@ -271,4 +291,5 @@
 	atf_add_test_case pwd
 	atf_add_test_case ls
 	#atf_add_test_case setattr_cache
+	atf_add_test_case read_empty_file
	To avoid this problem one must not read from empty files through
	psshfs. Determining whether a file is empty by means other than
	trying to read it does not cause problems described above.

Mateusz Poszwa

Home | Main Index | Thread Index | Old Index