Date: Thu, 26 Aug 2021 11:38:39 GMT From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 7b2561b46be6 - main - vfs: stop open-coding vfs_getvfs in kern_unmount Message-ID: <202108261138.17QBcdXr039940@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7b2561b46be609deedeaacb7ccb35b5bc70d77ad commit 7b2561b46be609deedeaacb7ccb35b5bc70d77ad Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2021-08-26 08:29:47 +0000 Commit: Mateusz Guzik <mjg@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108261138.17QBcdXr039940>