Question about synchronization (nfssvc, vfs_busy)

Konstantin Belousov kostikbel at gmail.com
Mon Jun 5 10:31:05 PDT 2006


On Mon, Jun 05, 2006 at 02:01:36PM +0300, Andrey Simonenko wrote:
> 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
If vfs_busy() is called without LK_NOWAIT and fs is being unmounted,
then vfs_busy returns with ENOENT error, isn't it ?

> 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()?
vfs_busy() internally increases the ref count for mount point, so, it cannot
be taken from under it (look for MNT_REF/MNT_REL). Simultameous entrance
into the code in question in vfs_busy/vfs_mount_destroy is protected
by mnt_mtx (MNT_ILOCK/MNT_IUNLOCK).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20060605/3712f375/attachment.pgp


More information about the freebsd-hackers mailing list