MCPcopy Create free account
hub / github.com/F-Stack/f-stack / suspend_all_fs

Function suspend_all_fs

freebsd/kern/vfs_mount.c:2554–2586  ·  view source on GitHub ↗

* Suspend write operations on all local writeable filesystems. Does * full sync of them in the process. * * Iterate over the mount points in reverse order, suspending most * recently mounted filesystems first. It handles a case where a * filesystem mounted from a md(4) vnode-backed device should be * suspended before the filesystem that owns the vnode. */

Source from the content-addressed store, hash-verified

2552 * suspended before the filesystem that owns the vnode.
2553 */
2554void
2555suspend_all_fs(void)
2556{
2557 struct mount *mp;
2558 int error;
2559
2560 mtx_lock(&mountlist_mtx);
2561 TAILQ_FOREACH_REVERSE(mp, &mountlist, mntlist, mnt_list) {
2562 error = vfs_busy(mp, MBF_MNTLSTLOCK | MBF_NOWAIT);
2563 if (error != 0)
2564 continue;
2565 if ((mp->mnt_flag & (MNT_RDONLY | MNT_LOCAL)) != MNT_LOCAL ||
2566 (mp->mnt_kern_flag & MNTK_SUSPEND) != 0) {
2567 mtx_lock(&mountlist_mtx);
2568 vfs_unbusy(mp);
2569 continue;
2570 }
2571 error = vfs_write_suspend(mp, 0);
2572 if (error == 0) {
2573 MNT_ILOCK(mp);
2574 MPASS((mp->mnt_kern_flag & MNTK_SUSPEND_ALL) == 0);
2575 mp->mnt_kern_flag |= MNTK_SUSPEND_ALL;
2576 MNT_IUNLOCK(mp);
2577 mtx_lock(&mountlist_mtx);
2578 } else {
2579 printf("suspend of %s failed, error %d\n",
2580 mp->mnt_stat.f_mntonname, error);
2581 mtx_lock(&mountlist_mtx);
2582 vfs_unbusy(mp);
2583 }
2584 }
2585 mtx_unlock(&mountlist_mtx);
2586}
2587
2588void
2589resume_all_fs(void)

Callers

nothing calls this directly

Calls 6

vfs_busyFunction · 0.85
vfs_unbusyFunction · 0.85
vfs_write_suspendFunction · 0.85
mtx_lockFunction · 0.70
printfFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected