Print this page
9702 HBA drivers don't need the redundant devfs_clean step
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/fibre-channel/ulp/fcp.c
          +++ new/usr/src/uts/common/io/fibre-channel/ulp/fcp.c
↓ open down ↓ 10 lines elided ↑ open up ↑
  11   11   * and limitations under the License.
  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  /*
  22   23   * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - *
       24 + */
       25 +
       26 +/*
       27 + * Copyright 2018 Nexenta Systems, Inc.
       28 + */
       29 +
       30 +/*
  24   31   * Fibre Channel SCSI ULP Mapping driver
  25   32   */
  26   33  
  27   34  #include <sys/scsi/scsi.h>
  28   35  #include <sys/types.h>
  29   36  #include <sys/varargs.h>
  30   37  #include <sys/devctl.h>
  31   38  #include <sys/thread.h>
  32   39  #include <sys/thread.h>
  33   40  #include <sys/open.h>
  34   41  #include <sys/file.h>
  35   42  #include <sys/sunndi.h>
  36   43  #include <sys/console.h>
  37   44  #include <sys/proc.h>
  38   45  #include <sys/time.h>
  39   46  #include <sys/utsname.h>
  40   47  #include <sys/scsi/impl/scsi_reset_notify.h>
  41   48  #include <sys/ndi_impldefs.h>
  42   49  #include <sys/byteorder.h>
  43      -#include <sys/fs/dv_node.h>
  44   50  #include <sys/ctype.h>
  45   51  #include <sys/sunmdi.h>
  46   52  
  47   53  #include <sys/fibre-channel/fc.h>
  48   54  #include <sys/fibre-channel/impl/fc_ulpif.h>
  49   55  #include <sys/fibre-channel/ulp/fcpvar.h>
  50   56  
  51   57  /*
  52   58   * Discovery Process
  53   59   * =================
↓ open down ↓ 8090 lines elided ↑ open up ↑
8144 8150   */
8145 8151  static int
8146 8152  fcp_trigger_lun(struct fcp_lun *plun, child_info_t *cip, int old_mpxio,
8147 8153      int online, int lcount, int tcount, int flags)
8148 8154  {
8149 8155          int                     rval = NDI_FAILURE;
8150 8156          int                     circ;
8151 8157          child_info_t            *ccip;
8152 8158          struct fcp_port         *pptr = plun->lun_tgt->tgt_port;
8153 8159          int                     is_mpxio = pptr->port_mpxio;
8154      -        dev_info_t              *cdip, *pdip;
8155      -        char                    *devname;
8156 8160  
8157 8161          if ((old_mpxio != 0) && (plun->lun_mpxio != old_mpxio)) {
8158 8162                  /*
8159 8163                   * When this event gets serviced, lun_cip and lun_mpxio
8160 8164                   * has changed, so it should be invalidated now.
8161 8165                   */
8162 8166                  FCP_TRACE(fcp_logq, pptr->port_instbuf, fcp_trace,
8163 8167                      FCP_BUF_LEVEL_2, 0, "fcp_trigger_lun: lun_mpxio changed: "
8164 8168                      "plun: %p, cip: %p, what:%d", plun, cip, online);
8165 8169                  return (rval);
↓ open down ↓ 19 lines elided ↑ open up ↑
8185 8189          if (online == FCP_MPXIO_PATH_CLEAR_BUSY ||
8186 8190              online == FCP_MPXIO_PATH_SET_BUSY) {
8187 8191                  if (plun->lun_mpxio) {
8188 8192                          rval = fcp_update_mpxio_path(plun, cip, online);
8189 8193                  } else {
8190 8194                          rval = NDI_SUCCESS;
8191 8195                  }
8192 8196                  return (rval);
8193 8197          }
8194 8198  
8195      -        /*
8196      -         * Explicit devfs_clean() due to ndi_devi_offline() not
8197      -         * executing devfs_clean() if parent lock is held.
8198      -         */
8199      -        ASSERT(!servicing_interrupt());
8200      -        if (online == FCP_OFFLINE) {
8201      -                if (plun->lun_mpxio == 0) {
8202      -                        if (plun->lun_cip == cip) {
8203      -                                cdip = DIP(plun->lun_cip);
8204      -                        } else {
8205      -                                cdip = DIP(cip);
8206      -                        }
8207      -                } else if ((plun->lun_cip == cip) && plun->lun_cip) {
8208      -                        cdip = mdi_pi_get_client(PIP(plun->lun_cip));
8209      -                } else if ((plun->lun_cip != cip) && cip) {
8210      -                        /*
8211      -                         * This means a DTYPE/GUID change, we shall get the
8212      -                         * dip of the old cip instead of the current lun_cip.
8213      -                         */
8214      -                        cdip = mdi_pi_get_client(PIP(cip));
8215      -                }
8216      -                if (cdip) {
8217      -                        if (i_ddi_devi_attached(cdip)) {
8218      -                                pdip = ddi_get_parent(cdip);
8219      -                                devname = kmem_alloc(MAXNAMELEN + 1, KM_SLEEP);
8220      -                                ndi_devi_enter(pdip, &circ);
8221      -                                (void) ddi_deviname(cdip, devname);
8222      -                                /*
8223      -                                 * Release parent lock before calling
8224      -                                 * devfs_clean().
8225      -                                 */
8226      -                                ndi_devi_exit(pdip, circ);
8227      -                                (void) devfs_clean(pdip, devname + 1,
8228      -                                    DV_CLEAN_FORCE);
8229      -                                kmem_free(devname, MAXNAMELEN + 1);
8230      -                        }
8231      -                }
8232      -        }
8233      -
8234 8199          if (fc_ulp_busy_port(pptr->port_fp_handle) != 0) {
8235 8200                  return (NDI_FAILURE);
8236 8201          }
8237 8202  
8238 8203          if (is_mpxio) {
8239 8204                  mdi_devi_enter(pptr->port_dip, &circ);
8240 8205          } else {
8241 8206                  ndi_devi_enter(pptr->port_dip, &circ);
8242 8207          }
8243 8208  
↓ open down ↓ 5061 lines elided ↑ open up ↑
13305 13270          /*
13306 13271           * We will use this value twice. Make a copy to be sure we use
13307 13272           * the same value in both places.
13308 13273           */
13309 13274          lun_mpxio = plun->lun_mpxio;
13310 13275  
13311 13276          if (lun_mpxio == 0) {
13312 13277                  cdip = DIP(cip);
13313 13278                  mutex_exit(&plun->lun_mutex);
13314 13279                  mutex_exit(&pptr->port_mutex);
13315      -                rval = ndi_devi_offline(DIP(cip), flags);
     13280 +                rval = ndi_devi_offline(DIP(cip), NDI_DEVFS_CLEAN | flags);
13316 13281                  if (rval != NDI_SUCCESS) {
13317 13282                          FCP_TRACE(fcp_logq, pptr->port_instbuf,
13318 13283                              fcp_trace, FCP_BUF_LEVEL_3, 0,
13319 13284                              "fcp_offline_child: ndi_devi_offline failed "
13320 13285                              "rval=%x cip=%p", rval, cip);
13321 13286                  }
13322 13287          } else {
13323 13288                  cdip = mdi_pi_get_client(PIP(cip));
13324 13289                  mutex_exit(&plun->lun_mutex);
13325 13290                  mutex_exit(&pptr->port_mutex);
↓ open down ↓ 3030 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX