Index: sys/compat/linux/linux_file.c =================================================================== --- sys/compat/linux/linux_file.c +++ sys/compat/linux/linux_file.c @@ -1051,11 +1051,8 @@ int linux_oldumount(struct thread *td, struct linux_oldumount_args *args) { - struct linux_umount_args args2; - args2.path = args->path; - args2.flags = 0; - return (linux_umount(td, &args2)); + return (kern_unmount(td, args->path, 0)); } #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ @@ -1063,11 +1060,8 @@ int linux_umount(struct thread *td, struct linux_umount_args *args) { - struct unmount_args bsd; - bsd.path = args->path; - bsd.flags = args->flags; /* XXX correct? */ - return (sys_unmount(td, &bsd)); + return (kern_unmount(td, args->path, args->flags /* XXX: correct? */)); } #endif Index: sys/kern/vfs_mount.c =================================================================== --- sys/kern/vfs_mount.c +++ sys/kern/vfs_mount.c @@ -1298,12 +1298,19 @@ int sys_unmount(struct thread *td, struct unmount_args *uap) { + + return (kern_unmount(td, uap->path, uap->flags)); +} + +int +kern_unmount(struct thread *td, const char *path, int flags) +{ struct nameidata nd; struct mount *mp; char *pathbuf; int error, id0, id1; - AUDIT_ARG_VALUE(uap->flags); + AUDIT_ARG_VALUE(flags); if (jailed(td->td_ucred) || usermount == 0) { error = priv_check(td, PRIV_VFS_UNMOUNT); if (error) @@ -1311,12 +1318,12 @@ } pathbuf = malloc(MNAMELEN, M_TEMP, M_WAITOK); - error = copyinstr(uap->path, pathbuf, MNAMELEN, NULL); + error = copyinstr(path, pathbuf, MNAMELEN, NULL); if (error) { free(pathbuf, M_TEMP); return (error); } - if (uap->flags & MNT_BYFSID) { + if (flags & MNT_BYFSID) { AUDIT_ARG_TEXT(pathbuf); /* Decode the filesystem ID. */ if (sscanf(pathbuf, "FSID:%d:%d", &id0, &id1) != 2) { @@ -1363,7 +1370,7 @@ * now, so in the !MNT_BYFSID case return the more likely * EINVAL for compatibility. */ - return ((uap->flags & MNT_BYFSID) ? ENOENT : EINVAL); + return ((flags & MNT_BYFSID) ? ENOENT : EINVAL); } /* @@ -1373,7 +1380,7 @@ vfs_rel(mp); return (EINVAL); } - error = dounmount(mp, uap->flags, td); + error = dounmount(mp, flags, td); return (error); } Index: sys/sys/syscallsubr.h =================================================================== --- sys/sys/syscallsubr.h +++ sys/sys/syscallsubr.h @@ -304,6 +304,7 @@ int kern_writev(struct thread *td, int fd, struct uio *auio); int kern_socketpair(struct thread *td, int domain, int type, int protocol, int *rsv); +int kern_unmount(struct thread *td, const char *path, int flags); /* flags for kern_sigaction */ #define KSA_OSIGSET 0x0001 /* uses osigact_t */