Print this page
4953763 Need way to configure NFS window sizes without changing system wide defaults
6216670 NFS server needs a bigger transmit buffer

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/nfs/nfs4cbd/nfs4cbd.c
          +++ new/usr/src/cmd/fs.d/nfs/nfs4cbd/nfs4cbd.c
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  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      - * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
       22 + * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T     */
  27   27  /*        All Rights Reserved   */
  28   28  
  29   29  /*
  30   30   * Portions of this source code were derived from Berkeley 4.3 BSD
  31   31   * under license from the Regents of the University of California.
  32   32   */
  33   33  
  34      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  35      -
  36   34  /*
  37   35   * This module provides the user level support for the NFSv4
  38   36   * callback program.  It is modeled after nfsd.  When a nfsv4
  39   37   * mount occurs, the mount command forks and the child runs
  40   38   * start_nfs4_callback.  If this is the first mount, then the
  41   39   * process will hang around listening for incoming connection
  42   40   * requests from the nfsv4 server.
  43   41   *
  44   42   * For connection-less protocols, the krpc is started immediately.
  45   43   * For connection oriented protocols, the kernel module is informed
↓ open down ↓ 76 lines elided ↑ open up ↑
 122  120          /*
 123  121           * create a child to continue our work
 124  122           * Parent's exit will tell mount command we're ready to go
 125  123           */
 126  124          if ((pi = fork()) > 0) {
 127  125                  exit(0);
 128  126          }
 129  127  
 130  128          if (pi == -1) {
 131  129                  (void) syslog(LOG_ERR,
 132      -                        "Could not start NFS4_CALLBACK service");
      130 +                    "Could not start NFS4_CALLBACK service");
 133  131                  exit(1);
 134  132          }
 135  133  
 136  134          (void) _create_daemon_lock(NFS4CBD, DAEMON_UID, DAEMON_GID);
 137  135  
 138  136          svcsetprio();
 139  137  
 140  138          if (__init_daemon_priv(PU_RESETGROUPS|PU_CLEARLIMITSET,
 141  139              DAEMON_UID, DAEMON_GID, PRIV_SYS_NFS, (char *)NULL) == -1) {
 142  140                  (void) fprintf(stderr, "%s must be run with sufficient"
 143      -                        " privileges\n", argv[0]);
      141 +                    " privileges\n", argv[0]);
 144  142                  exit(1);
 145  143          }
 146  144          /* Basic privileges we don't need, remove from E/P. */
 147  145          __fini_daemon_priv(PRIV_PROC_EXEC, PRIV_PROC_FORK, PRIV_FILE_LINK_ANY,
 148  146              PRIV_PROC_SESSION, PRIV_PROC_INFO, (char *)NULL);
 149  147  
 150  148          /*
 151  149           * establish our lock on the lock file and write our pid to it.
 152  150           * exit if some other process holds the lock, or if there's any
 153  151           * error in writing/locking the file.
↓ open down ↓ 79 lines elided ↑ open up ↑
 233  231          char me[MAXHOSTNAMELEN];
 234  232          struct nd_addrlist *nas;
 235  233          struct nd_hostserv hs;
 236  234          struct nd_mergearg ma;
 237  235  
 238  236          ua = taddr2uaddr(nconf, nb);
 239  237  
 240  238          if (ua == NULL) {
 241  239  #ifdef  DEBUG
 242  240                  fprintf(stderr, "taddr2uaddr failed for netid %s\n",
 243      -                        nconf->nc_netid);
      241 +                    nconf->nc_netid);
 244  242  #endif
 245  243                  return (NULL);
 246  244          }
 247  245  
 248  246          gethostname(me, MAXHOSTNAMELEN);
 249  247  
 250  248          hs.h_host = me;
 251  249          hs.h_serv = "nfs";
 252  250          if (netdir_getbyname(nconf, &hs, &nas)) {
 253  251  #ifdef DEBUG
 254  252                  netdir_perror("netdir_getbyname");
 255  253  #endif
 256  254                  return (NULL);
 257  255          }
 258  256  
 259  257          ua2 = taddr2uaddr(nconf, nas->n_addrs);
 260  258  
 261  259          if (ua2 == NULL) {
 262  260  #ifdef  DEBUG
 263  261                  fprintf(stderr, "taddr2uaddr failed for netid %s.\n",
 264      -                        nconf->nc_netid);
      262 +                    nconf->nc_netid);
 265  263  #endif
 266  264                  return (NULL);
 267  265          }
 268  266  
 269  267          ma.s_uaddr = ua;
 270  268          ma.c_uaddr = ua2;
 271  269          ma.m_uaddr = NULL;
 272  270  
 273  271          if (netdir_options(nconf, ND_MERGEADDR, 0, (char *)&ma)) {
 274  272  #ifdef DEBUG
↓ open down ↓ 14 lines elided ↑ open up ↑
 289  287          int cmd, struct netbuf *addr)
 290  288  {
 291  289          struct nfs4_svc_args nsa;
 292  290          char *ua;
 293  291          int error;
 294  292  
 295  293          ua = get_uaddr(fd, nconf, addr);
 296  294  
 297  295          if (ua == NULL) {
 298  296                  syslog(LOG_NOTICE, "nfsv4 cannot determine local hostname "
 299      -                        "binding for transport %s - delegations will not be "
 300      -                        "available on this transport\n", nconf->nc_netid);
      297 +                    "binding for transport %s - delegations will not be "
      298 +                    "available on this transport\n", nconf->nc_netid);
 301  299                  return (0);
 302  300          }
 303  301  
 304  302  #ifdef  DEBUG
 305  303          if (cmd & NFS4_KRPC_START)
 306  304                  fprintf(stderr, "nfs4cbd: starting callback rpc on %s %s\n",
 307      -                        nconf->nc_netid, ua);
      305 +                    nconf->nc_netid, ua);
 308  306          else
 309  307                  fprintf(stderr, "nfs4cbd: listening on %s %s\n",
 310      -                        nconf->nc_netid, ua);
      308 +                    nconf->nc_netid, ua);
 311  309  #endif
 312  310  
 313  311          nsa.fd = fd;
 314  312          nsa.cmd = cmd;
 315  313          nsa.netid = nconf->nc_netid;
 316  314          if (addrmask)
 317  315                  nsa.addrmask = *addrmask;
 318  316          else
 319  317                  bzero(&nsa.addrmask, sizeof (struct netbuf));
 320  318          nsa.addr = ua;
 321  319          nsa.protofmly = nconf->nc_protofmly;
 322  320          nsa.proto = nconf->nc_proto;
 323  321          if ((error = _nfssys(NFS4_SVC, &nsa)) != 0)
 324  322                  syslog(LOG_ERR, "nfssys NFS4_SVC failed\n");
 325  323  
 326  324          return (error);
 327  325  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX