# HG changeset patch # User zk194757 # Date 1175269595 25200 # Node ID 273f6bb7e684c982f96057148de364190e6450db # Parent ea83e56013c83a6f8f80ca1567eeec45b0d410a8 6516007 The iostat -E shows the "Illegal Request(Soft Errors)" statistic for a DVD device diff -r ea83e56013c8 -r 273f6bb7e684 usr/src/uts/common/io/scsi/targets/sd.c --- a/usr/src/uts/common/io/scsi/targets/sd.c Fri Mar 30 07:16:06 2007 -0700 +++ b/usr/src/uts/common/io/scsi/targets/sd.c Fri Mar 30 08:46:35 2007 -0700 @@ -4266,6 +4266,15 @@ } pgeom_p->g_secsize = (unsigned short)lbasize; + /* + * If the unit is a cd/dvd drive MODE SENSE page three + * and MODE SENSE page four are reserved (see SBC spec + * and MMC spec). To prevent soft errors just return + * using the default LBA size. + */ + if (ISCD(un)) + return (ret); + cdbsize = (un->un_f_cfg_is_atapi == TRUE) ? CDB_GROUP2 : CDB_GROUP0; /* @@ -4323,7 +4332,7 @@ * 1243403: The NEC D38x7 drives do not support MODE SENSE sector size */ if (sector_size == 0) { - sector_size = (ISCD(un)) ? 2048 : un->un_sys_blocksize; + sector_size = un->un_sys_blocksize; } else { sector_size &= ~(un->un_sys_blocksize - 1); } @@ -7208,29 +7217,6 @@ mutex_exit(SD_MUTEX(un)); /* - * Set the pstat and error stat values here, so data obtained during the - * previous attach-time routines is available. - * - * Note: This is a critical sequence that needs to be maintained: - * 1) Instantiate the kstats before any routines using the iopath - * (i.e. sd_send_scsi_cmd). - * 2) Initialize the error stats (sd_set_errstats) and partition - * stats (sd_set_pstats)here, following - * cmlb_validate_geometry(), sd_register_devid(), and - * sd_cache_control(). - */ - - if (un->un_f_pkstats_enabled && geom_label_valid) { - sd_set_pstats(un); - SD_TRACE(SD_LOG_IO_PARTITION, un, - "sd_unit_attach: un:0x%p pstats created and set\n", un); - } - - sd_set_errstats(un); - SD_TRACE(SD_LOG_ATTACH_DETACH, un, - "sd_unit_attach: un:0x%p errstats set\n", un); - - /* * Find out what type of reservation this disk supports. */ switch (sd_send_scsi_PERSISTENT_RESERVE_IN(un, SD_READ_KEYS, 0, NULL)) { @@ -7262,6 +7248,30 @@ } /* + * Set the pstat and error stat values here, so data obtained during the + * previous attach-time routines is available. + * + * Note: This is a critical sequence that needs to be maintained: + * 1) Instantiate the kstats before any routines using the iopath + * (i.e. sd_send_scsi_cmd). + * 2) Initialize the error stats (sd_set_errstats) and partition + * stats (sd_set_pstats)here, following + * cmlb_validate_geometry(), sd_register_devid(), and + * sd_cache_control(). + */ + + if (un->un_f_pkstats_enabled && geom_label_valid) { + sd_set_pstats(un); + SD_TRACE(SD_LOG_IO_PARTITION, un, + "sd_unit_attach: un:0x%p pstats created and set\n", un); + } + + sd_set_errstats(un); + SD_TRACE(SD_LOG_ATTACH_DETACH, un, + "sd_unit_attach: un:0x%p errstats set\n", un); + + + /* * After successfully attaching an instance, we record the information * of how many luns have been attached on the relative target and * controller for parallel SCSI. This information is used when sd tries