If the effective link count is zero when an NFS file handle request

comes in for it, the file is really gone, so return ESTALE.

The problem arises when the last reference to an FFS file is
released because soft-updates may delay the actual freeing of the
inode for some time. Since there are no filesystem links or open
file descriptors referencing the inode, from the point of view of
the system, the file is inaccessible. However, if the filesystem
is NFS exported, then the remote client can still access the inode
via ufs_fhtovp() until the inode really goes away. To prevent this
anomoly, it is necessary to begin returning ESTALE at the same time
that the file ceases to be accessible to the local filesystem.

Obtained from:	Ian Dowse <iedowse@maths.tcd.ie>
This commit is contained in:
Kirk McKusick 2001-05-13 23:30:45 +00:00
parent 319b2df8ad
commit 0b04113700
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=76557

View File

@ -205,7 +205,9 @@ ufs_fhtovp(mp, ufhp, vpp)
return (error);
}
ip = VTOI(nvp);
if (ip->i_mode == 0 || ip->i_gen != ufhp->ufid_gen) {
if (ip->i_mode == 0 ||
ip->i_gen != ufhp->ufid_gen ||
ip->i_effnlink <= 0) {
vput(nvp);
*vpp = NULLVP;
return (ESTALE);