2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 1994-1995 Søren Schmidt
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
32 #include "opt_compat.h"
34 #include <sys/param.h>
35 #include <sys/capsicum.h>
36 #include <sys/dirent.h>
38 #include <sys/filedesc.h>
40 #include <sys/malloc.h>
41 #include <sys/mount.h>
42 #include <sys/namei.h>
44 #include <sys/syscallsubr.h>
45 #include <sys/systm.h>
47 #include <sys/vnode.h>
49 #include <sys/fcntl.h>
52 #include <machine/../linux32/linux.h>
53 #include <machine/../linux32/linux32_proto.h>
55 #include <machine/../linux/linux.h>
56 #include <machine/../linux/linux_proto.h>
59 #include <compat/linux/linux_util.h>
60 #include <compat/linux/linux_file.h>
63 translate_vnhook_major_minor(struct vnode *vp, struct stat *sb)
68 sb->st_mode &= ~S_IFMT;
69 sb->st_mode |= S_IFBLK;
73 * Return the same st_dev for every devfs instance. The reason
74 * for this is to work around an idiosyncrasy of glibc getttynam()
75 * implementation: it checks whether st_dev returned for fd 0
76 * is the same as st_dev returned for the target of /proc/self/fd/0
77 * symlink, and with linux chroots having their own devfs instance,
78 * the check will fail if you chroot into it.
80 if (rootdevmp != NULL && vp->v_mount->mnt_vfc == rootdevmp->mnt_vfc)
81 sb->st_dev = rootdevmp->mnt_stat.f_fsid.val[0];
83 if (linux_vn_get_major_minor(vp, &major, &minor) == 0)
84 sb->st_rdev = (major << 8 | minor);
88 linux_kern_statat(struct thread *td, int flag, int fd, const char *path,
89 enum uio_seg pathseg, struct stat *sbp)
92 return (kern_statat(td, flag, fd, path, pathseg, sbp,
93 translate_vnhook_major_minor));
96 #ifdef LINUX_LEGACY_SYSCALLS
98 linux_kern_stat(struct thread *td, const char *path, enum uio_seg pathseg,
102 return (linux_kern_statat(td, 0, AT_FDCWD, path, pathseg, sbp));
106 linux_kern_lstat(struct thread *td, const char *path, enum uio_seg pathseg,
110 return (linux_kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, path,
116 translate_fd_major_minor(struct thread *td, int fd, struct stat *buf)
124 * No capability rights required here.
126 if ((!S_ISCHR(buf->st_mode) && !S_ISBLK(buf->st_mode)) ||
127 fget(td, fd, &cap_no_rights, &fp) != 0)
130 if (vp != NULL && vn_isdisk(vp)) {
131 buf->st_mode &= ~S_IFMT;
132 buf->st_mode |= S_IFBLK;
134 if (vp != NULL && rootdevmp != NULL) {
137 if (mp != NULL && mp->mnt_vfc == rootdevmp->mnt_vfc)
138 buf->st_dev = rootdevmp->mnt_stat.f_fsid.val[0];
140 if (linux_vn_get_major_minor(vp, &major, &minor) == 0) {
141 buf->st_rdev = (major << 8 | minor);
142 } else if (fp->f_type == DTYPE_PTS) {
143 struct tty *tp = fp->f_data;
145 /* Convert the numbers for the slave device. */
146 if (linux_driver_get_major_minor(devtoname(tp->t_dev),
147 &major, &minor) == 0) {
148 buf->st_rdev = (major << 8 | minor);
155 * l_dev_t has the same encoding as dev_t in the latter's low 16 bits, so
156 * truncation of a dev_t to 16 bits gives the same result as unpacking
157 * using major() and minor() and repacking in the l_dev_t format. This
158 * detail is hidden in dev_to_ldev(). Overflow in conversions of dev_t's
159 * are not checked for, as for other fields.
161 * dev_to_ldev() is only used for translating st_dev. When we convert
162 * st_rdev for copying it out, it isn't really a dev_t, but has already
163 * been translated to an l_dev_t in a nontrivial way. Translating it
164 * again would be illogical but would have no effect since the low 16
165 * bits have the same encoding.
167 * The nontrivial translation for st_rdev renumbers some devices, but not
168 * ones that can be mounted on, so it is consistent with the translation
169 * for st_dev except when the renumbering or truncation causes conflicts.
171 #define dev_to_ldev(d) ((uint16_t)(d))
174 newstat_copyout(struct stat *buf, void *ubuf)
176 struct l_newstat tbuf;
178 bzero(&tbuf, sizeof(tbuf));
179 tbuf.st_dev = dev_to_ldev(buf->st_dev);
180 tbuf.st_ino = buf->st_ino;
181 tbuf.st_mode = buf->st_mode;
182 tbuf.st_nlink = buf->st_nlink;
183 tbuf.st_uid = buf->st_uid;
184 tbuf.st_gid = buf->st_gid;
185 tbuf.st_rdev = buf->st_rdev;
186 tbuf.st_size = buf->st_size;
187 tbuf.st_atim.tv_sec = buf->st_atim.tv_sec;
188 tbuf.st_atim.tv_nsec = buf->st_atim.tv_nsec;
189 tbuf.st_mtim.tv_sec = buf->st_mtim.tv_sec;
190 tbuf.st_mtim.tv_nsec = buf->st_mtim.tv_nsec;
191 tbuf.st_ctim.tv_sec = buf->st_ctim.tv_sec;
192 tbuf.st_ctim.tv_nsec = buf->st_ctim.tv_nsec;
193 tbuf.st_blksize = buf->st_blksize;
194 tbuf.st_blocks = buf->st_blocks;
196 return (copyout(&tbuf, ubuf, sizeof(tbuf)));
199 #ifdef LINUX_LEGACY_SYSCALLS
201 linux_newstat(struct thread *td, struct linux_newstat_args *args)
207 if (!LUSECONVPATH(td)) {
208 error = linux_kern_stat(td, args->path, UIO_USERSPACE, &buf);
210 LCONVPATHEXIST(td, args->path, &path);
211 error = linux_kern_stat(td, path, UIO_SYSSPACE, &buf);
216 return (newstat_copyout(&buf, args->buf));
220 linux_newlstat(struct thread *td, struct linux_newlstat_args *args)
226 if (!LUSECONVPATH(td)) {
227 error = linux_kern_lstat(td, args->path, UIO_USERSPACE, &sb);
229 LCONVPATHEXIST(td, args->path, &path);
230 error = linux_kern_lstat(td, path, UIO_SYSSPACE, &sb);
235 return (newstat_copyout(&sb, args->buf));
240 linux_newfstat(struct thread *td, struct linux_newfstat_args *args)
245 error = kern_fstat(td, args->fd, &buf);
246 translate_fd_major_minor(td, args->fd, &buf);
248 error = newstat_copyout(&buf, args->buf);
253 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
255 stat_copyout(struct stat *buf, void *ubuf)
259 bzero(&lbuf, sizeof(lbuf));
260 lbuf.st_dev = dev_to_ldev(buf->st_dev);
261 lbuf.st_ino = buf->st_ino;
262 lbuf.st_mode = buf->st_mode;
263 lbuf.st_nlink = buf->st_nlink;
264 lbuf.st_uid = buf->st_uid;
265 lbuf.st_gid = buf->st_gid;
266 lbuf.st_rdev = buf->st_rdev;
267 lbuf.st_size = MIN(buf->st_size, INT32_MAX);
268 lbuf.st_atim.tv_sec = buf->st_atim.tv_sec;
269 lbuf.st_atim.tv_nsec = buf->st_atim.tv_nsec;
270 lbuf.st_mtim.tv_sec = buf->st_mtim.tv_sec;
271 lbuf.st_mtim.tv_nsec = buf->st_mtim.tv_nsec;
272 lbuf.st_ctim.tv_sec = buf->st_ctim.tv_sec;
273 lbuf.st_ctim.tv_nsec = buf->st_ctim.tv_nsec;
274 lbuf.st_blksize = buf->st_blksize;
275 lbuf.st_blocks = buf->st_blocks;
276 lbuf.st_flags = buf->st_flags;
277 lbuf.st_gen = buf->st_gen;
279 return (copyout(&lbuf, ubuf, sizeof(lbuf)));
283 linux_stat(struct thread *td, struct linux_stat_args *args)
289 if (!LUSECONVPATH(td)) {
290 error = linux_kern_stat(td, args->path, UIO_USERSPACE, &buf);
292 LCONVPATHEXIST(td, args->path, &path);
293 error = linux_kern_stat(td, path, UIO_SYSSPACE, &buf);
299 return (stat_copyout(&buf, args->up));
303 linux_lstat(struct thread *td, struct linux_lstat_args *args)
309 if (!LUSECONVPATH(td)) {
310 error = linux_kern_lstat(td, args->path, UIO_USERSPACE, &buf);
312 LCONVPATHEXIST(td, args->path, &path);
313 error = linux_kern_lstat(td, path, UIO_SYSSPACE, &buf);
319 return (stat_copyout(&buf, args->up));
321 #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
338 #define LINUX_CODA_SUPER_MAGIC 0x73757245L
339 #define LINUX_EXT2_SUPER_MAGIC 0xEF53L
340 #define LINUX_HPFS_SUPER_MAGIC 0xf995e849L
341 #define LINUX_ISOFS_SUPER_MAGIC 0x9660L
342 #define LINUX_MSDOS_SUPER_MAGIC 0x4d44L
343 #define LINUX_NCP_SUPER_MAGIC 0x564cL
344 #define LINUX_NFS_SUPER_MAGIC 0x6969L
345 #define LINUX_NTFS_SUPER_MAGIC 0x5346544EL
346 #define LINUX_PROC_SUPER_MAGIC 0x9fa0L
347 #define LINUX_UFS_SUPER_MAGIC 0x00011954L /* XXX - UFS_MAGIC in Linux */
348 #define LINUX_ZFS_SUPER_MAGIC 0x2FC12FC1
349 #define LINUX_DEVFS_SUPER_MAGIC 0x1373L
350 #define LINUX_SHMFS_MAGIC 0x01021994
353 bsd_to_linux_ftype(const char *fstypename)
356 static struct {const char *bsd_name; long linux_type;} b2l_tbl[] = {
357 {"ufs", LINUX_UFS_SUPER_MAGIC},
358 {"zfs", LINUX_ZFS_SUPER_MAGIC},
359 {"cd9660", LINUX_ISOFS_SUPER_MAGIC},
360 {"nfs", LINUX_NFS_SUPER_MAGIC},
361 {"ext2fs", LINUX_EXT2_SUPER_MAGIC},
362 {"procfs", LINUX_PROC_SUPER_MAGIC},
363 {"msdosfs", LINUX_MSDOS_SUPER_MAGIC},
364 {"ntfs", LINUX_NTFS_SUPER_MAGIC},
365 {"nwfs", LINUX_NCP_SUPER_MAGIC},
366 {"hpfs", LINUX_HPFS_SUPER_MAGIC},
367 {"coda", LINUX_CODA_SUPER_MAGIC},
368 {"devfs", LINUX_DEVFS_SUPER_MAGIC},
369 {"tmpfs", LINUX_SHMFS_MAGIC},
372 for (i = 0; b2l_tbl[i].bsd_name != NULL; i++)
373 if (strcmp(b2l_tbl[i].bsd_name, fstypename) == 0)
374 return (b2l_tbl[i].linux_type);
380 bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs)
382 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
385 #define LINUX_HIBITS 0xffffffff00000000ULL
387 tmp = bsd_statfs->f_blocks | bsd_statfs->f_bfree | bsd_statfs->f_files |
389 if ((bsd_statfs->f_bavail != -1 && (bsd_statfs->f_bavail & LINUX_HIBITS)) ||
390 (bsd_statfs->f_ffree != -1 && (bsd_statfs->f_ffree & LINUX_HIBITS)) ||
391 (tmp & LINUX_HIBITS))
395 linux_statfs->f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename);
396 linux_statfs->f_bsize = bsd_statfs->f_bsize;
397 linux_statfs->f_blocks = bsd_statfs->f_blocks;
398 linux_statfs->f_bfree = bsd_statfs->f_bfree;
399 linux_statfs->f_bavail = bsd_statfs->f_bavail;
400 linux_statfs->f_ffree = bsd_statfs->f_ffree;
401 linux_statfs->f_files = bsd_statfs->f_files;
402 linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
403 linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
404 linux_statfs->f_namelen = MAXNAMLEN;
405 linux_statfs->f_frsize = bsd_statfs->f_bsize;
406 linux_statfs->f_flags = 0;
407 memset(linux_statfs->f_spare, 0, sizeof(linux_statfs->f_spare));
413 linux_statfs(struct thread *td, struct linux_statfs_args *args)
415 struct l_statfs linux_statfs;
416 struct statfs *bsd_statfs;
420 if (!LUSECONVPATH(td)) {
421 bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
422 error = kern_statfs(td, args->path, UIO_USERSPACE, bsd_statfs);
424 LCONVPATHEXIST(td, args->path, &path);
425 bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
426 error = kern_statfs(td, path, UIO_SYSSPACE, bsd_statfs);
430 error = bsd_to_linux_statfs(bsd_statfs, &linux_statfs);
431 free(bsd_statfs, M_STATFS);
434 return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs)));
437 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
439 bsd_to_linux_statfs64(struct statfs *bsd_statfs, struct l_statfs64 *linux_statfs)
442 linux_statfs->f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename);
443 linux_statfs->f_bsize = bsd_statfs->f_bsize;
444 linux_statfs->f_blocks = bsd_statfs->f_blocks;
445 linux_statfs->f_bfree = bsd_statfs->f_bfree;
446 linux_statfs->f_bavail = bsd_statfs->f_bavail;
447 linux_statfs->f_ffree = bsd_statfs->f_ffree;
448 linux_statfs->f_files = bsd_statfs->f_files;
449 linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
450 linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
451 linux_statfs->f_namelen = MAXNAMLEN;
452 linux_statfs->f_frsize = bsd_statfs->f_bsize;
453 linux_statfs->f_flags = 0;
454 memset(linux_statfs->f_spare, 0, sizeof(linux_statfs->f_spare));
458 linux_statfs64(struct thread *td, struct linux_statfs64_args *args)
460 struct l_statfs64 linux_statfs;
461 struct statfs *bsd_statfs;
465 if (args->bufsize != sizeof(struct l_statfs64))
468 if (!LUSECONVPATH(td)) {
469 bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
470 error = kern_statfs(td, args->path, UIO_USERSPACE, bsd_statfs);
472 LCONVPATHEXIST(td, args->path, &path);
473 bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
474 error = kern_statfs(td, path, UIO_SYSSPACE, bsd_statfs);
478 bsd_to_linux_statfs64(bsd_statfs, &linux_statfs);
479 free(bsd_statfs, M_STATFS);
482 return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs)));
486 linux_fstatfs64(struct thread *td, struct linux_fstatfs64_args *args)
488 struct l_statfs64 linux_statfs;
489 struct statfs *bsd_statfs;
492 if (args->bufsize != sizeof(struct l_statfs64))
495 bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
496 error = kern_fstatfs(td, args->fd, bsd_statfs);
498 bsd_to_linux_statfs64(bsd_statfs, &linux_statfs);
499 free(bsd_statfs, M_STATFS);
502 return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs)));
504 #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
507 linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
509 struct l_statfs linux_statfs;
510 struct statfs *bsd_statfs;
513 bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
514 error = kern_fstatfs(td, args->fd, bsd_statfs);
516 error = bsd_to_linux_statfs(bsd_statfs, &linux_statfs);
517 free(bsd_statfs, M_STATFS);
520 return (copyout(&linux_statfs, args->buf, sizeof(linux_statfs)));
531 #ifdef LINUX_LEGACY_SYSCALLS
533 linux_ustat(struct thread *td, struct linux_ustat_args *args)
540 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
543 stat64_copyout(struct stat *buf, void *ubuf)
545 struct l_stat64 lbuf;
547 bzero(&lbuf, sizeof(lbuf));
548 lbuf.st_dev = dev_to_ldev(buf->st_dev);
549 lbuf.st_ino = buf->st_ino;
550 lbuf.st_mode = buf->st_mode;
551 lbuf.st_nlink = buf->st_nlink;
552 lbuf.st_uid = buf->st_uid;
553 lbuf.st_gid = buf->st_gid;
554 lbuf.st_rdev = buf->st_rdev;
555 lbuf.st_size = buf->st_size;
556 lbuf.st_atim.tv_sec = buf->st_atim.tv_sec;
557 lbuf.st_atim.tv_nsec = buf->st_atim.tv_nsec;
558 lbuf.st_mtim.tv_sec = buf->st_mtim.tv_sec;
559 lbuf.st_mtim.tv_nsec = buf->st_mtim.tv_nsec;
560 lbuf.st_ctim.tv_sec = buf->st_ctim.tv_sec;
561 lbuf.st_ctim.tv_nsec = buf->st_ctim.tv_nsec;
562 lbuf.st_blksize = buf->st_blksize;
563 lbuf.st_blocks = buf->st_blocks;
566 * The __st_ino field makes all the difference. In the Linux kernel
567 * it is conditionally compiled based on STAT64_HAS_BROKEN_ST_INO,
568 * but without the assignment to __st_ino the runtime linker refuses
569 * to mmap(2) any shared libraries. I guess it's broken alright :-)
571 lbuf.__st_ino = buf->st_ino;
573 return (copyout(&lbuf, ubuf, sizeof(lbuf)));
577 linux_stat64(struct thread *td, struct linux_stat64_args *args)
583 if (!LUSECONVPATH(td)) {
584 error = linux_kern_stat(td, args->filename, UIO_USERSPACE, &buf);
586 LCONVPATHEXIST(td, args->filename, &filename);
587 error = linux_kern_stat(td, filename, UIO_SYSSPACE, &buf);
592 return (stat64_copyout(&buf, args->statbuf));
596 linux_lstat64(struct thread *td, struct linux_lstat64_args *args)
602 if (!LUSECONVPATH(td)) {
603 error = linux_kern_lstat(td, args->filename, UIO_USERSPACE, &sb);
605 LCONVPATHEXIST(td, args->filename, &filename);
606 error = linux_kern_lstat(td, filename, UIO_SYSSPACE, &sb);
611 return (stat64_copyout(&sb, args->statbuf));
615 linux_fstat64(struct thread *td, struct linux_fstat64_args *args)
620 error = kern_fstat(td, args->fd, &buf);
621 translate_fd_major_minor(td, args->fd, &buf);
623 error = stat64_copyout(&buf, args->statbuf);
629 linux_fstatat64(struct thread *td, struct linux_fstatat64_args *args)
632 int error, dfd, flag;
635 if (args->flag & ~LINUX_AT_SYMLINK_NOFOLLOW)
637 flag = (args->flag & LINUX_AT_SYMLINK_NOFOLLOW) ?
638 AT_SYMLINK_NOFOLLOW : 0;
640 dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
641 if (!LUSECONVPATH(td)) {
642 error = linux_kern_statat(td, flag, dfd, args->pathname,
643 UIO_USERSPACE, &buf);
645 LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
646 error = linux_kern_statat(td, flag, dfd, path, UIO_SYSSPACE, &buf);
650 error = stat64_copyout(&buf, args->statbuf);
655 #else /* __amd64__ && !COMPAT_LINUX32 */
658 linux_newfstatat(struct thread *td, struct linux_newfstatat_args *args)
661 int error, dfd, flag;
664 if (args->flag & ~LINUX_AT_SYMLINK_NOFOLLOW)
666 flag = (args->flag & LINUX_AT_SYMLINK_NOFOLLOW) ?
667 AT_SYMLINK_NOFOLLOW : 0;
669 dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
670 if (!LUSECONVPATH(td)) {
671 error = linux_kern_statat(td, flag, dfd, args->pathname,
672 UIO_USERSPACE, &buf);
674 LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
675 error = linux_kern_statat(td, flag, dfd, path, UIO_SYSSPACE, &buf);
679 error = newstat_copyout(&buf, args->statbuf);
684 #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
687 linux_syncfs(struct thread *td, struct linux_syncfs_args *args)
693 error = fgetvp(td, args->fd, &cap_fsync_rights, &vp);
696 * Linux syncfs() returns only EBADF, however fgetvp()
697 * can return EINVAL in case of file descriptor does
698 * not represent a vnode. XXX.
703 mtx_lock(&mountlist_mtx);
704 error = vfs_busy(mp, MBF_MNTLSTLOCK);
706 /* See comment above. */
707 mtx_unlock(&mountlist_mtx);
710 if ((mp->mnt_flag & MNT_RDONLY) == 0 &&
711 vn_start_write(NULL, &mp, V_NOWAIT) == 0) {
712 save = curthread_pflags_set(TDP_SYNCIO);
713 vfs_periodic(mp, MNT_NOWAIT);
714 VFS_SYNC(mp, MNT_NOWAIT);
715 curthread_pflags_restore(save);
716 vn_finished_write(mp);