Print this page
8115 parallel zfs mount


   6  * You may not use this file except in compliance with the License.
   7  *
   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 2016 Joyent, Inc.
  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>


1274          * would deadlock with lookuppn().
1275          */
1276         if (splice) {
1277                 ASSERT(vp->v_count > 0);
1278 
1279                 /*
1280                  * Pick up mount point and device from appropriate space.
1281                  */
1282                 if (pn_get(uap->spec, fromspace, &pn) == 0) {
1283                         resource = kmem_alloc(pn.pn_pathlen + 1,
1284                             KM_SLEEP);
1285                         (void) strcpy(resource, pn.pn_path);
1286                         pn_free(&pn);
1287                 }
1288                 /*
1289                  * Do a lookupname prior to taking the
1290                  * writelock. Mark this as completed if
1291                  * successful for later cleanup and addition to
1292                  * the mount in progress table.
1293                  */
1294                 if ((uap->flags & MS_GLOBAL) == 0 &&

1295                     lookupname(uap->spec, fromspace,
1296                     FOLLOW, NULL, &bvp) == 0) {
1297                         addmip = 1;
1298                 }
1299 
1300                 if ((error = pn_get(uap->dir, fromspace, &pn)) == 0) {
1301                         pathname_t *pnp;
1302 
1303                         if (*pn.pn_path != '/') {
1304                                 error = EINVAL;
1305                                 pn_free(&pn);
1306                                 goto errout;
1307                         }
1308                         pn_alloc(&rpn);
1309                         /*
1310                          * Kludge to prevent autofs from deadlocking with
1311                          * itself when it calls domount().
1312                          *
1313                          * If autofs is calling, it is because it is doing
1314                          * (autofs) mounts in the process of an NFS mount.  A


1490 
1491                         lofi_remove(vfsp);
1492 
1493                         if (splice)
1494                                 vn_vfsunlock(vp);
1495                         vfs_free(vfsp);
1496                         goto errout;
1497                 }
1498         } else {
1499                 vfs_lock_wait(vfsp);
1500         }
1501 
1502         /*
1503          * Add device to mount in progress table, global mounts require special
1504          * handling. It is possible that we have already done the lookupname
1505          * on a spliced, non-global fs. If so, we don't want to do it again
1506          * since we cannot do a lookupname after taking the
1507          * wlock above. This case is for a non-spliced, non-global filesystem.
1508          */
1509         if (!addmip) {
1510                 if ((uap->flags & MS_GLOBAL) == 0 &&

1511                     lookupname(uap->spec, fromspace, FOLLOW, NULL, &bvp) == 0) {
1512                         addmip = 1;
1513                 }
1514         }
1515 
1516         if (addmip) {
1517                 vnode_t *lvp = NULL;
1518 
1519                 error = vfs_get_lofi(vfsp, &lvp);
1520                 if (error > 0) {
1521                         lofi_remove(vfsp);
1522 
1523                         if (splice)
1524                                 vn_vfsunlock(vp);
1525                         vfs_unlock(vfsp);
1526 
1527                         if (remount) {
1528                                 VFS_RELE(vfsp);
1529                         } else {
1530                                 vfs_free(vfsp);




   6  * You may not use this file except in compliance with the License.
   7  *
   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 2016 Joyent, Inc.
  25  * Copyright 2016 Toomas Soome <tsoome@me.com>
  26  * Copyright (c) 2016, 2017 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>


1274          * would deadlock with lookuppn().
1275          */
1276         if (splice) {
1277                 ASSERT(vp->v_count > 0);
1278 
1279                 /*
1280                  * Pick up mount point and device from appropriate space.
1281                  */
1282                 if (pn_get(uap->spec, fromspace, &pn) == 0) {
1283                         resource = kmem_alloc(pn.pn_pathlen + 1,
1284                             KM_SLEEP);
1285                         (void) strcpy(resource, pn.pn_path);
1286                         pn_free(&pn);
1287                 }
1288                 /*
1289                  * Do a lookupname prior to taking the
1290                  * writelock. Mark this as completed if
1291                  * successful for later cleanup and addition to
1292                  * the mount in progress table.
1293                  */
1294                 if ((vswp->vsw_flag & VSW_MOUNTDEV) &&
1295                     (uap->flags & MS_GLOBAL) == 0 &&
1296                     lookupname(uap->spec, fromspace,
1297                     FOLLOW, NULL, &bvp) == 0) {
1298                         addmip = 1;
1299                 }
1300 
1301                 if ((error = pn_get(uap->dir, fromspace, &pn)) == 0) {
1302                         pathname_t *pnp;
1303 
1304                         if (*pn.pn_path != '/') {
1305                                 error = EINVAL;
1306                                 pn_free(&pn);
1307                                 goto errout;
1308                         }
1309                         pn_alloc(&rpn);
1310                         /*
1311                          * Kludge to prevent autofs from deadlocking with
1312                          * itself when it calls domount().
1313                          *
1314                          * If autofs is calling, it is because it is doing
1315                          * (autofs) mounts in the process of an NFS mount.  A


1491 
1492                         lofi_remove(vfsp);
1493 
1494                         if (splice)
1495                                 vn_vfsunlock(vp);
1496                         vfs_free(vfsp);
1497                         goto errout;
1498                 }
1499         } else {
1500                 vfs_lock_wait(vfsp);
1501         }
1502 
1503         /*
1504          * Add device to mount in progress table, global mounts require special
1505          * handling. It is possible that we have already done the lookupname
1506          * on a spliced, non-global fs. If so, we don't want to do it again
1507          * since we cannot do a lookupname after taking the
1508          * wlock above. This case is for a non-spliced, non-global filesystem.
1509          */
1510         if (!addmip) {
1511                 if ((vswp->vsw_flag & VSW_MOUNTDEV) &&
1512                     (uap->flags & MS_GLOBAL) == 0 &&
1513                     lookupname(uap->spec, fromspace, FOLLOW, NULL, &bvp) == 0) {
1514                         addmip = 1;
1515                 }
1516         }
1517 
1518         if (addmip) {
1519                 vnode_t *lvp = NULL;
1520 
1521                 error = vfs_get_lofi(vfsp, &lvp);
1522                 if (error > 0) {
1523                         lofi_remove(vfsp);
1524 
1525                         if (splice)
1526                                 vn_vfsunlock(vp);
1527                         vfs_unlock(vfsp);
1528 
1529                         if (remount) {
1530                                 VFS_RELE(vfsp);
1531                         } else {
1532                                 vfs_free(vfsp);