Skip to content

Reminder to update boot code after zpool upgrade #12104

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

Merged
merged 1 commit into from
Jun 1, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cmd/zpool/os/freebsd/zpool_vdev_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,18 @@ check_sector_size_database(char *path, int *sector_size)
{
return (0);
}

void
after_zpool_upgrade(zpool_handle_t *zhp)
{
char bootfs[ZPOOL_MAXPROPLEN];

if (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
sizeof (bootfs), NULL, B_FALSE) == 0 &&
strcmp(bootfs, "-") != 0) {
(void) printf(gettext("Pool '%s' has the bootfs "
"property set, you might need to update\nthe boot "
"code. See gptzfsboot(8) and loader.efi(8) for "
"details.\n"), zpool_get_name(zhp));
}
}
5 changes: 5 additions & 0 deletions cmd/zpool/os/linux/zpool_vdev_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,8 @@ check_device(const char *path, boolean_t force,

return (error);
}

void
after_zpool_upgrade(zpool_handle_t *zhp)
{
}
22 changes: 12 additions & 10 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8849,7 +8849,7 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)
upgrade_cbdata_t *cbp = arg;
nvlist_t *config;
uint64_t version;
boolean_t printnl = B_FALSE;
boolean_t modified_pool = B_FALSE;
int ret;

config = zpool_get_config(zhp, NULL);
Expand All @@ -8863,7 +8863,7 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)
ret = upgrade_version(zhp, cbp->cb_version);
if (ret != 0)
return (ret);
printnl = B_TRUE;
modified_pool = B_TRUE;

/*
* If they did "zpool upgrade -a", then we could
Expand All @@ -8883,12 +8883,13 @@ upgrade_cb(zpool_handle_t *zhp, void *arg)

if (count > 0) {
cbp->cb_first = B_FALSE;
printnl = B_TRUE;
modified_pool = B_TRUE;
}
}

if (printnl) {
(void) printf(gettext("\n"));
if (modified_pool) {
(void) printf("\n");
(void) after_zpool_upgrade(zhp);
}

return (0);
Expand Down Expand Up @@ -9001,7 +9002,7 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg)
static int
upgrade_one(zpool_handle_t *zhp, void *data)
{
boolean_t printnl = B_FALSE;
boolean_t modified_pool = B_FALSE;
upgrade_cbdata_t *cbp = data;
uint64_t cur_version;
int ret;
Expand Down Expand Up @@ -9029,7 +9030,7 @@ upgrade_one(zpool_handle_t *zhp, void *data)
}

if (cur_version != cbp->cb_version) {
printnl = B_TRUE;
modified_pool = B_TRUE;
ret = upgrade_version(zhp, cbp->cb_version);
if (ret != 0)
return (ret);
Expand All @@ -9042,16 +9043,17 @@ upgrade_one(zpool_handle_t *zhp, void *data)
return (ret);

if (count != 0) {
printnl = B_TRUE;
modified_pool = B_TRUE;
} else if (cur_version == SPA_VERSION) {
(void) printf(gettext("Pool '%s' already has all "
"supported and requested features enabled.\n"),
zpool_get_name(zhp));
}
}

if (printnl) {
(void) printf(gettext("\n"));
if (modified_pool) {
(void) printf("\n");
(void) after_zpool_upgrade(zhp);
}

return (0);
Expand Down
1 change: 1 addition & 0 deletions cmd/zpool/zpool_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ int check_device(const char *path, boolean_t force,
boolean_t check_sector_size_database(char *path, int *sector_size);
void vdev_error(const char *fmt, ...);
int check_file(const char *file, boolean_t force, boolean_t isspare);
void after_zpool_upgrade(zpool_handle_t *zhp);

#ifdef __cplusplus
}
Expand Down