Add missing zfs_exit() when snapdir is disabled (#16912)

zfs_vget doesn't zfs_exit when erroring out due to snapdir
being disabled.

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: @bmeagherix
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
This commit is contained in:
Andrew Walker 2024-12-30 19:06:48 -06:00 committed by Brian Behlendorf
parent c2d9494f99
commit 679b164cd3

View File

@ -1702,13 +1702,14 @@ zfs_vget(struct super_block *sb, struct inode **ipp, fid_t *fidp)
/* A zero fid_gen means we are in the .zfs control directories */ /* A zero fid_gen means we are in the .zfs control directories */
if (fid_gen == 0 && if (fid_gen == 0 &&
(object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) { (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) {
*ipp = zfsvfs->z_ctldir;
ASSERT(*ipp != NULL);
if (zfsvfs->z_show_ctldir == ZFS_SNAPDIR_DISABLED) { if (zfsvfs->z_show_ctldir == ZFS_SNAPDIR_DISABLED) {
zfs_exit(zfsvfs, FTAG);
return (SET_ERROR(ENOENT)); return (SET_ERROR(ENOENT));
} }
*ipp = zfsvfs->z_ctldir;
ASSERT(*ipp != NULL);
if (object == ZFSCTL_INO_SNAPDIR) { if (object == ZFSCTL_INO_SNAPDIR) {
VERIFY(zfsctl_root_lookup(*ipp, "snapshot", ipp, VERIFY(zfsctl_root_lookup(*ipp, "snapshot", ipp,
0, kcred, NULL, NULL) == 0); 0, kcred, NULL, NULL) == 0);