Print this page
NEX-15860 devfsadmd shouldn't post disk add/remove events when disk minors are added/removed
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-15860 devfsadmd shouldn't post disk add/remove events when disk minors are added/removed
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Revert "Revert "6602 lofi should support labeled devices""
This reverts commit 21386c8bd8477810b291eee22e08f1382e70cdf3.
NEX-1881 c0 controller instance should be reserved for vhci
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Revert "6602 lofi should support labeled devices"
This reverts commit 406fc5100dac8d225a315a6def6be8d628f34e24.

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/devfsadm/devfsadm.c
          +++ new/usr/src/cmd/devfsadm/devfsadm.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 2016 Toomas Soome <tsoome@me.com>
  24      - * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
       24 + * Copyright 2018 Nexenta Systems, Inc.
  25   25   * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  26   26   */
  27   27  
  28   28  /*
  29   29   * Devfsadm replaces drvconfig, audlinks, disks, tapes, ports, devlinks
  30   30   * as a general purpose device administrative utility.  It creates
  31   31   * devices special files in /devices and logical links in /dev, and
  32   32   * coordinates updates to /etc/path_to_instance with the kernel.  It
  33   33   * operates in both command line mode to handle user or script invoked
  34   34   * reconfiguration updates, and operates in daemon mode to handle dynamic
↓ open down ↓ 8181 lines elided ↑ open up ↑
8216 8216  
8217 8217          if (strcmp(class, EC_DEV_ADD) != 0 &&
8218 8218              strcmp(class, EC_DEV_REMOVE) != 0)
8219 8219                  return (nvl);
8220 8220  
8221 8221          if (driver_name == NULL || instance == -1)
8222 8222                  goto out;
8223 8223  
8224 8224          if (strcmp(subclass, ESC_DISK) == 0) {
8225 8225                  /*
8226      -                 * While we're removing labeled lofi device, we will receive
8227      -                 * event for every registered minor device and lastly,
8228      -                 * an event with minor set to NULL, as in following example:
8229      -                 * class: EC_dev_remove subclass: disk
8230      -                 * node_path: /pseudo/lofi@1 driver: lofi minor: u,raw
8231      -                 * class: EC_dev_remove subclass: disk
8232      -                 * node_path: /pseudo/lofi@1 driver: lofi minor: NULL
     8226 +                 * FIXME Currently we will get ESC_devfs_devi_remove for labeled
     8227 +                 * lofi devices only after all its minors are already removed,
     8228 +                 * so the lookup_disk_dev_name() call below will fail.
8233 8229                   *
8234      -                 * When we receive this last event with minor set to NULL,
8235      -                 * all lofi minor devices are already removed and the call to
8236      -                 * lookup_disk_dev_name() would result in error.
8237      -                 * To prevent name lookup error messages for this case, we
8238      -                 * need to filter out that last event.
     8230 +                 * Given the above, ignore all lofi events except for lofi minor
     8231 +                 * remove event for minor 'a' (chosen arbitrarily) so that we
     8232 +                 * post exactly one ESC_dev_remove/disk event for labeled lofi
     8233 +                 * devices, and don't get error from lookup_disk_dev_name().
8239 8234                   */
8240 8235                  if (strcmp(class, EC_DEV_REMOVE) == 0 &&
8241      -                    strcmp(driver_name, "lofi") ==  0 && minor == NULL) {
     8236 +                    strcmp(driver_name, "lofi") == 0 &&
     8237 +                    (minor == NULL || strcmp(minor, "a") != 0)) {
8242 8238                          nvlist_free(nvl);
8243 8239                          return (NULL);
     8240 +                }
     8241 +                /*
     8242 +                 * Don't post disk minor events (except for lofi workaround),
     8243 +                 * they don't provide any useful information.
     8244 +                 */
     8245 +                if (minor != NULL && strcmp(minor, "a") != 0) {
     8246 +                        nvlist_free(nvl);
     8247 +                        return (NULL);
8244 8248                  }
8245 8249                  if ((dev_name = lookup_disk_dev_name(node_path)) == NULL) {
8246 8250                          dev_name_lookup_err = 1;
8247 8251                          goto out;
8248 8252                  }
8249 8253          } else if (strcmp(subclass, ESC_NETWORK) == 0) {
8250 8254                  if ((dev_name = lookup_network_dev_name(node_path, driver_name))
8251 8255                      == NULL) {
8252 8256                          dev_name_lookup_err = 1;
8253 8257                          goto out;
↓ open down ↓ 523 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX