From 356e698011b20ccba9c0a3f211e2a7761490875c Mon Sep 17 00:00:00 2001 From: "Jason A. Harmening" Date: Sat, 25 Mar 2023 20:50:55 -0500 Subject: [PATCH] unionfs(): destroy root vnode if upper registration fails If unionfs_domount() fails, the mount path will not call VFS_UNMOUNT() to clean up after it. If this failure happens during upper vnode registration, the unionfs root vnode will already be allocated. vflush() it in order to prevent the vnode from being leaked and the subsequent vfs_mount_destroy() call from getting stuck waiting for the mountpoint reference count to drain. Reviewed by: kib, markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D39767 --- sys/fs/unionfs/union_vfsops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index cd6c7bd9065..9ef239aaad1 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -318,6 +318,7 @@ unionfs_domount(struct mount *mp) vfs_unregister_upper(lowermp, &ump->um_lower_link); if (uppermp != NULL) vfs_unregister_upper(uppermp, &ump->um_upper_link); + vflush(mp, 1, FORCECLOSE, curthread); free(ump, M_UNIONFSMNT); mp->mnt_data = NULL; return (ENOENT);