Peter Harvey wrote: > Hi Amit, > > Good to hear from someone working on OpenSolaris internals. > >> VFS_ROOT() is called after actual file system has been mounted. So >> after VFS_ROOT() root vnode should always have a count >= 2. But when >> I tried the same exercise with NFS3 it turned out to be 1 (which >> according to me should have been at least 2) Can anybody throw some >> light why is it so? > > I don't know why this is so. > > I'd be using DTrace to trace the holds and where they were applied. > > -- Peter
As I remember, the nfs client does not maintain an active ref on the root vnode. This seems to be confirmed by inspection, at the tail end of nfs3_mount, the code drops the reference. And, looking at nfs3_root, we see the code getting the vnode by searching for the matching file handle. So, this is expected behavior. The vnode/vfs interface does not require the filesystem to do this; nfs does not, other filesystems probably do. I think this makes it easier to do failover. During a failover, the value of the root file handle will (most likely) change. Using this "soft reference" model, we will always pick up the current root fh from mi_curr_serv->sv_fhandle rather than continuing to use the (potentially) old stale root vnode. -- Bill Baker, 512-401-1081, x64081