Subject: unmounting problems
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 07/20/1995 10:47:14
I'm having some trouble with NFS. I'm playing with some filesystem
stuff, which for ease of implementation I'm doing as an NFS server on
an unusual port number. I've implemented only three calls, but those
are the only calls that are being made (the rest are stubs that among
other things print out the fact that they got called); they're statfs,
getattr, and lookup.
The problems come when I try to unmount the filesystem. If I use
/sbin/umount, it fails. The mount point is /tfs/test/1/mount, and when
I run "umount -f /tfs/test/1/mount" it says "/tfs/test/1: No such file
or directory", which if taken literally is simply incorrect. Using
ktrace on umount reveals that it's doing a chdir() to /tfs/test/1/mount
and then appears to be walking up the filesystem tree a la /bin/pwd,
but getting confused (kdump output appended). When this happens, the
only NFS requests made are a getattr on the filesystem's root (which
happens only sometimes) and a lookup of "." in that root. umount
doesn't normally hiccup like this; what am I doing wrong?
The program includes a call to unmount(2) to unmount the filesystem
if (unmount(mount_point,MNT_FORCE) < 0)
{ fprintf(stderr,"%s: unmount: %s\n",argvec[0],strerror(errno));
exit(1);
}
which normally works. But in one case another process had its cwd on
the filesystem, and unmount() returned EBUSY, without unmounting
anything. Is this a bug in MNT_FORCE, or am I misunderstanding
something?
I've even dumped out packet contents and they are what they should be.
That kdump output from umount(8) is appended after my signature.
der Mouse
mouse@collatz.mcrcim.mcgill.edu
263 ktrace NAMI "/sbin/umount"
263 umount RET execve 0
263 umount CALL sync
263 umount RET sync 0
263 umount CALL open(0x2e40,0,0xd624)
263 umount NAMI "."
263 umount RET open 3
263 umount CALL chdir(0xf7fff168)
263 umount NAMI "/tfs/test/1"
263 umount RET chdir 0
263 umount CALL lstat(0xf7fff174,0xf7fff078)
263 umount NAMI "mount"
263 umount RET lstat 0
263 umount CALL chdir(0xf7fff174)
263 umount NAMI "mount"
263 umount RET chdir 0
263 umount CALL __sysctl(0xf7ffeac0,0x2,0x1ed88,0xf7ffeabc,0,0)
263 umount RET __sysctl 4
263 umount CALL break(0x1ee48)
263 umount RET break 0
263 umount CALL break(0x1effc)
263 umount RET break 0
263 umount CALL break(0x1fffc)
263 umount RET break 0
263 umount CALL stat(0x8f50,0xf7ffebb0)
263 umount NAMI "/"
263 umount RET stat 0
263 umount CALL lstat(0x1f000,0xf7ffebb0)
263 umount NAMI "."
263 umount RET lstat 0
263 umount CALL open(0x1f000,0x4,0xf85cd900)
263 umount NAMI ".."
263 umount RET open 4
263 umount CALL fstat(0x4,0xf7ffea68)
263 umount RET fstat 0
263 umount CALL fcntl(0x4,0x2,0x1)
263 umount RET fcntl 0
263 umount CALL break(0x20ffc)
263 umount RET break 0
263 umount CALL fstatfs(0x4,0xf7ffe968)
263 umount RET fstatfs 0
263 umount CALL break(0x22ffc)
263 umount RET break 0
263 umount CALL break(0x23ffc)
263 umount RET break 0
263 umount CALL fstat(0x4,0xf7ffebb0)
263 umount RET fstat 0
263 umount CALL getdirentries(0x4,0x21000,0x1000,0x20014)
263 umount RET getdirentries 512/0x200
263 umount CALL lstat(0x1f000,0xf7ffebb0)
263 umount NAMI "../lower"
263 umount RET lstat 0
263 umount CALL lstat(0x1f000,0xf7ffebb0)
263 umount NAMI "../upper"
263 umount RET lstat 0
263 umount CALL lstat(0x1f000,0xf7ffebb0)
263 umount NAMI "../mount"
263 umount RET lstat 0
263 umount CALL getdirentries(0x4,0x21000,0x1000,0x20014)
263 umount RET getdirentries 0
263 umount CALL fchdir(0x3)
263 umount RET fchdir 0
263 umount CALL close(0x3)
263 umount RET close 0
263 umount CALL write(0x2,0xf7ffe808,0x8)
263 umount GIO fd 2 wrote 8 bytes
"umount: "
263 umount RET write 8
263 umount CALL write(0x2,0xf7ffe870,0xb)
263 umount GIO fd 2 wrote 11 bytes
"/tfs/test/1"
263 umount RET write 11/0xb
263 umount CALL write(0x2,0xf7ffe808,0x2)
263 umount GIO fd 2 wrote 2 bytes
": "
263 umount RET write 2
263 umount CALL stat(0xf7ffeb38,0xf7ffead8)
263 umount NAMI "/usr/share/nls/C/libc.cat"
263 umount RET stat 0
263 umount CALL open(0xf7ffeb38,0,0x13458)
263 umount NAMI "/usr/share/nls/C/libc.cat"
263 umount RET open 3
[...a whole bunch of stuff reading fd 3 deleted...]
263 umount CALL close(0x3)
263 umount RET close 0
263 umount CALL write(0x2,0xf7ffe808,0x1a)
263 umount GIO fd 2 wrote 26 bytes
"No such file or directory
"
263 umount RET write 26/0x1a
263 umount CALL exit(0x1)