diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2026-09-20 10:27:07 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2026-09-24 18:38:32 +0000 |
| commit | 87962e08fa18797103c96c17fd8c88ada056e0c0 (patch) | |
| tree | 6c429bf72c35cdb2cf1df94b44cac05c4eee4859 | |
| parent | fc544d3b57f27f1422969fca0002cb2bff30ab17 (diff) | |
g_vfs_close_unlocked(9): wrapper around g_vfs_close(9)
that locks both bo vnode and topology.
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59932
| -rw-r--r-- | sys/geom/geom_vfs.c | 13 | ||||
| -rw-r--r-- | sys/geom/geom_vfs.h | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/sys/geom/geom_vfs.c b/sys/geom/geom_vfs.c index 122e2f6a02ec..74723f43081c 100644 --- a/sys/geom/geom_vfs.c +++ b/sys/geom/geom_vfs.c @@ -338,3 +338,16 @@ g_vfs_close(struct g_consumer *cp) KASSERT(sc->sc_event == NULL, ("g_vfs %p event is non-NULL", sc)); g_free(sc); } + +void +g_vfs_close_unlocked(struct g_consumer *cp) +{ + struct vnode *vp; + + vp = cp->private; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + g_topology_lock(); + g_vfs_close(cp); + g_topology_unlock(); + VOP_UNLOCK(vp); +} diff --git a/sys/geom/geom_vfs.h b/sys/geom/geom_vfs.h index 56b91dd10c3b..01efc3e19d41 100644 --- a/sys/geom/geom_vfs.h +++ b/sys/geom/geom_vfs.h @@ -36,7 +36,9 @@ struct buf; extern struct buf_ops *g_vfs_bufops; void g_vfs_strategy(struct bufobj *bo, struct buf *bp); -int g_vfs_open(struct vnode *vp, struct g_consumer **cpp, const char *fsname, int wr); +int g_vfs_open(struct vnode *vp, struct g_consumer **cpp, + const char *fsname, int wr); void g_vfs_close(struct g_consumer *cp); +void g_vfs_close_unlocked(struct g_consumer *cp); #endif /* _GEOM_GEOM_VFS_H_ */ |
