mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-05-30 18:34:59 +03:00
zed: Print return code on failed zpool_prepare_disk
We had a case where we were autoreplacing a disk and zpool_prepare_disk failed for some reason, and ZED didn't log the return code. This commit logs the code. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #17124
This commit is contained in:
parent
fe674998bb
commit
62a9d372f8
@ -214,6 +214,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
|||||||
vdev_stat_t *vs;
|
vdev_stat_t *vs;
|
||||||
char **lines = NULL;
|
char **lines = NULL;
|
||||||
int lines_cnt = 0;
|
int lines_cnt = 0;
|
||||||
|
int rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the persistent path, typically under the '/dev/disk/by-id' or
|
* Get the persistent path, typically under the '/dev/disk/by-id' or
|
||||||
@ -405,17 +406,17 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nvlist_lookup_string(vdev, "new_devid", &new_devid);
|
nvlist_lookup_string(vdev, "new_devid", &new_devid);
|
||||||
|
|
||||||
if (is_mpath_wholedisk) {
|
if (is_mpath_wholedisk) {
|
||||||
/* Don't label device mapper or multipath disks. */
|
/* Don't label device mapper or multipath disks. */
|
||||||
zed_log_msg(LOG_INFO,
|
zed_log_msg(LOG_INFO,
|
||||||
" it's a multipath wholedisk, don't label");
|
" it's a multipath wholedisk, don't label");
|
||||||
if (zpool_prepare_disk(zhp, vdev, "autoreplace", &lines,
|
rc = zpool_prepare_disk(zhp, vdev, "autoreplace", &lines,
|
||||||
&lines_cnt) != 0) {
|
&lines_cnt);
|
||||||
|
if (rc != 0) {
|
||||||
zed_log_msg(LOG_INFO,
|
zed_log_msg(LOG_INFO,
|
||||||
" zpool_prepare_disk: could not "
|
" zpool_prepare_disk: could not "
|
||||||
"prepare '%s' (%s)", fullpath,
|
"prepare '%s' (%s), path '%s', rc = %d", fullpath,
|
||||||
libzfs_error_description(g_zfshdl));
|
libzfs_error_description(g_zfshdl), path, rc);
|
||||||
if (lines_cnt > 0) {
|
if (lines_cnt > 0) {
|
||||||
zed_log_msg(LOG_INFO,
|
zed_log_msg(LOG_INFO,
|
||||||
" zfs_prepare_disk output:");
|
" zfs_prepare_disk output:");
|
||||||
@ -446,12 +447,13 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
|||||||
* If this is a request to label a whole disk, then attempt to
|
* If this is a request to label a whole disk, then attempt to
|
||||||
* write out the label.
|
* write out the label.
|
||||||
*/
|
*/
|
||||||
if (zpool_prepare_and_label_disk(g_zfshdl, zhp, leafname,
|
rc = zpool_prepare_and_label_disk(g_zfshdl, zhp, leafname,
|
||||||
vdev, "autoreplace", &lines, &lines_cnt) != 0) {
|
vdev, "autoreplace", &lines, &lines_cnt);
|
||||||
|
if (rc != 0) {
|
||||||
zed_log_msg(LOG_WARNING,
|
zed_log_msg(LOG_WARNING,
|
||||||
" zpool_prepare_and_label_disk: could not "
|
" zpool_prepare_and_label_disk: could not "
|
||||||
"label '%s' (%s)", leafname,
|
"label '%s' (%s), rc = %d", leafname,
|
||||||
libzfs_error_description(g_zfshdl));
|
libzfs_error_description(g_zfshdl), rc);
|
||||||
if (lines_cnt > 0) {
|
if (lines_cnt > 0) {
|
||||||
zed_log_msg(LOG_INFO,
|
zed_log_msg(LOG_INFO,
|
||||||
" zfs_prepare_disk output:");
|
" zfs_prepare_disk output:");
|
||||||
|
Loading…
Reference in New Issue
Block a user