Print this page
7798 vfs_mountfs passes junk in flags to domount
Reviewed by: Alexander Pyhalov <alp@rsu.ru>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Juraj Lutter <juraj.lutter@erigones.com>
Reviewed by: Marcel Telka <marcel@telka.sk>


   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  25  * Copyright 2016 Toomas Soome <tsoome@me.com>
  26  * Copyright (c) 2016 by Delphix. All rights reserved.
  27  * Copyright 2016 Nexenta Systems, Inc.

  28  */
  29 
  30 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  31 /*        All Rights Reserved   */
  32 
  33 /*
  34  * University Copyright- Copyright (c) 1982, 1986, 1988
  35  * The Regents of the University of California
  36  * All Rights Reserved
  37  *
  38  * University Acknowledgment- Portions of this document are derived from
  39  * software developed by the University of California, Berkeley, and its
  40  * contributors.
  41  */
  42 
  43 #include <sys/types.h>
  44 #include <sys/t_lock.h>
  45 #include <sys/param.h>
  46 #include <sys/errno.h>
  47 #include <sys/user.h>


 774                 cmn_err(CE_NOTE, "Cannot acquire vfswlock of /dev");
 775                 return;
 776         }
 777 
 778         vfs_add(mvp, &dev, 0);
 779         vn_vfsunlock(mvp);
 780         vfs_unlock(&dev);
 781         VN_RELE(devdir);
 782 }
 783 
 784 /*
 785  * Mount required filesystem. This is done right after root is mounted.
 786  */
 787 static void
 788 vfs_mountfs(char *module, char *spec, char *path)
 789 {
 790         struct vnode *mvp;
 791         struct mounta mounta;
 792         vfs_t *vfsp;
 793 

 794         mounta.flags = MS_SYSSPACE | MS_DATA;
 795         mounta.fstype = module;
 796         mounta.spec = spec;
 797         mounta.dir = path;
 798         if (lookupname(path, UIO_SYSSPACE, FOLLOW, NULLVPP, &mvp)) {
 799                 cmn_err(CE_WARN, "Cannot find %s", path);
 800                 return;
 801         }
 802         if (domount(NULL, &mounta, mvp, CRED(), &vfsp))
 803                 cmn_err(CE_WARN, "Cannot mount %s", path);
 804         else
 805                 VFS_RELE(vfsp);
 806         VN_RELE(mvp);
 807 }
 808 
 809 /*
 810  * vfs_mountroot is called by main() to mount the root filesystem.
 811  */
 812 void
 813 vfs_mountroot(void)




   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  25  * Copyright 2016 Toomas Soome <tsoome@me.com>
  26  * Copyright (c) 2016 by Delphix. All rights reserved.
  27  * Copyright 2016 Nexenta Systems, Inc.
  28  * Copyright 2017 RackTop Systems.
  29  */
  30 
  31 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  32 /*        All Rights Reserved   */
  33 
  34 /*
  35  * University Copyright- Copyright (c) 1982, 1986, 1988
  36  * The Regents of the University of California
  37  * All Rights Reserved
  38  *
  39  * University Acknowledgment- Portions of this document are derived from
  40  * software developed by the University of California, Berkeley, and its
  41  * contributors.
  42  */
  43 
  44 #include <sys/types.h>
  45 #include <sys/t_lock.h>
  46 #include <sys/param.h>
  47 #include <sys/errno.h>
  48 #include <sys/user.h>


 775                 cmn_err(CE_NOTE, "Cannot acquire vfswlock of /dev");
 776                 return;
 777         }
 778 
 779         vfs_add(mvp, &dev, 0);
 780         vn_vfsunlock(mvp);
 781         vfs_unlock(&dev);
 782         VN_RELE(devdir);
 783 }
 784 
 785 /*
 786  * Mount required filesystem. This is done right after root is mounted.
 787  */
 788 static void
 789 vfs_mountfs(char *module, char *spec, char *path)
 790 {
 791         struct vnode *mvp;
 792         struct mounta mounta;
 793         vfs_t *vfsp;
 794 
 795         bzero(&mounta, sizeof (mounta));
 796         mounta.flags = MS_SYSSPACE | MS_DATA;
 797         mounta.fstype = module;
 798         mounta.spec = spec;
 799         mounta.dir = path;
 800         if (lookupname(path, UIO_SYSSPACE, FOLLOW, NULLVPP, &mvp)) {
 801                 cmn_err(CE_WARN, "Cannot find %s", path);
 802                 return;
 803         }
 804         if (domount(NULL, &mounta, mvp, CRED(), &vfsp))
 805                 cmn_err(CE_WARN, "Cannot mount %s", path);
 806         else
 807                 VFS_RELE(vfsp);
 808         VN_RELE(mvp);
 809 }
 810 
 811 /*
 812  * vfs_mountroot is called by main() to mount the root filesystem.
 813  */
 814 void
 815 vfs_mountroot(void)