git: 7b2561b46be6 - main - vfs: stop open-coding vfs_getvfs in kern_unmount
Mateusz Guzik
mjg at FreeBSD.org
Thu Aug 26 11:38:40 UTC 2021
The branch main has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=7b2561b46be609deedeaacb7ccb35b5bc70d77ad
commit 7b2561b46be609deedeaacb7ccb35b5bc70d77ad
Author: Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-08-26 08:29:47 +0000
Commit: Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-08-26 11:38:31 +0000
vfs: stop open-coding vfs_getvfs in kern_unmount
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/kern/vfs_mount.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 6804f6eb68bf..2d955fc4889f 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1589,7 +1589,8 @@ kern_unmount(struct thread *td, const char *path, int flags)
struct nameidata nd;
struct mount *mp;
char *pathbuf;
- int error, id0, id1;
+ fsid_t fsid;
+ int error;
AUDIT_ARG_VALUE(flags);
if (jailed(td->td_ucred) || usermount == 0) {
@@ -1607,20 +1608,12 @@ kern_unmount(struct thread *td, const char *path, int flags)
if (flags & MNT_BYFSID) {
AUDIT_ARG_TEXT(pathbuf);
/* Decode the filesystem ID. */
- if (sscanf(pathbuf, "FSID:%d:%d", &id0, &id1) != 2) {
+ if (sscanf(pathbuf, "FSID:%d:%d", &fsid.val[0], &fsid.val[1]) != 2) {
free(pathbuf, M_TEMP);
return (EINVAL);
}
- mtx_lock(&mountlist_mtx);
- TAILQ_FOREACH_REVERSE(mp, &mountlist, mntlist, mnt_list) {
- if (mp->mnt_stat.f_fsid.val[0] == id0 &&
- mp->mnt_stat.f_fsid.val[1] == id1) {
- vfs_ref(mp);
- break;
- }
- }
- mtx_unlock(&mountlist_mtx);
+ mp = vfs_getvfs(&fsid);
} else {
/*
* Try to find global path for path argument.
More information about the dev-commits-src-all
mailing list