mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-04-06 17:49:11 +03:00
Fix zpool status -v
error message
When a pool is suspended it's impossible to read the list of damaged files from disk. This would result in a generic misleading "insufficient permissions" error message. Update zpool_get_errlog() to use the standard zpool error logging functions to generate a useful error message. In this case: errors: List of errors unavailable: pool I/O is currently suspended This patch does not address the related issue of potentially not being able to resume a suspend pool when the underlying device names have changed. Additionally, remove the error handling from zfs_alloc() in zpool_get_errlog() for readability since this function can never fail. Reviewed-by: George Melikov <mail@gmelikov.ru> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #4031 Closes #5731 Closes #5907
This commit is contained in:
parent
6a9d635998
commit
56a6054d55
@ -5603,11 +5603,8 @@ print_error_log(zpool_handle_t *zhp)
|
|||||||
char *pathname;
|
char *pathname;
|
||||||
size_t len = MAXPATHLEN * 2;
|
size_t len = MAXPATHLEN * 2;
|
||||||
|
|
||||||
if (zpool_get_errlog(zhp, &nverrlist) != 0) {
|
if (zpool_get_errlog(zhp, &nverrlist) != 0)
|
||||||
(void) printf("errors: List of errors unavailable "
|
|
||||||
"(insufficient privileges)\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
(void) printf("errors: Permanent errors have been "
|
(void) printf("errors: Permanent errors have been "
|
||||||
"detected in the following files:\n\n");
|
"detected in the following files:\n\n");
|
||||||
|
@ -3568,6 +3568,7 @@ int
|
|||||||
zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp)
|
zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp)
|
||||||
{
|
{
|
||||||
zfs_cmd_t zc = {"\0"};
|
zfs_cmd_t zc = {"\0"};
|
||||||
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
uint64_t count;
|
uint64_t count;
|
||||||
zbookmark_phys_t *zb = NULL;
|
zbookmark_phys_t *zb = NULL;
|
||||||
int i;
|
int i;
|
||||||
@ -3581,9 +3582,8 @@ zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp)
|
|||||||
&count) == 0);
|
&count) == 0);
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return (0);
|
return (0);
|
||||||
if ((zc.zc_nvlist_dst = (uintptr_t)zfs_alloc(zhp->zpool_hdl,
|
zc.zc_nvlist_dst = (uintptr_t)zfs_alloc(zhp->zpool_hdl,
|
||||||
count * sizeof (zbookmark_phys_t))) == (uintptr_t)NULL)
|
count * sizeof (zbookmark_phys_t));
|
||||||
return (-1);
|
|
||||||
zc.zc_nvlist_dst_size = count;
|
zc.zc_nvlist_dst_size = count;
|
||||||
(void) strcpy(zc.zc_name, zhp->zpool_name);
|
(void) strcpy(zc.zc_name, zhp->zpool_name);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -3596,11 +3596,11 @@ zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp)
|
|||||||
count = zc.zc_nvlist_dst_size;
|
count = zc.zc_nvlist_dst_size;
|
||||||
dst = zfs_alloc(zhp->zpool_hdl, count *
|
dst = zfs_alloc(zhp->zpool_hdl, count *
|
||||||
sizeof (zbookmark_phys_t));
|
sizeof (zbookmark_phys_t));
|
||||||
if (dst == NULL)
|
|
||||||
return (-1);
|
|
||||||
zc.zc_nvlist_dst = (uintptr_t)dst;
|
zc.zc_nvlist_dst = (uintptr_t)dst;
|
||||||
} else {
|
} else {
|
||||||
return (-1);
|
return (zpool_standard_error_fmt(hdl, errno,
|
||||||
|
dgettext(TEXT_DOMAIN, "errors: List of "
|
||||||
|
"errors unavailable")));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user