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.
        
*** 19,29 ****
   * CDDL HEADER END
   */
  
  /*
   * Copyright 2016 Toomas Soome <tsoome@me.com>
!  * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
   * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   */
  
  /*
   * Devfsadm replaces drvconfig, audlinks, disks, tapes, ports, devlinks
--- 19,29 ----
   * CDDL HEADER END
   */
  
  /*
   * Copyright 2016 Toomas Soome <tsoome@me.com>
!  * Copyright 2018 Nexenta Systems, Inc.
   * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   */
  
  /*
   * Devfsadm replaces drvconfig, audlinks, disks, tapes, ports, devlinks
*** 8221,8248 ****
          if (driver_name == NULL || instance == -1)
                  goto out;
  
          if (strcmp(subclass, ESC_DISK) == 0) {
                  /*
!                  * While we're removing labeled lofi device, we will receive
!                  * event for every registered minor device and lastly,
!                  * an event with minor set to NULL, as in following example:
!                  * class: EC_dev_remove subclass: disk
!                  * node_path: /pseudo/lofi@1 driver: lofi minor: u,raw
!                  * class: EC_dev_remove subclass: disk
!                  * node_path: /pseudo/lofi@1 driver: lofi minor: NULL
                   *
!                  * When we receive this last event with minor set to NULL,
!                  * all lofi minor devices are already removed and the call to
!                  * lookup_disk_dev_name() would result in error.
!                  * To prevent name lookup error messages for this case, we
!                  * need to filter out that last event.
                   */
                  if (strcmp(class, EC_DEV_REMOVE) == 0 &&
!                     strcmp(driver_name, "lofi") ==  0 && minor == NULL) {
                          nvlist_free(nvl);
                          return (NULL);
                  }
                  if ((dev_name = lookup_disk_dev_name(node_path)) == NULL) {
                          dev_name_lookup_err = 1;
                          goto out;
                  }
--- 8221,8252 ----
          if (driver_name == NULL || instance == -1)
                  goto out;
  
          if (strcmp(subclass, ESC_DISK) == 0) {
                  /*
!                  * FIXME Currently we will get ESC_devfs_devi_remove for labeled
!                  * lofi devices only after all its minors are already removed,
!                  * so the lookup_disk_dev_name() call below will fail.
                   *
!                  * Given the above, ignore all lofi events except for lofi minor
!                  * remove event for minor 'a' (chosen arbitrarily) so that we
!                  * post exactly one ESC_dev_remove/disk event for labeled lofi
!                  * devices, and don't get error from lookup_disk_dev_name().
                   */
                  if (strcmp(class, EC_DEV_REMOVE) == 0 &&
!                     strcmp(driver_name, "lofi") == 0 &&
!                     (minor == NULL || strcmp(minor, "a") != 0)) {
                          nvlist_free(nvl);
                          return (NULL);
+                 }
+                 /*
+                  * Don't post disk minor events (except for lofi workaround),
+                  * they don't provide any useful information.
+                  */
+                 if (minor != NULL && strcmp(minor, "a") != 0) {
+                         nvlist_free(nvl);
+                         return (NULL);
                  }
                  if ((dev_name = lookup_disk_dev_name(node_path)) == NULL) {
                          dev_name_lookup_err = 1;
                          goto out;
                  }