git: c34a5148e8f2 - main - ffs: fix newly introduced LOR between mntfs vnode lock and topology lock
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 16 Nov 2021 18:01:37 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c34a5148e8f21e9be28330c4ae4884b6f31193dd commit c34a5148e8f21e9be28330c4ae4884b6f31193dd Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-11-16 17:31:11 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-11-16 18:01:31 +0000 ffs: fix newly introduced LOR between mntfs vnode lock and topology lock The mntfs vnode lock should be before topology, as established in ffs_mountfs(). Extend the locked region in ffs_unmount(). Reported and reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33013 --- sys/geom/geom_vfs.c | 2 -- sys/ufs/ffs/ffs_vfsops.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/geom/geom_vfs.c b/sys/geom/geom_vfs.c index 9590fee11000..ab068d7c85d5 100644 --- a/sys/geom/geom_vfs.c +++ b/sys/geom/geom_vfs.c @@ -309,9 +309,7 @@ g_vfs_close(struct g_consumer *cp) gp = cp->geom; sc = gp->softc; vp = cp->private; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); bufobj_invalbuf(sc->sc_bo, V_SAVE, 0, 0); - VOP_UNLOCK(vp); sc->sc_bo->bo_private = cp->private; gp->softc = NULL; mtx_destroy(&sc->sc_mtx); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index f2ea6b666fad..1edc127bd68c 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1431,6 +1431,7 @@ ffs_unmount(mp, mntflags) taskqueue_free(ump->um_trim_tq); free (ump->um_trimhash, M_TRIM); } + vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY); g_topology_lock(); g_vfs_close(ump->um_cp); g_topology_unlock(); @@ -1438,7 +1439,6 @@ ffs_unmount(mp, mntflags) ump->um_odevvp->v_bufobj.bo_flag &= ~BO_NOBUFS; BO_UNLOCK(&ump->um_odevvp->v_bufobj); atomic_store_rel_ptr((uintptr_t *)&ump->um_dev->si_mountpt, 0); - vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY); mntfs_freevp(ump->um_devvp); vrele(ump->um_odevvp); dev_rel(ump->um_dev);