Skip to content

Commit

Permalink
Attempt to handle taskq wait returning early
Browse files Browse the repository at this point in the history
to better deal with a NULL vp.

Signed-off-by: Jorgen Lundman <lundman@lundman.net>
  • Loading branch information
lundman committed Feb 1, 2024
1 parent 674ab11 commit a6951e4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions module/os/windows/zfs/zfs_vnops_windows_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,7 @@ zfs_znode_asyncwait(zfsvfs_t *zfsvfs, znode_t *zp)
// Work out if we need to block, that is, we have
// no vnode AND a taskq was launched. Unsure if we should
// look inside taskqent node like this.
again:
mutex_enter(&zp->z_attach_lock);
if (zp->z_vnode == NULL &&
zp->z_attach_taskq.tqent_func != NULL) {
Expand All @@ -1312,6 +1313,11 @@ zfs_znode_asyncwait(zfsvfs_t *zfsvfs, znode_t *zp)
}
mutex_exit(&zp->z_attach_lock);

// Why would it be NULL?
if (zp->z_vnode == NULL &&
zp->z_attach_taskq.tqent_func != NULL)
goto again;

out:
zfs_exit(zfsvfs, FTAG);
return (ret);
Expand All @@ -1327,6 +1333,11 @@ zfs_znode_asyncput_impl(znode_t *zp)
// This may block, if waiting is required.
zfs_znode_asyncwait(zp->z_zfsvfs, zp);

// This shouldn't happen
if (ZTOV(zp) == NULL) {
dprintf("%s: zp %p vp still NULL after wait?\n", __func__, zp);
return;
}
// Safe to release now that it is attached.
VN_RELE(ZTOV(zp));

Expand Down

0 comments on commit a6951e4

Please sign in to comment.