Skip to content

Commit

Permalink
Linux: hash in tmpfile inode when linked
Browse files Browse the repository at this point in the history
afa7b34 didn't account for when tmpfile gets linked, the inode
was still I_NEW even after it was linked and should thus be
hashed in

Fixes openzfs#16608

Signed-off-by: Pavel Snajdr <[email protected]>
  • Loading branch information
snajpa committed Oct 24, 2024
1 parent 877d96c commit 8c12656
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions module/os/linux/zfs/zfs_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
uint64_t mtime[2], ctime[2];
uint64_t links;
int count = 0;
int need_unlock = 0;
int error;

mutex_enter(&zp->z_lock);
Expand Down Expand Up @@ -855,6 +856,8 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
zp->z_unlinked = B_FALSE;
VERIFY(zap_remove_int(zfsvfs->z_os,
zfsvfs->z_unlinkedobj, zp->z_id, tx) == 0);
insert_inode_locked(ZTOI(zp));
need_unlock = 1;
}

/*
Expand Down Expand Up @@ -903,6 +906,9 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
ASSERT(error == 0);
mutex_exit(&dzp->z_lock);

if (need_unlock)
unlock_new_inode(ZTOI(zp));

return (0);
}

Expand Down Expand Up @@ -999,6 +1005,9 @@ zfs_drop_nlink_locked(znode_t *zp, dmu_tx_t *tx, boolean_t *unlinkedp)
else if (unlinked)
zfs_unlinked_add(zp, tx);

if (z->z_is_tmpfile && unlinked)
remove_inode_hash(ZTOI(zp));

return (0);
}

Expand Down

0 comments on commit 8c12656

Please sign in to comment.