From 0b041137004f55b30b8e4cd8a8fc408f0a86c15d Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Sun, 13 May 2001 23:30:45 +0000 Subject: [PATCH] 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 --- sys/ufs/ufs/ufs_vfsops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index 13694655567..5c293df97b5 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -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);