Page MenuHomeFreeBSD

Prevent ZFS TRIM breaking VTOC8 partitions

Authored by smh on Mar 14 2018, 5:40 PM.



Update the ZFS TRIM code to ensure it respects VTOC8 partition headers as documented by the ZFS On-Disk Specification section 1.3

Before this a zpool create on a VTOC8 partitioned device would overwrite the partition metadata.

Test Plan

Create a VTOC8 parition on a md device followed by creating a ZFS pool and ensure it doesn't remove the partition metadata.

Diff Detail

rS FreeBSD src repository
No Linters Available
No Unit Test Coverage
Build Status
Buildable 15568
Build 15605: arc lint + arc unit

Event Timeline

smh created this revision.Mar 14 2018, 5:40 PM
smh retitled this revision from Prevent ZFS TRIM breakng VTOC8 partitions to Prevent ZFS TRIM breaking VTOC8 partitions.Mar 14 2018, 5:41 PM
smh edited the summary of this revision. (Show Details)
smh edited the test plan for this revision. (Show Details)
smh added reviewers: marius, avg.
imp added inline comments.Mar 14 2018, 5:42 PM

I'd have expected the size to be trimmed as well... or is this a start block to end block API

avg added inline comments.Mar 14 2018, 5:51 PM

No, it's start plus size.
Good catch.

smh updated this revision to Diff 40295.Mar 14 2018, 8:34 PM

Correct size argument as zio_trim is offset + size not start + end.

smh marked 2 inline comments as done.Mar 14 2018, 8:37 PM
avg accepted this revision.Mar 14 2018, 9:00 PM
This revision is now accepted and ready to land.Mar 14 2018, 9:00 PM
marius accepted this revision.Mar 14 2018, 9:10 PM

This looks good to me, I'm still somewhat puzzled, though, as to why the problem has only be encountered with md(4) devices. Was that simply due to the fact that we happened to test with disks that DISKFLAG_CANDELETE doesn't get set for?

smh added a comment.Mar 14 2018, 9:12 PM

Its only a problem for devices that report they support TRIM so it wouldn't impact HDD's but would effect SSD's or MD devices.