Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for devid and phys_path keys in vdev disk labels. #4416

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion cmd/zpool/zpool_vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2016 Intel Corporation.
*/

/*
Expand Down Expand Up @@ -447,7 +448,7 @@ check_disk(const char *path, blkid_cache cache, int force,
(void) close(fd);

if (force) {
/* Partitions will no be created using the backup */
/* Partitions will now be created using the backup */
return (0);
} else {
vdev_error(gettext("%s contains a corrupt primary "
Expand Down Expand Up @@ -1178,6 +1179,12 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
&wholedisk));

if (!wholedisk) {
/*
* Update device id string for mpath nodes (Linux only)
*/
if (is_mpath_whole_disk(path))
update_vdev_config_dev_strs(nv);

(void) zero_label(path);
return (0);
}
Expand Down Expand Up @@ -1249,6 +1256,12 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
*/
verify(nvlist_add_string(nv, ZPOOL_CONFIG_PATH, udevpath) == 0);

/*
* Update device id strings for whole disks (Linux only)
*/
if (wholedisk)
update_vdev_config_dev_strs(nv);

return (0);
}

Expand Down
13 changes: 13 additions & 0 deletions config/user-libudev.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dnl #
dnl # Check for libudev - needed for vdev auto-online and auto-replace
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUDEV], [
LIBUDEV=

AC_CHECK_HEADER([libudev.h], [AC_SUBST([LIBUDEV], ["-ludev"])
AC_DEFINE([HAVE_LIBUDEV], 1, [Define if you have libudev])], [])

AC_SEARCH_LIBS(i[udev_device_get_is_initialized], [udev], [
AC_DEFINE([HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED], 1, [
Define if udev_device_get_is_initialized is available])], [])
])
1 change: 1 addition & 0 deletions config/user.m4
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_LIBUUID
ZFS_AC_CONFIG_USER_LIBBLKID
ZFS_AC_CONFIG_USER_LIBATTR
ZFS_AC_CONFIG_USER_LIBUDEV
ZFS_AC_CONFIG_USER_FRAME_LARGER_THAN
ZFS_AC_CONFIG_USER_RUNSTATEDIR

Expand Down
7 changes: 7 additions & 0 deletions include/libzfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2016, Intel Corporation.
*/

#ifndef _LIBZFS_H
Expand Down Expand Up @@ -801,6 +802,12 @@ extern boolean_t libzfs_fru_compare(libzfs_handle_t *, const char *,
extern boolean_t libzfs_fru_notself(libzfs_handle_t *, const char *);
extern int zpool_fru_set(zpool_handle_t *, uint64_t, const char *);

/*
* Support for Linux libudev derived persistent device strings
*/
extern boolean_t is_mpath_whole_disk(const char *);
extern void update_vdev_config_dev_strs(nvlist_t *);

#ifdef __cplusplus
}
#endif
Expand Down
78 changes: 0 additions & 78 deletions lib/libspl/include/devid.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,82 +27,4 @@
#ifndef _LIBSPL_DEVID_H
#define _LIBSPL_DEVID_H

#include <stdlib.h>

typedef int ddi_devid_t;

typedef struct devid_nmlist {
char *devname;
dev_t dev;
} devid_nmlist_t;

static inline
int
devid_str_decode(
char *devidstr,
ddi_devid_t *retdevid,
char **retminor_name)
{
abort();
}

static inline
int
devid_deviceid_to_nmlist(
char *search_path,
ddi_devid_t devid,
char *minor_name,
devid_nmlist_t **retlist)
{
abort();
}

static inline
void
devid_str_free(char *str)
{
abort();
}

static inline
void
devid_free(ddi_devid_t devid)
{
abort();
}

static inline
void
devid_free_nmlist(devid_nmlist_t *list)
{
abort();
}

static inline
int
devid_get(
int fd,
ddi_devid_t *retdevid)
{
return (-1);
}

static inline
int
devid_get_minor_name(
int fd,
char **retminor_name)
{
abort();
}

static inline
char *
devid_str_encode(
ddi_devid_t devid,
char *minor_name)
{
abort();
}

#endif
2 changes: 1 addition & 1 deletion lib/libzfs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ libzfs_la_LIBADD = \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libzpool/libzpool.la

libzfs_la_LIBADD += -lm $(LIBBLKID)
libzfs_la_LIBADD += -lm $(LIBBLKID) $(LIBUDEV)
libzfs_la_LDFLAGS = -version-info 2:0:0

EXTRA_DIST = $(libzfs_pc_DATA) $(USER_C)
Loading