Print this page
3354 kernel crash in rpcsec_gss after using gsscred
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Carlos Neira <cneirabustos@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
NEX-14051 Be careful with RPC groups
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
8085 Handle RPC groups better
Reviewed by: "Joshua M. Clulow" <josh@sysmgr.org>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Dan McDonald <danmcd@omniti.com>
NEX-2320 svc_queueclose() could wake up too much threads
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Tony Nguyen <tony.nguyen@nexenta.com>
re #12783 rb4338 Flow control is needed in rpcmod when the NFS server is unable to keep up with the network
re #13613 rb4516 Tunables needs volatile keyword
re #12714 rb4347 Corruption of the `xprt-ready' queue in svc_xprt_qdelete()

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/rpc/svc.c
          +++ new/usr/src/uts/common/rpc/svc.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  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   22  /*
       23 + * Copyright 2012 Marcel Telka <marcel@telka.sk>
  23   24   * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
  24   26   */
  25   27  
  26   28  /*
  27   29   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  28   30   * Use is subject to license terms.
  29   31   */
  30   32  
  31   33  /*
  32   34   * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved.
  33   35   */
  34   36  
  35   37  /*      Copyright (c) 1983, 1984, 1985,  1986, 1987, 1988, 1989 AT&T    */
  36      -/*        All Rights Reserved   */
       38 +/*      All Rights Reserved     */
  37   39  
  38   40  /*
  39   41   * Portions of this source code were derived from Berkeley 4.3 BSD
  40   42   * under license from the Regents of the University of California.
  41   43   */
  42   44  
  43   45  /*
  44   46   * Server-side remote procedure call interface.
  45   47   *
  46   48   * Master transport handle (SVCMASTERXPRT).
↓ open down ↓ 165 lines elided ↑ open up ↑
 212  214   */
 213  215  #define SVC_EXPRTGONE ((SVCMASTERXPRT *)1)      /* Transport is closing */
 214  216  #define SVC_ETIMEDOUT ((SVCMASTERXPRT *)2)      /* Timeout */
 215  217  #define SVC_EINTR ((SVCMASTERXPRT *)3)          /* Interrupted by signal */
 216  218  
 217  219  /*
 218  220   * Default stack size for service threads.
 219  221   */
 220  222  #define DEFAULT_SVC_RUN_STKSIZE         (0)     /* default kernel stack */
 221  223  
 222      -int    svc_default_stksize = DEFAULT_SVC_RUN_STKSIZE;
      224 +volatile int    svc_default_stksize = DEFAULT_SVC_RUN_STKSIZE;
 223  225  
 224  226  /*
 225  227   * Default polling timeout for service threads.
 226  228   * Multiplied by hz when used.
 227  229   */
 228  230  #define DEFAULT_SVC_POLL_TIMEOUT        (5)     /* seconds */
 229  231  
 230  232  clock_t svc_default_timeout = DEFAULT_SVC_POLL_TIMEOUT;
 231  233  
 232  234  /*
↓ open down ↓ 8 lines elided ↑ open up ↑
 241  243   */
 242  244  #define DEFAULT_SVC_MAXTHREADS          (INT16_MAX)
 243  245  
 244  246  int    svc_default_maxthreads = DEFAULT_SVC_MAXTHREADS;
 245  247  
 246  248  /*
 247  249   * Maximum number of requests from the same transport (in `drain' mode).
 248  250   */
 249  251  #define DEFAULT_SVC_MAX_SAME_XPRT       (8)
 250  252  
 251      -int    svc_default_max_same_xprt = DEFAULT_SVC_MAX_SAME_XPRT;
      253 +volatile int    svc_default_max_same_xprt = DEFAULT_SVC_MAX_SAME_XPRT;
 252  254  
 253  255  
 254  256  /*
 255  257   * Default `Redline' of non-detached threads.
 256  258   * Total number of detached and reserved threads in an RPC server
 257  259   * thread pool is limited to pool->p_maxthreads - svc_redline.
 258  260   */
 259  261  #define DEFAULT_SVC_REDLINE             (1)
 260  262  
 261  263  int    svc_default_redline = DEFAULT_SVC_REDLINE;
↓ open down ↓ 27 lines elided ↑ open up ↑
 289  291   */
 290  292  volatile int svc_flowcontrol_disable = 0;
 291  293  
 292  294  /*
 293  295   * Authentication parameters list.
 294  296   */
 295  297  static caddr_t rqcred_head;
 296  298  static kmutex_t rqcred_lock;
 297  299  
 298  300  /*
 299      - * Pointers to transport specific `rele' routines in rpcmod (set from rpcmod).
 300      - */
 301      -void    (*rpc_rele)(queue_t *, mblk_t *, bool_t) = NULL;
 302      -void    (*mir_rele)(queue_t *, mblk_t *, bool_t) = NULL;
 303      -
 304      -/* ARGSUSED */
 305      -void
 306      -rpc_rdma_rele(queue_t *q, mblk_t *mp, bool_t enable)
 307      -{
 308      -}
 309      -void    (*rdma_rele)(queue_t *, mblk_t *, bool_t) = rpc_rdma_rele;
 310      -
 311      -
 312      -/*
 313      - * This macro picks which `rele' routine to use, based on the transport type.
 314      - */
 315      -#define RELE_PROC(xprt) \
 316      -        ((xprt)->xp_type == T_RDMA ? rdma_rele : \
 317      -        (((xprt)->xp_type == T_CLTS) ? rpc_rele : mir_rele))
 318      -
 319      -/*
 320  301   * If true, then keep quiet about version mismatch.
 321  302   * This macro is for broadcast RPC only. We have no broadcast RPC in
 322  303   * kernel now but one may define a flag in the transport structure
 323  304   * and redefine this macro.
 324  305   */
 325  306  #define version_keepquiet(xprt) (FALSE)
 326  307  
 327  308  /*
 328  309   * ZSD key used to retrieve zone-specific svc globals
 329  310   */
