Question about synchronization (nfssvc, vfs_busy)

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Mon Jun 5 04:01:40 PDT 2006


Greetings,

Can somebody comment following questions?  I want to know where
I'm wrong (I checked CURRENT).

1.

If the nfsserver is a KLD, then it can be unloaded.  There is the
nfssvc(2) which is implemented in nfsserver and it is called without
Giant.  Suppose nfsrv_numnfsd is equal to 0 and some process calls
nfssvc(NFSSVC_ADDSOCK), as the result copyin() is called, which can
sleep due to possible vm fault, I do not even mention thread
preemption.

Now nfsserver is unloaded, since nfsrv_numnfsd is equal to zero;
when blocked process in copyin() wakes up, it will be continue
execution in non-existent KVM address space.

2.

If vfs_busy() is called without LK_NOWAIT flag, then it can sleep
if a filesystem is being unmounted.  At some point unmount() will
reach vfs_mount_destroy() and since there is one ref from vfs_busy()
it will sleep 3 seconds and will notice MNTK_MWAIT flag and wake up
a process, which is sleeping in vfs_busy().  How woken up process
can work with mount structure in vfs_busy() after wakeup(), which
could be already deallocated in vfs_mount_destroy()?


More information about the freebsd-hackers mailing list