git: 21d42c8d9022 - main - vfs: let the compiler catch unhandled vgetstate values in vget_abort
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 24 Sep 2025 09:01:32 UTC
The branch main has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=21d42c8d902235b90b59d1aea6203b12e40c6c1b
commit 21d42c8d902235b90b59d1aea6203b12e40c6c1b
Author: Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2025-09-24 08:52:28 +0000
Commit: Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2025-09-24 08:52:28 +0000
vfs: let the compiler catch unhandled vgetstate values in vget_abort
---
sys/kern/vfs_subr.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 9818c60ca387..73e110c05bc1 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -3352,13 +3352,22 @@ vget_abort(struct vnode *vp, enum vgetstate vs)
switch (vs) {
case VGET_USECOUNT:
vrele(vp);
- break;
+ goto out_ok;
case VGET_HOLDCNT:
vdrop(vp);
+ goto out_ok;
+ case VGET_NONE:
break;
- default:
- __assert_unreachable();
}
+
+ __assert_unreachable();
+
+ /*
+ * This is a goto label should the cases above have more in common than
+ * just the 'return' statement.
+ */
+out_ok:
+ return;
}
int