Print this page
OS-3969 lx brand: reading process map induces many DNLC scans

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/lookup.c
          +++ new/usr/src/uts/common/fs/lookup.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
       24 + * Copyright (c) 2015, Joyent, Inc. All rights reserved.
  24   25   * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  25   26   */
  26   27  
  27   28  /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T     */
  28   29  /*        All Rights Reserved   */
  29   30  
  30   31  /*
  31   32   * University Copyright- Copyright (c) 1982, 1986, 1988
  32   33   * The Regents of the University of California
  33   34   * All Rights Reserved
↓ open down ↓ 16 lines elided ↑ open up ↑
  50   51  #include <sys/pathname.h>
  51   52  #include <sys/proc.h>
  52   53  #include <sys/vtrace.h>
  53   54  #include <sys/sysmacros.h>
  54   55  #include <sys/debug.h>
  55   56  #include <sys/dirent.h>
  56   57  #include <c2/audit.h>
  57   58  #include <sys/zone.h>
  58   59  #include <sys/dnlc.h>
  59   60  #include <sys/fs/snode.h>
       61 +#include <sys/brand.h>
  60   62  
  61   63  /* Controls whether paths are stored with vnodes. */
  62   64  int vfs_vnode_path = 1;
  63   65  
  64   66  int
  65   67  lookupname(
  66   68          char *fnamep,
  67   69          enum uio_seg seg,
  68   70          int followlink,
  69   71          vnode_t **dirvpp,
↓ open down ↓ 1331 lines elided ↑ open up ↑
1401 1403                  }
1402 1404  
1403 1405  notcached:
1404 1406                  pn_free(&rpn);
1405 1407          } else {
1406 1408                  mutex_exit(&vp->v_lock);
1407 1409          }
1408 1410  
1409 1411          pn_free(&pn);
1410 1412  
1411      -        if (vp->v_type != VDIR) {
     1413 +        if (PROC_IS_BRANDED(curproc)) {
1412 1414                  /*
     1415 +                 * If v_path doesn't work out and we're in a branded zone,
     1416 +                 * we're not going to bother doing more work here:  because
     1417 +                 * directories from the global can be lofs mounted into odd
     1418 +                 * locations (e.g., /native in an lx zone), it is likely that
     1419 +                 * the DNLC reverse lookup will yield nothing.  Indeed, the
     1420 +                 * only certainty is that the DNLC reverse lookup will be
     1421 +                 * exceedingly painful; we save ourselves the substantial
     1422 +                 * grief of scanning the entire DNLC and kick out with ENOENT
     1423 +                 * in this case.
     1424 +                 */
     1425 +                ret = ENOENT;
     1426 +        } else if (vp->v_type != VDIR) {
     1427 +                /*
1413 1428                   * If we don't have a directory, try to find it in the dnlc via
1414 1429                   * reverse lookup.  Once this is found, we can use the regular
1415 1430                   * directory search to find the full path.
1416 1431                   */
1417 1432                  if ((pvp = dnlc_reverse_lookup(vp, path, MAXNAMELEN)) != NULL) {
1418 1433                          /*
1419 1434                           * Check if we have read privilege so, that
1420 1435                           * we can lookup the path in the directory
1421 1436                           */
1422 1437                          ret = 0;
↓ open down ↓ 131 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX