* Helper loop around vfs_write_suspend() for filesystem unmount VFS * methods. */
| 2075 | * methods. |
| 2076 | */ |
| 2077 | int |
| 2078 | vfs_write_suspend_umnt(struct mount *mp) |
| 2079 | { |
| 2080 | int error; |
| 2081 | |
| 2082 | KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0, |
| 2083 | ("vfs_write_suspend_umnt: recursed")); |
| 2084 | |
| 2085 | /* dounmount() already called vn_start_write(). */ |
| 2086 | for (;;) { |
| 2087 | vn_finished_write(mp); |
| 2088 | error = vfs_write_suspend(mp, 0); |
| 2089 | if (error != 0) { |
| 2090 | vn_start_write(NULL, &mp, V_WAIT); |
| 2091 | return (error); |
| 2092 | } |
| 2093 | MNT_ILOCK(mp); |
| 2094 | if ((mp->mnt_kern_flag & MNTK_SUSPENDED) != 0) |
| 2095 | break; |
| 2096 | MNT_IUNLOCK(mp); |
| 2097 | vn_start_write(NULL, &mp, V_WAIT); |
| 2098 | } |
| 2099 | mp->mnt_kern_flag &= ~(MNTK_SUSPENDED | MNTK_SUSPEND2); |
| 2100 | wakeup(&mp->mnt_flag); |
| 2101 | MNT_IUNLOCK(mp); |
| 2102 | curthread->td_pflags |= TDP_IGNSUSP; |
| 2103 | return (0); |
| 2104 | } |
| 2105 | |
| 2106 | /* |
| 2107 | * Implement kqueues for files by translating it to vnode operation. |
nothing calls this directly
no test coverage detected