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

Fix "out of memory" error #15747

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/libzfs/libzfs_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,8 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,

*inuse = B_FALSE;

if (zpool_read_label(fd, &config, NULL) != 0) {
(void) no_memory(hdl);
if (zpool_read_label(fd, &config, NULL) != 0)
return (-1);
}

if (config == NULL)
return (0);
Expand Down
15 changes: 13 additions & 2 deletions lib/libzutil/zutil_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,10 +1056,21 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels)
case EINVAL:
break;
case EINPROGRESS:
// This shouldn't be possible to
// encounter, die if we do.
/*
* This shouldn't be possible to
* encounter, die if we do.
*/
ASSERT(B_FALSE);
zfs_fallthrough;
case EREMOTEIO:
/*
* May be returned by an NVMe device
* which is visible in /dev/ but due
* to a low-level format change, or
* other error, needs to be rescanned.
* Try the slow method.
*/
zfs_fallthrough;
case EOPNOTSUPP:
case ENOSYS:
do_slow = B_TRUE;
Expand Down