Subject: kern/36637: Puffs's psshfs kills itself on any rename with ENODEV and will unmount
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <reinoud@NetBSD.org>
List: netbsd-bugs
Date: 07/12/2007 12:30:01
>Number:         36637
>Category:       kern
>Synopsis:       Puffs's psshfs kills itself on any rename with ENODEV and will unmount
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 12 12:30:00 +0000 2007
>Originator:     Reinoud Zandijk
>Release:        
>Organization:
NetBSD
>Environment:
NetBSD heethoofdje.13thmonkey.org 4.99.23 NetBSD 4.99.23 (GENERIC) #2: Thu Jul 12 02:59:03 CEST 2007  reinoud@heethoofdje.13thmonkey.org:/usr/sources/cvs.netbsd.org/src/sys/arch/i386/compile/GENERIC i386
>Description:
When mounting the puffs ssh file system using mount_psshfs, the file system will mount correctly and files can be created and modified fine. When renaming a file however, it will return ENODEV and the mount will be gone with a coredump of mount_psshfs.

Note that *some* renames work...
>How-To-Repeat:
heethoofdje# mount_psshfs reinoud@aapje.kasbah:/home/reinoud /puffs
Password: 
heethoofdje# cp .vimrc dot.vimrc
heethoofdje# mv dot.vimrc old.dot.vimrc
heethoofdje# ls -al old.dot.vimrc 
-rw-r-----  1 reinoud  users  4312 Jul 12 13:59 old.dot.vimrc
heethoofdje# cd UDF
heethoofdje# make
ar -rsc libuscsi.a uscsi_sense.o uscsi_subr.o
ar: unable to rename 'libuscsi.a' reason: Device not configured
*** Error code 1

Stop.
make: stopped in /puffs/UDF
heethoofdje# mount
/dev/wd0a on / type ffs (soft dependencies, NFS exported, local)
/dev/wd0e on /win2000 type ntfs (read-only, local)
kernfs on /kern type kernfs (local)
procfs on /usr/pkg/emul/linux/proc type procfs (local)
rangerover.kasbah:/home on /home type nfs
rangerover.kasbah:/var/mail on /var/mail type nfs
heethoofdje# 

ktrace gives:
 12931      1 ar       RET   write 3426/0xd62
 12931      1 ar       CALL  close(6)
 12931      1 ar       RET   close 0
 12931      1 ar       CALL  close(3)
 12931      1 ar       RET   close 0
 12931      1 ar       CALL  __lstat30(0x8056090,0xbfbfe598)
 12931      1 ar       NAMI  "libuscsi.a"
 12931      1 ar       RET   __lstat30 0
 12931      1 ar       CALL  rename(0x80560a0,0x8056090)
 12931      1 ar       NAMI  "st12931a"
 12931      1 ar       NAMI  "libuscsi.a"
 12931      1 ar       RET   rename -1 errno 6 Device not configured
...
 12931      1 ar       CALL  write(2,0xbfbfbe04,4)
 12931      1 ar       GIO   fd 2 wrote 4 bytes
       "ar: "
 12931      1 ar       RET   write 4
 12931      1 ar       CALL  write(2,0xbfbfbe34,0x3b)
 12931      1 ar       GIO   fd 2 wrote 59 bytes
       "unable to rename 'libuscsi.a' reason: Device not configured"
 12931      1 ar       RET   write 59/0x3b
 12931      1 ar       CALL  write(2,0x8052e3b,1)
 12931      1 ar       GIO   fd 2 wrote 1 bytes
       "
       "
 12931      1 ar       RET   write 1
 12931      1 ar       CALL  unlink(0x80560a0)
 12931      1 ar       NAMI  "st12931a"
 12931      1 ar       RET   unlink -1 errno 2 No such file or directory
 12931      1 ar       CALL  exit(1)


The trace of mount_psshfs is:
heethoofdje# gdb --core mount_psshfs.core /usr/sbin/mount_psshfs 
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf"...
Reading symbols from /usr/lib/libpuffs.so.0...done.
Loaded symbols for /usr/lib/libpuffs.so.0
Reading symbols from /usr/lib/libutil.so.7...done.
Loaded symbols for /usr/lib/libutil.so.7
Reading symbols from /usr/lib/libc.so.12...done.
Loaded symbols for /usr/lib/libc.so.12
Reading symbols from /usr/libexec/ld.elf_so...done.
Loaded symbols for /usr/libexec/ld.elf_so
Core was generated by `mount_psshfs'.
Program terminated with signal 6, Aborted.
#0  0xbbae6b9b in kill () from /usr/lib/libc.so.12
(gdb) where
#0  0xbbae6b9b in kill () from /usr/lib/libc.so.12
#1  0xbbb875b8 in abort () from /usr/lib/libc.so.12
#2  0xbbb49f8e in __assert13 () from /usr/lib/libc.so.12
#3  0xbbbc6115 in puffs_setback () from /usr/lib/libpuffs.so.0
#4  0x0804b934 in psshfs_node_remove (pcc=0x8087000, opc=0x8052100, targ=0x8052300, pcn=0x8697f88) at node.c:424
#5  0x0804bcfa in psshfs_node_rename (pcc=0x8087000, opc=0x8052100, src=0x8052500, pcn_src=0x8697fa0, targ_dir=0x8052100, 
    targ=0x8052300, pcn_targ=0x8697f88) at node.c:537
#6  0xbbbc53b4 in puffs_calldispatcher () from /usr/lib/libpuffs.so.0
#7  0xbbb09354 in swapcontext () from /usr/lib/libc.so.12
(gdb) 

#4  0x0804b934 in psshfs_node_remove (pcc=0x8087000, opc=0x8052100, targ=0x8052300, pcn=0x8697f88) at node.c:424
424                     puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);

(gdb) print *pcn
$3 = {pcn_pkcnp = 0x808b488, pcn_cred = 0x808b898, pcn_cid = 0x808b8ec, pcn_po_full = {po_path = 0x8050260, po_len = 28, 
    po_hash = 0}}
(gdb) print *pn_targ
$4 = {pn_size = 0, pn_flags = 0, pn_va = {va_type = VREG, va_mode = 33188, va_nlink = 1, va_uid = 103, va_gid = 100, 
    va_fsid = -1, va_fileid = 64, va_size = 8, va_blocksize = 4096, va_atime = {tv_sec = 1184242042, tv_nsec = 0}, 
    va_mtime = {tv_sec = 1184242042, tv_nsec = 0}, va_ctime = {tv_sec = 1184242042, tv_nsec = 0}, va_birthtime = {
      tv_sec = -1, tv_nsec = -1}, va_gen = 0, va_flags = 0, va_rdev = 4294967295, va_bytes = 0, va_filerev = 0, 
    va_vaflags = 0, va_spare = 0}, pn_data = 0x80551c0, pn_po = {po_path = 0x80500e0, po_len = 28, po_hash = 0}, 
  pn_mnt = 0x8051000, pn_entries = {le_next = 0x8052200, le_prev = 0x8052490}, pn_cacheinfo = {lh_first = 0x0}}


>Fix:
Unknown