Skip to content

zhack: Fix importing large allocation profiles on small pools#18256

Merged
tonyhutter merged 1 commit intoopenzfs:masterfrom
KlaraSystems:0mp_zhack_segfault
Feb 24, 2026
Merged

zhack: Fix importing large allocation profiles on small pools#18256
tonyhutter merged 1 commit intoopenzfs:masterfrom
KlaraSystems:0mp_zhack_segfault

Conversation

@0mp
Copy link
Copy Markdown
Contributor

@0mp 0mp commented Feb 23, 2026

This patch fixes a segmentation fault in zhack metaslab leak which might be triggered by feeding zhack with a fragmentation profile that's exported from a pool larger than the target pool.

Fixes: 8f15d2e
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.

Motivation and Context

Currently, if you export an allocation profile from pool A and you import that allocation profile into pool B, then zhack will segfault if pool A was larger than pool B. This patch fixes that.

Description

The way this fix works is that the allocation profile's allocations targeting metaslabs, which are not present in the pool, are ignored.

How Has This Been Tested?

I've tested this manually by importing the allocation profile of a larger pool into a smaller pool.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

This patch fixes a segmentation fault in zhack metaslab leak which might
be triggered by feeding zhack with a fragmentation profile that's
exported from a pool larger than the target pool.

Fixes: 8f15d2e
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Signed-off-by: Mateusz Piotrowski <mateusz.piotrowski@klarasystems.com>
@0mp 0mp force-pushed the 0mp_zhack_segfault branch from 680a23c to ebb07dc Compare February 23, 2026 15:36
@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Feb 23, 2026
@tonyhutter tonyhutter merged commit 3408332 into openzfs:master Feb 24, 2026
26 of 28 checks passed
allanjude pushed a commit to KlaraSystems/zfs that referenced this pull request Feb 27, 2026
…s#18256)

This patch fixes a segmentation fault in zhack metaslab leak which might
be triggered by feeding zhack with a fragmentation profile that's
exported from a pool larger than the target pool.

Fixes: 8f15d2e
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <paul.dagnelie@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>

Signed-off-by: Mateusz Piotrowski <mateusz.piotrowski@klarasystems.com>
(cherry picked from commit 3408332)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Accepted Ready to integrate (reviewed, tested)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants