Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_mountroot.c
Show First 20 Lines • Show All 329 Lines • ▼ Show 20 Lines | vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs) | ||||
if (mporoot != mpdevfs) | if (mporoot != mpdevfs) | ||||
cache_purgevfs(mpdevfs); | cache_purgevfs(mpdevfs); | ||||
if (VFS_ROOT(mporoot, LK_EXCLUSIVE, &vporoot)) | if (VFS_ROOT(mporoot, LK_EXCLUSIVE, &vporoot)) | ||||
panic("vfs_mountroot_shuffle: Cannot find root vnode"); | panic("vfs_mountroot_shuffle: Cannot find root vnode"); | ||||
VI_LOCK(vporoot); | VI_LOCK(vporoot); | ||||
vporoot->v_iflag &= ~VI_MOUNT; | vporoot->v_iflag &= ~VI_MOUNT; | ||||
VI_UNLOCK(vporoot); | vn_irflag_unset_locked(vporoot, VIRF_MOUNTPOINT); | ||||
vporoot->v_mountedhere = NULL; | vporoot->v_mountedhere = NULL; | ||||
VI_UNLOCK(vporoot); | |||||
mporoot->mnt_flag &= ~MNT_ROOTFS; | mporoot->mnt_flag &= ~MNT_ROOTFS; | ||||
mporoot->mnt_vnodecovered = NULL; | mporoot->mnt_vnodecovered = NULL; | ||||
vput(vporoot); | vput(vporoot); | ||||
/* Set up the new rootvnode, and purge the cache */ | /* Set up the new rootvnode, and purge the cache */ | ||||
mpnroot->mnt_vnodecovered = NULL; | mpnroot->mnt_vnodecovered = NULL; | ||||
set_rootvnode(); | set_rootvnode(); | ||||
cache_purgevfs(rootvnode->v_mount); | cache_purgevfs(rootvnode->v_mount); | ||||
Show All 40 Lines | if (!error) { | ||||
vp = nd.ni_vp; | vp = nd.ni_vp; | ||||
error = (vp->v_type == VDIR) ? 0 : ENOTDIR; | error = (vp->v_type == VDIR) ? 0 : ENOTDIR; | ||||
if (!error) | if (!error) | ||||
error = vinvalbuf(vp, V_SAVE, 0, 0); | error = vinvalbuf(vp, V_SAVE, 0, 0); | ||||
if (!error) { | if (!error) { | ||||
vpdevfs = mpdevfs->mnt_vnodecovered; | vpdevfs = mpdevfs->mnt_vnodecovered; | ||||
if (vpdevfs != NULL) { | if (vpdevfs != NULL) { | ||||
cache_purge(vpdevfs); | cache_purge(vpdevfs); | ||||
VI_LOCK(vpdevfs); | |||||
vn_irflag_unset_locked(vpdevfs, VIRF_MOUNTPOINT); | |||||
vpdevfs->v_mountedhere = NULL; | vpdevfs->v_mountedhere = NULL; | ||||
VI_UNLOCK(vpdevfs); | |||||
vrele(vpdevfs); | vrele(vpdevfs); | ||||
} | } | ||||
VI_LOCK(vp); | |||||
mpdevfs->mnt_vnodecovered = vp; | mpdevfs->mnt_vnodecovered = vp; | ||||
vn_irflag_set_locked(vp, VIRF_MOUNTPOINT); | |||||
vp->v_mountedhere = mpdevfs; | vp->v_mountedhere = mpdevfs; | ||||
VI_UNLOCK(vp); | |||||
VOP_UNLOCK(vp); | VOP_UNLOCK(vp); | ||||
} else | } else | ||||
vput(vp); | vput(vp); | ||||
} | } | ||||
if (error) | if (error) | ||||
printf("mountroot: unable to remount devfs under /dev " | printf("mountroot: unable to remount devfs under /dev " | ||||
"(error %d)\n", error); | "(error %d)\n", error); | ||||
NDFREE(&nd, NDF_ONLY_PNBUF); | NDFREE(&nd, NDF_ONLY_PNBUF); | ||||
▲ Show 20 Lines • Show All 745 Lines • Show Last 20 Lines |