svn commit: r241270 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

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


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

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

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

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
==============================================================================
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c	Sat Oct  6 18:55:54 2012	(r241269)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c	Sat Oct  6 18:57:27 2012	(r241270)
@@ -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-stable-9 mailing list