OpenSolaris

Printable Version Enter a New Search
Bug ID 6722991
Synopsis vdev_disk.c: error checking for ddi_pathname_to_dev_t() must test for NODEV
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:zfs
Keywords opensolaris
Responsible Engineer Mark Musante
Reported Against snv_93
Duplicate Of
Introduced In solaris_nevada
Commit to Fix snv_105
Fixed In snv_105
Release Fixed solaris_nevada(snv_105) , solaris_10u8(s10u8_01) (Bug ID:2176249)
Related Bugs
Submit Date 7-July-2008
Last Update Date 17-December-2008
Description
Category
   kernel
Sub-Category
   zfs
Description
   vdev_disk.c, function vdev_disk_open_common() calls ddi_pathname_to_dev_t()
and tests the returned value against ENODEV:
        /*
         * If all else fails, then try opening by physical path (if available)
         * or the logical path (if we failed due to the devid check).  While not
         * as reliable as the devid, this will give us something, and the higher
         * level vdev validation will prevent us from opening the wrong device.
         */
        if (error) {
                if (vd->vdev_physpath != NULL &&
                    (dev = ddi_pathname_to_dev_t(vd->vdev_physpath)) != ENODEV)
                        error = ldi_open_by_dev(&dev, OTYP_BLK, spa_mode,
                            kcred, &dvd->vd_lh, zfs_li);
ENODEV (errno code) isn't a special return value from ddi_pathname_to_dev_t()
on failures;  the comment in usr/src/uts/common/os/devcfg.c states that
NODEV is returned on failure:
    /*
     * Given the pathname of a device, return the dev_t of the corresponding
     * device.  Returns NODEV on failure.
     *
     * Note that this call sets the DDI_NO_AUTODETACH property on the devinfo node.
     */
    dev_t ddi_pathname_to_dev_t(char *pathname);
Correct test for failures in vdev_disk.c should be 
    (dev = ddi_pathname_to_dev_t(vd->vdev_physpath)) != NODEV
Frequency
   Always
Regression
   No
Steps to Reproduce
   Look at the usr/src/uts/common/fs/zfs/vdev_disk.c
function vdev_disk_open_common()
Expected Result
   ddi_pathname_to_dev_t() return value is tested against NODEV
Actual Result
   return value is tested against ENODEV; ldi_open_by_dev() is called with 
invalid dev_t values.
Error Message(s)
   
Test Case
   
Workaround
   
Submitter wants to work on bug
   No
Additional configuration information
Work Around
N/A
Comments
N/A