Page MenuHomeFreeBSD

Prevent ZFS TRIM breaking VTOC8 partitions
ClosedPublic

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

Details

Reviewers
marius
avg
Summary

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

Repository
rS FreeBSD src repository
Lint
No Linters Available
Unit
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
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
816

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
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
816

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.