Fix symlink(2) inode reference count

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
This commit is contained in:
Brian Behlendorf 2011-02-17 11:26:51 -08:00
parent 5095000169
commit efd1832bc6

View File

@ -3169,7 +3169,6 @@ zfs_symlink(struct inode *dip, char *name, vattr_t *vap, char *link,
zfs_dirent_unlock(dl);
*ipp = ZTOI(zp);
iput(ZTOI(zp));
if (zsb->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, 0);