git: c041b82c59e8 - main - ffs: do not return ESTALE on attempt to ffs_unotovp() on unlinked inode

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 03 Jul 2026 00:28:39 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=c041b82c59e885d106f45454302bad3d9dcc58a7

commit c041b82c59e885d106f45454302bad3d9dcc58a7
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-07-01 01:14:45 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-07-03 00:28:23 +0000

    ffs: do not return ESTALE on attempt to ffs_unotovp() on unlinked inode
    
    The consequences are:
    - for nfs exports and fhopen(2), unlinked but still referenced inodes
      are accessible
    - for ffs_vput_pair() with unlock_vp = false, spurious ESTALE is not
      returned when the inode is still alive but unlinked
    
    Note that tmpfs does not return ESTALE for the unlinked nodes.
    The same behavior is claimed for Linux in
    https://github.com/openzfs/zfs/issues/18699
    
    Reviewed by:    rmacklem
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D57982
---
 sys/ufs/ffs/ffs_vfsops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 11afa99bea76..a9b04bd290bd 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1962,7 +1962,7 @@ ffs_inotovp(struct mount *mp,
 		return (ESTALE);
 
 	ip = VTOI(nvp);
-	if (ip->i_mode == 0 || ip->i_gen != gen || ip->i_effnlink <= 0) {
+	if (ip->i_mode == 0 || ip->i_gen != gen) {
 		if (ip->i_mode == 0)
 			vgone(nvp);
 		vput(nvp);