Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/vfs_mount.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/kern/vfs_mount.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.11 retrieving revision 1.11.2.2 diff -u -p -r1.11 -r1.11.2.2 --- src/sys/kern/vfs_mount.c 2011/10/14 09:23:31 1.11 +++ src/sys/kern/vfs_mount.c 2012/05/23 10:08:12 1.11.2.2 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_mount.c,v 1.11 2011/10/14 09:23:31 hannken Exp $ */ +/* $NetBSD: vfs_mount.c,v 1.11.2.2 2012/05/23 10:08:12 yamt Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.11 2011/10/14 09:23:31 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.11.2.2 2012/05/23 10:08:12 yamt Exp $"); #include #include @@ -83,6 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_mount.c, #include #include #include +#include #include #include #include @@ -642,7 +643,6 @@ mount_domount(struct lwp *l, vnode_t **v { vnode_t *vp = *vpp; struct mount *mp; - struct vattr va; struct pathbuf *pb; struct nameidata nd; int error; @@ -660,24 +660,6 @@ mount_domount(struct lwp *l, vnode_t **v return ENOTDIR; } - /* - * If the user is not root, ensure that they own the directory - * onto which we are attempting to mount. - */ - vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_GETATTR(vp, &va, l->l_cred); - VOP_UNLOCK(vp); - if (error != 0) { - vfs_delref(vfsops); - return error; - } - if ((va.va_uid != kauth_cred_geteuid(l->l_cred) && - (error = kauth_authorize_generic(l->l_cred, - KAUTH_GENERIC_ISSUSER, NULL)) != 0)) { - vfs_delref(vfsops); - return error; - } - if (flags & MNT_EXPORTED) { vfs_delref(vfsops); return EINVAL; @@ -696,11 +678,7 @@ mount_domount(struct lwp *l, vnode_t **v * * Set the mount level flags. */ - mp->mnt_flag = flags & - (MNT_FORCE | MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | - MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOCOREDUMP | - MNT_NOATIME | MNT_NODEVMTIME | MNT_SYMPERM | MNT_SOFTDEP | - MNT_LOG | MNT_IGNORE | MNT_RDONLY); + mp->mnt_flag = flags & (MNT_BASIC_FLAGS | MNT_FORCE | MNT_IGNORE); mutex_enter(&mp->mnt_updating); error = VFS_MOUNT(mp, path, data, data_len); @@ -762,8 +740,15 @@ mount_domount(struct lwp *l, vnode_t **v vfs_unbusy(mp, true, NULL); (void) VFS_STATVFS(mp, &mp->mnt_stat); error = VFS_START(mp, 0); - if (error) + if (error) { vrele(vp); + } else if (flags & MNT_EXTATTR) { + error = VFS_EXTATTRCTL(vp->v_mountedhere, + EXTATTR_CMD_START, NULL, 0, NULL); + if (error) + printf("%s: failed to start extattr: error = %d\n", + vp->v_mountedhere->mnt_stat.f_mntonname, error); + } /* Drop reference held for VFS_START(). */ vfs_destroy(mp); *vpp = NULL;