Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Carbon > File Management >

Third party VFS can't unmount on Mac OS X 10.3


Q: I've developed a VFS plug-in for Mac OS X. The plug-in worked fine on Mac OS X version 10.2. However, on Mac OS X version 10.3 I can't unmount my volumes. The unmount fails with an EBUSY error because there are extraneous references to the root vnode. How do I fix this?

A: Apple made changes in Mac OS X version 10.3 "Panther" that cause the VFS layer to hold extra references to your volume's root vnode. Depending on how your xxx_unmount vnode operation (VOP) is implemented, you may find that an attempt to unmount your volume fails with the error EBUSY. Specifically, your xxx_unmount VOP should call vflush before checking the v_usecount field of the root vnode.

For example, your existing xxx_unmount VOP might look like that shown in Listing 1, but it should look like that shown in Listing 2.



Listing 1. The wrong way to implement your xxx_unmount VOP.

if (rootvp->v_usecount > 1 && !(flags & FORCECLOSE)) {
    return EBUSY;
}
error = vflush(mp, rootvp, flags);
if (error != 0) {
    return error;
}




Listing 2. The right way to implement your xxx_unmount VOP.

error = vflush(mp, rootvp, flags);
if (error != 0) {
    return error;
}
if (rootvp->v_usecount > 1 && !(flags & FORCECLOSE)) {
    return EBUSY;
}


The effect of this problem is that your volume appears to be in use, and is thus unmountable, even when no files are open on it. This should not affect other aspects of the volume's behavior.


[Oct 23, 2003]