git: 8db7d16526de - main - geom_vfs: lock devvp in g_vfs_close()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Nov 2021 23:04:13 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8db7d16526debbca6bc7a32a57fd0378e48e37de commit 8db7d16526debbca6bc7a32a57fd0378e48e37de Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-11-01 05:46:52 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-11-12 23:00:13 +0000 geom_vfs: lock devvp in g_vfs_close() It is needed for g_vfs_close() invalidating the buffers. We rely on the vnode lock for correctness. Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32761 --- sys/geom/geom_vfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/geom/geom_vfs.c b/sys/geom/geom_vfs.c index 592062b8b12a..9590fee11000 100644 --- a/sys/geom/geom_vfs.c +++ b/sys/geom/geom_vfs.c @@ -302,12 +302,16 @@ g_vfs_close(struct g_consumer *cp) { struct g_geom *gp; struct g_vfs_softc *sc; + struct vnode *vp; g_topology_assert(); 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);