diff options
author | kpande <[email protected]> | 2019-02-26 11:13:15 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-02-26 11:13:15 -0800 |
commit | 47d7ef5490f06bf36bbf9667f266bfd6907ca596 (patch) | |
tree | 789b34a37e60d6d3845e473e78b88a470f89d1db /lib | |
parent | e065034563c8ea34d647c83c22717d72315ca580 (diff) |
Sort by full path name instead of by GUID when importing
Preferentially sort by the full path name instead of GUID when determining
which device links to use. This helps ensure that the pool vdevs are named
consistently when multiple links for a device appear in the same directory.
For example, the /dev/disk/by-id/scsi* and /dev/disk/by-id/wwn* links.
Reviewed-by: Alek Pinchuk <[email protected]>
Reviewed-by: Richard Elling <[email protected]>
Authored-by: Brian Behlendorf <[email protected]>
Signed-off-by: Kash Pande <[email protected]>
Closes #8108
Closes #8440
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzutil/zutil_import.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c index 4284efa75..e82744383 100644 --- a/lib/libzutil/zutil_import.c +++ b/lib/libzutil/zutil_import.c @@ -1458,7 +1458,7 @@ typedef struct rdsk_node { } rdsk_node_t; /* - * Sorted by vdev guid and full path to allow for multiple entries with + * Sorted by full path and then vdev guid to allow for multiple entries with * the same full path name. This is required because it's possible to * have multiple block devices with labels that refer to the same * ZPOOL_CONFIG_PATH yet have different vdev guids. In this case both @@ -1475,11 +1475,11 @@ slice_cache_compare(const void *arg1, const void *arg2) uint64_t guid2 = ((rdsk_node_t *)arg2)->rn_vdev_guid; int rv; - rv = AVL_CMP(guid1, guid2); + rv = AVL_ISIGN(strcmp(nm1, nm2)); if (rv) return (rv); - return (AVL_ISIGN(strcmp(nm1, nm2))); + return (AVL_CMP(guid1, guid2)); } static boolean_t |