Print this page
Revert "Revert "6602 lofi should support labeled devices""
This reverts commit 21386c8bd8477810b291eee22e08f1382e70cdf3.
Revert "6602 lofi should support labeled devices"
This reverts commit 406fc5100dac8d225a315a6def6be8d628f34e24.
OS-92 NexentaStor 4.0.1-PASSIV-12022013: Cannot mount root after install

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/cmlb.c
          +++ new/usr/src/uts/common/io/cmlb.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  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 2012 DEY Storage Systems, Inc.  All rights reserved.
  24   24   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  25   25   * Use is subject to license terms.
       26 + * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  26   27   * Copyright 2016 Toomas Soome <tsoome@me.com>
  27   28   */
  28   29  
  29   30  /*
  30   31   * This module provides support for labeling operations for target
  31   32   * drivers.
  32   33   */
  33   34  
  34   35  #include <sys/scsi/scsi.h>
  35   36  #include <sys/sunddi.h>
↓ open down ↓ 637 lines elided ↑ open up ↑
 673  674   *              if _SUNOS_VTOC_16 is defined
 674  675   *                      lowest 6 bits is taken as partition number
 675  676   *                      the rest is instance number
 676  677   *
 677  678   *
 678  679   * Return values:
 679  680   *      0       Success
 680  681   *      ENXIO   creating minor nodes failed.
 681  682   *      EINVAL  invalid arg, unsupported tg_ops version
 682  683   */
      684 +/*ARGSUSED8*/
 683  685  int
 684  686  cmlb_attach(dev_info_t *devi, cmlb_tg_ops_t *tgopsp, int device_type,
 685  687      boolean_t is_removable, boolean_t is_hotpluggable, char *node_type,
 686  688      int alter_behavior, cmlb_handle_t cmlbhandle, void *tg_cookie)
 687  689  {
 688  690  
 689  691          struct cmlb_lun *cl = (struct cmlb_lun *)cmlbhandle;
 690      -        diskaddr_t      cap;
 691      -        int             status;
 692  692  
 693  693          ASSERT(VALID_BOOLEAN(is_removable));
 694  694          ASSERT(VALID_BOOLEAN(is_hotpluggable));
 695  695  
 696  696          if (tgopsp->tg_version < TG_DK_OPS_VERSION_1)
 697  697                  return (EINVAL);
 698  698  
 699  699          mutex_enter(CMLB_MUTEX(cl));
 700  700  
 701  701          CMLB_DEVINFO(cl) = devi;
↓ open down ↓ 5 lines elided ↑ open up ↑
 707  707          cl->cl_sys_blocksize = DEV_BSIZE;
 708  708          cl->cl_f_geometry_is_valid = B_FALSE;
 709  709          cl->cl_def_labeltype = CMLB_LABEL_VTOC;
 710  710          cl->cl_alter_behavior = alter_behavior;
 711  711          cl->cl_reserved = -1;
 712  712          cl->cl_msglog_flag |= CMLB_ALLOW_2TB_WARN;
 713  713  #if defined(__i386) || defined(__amd64)
 714  714          cl->cl_logical_drive_count = 0;
 715  715  #endif
 716  716  
 717      -        if (!is_removable) {
 718      -                mutex_exit(CMLB_MUTEX(cl));
 719      -                status = DK_TG_GETCAP(cl, &cap, tg_cookie);
 720      -                mutex_enter(CMLB_MUTEX(cl));
 721      -                if (status == 0 && cap > CMLB_EXTVTOC_LIMIT) {
 722      -                        /* set default EFI if > 2TB */
 723      -                        cl->cl_def_labeltype = CMLB_LABEL_EFI;
 724      -                }
 725      -        }
 726      -
 727  717          /* create minor nodes based on default label type */
 728  718          cl->cl_last_labeltype = CMLB_LABEL_UNDEF;
 729  719          cl->cl_cur_labeltype = CMLB_LABEL_UNDEF;
 730  720  
 731  721          if (cmlb_create_minor_nodes(cl) != 0) {
 732  722                  mutex_exit(CMLB_MUTEX(cl));
 733  723                  return (ENXIO);
 734  724          }
 735  725  
 736  726          /* Define the dynamic properties for devinfo spapshots. */
↓ open down ↓ 26 lines elided ↑ open up ↑
 763  753  
 764  754          mutex_enter(CMLB_MUTEX(cl));
 765  755          cl->cl_def_labeltype = CMLB_LABEL_UNDEF;
 766  756          cl->cl_f_geometry_is_valid = B_FALSE;
 767  757          ddi_remove_minor_node(CMLB_DEVINFO(cl), NULL);
 768  758          i_ddi_prop_dyn_driver_set(CMLB_DEVINFO(cl), NULL);
 769  759          cl->cl_state = CMLB_INITED;
 770  760          mutex_exit(CMLB_MUTEX(cl));
 771  761  }
 772  762  
      763 +/*
      764 + * cmlb_workaround_off_by_one:
      765 + *
      766 + *      Enables the workaround for the ancient off-by-one bug in sd.
      767 + *      See comment preceding cmlb_attach().
      768 + *
      769 + * Arguments
      770 + *      cmlbhandle      cmlb handle associated with device.
      771 + *
      772 + *
      773 + * Notes:
      774 + *      This should only be called by sd_unit_attach(), and only before
      775 + *      validating the label for the first time.
      776 + *
      777 + * Return values:
      778 + *      None.
      779 + */
      780 +
      781 +void
      782 +cmlb_workaround_off_by_one(cmlb_handle_t cmlbhandle)
      783 +{
      784 +        struct cmlb_lun *cl = (struct cmlb_lun *)cmlbhandle;
      785 +
      786 +        cl->cl_alter_behavior |= CMLB_OFF_BY_ONE;
      787 +}
      788 +
 773  789  /*
 774  790   * cmlb_validate:
 775  791   *
 776  792   *      Validates label.
 777  793   *
 778  794   * Arguments
 779  795   *      cmlbhandle      cmlb handle associated with device.
 780  796   *
 781  797   *      flags           operation flags. used for verbosity control
 782  798   *
↓ open down ↓ 5046 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX