svn commit: r241271 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Andriy Gapon avg at FreeBSD.org
Sat Oct 6 18:57:45 UTC 2012


Author: avg
Date: Sat Oct  6 18:57:44 2012
New Revision: 241271
URL: http://svn.freebsd.org/changeset/base/241271

Log:
  MFC r240632:  zfs: correctly calculate dn_bonuslen for saving SAs to disk

Modified:
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/cddl/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)

Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
==============================================================================
--- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c	Sat Oct  6 18:57:27 2012	(r241270)
+++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c	Sat Oct  6 18:57:44 2012	(r241271)
@@ -577,7 +577,7 @@ sa_find_sizes(sa_os_t *sa, sa_bulk_attr_
 	for (i = 0; i != attr_count; i++) {
 		boolean_t is_var_sz;
 
-		*total += attr_desc[i].sa_length;
+		*total += P2ROUNDUP(attr_desc[i].sa_length, 8);
 		if (done)
 			goto next;
 
@@ -712,6 +712,8 @@ sa_build_layouts(sa_handle_t *hdl, sa_bu
 		length = SA_REGISTERED_LEN(sa, attrs[i]);
 		if (length == 0)
 			length = attr_desc[i].sa_length;
+		else
+			VERIFY(length == attr_desc[i].sa_length);
 
 		if (buf_space < length) {  /* switch to spill buffer */
 			VERIFY(bonustype == DMU_OT_SA);
@@ -741,6 +743,7 @@ sa_build_layouts(sa_handle_t *hdl, sa_bu
 		if (sa->sa_attr_table[attrs[i]].sa_length == 0) {
 			sahdr->sa_lengths[len_idx++] = length;
 		}
+		VERIFY((uintptr_t)data_start % 8 == 0);
 		data_start = (void *)P2ROUNDUP(((uintptr_t)data_start +
 		    length), 8);
 		buf_space -= P2ROUNDUP(length, 8);


More information about the svn-src-all mailing list