Skip to content

Commit

Permalink
Fix symlink(2) inode reference count
Browse files Browse the repository at this point in the history
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
  • Loading branch information
behlendorf committed Feb 17, 2011
1 parent 5095000 commit efd1832
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion module/zfs/zfs_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit efd1832

Please sign in to comment.