]> granicus.if.org Git - zfs/commitdiff
Fix symlink(2) inode reference count
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 17 Feb 2011 19:26:51 +0000 (11:26 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 17 Feb 2011 19:34:47 +0000 (11:34 -0800)
Under Linux sys_symlink(2) should result in a inode being created
with one reference for the inode itself, and a second reference on
the inode which is held by the new dentry.  Under Solaris this
appears not to be the case.  Their zfs_symlink() handler drops
the inode reference before returning.

The result of this under Linux is that the reference count for
symlinks is always one smaller than it should have been. This
results in a BUG() when the symlink is unlinked.  To handle this
the Linux port now keeps the inode reference which differs from
the Solaris behavior.  This results in correct reference counts.

Closes #96

module/zfs/zfs_vnops.c

index 8bff0ef4b70a21fbb3b04afb53db758f37fe2896..fcc85b8a08d5ee1500ebb19e80e1b290c481613a 100644 (file)
@@ -3169,7 +3169,6 @@ top:
        zfs_dirent_unlock(dl);
 
        *ipp = ZTOI(zp);
-       iput(ZTOI(zp));
 
        if (zsb->z_os->os_sync == ZFS_SYNC_ALWAYS)
                zil_commit(zilog, 0);