↓ open down ↓ 258 lines elided ↑ open up ↑
 588  569          svc->svc_pools = pool;
 589  570  
 590  571          mutex_exit(&svc->svc_plock);
 591  572  }
 592  573  
 593  574  /*
 594  575   * Initialize a newly created pool structure
 595  576   */
 596  577  static int
 597  578  svc_pool_init(SVCPOOL *pool, uint_t maxthreads, uint_t redline,
 598      -        uint_t qsize, uint_t timeout, uint_t stksize, uint_t max_same_xprt)
      579 +    uint_t qsize, uint_t timeout, uint_t stksize, uint_t max_same_xprt)
 599  580  {
 600  581          klwp_t *lwp = ttolwp(curthread);
 601  582  
 602  583          ASSERT(pool);
 603  584  
 604  585          if (maxthreads == 0)
 605  586                  maxthreads = svc_default_maxthreads;
 606  587          if (redline == 0)
 607  588                  redline = svc_default_redline;
 608  589          if (qsize == 0)
↓ open down ↓ 1771 lines elided ↑ open up ↑
2380 2361  
2381 2362                  /*
2382 2363                   * Release our reference on the rpcmod
2383 2364                   * slot attached to xp_wq->q_ptr.
2384 2365                   */
2385 2366                  mutex_enter(&xprt->xp_req_lock);
2386 2367                  enable = xprt->xp_enable;
2387 2368                  if (enable)
2388 2369                          xprt->xp_enable = FALSE;
2389 2370                  mutex_exit(&xprt->xp_req_lock);
2390      -                (*RELE_PROC(xprt)) (clone_xprt->xp_wq, NULL, enable);
     2371 +                SVC_RELE(clone_xprt, NULL, enable);
2391 2372          }
2392 2373          /* NOTREACHED */
2393 2374  }
2394 2375  
2395 2376  /*
2396 2377   * Flush any pending requests for the queue and
2397 2378   * free the associated mblks.
2398 2379   */
2399 2380  void
2400 2381  svc_queueclean(queue_t *q)
↓ open down ↓ 4 lines elided ↑ open up ↑
2405 2386  
2406 2387          /*
2407 2388           * clean up the requests
2408 2389           */
2409 2390          mutex_enter(&xprt->xp_req_lock);
2410 2391          pool = xprt->xp_pool;
2411 2392          while ((mp = xprt->xp_req_head) != NULL) {
2412 2393                  /* remove the request from the list */
2413 2394                  xprt->xp_req_head = mp->b_next;
2414 2395                  mp->b_next = (mblk_t *)0;
2415      -                (*RELE_PROC(xprt)) (xprt->xp_wq, mp, FALSE);
     2396 +                SVC_RELE(xprt, mp, FALSE);
2416 2397          }
2417 2398  
2418 2399          mutex_enter(&pool->p_req_lock);
2419 2400          pool->p_reqs -= xprt->xp_reqs;
2420 2401          pool->p_size -= xprt->xp_size;
2421 2402          mutex_exit(&pool->p_req_lock);
2422 2403  
2423 2404          xprt->xp_reqs = 0;
2424 2405          xprt->xp_size = 0;
2425 2406          xprt->xp_full = FALSE;
↓ open down ↓ 296 lines elided ↑ open up ↑
2722 2703          pool->p_reserved_threads--;
2723 2704          pool->p_detached_threads++;
2724 2705          mutex_exit(&pool->p_thread_lock);
2725 2706  
2726 2707          /* Release an rpcmod slot for this request */
2727 2708          mutex_enter(&xprt->xp_req_lock);
2728 2709          enable = xprt->xp_enable;
2729 2710          if (enable)
2730 2711                  xprt->xp_enable = FALSE;
2731 2712          mutex_exit(&xprt->xp_req_lock);
2732      -        (*RELE_PROC(xprt)) (clone_xprt->xp_wq, NULL, enable);
     2713 +        SVC_RELE(clone_xprt, NULL, enable);
2733 2714  
2734 2715          /* Mark the clone (thread) as detached */
2735 2716          clone_xprt->xp_reserved = FALSE;
2736 2717          clone_xprt->xp_detached = TRUE;
2737 2718  
2738 2719          return (NULL);
2739 2720  }
2740 2721  
2741 2722  /*
2742 2723   * This routine is responsible for extracting RDMA plugin master XPRT,
↓ open down ↓ 147 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX