git: 5b200ff58126 - stable/14 - vfs_remount_ro(): mnt_lockref should be only accessed after vfs_op_enter()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 Sep 2023 09:06:02 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5b200ff58126a028ba357f297cbb596a7475962c commit 5b200ff58126a028ba357f297cbb596a7475962c Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-09-20 03:42:31 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-09-28 09:05:05 +0000 vfs_remount_ro(): mnt_lockref should be only accessed after vfs_op_enter() PR: 273953 (cherry picked from commit c584bb9cac16bc200ac45cc8b709e7e7e99e24bb) --- sys/kern/vfs_mount.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 45ab9cfc93cc..8364081585f8 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -3004,6 +3004,7 @@ vfs_remount_ro(struct mount *mp) struct vnode *vp_covered, *rootvp; int error; + vfs_op_enter(mp); KASSERT(mp->mnt_lockref > 0, ("vfs_remount_ro: mp %p is not busied", mp)); KASSERT((mp->mnt_kern_flag & MNTK_UNMOUNT) == 0, @@ -3012,17 +3013,19 @@ vfs_remount_ro(struct mount *mp) rootvp = NULL; vp_covered = mp->mnt_vnodecovered; error = vget(vp_covered, LK_EXCLUSIVE | LK_NOWAIT); - if (error != 0) + if (error != 0) { + vfs_op_exit(mp); return (error); + } VI_LOCK(vp_covered); if ((vp_covered->v_iflag & VI_MOUNT) != 0) { VI_UNLOCK(vp_covered); vput(vp_covered); + vfs_op_exit(mp); return (EBUSY); } vp_covered->v_iflag |= VI_MOUNT; VI_UNLOCK(vp_covered); - vfs_op_enter(mp); vn_seqc_write_begin(vp_covered); MNT_ILOCK(mp);