Missed the differential review: https://reviews.freebsd.org/D14695
On 14/03/2018 21:21, Steven Hartland wrote:
Author: smh
Date: Wed Mar 14 21:21:03 2018
New Revision: 330950
URL: https://svnweb.freebsd.org/changeset/base/330950
Log:
Prevent ZFS TRIM breaking VTOC8 partitions
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.
Reported by: marius
Reviewed by: marius agv
MFC after: 1 week
Sponsored by: Multiplay
Modified:
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Wed Mar
14 21:11:41 2018 (r330949)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Wed Mar
14 21:21:03 2018 (r330950)
@@ -802,7 +802,9 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_label
}
/*
- * TRIM the whole thing so that we start with a clean slate.
+ * TRIM the whole thing, excluding the blank space and boot header
+ * as specified by ZFS On-Disk Specification (section 1.3), so that
+ * we start with a clean slate.
* It's just an optimization, so we don't care if it fails.
* Don't TRIM if removing so that we don't interfere with zpool
* disaster recovery.
@@ -810,7 +812,8 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_label
if (zfs_trim_enabled && vdev_trim_on_init && !vd->vdev_notrim &&
(reason == VDEV_LABEL_CREATE || reason == VDEV_LABEL_SPARE ||
reason == VDEV_LABEL_L2CACHE))
- zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize));
+ zio_wait(zio_trim(NULL, spa, vd, VDEV_SKIP_SIZE,
+ vd->vdev_psize - VDEV_SKIP_SIZE));
/*
* Initialize its label.
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"