From 4ff461e720e42824706b5fd015130f99294748cc Mon Sep 17 00:00:00 2001 From: Umer Saleem Date: Fri, 20 Sep 2024 22:19:57 +0500 Subject: [PATCH 1/2] Add compatibility file for GRUB versions up to v2.06 GRUB is not able to detect ZFS pool if snaphsot of top level boot pool is created. This issue is observed with GRUB versions up to v2.06 if extensible_dataset feature is enabled on ZFS boot pool. compatibility=grub2-2.06 would enable all read-only compatible zpool features except extensible_dataset and other features that depend on it. The existing grub2 compatibility file is now renamed to grub2-2.12 to reflect the appropriate grub2 version. grub2-2.12 lists all read-only features that can be enabled on boot pool for grub2 with version 2.12 onwards. A new symlink grub2 is created that currently points to the grub2-2.12 compatibility file. Signed-off-by: Umer Saleem --- cmd/zpool/Makefile.am | 4 ++- cmd/zpool/compatibility.d/grub2-2.06 | 23 +++++++++++++++ .../compatibility.d/{grub2 => grub2-2.12} | 2 +- man/man7/zpool-features.7 | 29 +++++++++++++++++-- 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 cmd/zpool/compatibility.d/grub2-2.06 rename cmd/zpool/compatibility.d/{grub2 => grub2-2.12} (81%) diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index d08b8e1791b6..8a218d365893 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -140,7 +140,8 @@ dist_zpoolcompat_DATA = \ %D%/compatibility.d/freebsd-11.2 \ %D%/compatibility.d/freebsd-11.3 \ %D%/compatibility.d/freenas-9.10.2 \ - %D%/compatibility.d/grub2 \ + %D%/compatibility.d/grub2-2.06 \ + %D%/compatibility.d/grub2-2.12 \ %D%/compatibility.d/openzfs-2.0-freebsd \ %D%/compatibility.d/openzfs-2.0-linux \ %D%/compatibility.d/openzfs-2.1-freebsd \ @@ -171,6 +172,7 @@ zpoolcompatlinks = \ "freebsd-11.3 freebsd-12.2" \ "freebsd-11.3 freebsd-12.3" \ "freebsd-11.3 freebsd-12.4" \ + "grub2-2.12 grub2" \ "openzfs-2.1-freebsd freebsd-13.0" \ "openzfs-2.1-freebsd freebsd-13.1" \ "openzfs-2.1-freebsd freebsd-13.2" \ diff --git a/cmd/zpool/compatibility.d/grub2-2.06 b/cmd/zpool/compatibility.d/grub2-2.06 new file mode 100644 index 000000000000..ea7468dbcc78 --- /dev/null +++ b/cmd/zpool/compatibility.d/grub2-2.06 @@ -0,0 +1,23 @@ +# Features which are supported by GRUB2 versions prior to v2.12. +# +# GRUB is not able to detect ZFS pool if snaphsot of top level boot pool +# is created. This issue is observed with GRUB versions before v2.12 if +# extensible_dataset feature is enabled on ZFS boot pool. +# +# This file lists all read-only comaptible features except +# extensible_dataset and any other feature that depends on it. +# +allocation_classes +async_destroy +block_cloning +device_rebuild +embedded_data +empty_bpobj +enabled_txg +hole_birth +log_spacemap +lz4_compress +resilver_defer +spacemap_histogram +spacemap_v2 +zpool_checkpoint diff --git a/cmd/zpool/compatibility.d/grub2 b/cmd/zpool/compatibility.d/grub2-2.12 similarity index 81% rename from cmd/zpool/compatibility.d/grub2 rename to cmd/zpool/compatibility.d/grub2-2.12 index 6d60e643593b..86cce6338bb8 100644 --- a/cmd/zpool/compatibility.d/grub2 +++ b/cmd/zpool/compatibility.d/grub2-2.12 @@ -1,4 +1,4 @@ -# Features which are supported by GRUB2 +# Features which are supported by GRUB2 versions from v2.12 onwards. allocation_classes async_destroy block_cloning diff --git a/man/man7/zpool-features.7 b/man/man7/zpool-features.7 index ff6e485a4819..fe7715496ead 100644 --- a/man/man7/zpool-features.7 +++ b/man/man7/zpool-features.7 @@ -219,7 +219,7 @@ to the end of the line is ignored. .Sy Example : .Bd -literal -compact -offset 4n .No example# Nm cat Pa /usr/share/zfs/compatibility.d/grub2 -# Features which are supported by GRUB2 +# Features which are supported by GRUB2 versions from v2.12 onwards. allocation_classes async_destroy block_cloning @@ -243,6 +243,31 @@ userobj_accounting zilsaxattr zpool_checkpoint +.No example# Nm cat Pa /usr/share/zfs/compatibility.d/grub2-2.06 +# Features which are supported by GRUB2 versions prior to v2.12. +# +# GRUB is not able to detect ZFS pool if snaphsot of top level boot pool +# is created. This issue is observed with GRUB versions before v2.12 if +# extensible_dataset feature is enabled on ZFS boot pool. +# +# This file lists all read-only comaptible features except +# extensible_dataset and any other feature that depends on it. +# +allocation_classes +async_destroy +block_cloning +device_rebuild +embedded_data +empty_bpobj +enabled_txg +hole_birth +log_spacemap +lz4_compress +resilver_defer +spacemap_histogram +spacemap_v2 +zpool_checkpoint + .No example# Nm zpool Cm create Fl o Sy compatibility Ns = Ns Ar grub2 Ar bootpool Ar vdev .Ed .Pp @@ -681,7 +706,7 @@ are destroyed. Large dnodes allow more data to be stored in the bonus buffer, thus potentially improving performance by avoiding the use of spill blocks. . -.feature com.delphix livelist yes +.feature com.delphix livelist yes extensible_dataset This feature allows clones to be deleted faster than the traditional method when a large number of random/sparse writes have been made to the clone. All blocks allocated and freed after a clone is created are tracked by the From 45a1d46af9d4b2fa1f0bb7f3bc82e10c2fa1a9a1 Mon Sep 17 00:00:00 2001 From: Umer Saleem Date: Fri, 20 Sep 2024 23:06:19 +0500 Subject: [PATCH 2/2] ZTS: Fix skipping over comment lines in zpool_create.shlib In zpool_create.shlib, check_feature_set iterates over all features mentioned in provided compatibility file to check if only those features are enabled on the pool. This commit fixes skipping over comment lines correctly. Otherwise, the test case fails as comment lines are also treated as feature names by check_feature_set function. Signed-off-by: Umer Saleem --- .../functional/cli_root/zpool_create/zpool_create.shlib | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib index 4987bc3a9dac..765be8ac0dd1 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib @@ -119,9 +119,8 @@ function check_feature_set while read line; do typeset flag=1 - if [[ "$line" == "#*" ]]; then - continue - fi + # Skip comments + [[ $line = \#* ]] && continue for set in "$@"; do if ! grep -q "$line" $ZPOOL_COMPAT_DIR/$set; then