From owner-svn-src-vendor@FreeBSD.ORG Tue Feb 26 00:43:04 2013 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 621D5CF; Tue, 26 Feb 2013 00:43:04 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 508EA198; Tue, 26 Feb 2013 00:43:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q0h4UQ088638; Tue, 26 Feb 2013 00:43:04 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q0h2GO088626; Tue, 26 Feb 2013 00:43:02 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302260043.r1Q0h2GO088626@svn.freebsd.org> From: Xin LI Date: Tue, 26 Feb 2013 00:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r247293 - in vendor/expat/dist: . doc examples lib tests tests/benchmark xmlwf X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2013 00:43:04 -0000 Author: delphij Date: Tue Feb 26 00:43:01 2013 New Revision: 247293 URL: http://svnweb.freebsd.org/changeset/base/247293 Log: Vendor import of expat 2.1.0 (trimmed). Added: vendor/expat/dist/FREEBSD-Xlist (contents, props changed) Deleted: vendor/expat/dist/FREEBSD-upgrade vendor/expat/dist/configure vendor/expat/dist/doc/valid-xhtml10.png vendor/expat/dist/lib/winconfig.h vendor/expat/dist/tests/benchmark/benchmark.dsp vendor/expat/dist/tests/benchmark/benchmark.dsw Modified: vendor/expat/dist/Changes (contents, props changed) vendor/expat/dist/MANIFEST (contents, props changed) vendor/expat/dist/Makefile.in (contents, props changed) vendor/expat/dist/README (contents, props changed) vendor/expat/dist/configure.in (contents, props changed) vendor/expat/dist/doc/reference.html (contents, props changed) vendor/expat/dist/doc/xmlwf.sgml (contents, props changed) vendor/expat/dist/expat_config.h.in (contents, props changed) vendor/expat/dist/lib/expat.h (contents, props changed) vendor/expat/dist/lib/xmlparse.c (contents, props changed) vendor/expat/dist/lib/xmlrole.c (contents, props changed) vendor/expat/dist/lib/xmltok.c (contents, props changed) vendor/expat/dist/lib/xmltok_impl.c (contents, props changed) vendor/expat/dist/tests/README.txt (contents, props changed) vendor/expat/dist/tests/minicheck.h vendor/expat/dist/tests/runtests.c (contents, props changed) vendor/expat/dist/tests/xmltest.sh (contents, props changed) vendor/expat/dist/xmlwf/readfilemap.c (contents, props changed) vendor/expat/dist/xmlwf/xmlwf.c (contents, props changed) Directory Properties: vendor/expat/dist/COPYING (props changed) vendor/expat/dist/doc/style.css (props changed) vendor/expat/dist/doc/xmlwf.1 (props changed) vendor/expat/dist/examples/elements.c (props changed) vendor/expat/dist/examples/outline.c (props changed) vendor/expat/dist/lib/ascii.h (props changed) vendor/expat/dist/lib/asciitab.h (props changed) vendor/expat/dist/lib/iasciitab.h (props changed) vendor/expat/dist/lib/internal.h (props changed) vendor/expat/dist/lib/latin1tab.h (props changed) vendor/expat/dist/lib/nametab.h (props changed) vendor/expat/dist/lib/utf8tab.h (props changed) vendor/expat/dist/lib/xmlrole.h (props changed) vendor/expat/dist/lib/xmltok.h (props changed) vendor/expat/dist/lib/xmltok_impl.h (props changed) vendor/expat/dist/lib/xmltok_ns.c (props changed) vendor/expat/dist/tests/chardata.c (props changed) vendor/expat/dist/tests/chardata.h (props changed) vendor/expat/dist/xmlwf/codepage.c (props changed) vendor/expat/dist/xmlwf/codepage.h (props changed) vendor/expat/dist/xmlwf/ct.c (props changed) vendor/expat/dist/xmlwf/filemap.h (props changed) vendor/expat/dist/xmlwf/unixfilemap.c (props changed) vendor/expat/dist/xmlwf/win32filemap.c (props changed) vendor/expat/dist/xmlwf/xmlfile.c (props changed) vendor/expat/dist/xmlwf/xmlfile.h (props changed) vendor/expat/dist/xmlwf/xmlmime.c (props changed) vendor/expat/dist/xmlwf/xmlmime.h (props changed) vendor/expat/dist/xmlwf/xmltchar.h (props changed) vendor/expat/dist/xmlwf/xmlurl.h (props changed) vendor/expat/dist/xmlwf/xmlwin32url.cxx (props changed) Modified: vendor/expat/dist/Changes ============================================================================== --- vendor/expat/dist/Changes Tue Feb 26 00:34:52 2013 (r247292) +++ vendor/expat/dist/Changes Tue Feb 26 00:43:01 2013 (r247293) @@ -1,5 +1,41 @@ +Release 2.1.0 Sat March 24 2012 + - Bug Fixes: + #1742315: Harmful XML_ParserCreateNS suggestion. + #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. + #1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3. + #1983953, 2517952, 2517962, 2649838: + Build modifications using autoreconf instead of buildconf.sh. + #2815947, #2884086: OBJEXT and EXEEXT support while building. + #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. + #2517938: xmlwf should return non-zero exit status if not well-formed. + #2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml. + #2855609: Dangling positionPtr after error. + #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). + #2958794: CVE-2012-1148 - Memory leak in poolGrow. + #2990652: CMake support. + #3010819: UNEXPECTED_STATE with a trailing "%" in entity value. + #3206497: Unitialized memory returned from XML_Parse. + #3287849: make check fails on mingw-w64. + #3496608: CVE-2012-0876 - Hash DOS attack. + - Patches: + #1749198: pkg-config support. + #3010222: Fix for bug #3010819. + #3312568: CMake support. + #3446384: Report byte offsets for attr names and values. + - New Features / API changes: + Added new API member XML_SetHashSalt() that allows setting an intial + value (salt) for hash calculations. This is part of the fix for + bug #3496608 to randomize hash parameters. + When compiled with XML_ATTR_INFO defined, adds new API member + XML_GetAttributeInfo() that allows retrieving the byte + offsets for attribute names and values (patch #3446384). + Added CMake build system. + See bug #2990652 and patch #3312568. + Added run-benchmark target to Makefile.in - relies on testdata module + present in the same relative location as in the repository. + Release 2.0.1 Tue June 5 2007 - - Fixed bugs #1515266, 1515600: The character data handler's calling + - Fixed bugs #1515266, #1515600: The character data handler's calling of XML_StopParser() was not handled properly; if the parser was stopped and the handler set to NULL, the parser would segfault. - Fixed bug #1690883: Expat failed on EBCDIC systems as it assumed @@ -8,7 +44,7 @@ Release 2.0.1 Tue June 5 2007 - Fixed xmlwf bug #1513566: "out of memory" error on file size zero. - Fixed outline.c bug #1543233: missing a final XML_ParserFree() call. - Fixes and improvements for Windows platform: - bugs #1409451, #1476160, 1548182, 1602769, 1717322. + bugs #1409451, #1476160, #1548182, #1602769, #1717322. - Build fixes for various platforms: HP-UX, Tru64, Solaris 9: patch #1437840, bug #1196180. All Unix: #1554618 (refreshed config.sub/config.guess). @@ -30,8 +66,8 @@ Release 2.0.0 Wed Jan 11 2006 byte indexes and line/column numbers. - Updated to use libtool 1.5.22 (the most recent). - Added support for AmigaOS. - - Some mostly minor bug fixes. SF issues include: 1006708, - 1021776, 1023646, 1114960, 1156398, 1221160, 1271642. + - Some mostly minor bug fixes. SF issues include: #1006708, + #1021776, #1023646, #1114960, #1156398, #1221160, #1271642. Release 1.95.8 Fri Jul 23 2004 - Major new feature: suspend/resume. Handlers can now request @@ -40,8 +76,8 @@ Release 1.95.8 Fri Jul 23 2004 documentation for more details. - Some mostly minor bug fixes, but compilation should no longer generate warnings on most platforms. SF issues - include: 827319, 840173, 846309, 888329, 896188, 923913, - 928113, 961698, 985192. + include: #827319, #840173, #846309, #888329, #896188, #923913, + #928113, #961698, #985192. Release 1.95.7 Mon Oct 20 2003 - Fixed enum XML_Status issue (reported on SourceForge many @@ -54,19 +90,19 @@ Release 1.95.7 Mon Oct 20 2003 - Improved ability to build without the configure-generated expat_config.h header. This is useful for applications which embed Expat rather than linking in the library. - - Fixed a variety of bugs: see SF issues 458907, 609603, - 676844, 679754, 692878, 692964, 695401, 699323, 699487, - 820946. + - Fixed a variety of bugs: see SF issues #458907, #609603, + #676844, #679754, #692878, #692964, #695401, #699323, #699487, + #820946. - Improved hash table lookups. - Added more regression tests and improved documentation. Release 1.95.6 Tue Jan 28 2003 - Added XML_FreeContentModel(). - Added XML_MemMalloc(), XML_MemRealloc(), XML_MemFree(). - - Fixed a variety of bugs: see SF issues 615606, 616863, - 618199, 653180, 673791. + - Fixed a variety of bugs: see SF issues #615606, #616863, + #618199, #653180, #673791. - Enhanced the regression test suite. - - Man page improvements: includes SF issue 632146. + - Man page improvements: includes SF issue #632146. Release 1.95.5 Fri Sep 6 2002 - Added XML_UseForeignDTD() for improved SAX2 support. @@ -84,9 +120,9 @@ Release 1.95.5 Fri Sep 6 2002 - Reduced line-length for all source code and headers to be no longer than 80 characters, to help with AS/400 support. - Reduced memory copying during parsing (SF patch #600964). - - Fixed a variety of bugs: see SF issues 580793, 434664, - 483514, 580503, 581069, 584041, 584183, 584832, 585537, - 596555, 596678, 598352, 598944, 599715, 600479, 600971. + - Fixed a variety of bugs: see SF issues #580793, #434664, + #483514, #580503, #581069, #584041, #584183, #584832, #585537, + #596555, #596678, #598352, #598944, #599715, #600479, #600971. Release 1.95.4 Fri Jul 12 2002 - Added support for VMS, contributed by Craig Berry. See @@ -95,14 +131,14 @@ Release 1.95.4 Fri Jul 12 2002 contributed by Thomas Wegner and Daryle Walker. - Added Borland C++ Builder 5 / BCC 5.5 support, contributed by Patrick McConnell (SF patch #538032). - - Fixed a variety of bugs: see SF issues 441449, 563184, - 564342, 566334, 566901, 569461, 570263, 575168, 579196. + - Fixed a variety of bugs: see SF issues #441449, #563184, + #564342, #566334, #566901, #569461, #570263, #575168, #579196. - Made skippedEntityHandler conform to SAX2 (see source comment) - Re-implemented WFC: Entity Declared from XML 1.0 spec and added a new error "entity declared in parameter entity": - see SF bug report 569461 and SF patch 578161 + see SF bug report #569461 and SF patch #578161 - Re-implemented section 5.1 from XML 1.0 spec: - see SF bug report 570263 and SF patch 578161 + see SF bug report #570263 and SF patch #578161 Release 1.95.3 Mon Jun 3 2002 - Added a project to the MSVC workspace to create a wchar_t @@ -114,9 +150,9 @@ Release 1.95.3 Mon Jun 3 2002 - Made the XML_UNICODE builds usable (thanks, Karl!). - Allow xmlwf to read from standard input. - Install a man page for xmlwf on Unix systems. - - Fixed many bugs; see SF bug reports 231864, 461380, 464837, - 466885, 469226, 477667, 484419, 487840, 494749, 496505, - 547350. Other bugs which we can't test as easily may also + - Fixed many bugs; see SF bug reports #231864, #461380, #464837, + #466885, #469226, #477667, #484419, #487840, #494749, #496505, + #547350. Other bugs which we can't test as easily may also have been fixed, especially in the area of build support. Release 1.95.2 Fri Jul 27 2001 Added: vendor/expat/dist/FREEBSD-Xlist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/expat/dist/FREEBSD-Xlist Tue Feb 26 00:43:01 2013 (r247293) @@ -0,0 +1,19 @@ +# $FreeBSD$ +*.MPW +*.cmake +*.def +*.dsp +*.dsw +*.m4 +*.pc.in +*config.h +CMake* +Configure* +amiga +bcb5 +configure +conftools +doc/valid-xhtml10.png +m4 +vms +win32 Modified: vendor/expat/dist/MANIFEST ============================================================================== --- vendor/expat/dist/MANIFEST Tue Feb 26 00:34:52 2013 (r247292) +++ vendor/expat/dist/MANIFEST Tue Feb 26 00:43:01 2013 (r247293) @@ -1,5 +1,8 @@ -amiga/stdlib.c amiga/launch.c +amiga/expat_68k.c +amiga/expat_68k.h +amiga/expat_68k_handler_stubs.c +amiga/expat_base.h amiga/expat_vectors.c amiga/expat_lib.c amiga/expat.xml @@ -42,25 +45,35 @@ doc/style.css doc/valid-xhtml10.png doc/xmlwf.1 doc/xmlwf.sgml +CMakeLists.txt +CMake.README COPYING Changes +ConfigureChecks.cmake MANIFEST Makefile.in README configure configure.in expat_config.h.in +expat_config.h.cmake +expat.pc.in expat.dsw +aclocal.m4 conftools/PrintPath conftools/ac_c_bigendian_cross.m4 -conftools/config.guess -conftools/config.sub conftools/expat.m4 conftools/get-version.sh +conftools/mkinstalldirs +conftools/config.guess +conftools/config.sub conftools/install-sh -conftools/libtool.m4 conftools/ltmain.sh -conftools/mkinstalldirs +m4/libtool.m4 +m4/ltversion.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/lt~obsolete.m4 examples/elements.c examples/elements.dsp examples/outline.c Modified: vendor/expat/dist/Makefile.in ============================================================================== --- vendor/expat/dist/Makefile.in Tue Feb 26 00:34:52 2013 (r247292) +++ vendor/expat/dist/Makefile.in Tue Feb 26 00:43:01 2013 (r247293) @@ -31,6 +31,7 @@ bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ man1dir = @mandir@/man1 +pkgconfigdir = $(libdir)/pkgconfig top_builddir = . @@ -46,18 +47,18 @@ LIBRARY = libexpat.la DESTDIR = $(INSTALL_ROOT) -default: buildlib xmlwf/xmlwf +default: buildlib xmlwf/xmlwf@EXEEXT@ -buildlib: $(LIBRARY) +buildlib: $(LIBRARY) expat.pc -all: $(LIBRARY) xmlwf/xmlwf examples/elements examples/outline +all: $(LIBRARY) expat.pc xmlwf/xmlwf@EXEEXT@ examples/elements examples/outline clean: - cd lib && rm -f $(LIBRARY) *.o *.lo && rm -rf .libs _libs - cd xmlwf && rm -f xmlwf *.o *.lo && rm -rf .libs _libs - cd examples && rm -f elements outline *.o *.lo && rm -rf .libs _libs - cd tests && rm -rf .libs runtests runtests.o runtestspp runtestspp.o - cd tests && rm -f chardata.o minicheck.o + cd lib && rm -f $(LIBRARY) *.@OBJEXT@ *.lo && rm -rf .libs _libs + cd xmlwf && rm -f xmlwf *.@OBJEXT@ *.lo && rm -rf .libs _libs + cd examples && rm -f elements outline *.@OBJEXT@ *.lo && rm -rf .libs _libs + cd tests && rm -rf .libs runtests runtests.@OBJEXT@ runtestspp runtestspp.@OBJEXT@ + cd tests && rm -f chardata.@OBJEXT@ minicheck.@OBJEXT@ rm -rf .libs libexpat.la rm -f examples/core tests/core xmlwf/core @@ -65,34 +66,37 @@ clobber: clean distclean: clean rm -f expat_config.h config.status config.log config.cache libtool - rm -f Makefile + rm -f Makefile expat.pc extraclean: distclean rm -f expat_config.h.in configure - rm -f conftools/ltconfig conftools/ltmain.sh conftools/libtool.m4 + rm -f aclocal.m4 m4/* + rm -f conftools/ltmain.sh conftools/install-sh conftools/config.guess conftools/config.sub check: tests/runtests tests/runtestspp tests/runtests tests/runtestspp -install: xmlwf/xmlwf installlib +install: xmlwf/xmlwf@EXEEXT@ installlib $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf $(DESTDIR)$(bindir)/xmlwf + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf@EXEEXT@ $(DESTDIR)$(bindir)/xmlwf $(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir) -installlib: $(LIBRARY) $(APIHEADER) - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) +installlib: $(LIBRARY) $(APIHEADER) expat.pc + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(pkgconfigdir) $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY) for FN in $(APIHEADER) ; do $(INSTALL_DATA) $$FN $(DESTDIR)$(includedir) ; done + $(INSTALL_DATA) expat.pc $(DESTDIR)$(pkgconfigdir)/expat.pc uninstall: uninstalllib - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf@EXEEXT@ rm -f $(DESTDIR)$(man1dir)/xmlwf.1 uninstalllib: $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY) rm -f $(DESTDIR)$(includedir)/expat.h rm -f $(DESTDIR)$(includedir)/expat_external.h + rm -f $(DESTDIR)$(pkgconfigdir)/expat.pc # for VPATH builds (invoked by configure) mkdir-init: @@ -125,6 +129,9 @@ LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo $(LIBRARY): $(LIB_OBJS) $(LINK_LIB) $(LIB_OBJS) +expat.pc: $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ + lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \ $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h @@ -137,46 +144,53 @@ lib/xmltok.lo: lib/xmltok.c lib/xmltok_i $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h -XMLWF_OBJS = xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/@FILEMAP@.o -xmlwf/xmlwf.o: xmlwf/xmlwf.c -xmlwf/xmlfile.o: xmlwf/xmlfile.c -xmlwf/codepage.o: xmlwf/codepage.c -xmlwf/@FILEMAP@.o: xmlwf/@FILEMAP@.c -xmlwf/xmlwf: $(XMLWF_OBJS) $(LIBRARY) +XMLWF_OBJS = xmlwf/xmlwf.@OBJEXT@ xmlwf/xmlfile.@OBJEXT@ xmlwf/codepage.@OBJEXT@ xmlwf/@FILEMAP@.@OBJEXT@ +xmlwf/xmlwf.@OBJEXT@: xmlwf/xmlwf.c +xmlwf/xmlfile.@OBJEXT@: xmlwf/xmlfile.c +xmlwf/codepage.@OBJEXT@: xmlwf/codepage.c +xmlwf/@FILEMAP@.@OBJEXT@: xmlwf/@FILEMAP@.c +xmlwf/xmlwf@EXEEXT@: $(XMLWF_OBJS) $(LIBRARY) $(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY) -examples/elements.o: examples/elements.c -examples/elements: examples/elements.o $(LIBRARY) +examples/elements.@OBJEXT@: examples/elements.c +examples/elements: examples/elements.@OBJEXT@ $(LIBRARY) $(LINK_EXE) $< $(LIBRARY) -examples/outline.o: examples/outline.c -examples/outline: examples/outline.o $(LIBRARY) +examples/outline.@OBJEXT@: examples/outline.c +examples/outline: examples/outline.@OBJEXT@ $(LIBRARY) $(LINK_EXE) $< $(LIBRARY) -tests/chardata.o: tests/chardata.c tests/chardata.h -tests/minicheck.o: tests/minicheck.c tests/minicheck.h -tests/runtests.o: tests/runtests.c tests/chardata.h -tests/runtests: tests/runtests.o tests/chardata.o tests/minicheck.o $(LIBRARY) - $(LINK_EXE) tests/runtests.o tests/chardata.o tests/minicheck.o $(LIBRARY) -tests/runtestspp.o: tests/runtestspp.cpp tests/runtests.c tests/chardata.h -tests/runtestspp: tests/runtestspp.o tests/chardata.o tests/minicheck.o $(LIBRARY) - $(LINK_CXX_EXE) tests/runtestspp.o tests/chardata.o tests/minicheck.o $(LIBRARY) +tests/chardata.@OBJEXT@: tests/chardata.c tests/chardata.h +tests/minicheck.@OBJEXT@: tests/minicheck.c tests/minicheck.h +tests/runtests.@OBJEXT@: tests/runtests.c tests/chardata.h +tests/runtests: tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) + $(LINK_EXE) tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) +tests/runtestspp.@OBJEXT@: tests/runtestspp.cpp tests/runtests.c tests/chardata.h +tests/runtestspp: tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) + $(LINK_CXX_EXE) tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) + +tests/benchmark/benchmark.@OBJEXT@: tests/benchmark/benchmark.c +tests/benchmark/benchmark: tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) + $(LINK_EXE) tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) + +run-benchmark: tests/benchmark/benchmark + tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 tests/xmlts.zip: wget --output-document=tests/xmlts.zip \ - http://www.w3.org/XML/Test/xmlts20020606.zip + http://www.w3.org/XML/Test/xmlts20080827.zip tests/XML-Test-Suite: tests/xmlts.zip cd tests && unzip -q xmlts.zip -run-xmltest: xmlwf/xmlwf tests/XML-Test-Suite +run-xmltest: xmlwf/xmlwf@EXEEXT@ tests/XML-Test-Suite tests/xmltest.sh -.SUFFIXES: .c .cpp .lo .o +.SUFFIXES: .c .cpp .lo .@OBJEXT@ -.cpp.o: +.cpp.@OBJEXT@: $(CXXCOMPILE) -o $@ -c $< -.c.o: +.c.@OBJEXT@: $(COMPILE) -o $@ -c $< .c.lo: $(LTCOMPILE) -o $@ -c $< Modified: vendor/expat/dist/README ============================================================================== --- vendor/expat/dist/README Tue Feb 26 00:34:52 2013 (r247292) +++ vendor/expat/dist/README Tue Feb 26 00:43:01 2013 (r247293) @@ -1,5 +1,5 @@ - Expat, Release 2.0.1 + Expat, Release 2.1.0 This is Expat, a C library for parsing XML, written by James Clark. Expat is a stream-oriented XML parser. This means that you register @@ -25,8 +25,7 @@ intended to be production grade software If you are building Expat from a check-out from the CVS repository, you need to run a script that generates the configure script using the GNU autoconf and libtool tools. To do this, you need to have -autoconf 2.52 or newer and libtool 1.4 or newer (1.5 or newer preferred). -Run the script like this: +autoconf 2.58 or newer. Run the script like this: ./buildconf.sh @@ -65,8 +64,8 @@ location. Have a look at the "Makefile" the directories into which things will be installed. If you are interested in building Expat to provide document -information in UTF-16 rather than the default UTF-8, follow these -instructions (after having run "make distclean"): +information in UTF-16 encoding rather than the default UTF-8, follow +these instructions (after having run "make distclean"): 1. For UTF-16 output as unsigned short (and version/error strings as char), run: @@ -106,7 +105,10 @@ use DESTDIR=$(INSTALL_ROOT), even if DES environment, because variable-setting priority is 1) commandline 2) in-makefile -3) environment +3) environment + +Note: This only applies to the Expat library itself, building UTF-16 versions +of xmlwf and the tests is currently not supported. Note for Solaris users: The "ar" command is usually located in "/usr/ccs/bin", which is not in the default PATH. You will need to Modified: vendor/expat/dist/configure.in ============================================================================== --- vendor/expat/dist/configure.in Tue Feb 26 00:34:52 2013 (r247292) +++ vendor/expat/dist/configure.in Tue Feb 26 00:43:01 2013 (r247293) @@ -10,8 +10,8 @@ dnl under the terms of the License (ba dnl in the file COPYING that comes with this distribution. dnl -dnl Ensure that Expat is configured with autoconf 2.52 or newer -AC_PREREQ(2.52) +dnl Ensure that Expat is configured with autoconf 2.58 or newer +AC_PREREQ(2.58) dnl Get the version number of Expat, using m4's esyscmd() command to run dnl the command at m4-generation time. This allows us to create an m4 @@ -25,12 +25,13 @@ dnl test. I believe this test will work, dnl GNU M4 to test it right now. define([expat_version], ifdef([__gnu__], [esyscmd(conftools/get-version.sh lib/expat.h)], - [2.0.x])) + [2.1.x])) AC_INIT(expat, expat_version, expat-bugs@libexpat.org) undefine([expat_version]) AC_CONFIG_SRCDIR(Makefile.in) AC_CONFIG_AUX_DIR(conftools) +AC_CONFIG_MACRO_DIR([m4]) dnl @@ -44,13 +45,12 @@ dnl dnl If the API changes incompatibly set LIBAGE back to 0 dnl -LIBCURRENT=6 -LIBREVISION=2 -LIBAGE=5 +LIBCURRENT=7 +LIBREVISION=0 +LIBAGE=6 AC_CONFIG_HEADER(expat_config.h) -sinclude(conftools/libtool.m4) sinclude(conftools/ac_c_bigendian_cross.m4) AC_LIBTOOL_WIN32_DLL @@ -62,6 +62,7 @@ AC_SUBST(LIBAGE) dnl Checks for programs. AC_PROG_CC +AC_PROG_CXX AC_PROG_INSTALL if test "$GCC" = yes ; then @@ -144,7 +145,7 @@ AC_DEFINE([XML_DTD], 1, AC_DEFINE([XML_CONTEXT_BYTES], 1024, [Define to specify how much context to retain around the current parse point.]) -AC_CONFIG_FILES(Makefile) +AC_CONFIG_FILES([Makefile expat.pc]) AC_OUTPUT abs_srcdir="`cd $srcdir && pwd`" Modified: vendor/expat/dist/doc/reference.html ============================================================================== --- vendor/expat/dist/doc/reference.html Tue Feb 26 00:34:52 2013 (r247292) +++ vendor/expat/dist/doc/reference.html Tue Feb 26 00:43:01 2013 (r247293) @@ -129,8 +129,10 @@ interface.

  • XML_GetBase
  • XML_GetSpecifiedAttributeCount
  • XML_GetIdAttributeIndex
  • +
  • XML_GetAttributeInfo
  • XML_SetEncoding
  • XML_SetParamEntityParsing
  • +
  • XML_SetHashSalt
  • XML_UseForeignDTD
  • XML_SetReturnNSTriplet
  • XML_DefaultCurrent
  • @@ -369,6 +371,11 @@ footprint and can be faster. statically with the code that calls it; this is required to get all the right MSVC magic annotations correct. This is ignored on other platforms. + +
    XML_ATTR_INFO
    +
    If defined, makes the the additional function XML_GetAttributeInfo available +for reporting attribute byte offsets.

    @@ -917,12 +924,15 @@ XML_ParserCreateNS(const XML_Char *encod Constructs a new parser that has namespace processing in effect. Namespace expanded element names and attribute names are returned as a concatenation of the namespace URI, sep, and the local part of the name. This -means that you should pick a character for sep that can't be -part of a legal URI. There is a special case when sep is the null -character '\0': the namespace URI and the local part will be -concatenated without any separator - this is intended to support RDF processors. -It is a programming error to use the null separator with -namespace triplets. +means that you should pick a character for sep that can't be part +of an URI. Since Expat does not check namespace URIs for conformance, the +only safe choice for a namespace separator is a character that is illegal +in XML. For instance, '\xFF' is not legal in UTF-8, and +'\xFFFF' is not legal in UTF-16. There is a special case when +sep is the null character '\0': the namespace URI and +the local part will be concatenated without any separator - this is intended +to support RDF processors. It is a programming error to use the null separator +with namespace triplets.
     XML_Parser XMLCALL
    @@ -2074,6 +2084,27 @@ attribute. If called inside a start hand
     current call.
     
     
    +
    +const XML_AttrInfo * XMLCALL
    +XML_GetAttributeInfo(XML_Parser parser);
    +
    +
    +typedef struct {
    +  XML_Index  nameStart;  /* Offset to beginning of the attribute name. */
    +  XML_Index  nameEnd;    /* Offset after the attribute name's last byte. */
    +  XML_Index  valueStart; /* Offset to beginning of the attribute value. */
    +  XML_Index  valueEnd;   /* Offset after the attribute value's last byte. */
    +} XML_AttrInfo;
    +
    +
    +Returns an array of XML_AttrInfo structures for the +attribute/value pairs passed in the last call to the +XML_StartElementHandler that were specified +in the start-tag rather than defaulted. Each attribute/value pair counts +as 1; thus the number of entries in the array is +XML_GetSpecifiedAttributeCount(parser) / 2. +
    +
     enum XML_Status XMLCALL
     XML_SetEncoding(XML_Parser p,
    @@ -2104,6 +2135,24 @@ The choices for code are:
     
  • XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
  • XML_PARAM_ENTITY_PARSING_ALWAYS
  • +Note: If XML_SetParamEntityParsing is called after +XML_Parse or XML_ParseBuffer, then it has +no effect and will always return 0. + + +
    +int XMLCALL
    +XML_SetHashSalt(XML_Parser p,
    +                unsigned long hash_salt);
    +
    +
    +Sets the hash salt to use for internal hash calculations. +Helps in preventing DoS attacks based on predicting hash +function behavior. In order to have an effect this must be called +before parsing has started. Returns 1 if successful, 0 when called +after XML_Parse or XML_ParseBuffer. +

    Note: This call is optional, as the parser will auto-generate a new +random salt value if no value has been set at the start of parsing.

    
    Modified: vendor/expat/dist/doc/xmlwf.sgml
    ==============================================================================
    --- vendor/expat/dist/doc/xmlwf.sgml	Tue Feb 26 00:34:52 2013	(r247292)
    +++ vendor/expat/dist/doc/xmlwf.sgml	Tue Feb 26 00:43:01 2013	(r247293)
    @@ -389,11 +389,6 @@ supports both.
       
         BUGS
     	
    -	According to the W3C standard, an XML file without a
    -	declaration at the beginning is not considered well-formed.
    -	However, &dhpackage; allows this to pass.
    -	
    -	
     	&dhpackage; returns a 0 - noerr result,
     	even if the file is not well-formed.  There is no good way for
     	a program to use &dhpackage; to quickly
    
    Modified: vendor/expat/dist/expat_config.h.in
    ==============================================================================
    --- vendor/expat/dist/expat_config.h.in	Tue Feb 26 00:34:52 2013	(r247292)
    +++ vendor/expat/dist/expat_config.h.in	Tue Feb 26 00:43:01 2013	(r247293)
    @@ -39,6 +39,9 @@
     /* Define to 1 if you have the  header file. */
     #undef HAVE_STRING_H
     
    +/* Define to 1 if you have the  header file. */
    +#undef HAVE_SYS_PARAM_H
    +
     /* Define to 1 if you have the  header file. */
     #undef HAVE_SYS_STAT_H
     
    @@ -48,6 +51,10 @@
     /* Define to 1 if you have the  header file. */
     #undef HAVE_UNISTD_H
     
    +/* Define to the sub-directory in which libtool stores uninstalled libraries.
    +   */
    +#undef LT_OBJDIR
    +
     /* Define to the address where bug reports for this package should be sent. */
     #undef PACKAGE_BUGREPORT
     
    @@ -60,6 +67,9 @@
     /* Define to the one symbol short name of this package. */
     #undef PACKAGE_TARNAME
     
    +/* Define to the home page for this package. */
    +#undef PACKAGE_URL
    +
     /* Define to the version of this package. */
     #undef PACKAGE_VERSION
     
    @@ -85,8 +95,8 @@
     /* Define to empty if `const' does not conform to ANSI C. */
     #undef const
     
    -/* Define to `long' if  does not define. */
    +/* Define to `long int' if  does not define. */
     #undef off_t
     
    -/* Define to `unsigned' if  does not define. */
    +/* Define to `unsigned int' if  does not define. */
     #undef size_t
    
    Modified: vendor/expat/dist/lib/expat.h
    ==============================================================================
    --- vendor/expat/dist/lib/expat.h	Tue Feb 26 00:34:52 2013	(r247292)
    +++ vendor/expat/dist/lib/expat.h	Tue Feb 26 00:43:01 2013	(r247293)
    @@ -742,6 +742,29 @@ XML_GetSpecifiedAttributeCount(XML_Parse
     XMLPARSEAPI(int)
     XML_GetIdAttributeIndex(XML_Parser parser);
     
    +#ifdef XML_ATTR_INFO
    +/* Source file byte offsets for the start and end of attribute names and values.
    +   The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
    +   file an attribute value of "blah" will yield:
    +   info->valueEnd - info->valueStart = 4 bytes.
    +*/
    +typedef struct {
    +  XML_Index  nameStart;  /* Offset to beginning of the attribute name. */
    +  XML_Index  nameEnd;    /* Offset after the attribute name's last byte. */
    +  XML_Index  valueStart; /* Offset to beginning of the attribute value. */
    +  XML_Index  valueEnd;   /* Offset after the attribute value's last byte. */
    +} XML_AttrInfo;
    +
    +/* Returns an array of XML_AttrInfo structures for the attribute/value pairs
    +   passed in last call to the XML_StartElementHandler that were specified
    +   in the start-tag rather than defaulted. Each attribute/value pair counts
    +   as 1; thus the number of entries in the array is
    +   XML_GetSpecifiedAttributeCount(parser) / 2.
    +*/
    +XMLPARSEAPI(const XML_AttrInfo *)
    +XML_GetAttributeInfo(XML_Parser parser);
    +#endif
    +
     /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
        detected.  The last call to XML_Parse must have isFinal true; len
        may be zero for this call (or any other).
    @@ -883,6 +906,15 @@ XMLPARSEAPI(int)
     XML_SetParamEntityParsing(XML_Parser parser,
                               enum XML_ParamEntityParsing parsing);
     
    +/* Sets the hash salt to use for internal hash calculations.
    +   Helps in preventing DoS attacks based on predicting hash
    +   function behavior. This must be called before parsing is started.
    +   Returns 1 if successful, 0 when called after parsing has started.
    +*/
    +XMLPARSEAPI(int)
    +XML_SetHashSalt(XML_Parser parser,
    +                unsigned long hash_salt);
    +
     /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
        XML_GetErrorCode returns information about the error.
     */
    @@ -984,7 +1016,8 @@ enum XML_FeatureEnum {
       XML_FEATURE_SIZEOF_XML_CHAR,
       XML_FEATURE_SIZEOF_XML_LCHAR,
       XML_FEATURE_NS,
    -  XML_FEATURE_LARGE_SIZE
    +  XML_FEATURE_LARGE_SIZE,
    +  XML_FEATURE_ATTR_INFO
       /* Additional features must be added to the end of this enum. */
     };
     
    @@ -1004,8 +1037,8 @@ XML_GetFeatureList(void);
        change to major or minor version.
     */
     #define XML_MAJOR_VERSION 2
    -#define XML_MINOR_VERSION 0
    -#define XML_MICRO_VERSION 1
    +#define XML_MINOR_VERSION 1
    +#define XML_MICRO_VERSION 0
     
     #ifdef __cplusplus
     }
    
    Modified: vendor/expat/dist/lib/xmlparse.c
    ==============================================================================
    --- vendor/expat/dist/lib/xmlparse.c	Tue Feb 26 00:34:52 2013	(r247292)
    +++ vendor/expat/dist/lib/xmlparse.c	Tue Feb 26 00:43:01 2013	(r247293)
    @@ -5,6 +5,8 @@
     #include 
     #include                      /* memset(), memcpy() */
     #include 
    +#include                      /* UINT_MAX */
    +#include                        /* time() */
     
     #define XML_BUILDING_EXPAT 1
     
    @@ -12,7 +14,7 @@
     #include "winconfig.h"
     #elif defined(MACOS_CLASSIC)
     #include "macconfig.h"
    -#elif defined(__amigaos4__)
    +#elif defined(__amigaos__)
     #include "amigaconfig.h"
     #elif defined(__WATCOMC__)
     #include "watcomconfig.h"
    @@ -327,15 +329,15 @@ processXmlDecl(XML_Parser parser, int is
     static enum XML_Error
     initializeEncoding(XML_Parser parser);
     static enum XML_Error
    -doProlog(XML_Parser parser, const ENCODING *enc, const char *s, 
    -         const char *end, int tok, const char *next, const char **nextPtr, 
    +doProlog(XML_Parser parser, const ENCODING *enc, const char *s,
    +         const char *end, int tok, const char *next, const char **nextPtr,
              XML_Bool haveMore);
     static enum XML_Error
    -processInternalEntity(XML_Parser parser, ENTITY *entity, 
    +processInternalEntity(XML_Parser parser, ENTITY *entity,
                           XML_Bool betweenDecl);
     static enum XML_Error
     doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
    -          const char *start, const char *end, const char **endPtr, 
    +          const char *start, const char *end, const char **endPtr,
               XML_Bool haveMore);
     static enum XML_Error
     doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr,
    @@ -353,7 +355,7 @@ static enum XML_Error
     addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
                const XML_Char *uri, BINDING **bindingsPtr);
     static int
    -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, 
    +defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata,
                     XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser);
     static enum XML_Error
     storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata,
    @@ -391,12 +393,13 @@ static void dtdReset(DTD *p, const XML_M
     static void
     dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms);
     static int
    -dtdCopy(DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms);
    +dtdCopy(XML_Parser oldParser,
    +        DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms);
     static int
    -copyEntityTable(HASH_TABLE *, STRING_POOL *, const HASH_TABLE *);
    -
    +copyEntityTable(XML_Parser oldParser,
    +                HASH_TABLE *, STRING_POOL *, const HASH_TABLE *);
     static NAMED *
    -lookup(HASH_TABLE *table, KEY name, size_t createSize);
    +lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize);
     static void FASTCALL
     hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms);
     static void FASTCALL hashTableClear(HASH_TABLE *);
    @@ -429,11 +432,15 @@ static ELEMENT_TYPE *
     getElementType(XML_Parser parser, const ENCODING *enc,
                    const char *ptr, const char *end);
     
    +static unsigned long generate_hash_secret_salt(void);
    +static XML_Bool startParsing(XML_Parser parser);
    +
     static XML_Parser
     parserCreate(const XML_Char *encodingName,
                  const XML_Memory_Handling_Suite *memsuite,
                  const XML_Char *nameSep,
                  DTD *dtd);
    +
     static void
     parserInit(XML_Parser parser, const XML_Char *encodingName);
     
    @@ -533,6 +540,9 @@ struct XML_ParserStruct {
       NS_ATT *m_nsAtts;
       unsigned long m_nsAttsVersion;
       unsigned char m_nsAttsPower;
    +#ifdef XML_ATTR_INFO
    +  XML_AttrInfo *m_attInfo;
    +#endif
       POSITION m_position;
       STRING_POOL m_tempPool;
       STRING_POOL m_temp2Pool;
    @@ -546,6 +556,7 @@ struct XML_ParserStruct {
       XML_Bool m_useForeignDTD;
       enum XML_ParamEntityParsing m_paramEntityParsing;
     #endif
    +  unsigned long m_hash_secret_salt;
     };
     
     #define MALLOC(s) (parser->m_mem.malloc_fcn((s)))
    @@ -640,6 +651,7 @@ struct XML_ParserStruct {
     #define nsAtts (parser->m_nsAtts)
     #define nsAttsVersion (parser->m_nsAttsVersion)
     #define nsAttsPower (parser->m_nsAttsPower)
    +#define attInfo (parser->m_attInfo)
     #define tempPool (parser->m_tempPool)
     #define temp2Pool (parser->m_temp2Pool)
     #define groupConnector (parser->m_groupConnector)
    @@ -653,6 +665,7 @@ struct XML_ParserStruct {
     #define useForeignDTD (parser->m_useForeignDTD)
     #define paramEntityParsing (parser->m_paramEntityParsing)
     #endif /* XML_DTD */
    +#define hash_secret_salt (parser->m_hash_secret_salt)
     
     XML_Parser XMLCALL
     XML_ParserCreate(const XML_Char *encodingName)
    @@ -670,29 +683,42 @@ XML_ParserCreateNS(const XML_Char *encod
     
     static const XML_Char implicitContext[] = {
       ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p,
    -  ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, 
    +  ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w,
       ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g,
       ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9,
       ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e,
       ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0'
     };
     
    +static unsigned long
    +generate_hash_secret_salt(void)
    +{
    +  unsigned int seed = time(NULL) % UINT_MAX;
    +  srand(seed);
    +  return rand();
    +}
    +
    +static XML_Bool  /* only valid for root parser */
    +startParsing(XML_Parser parser)
    +{
    +    /* hash functions must be initialized before setContext() is called */
    +    if (hash_secret_salt == 0)
    +      hash_secret_salt = generate_hash_secret_salt();
    +    if (ns) {
    +      /* implicit context only set for root parser, since child
    +         parsers (i.e. external entity parsers) will inherit it
    +      */
    +      return setContext(parser, implicitContext);
    +    }
    +    return XML_TRUE;
    +}
    +
     XML_Parser XMLCALL
     XML_ParserCreate_MM(const XML_Char *encodingName,
                         const XML_Memory_Handling_Suite *memsuite,
                         const XML_Char *nameSep)
     {
    -  XML_Parser parser = parserCreate(encodingName, memsuite, nameSep, NULL);
    -  if (parser != NULL && ns) {
    -    /* implicit context only set for root parser, since child
    -       parsers (i.e. external entity parsers) will inherit it
    -    */
    -    if (!setContext(parser, implicitContext)) {
    -      XML_ParserFree(parser);
    -      return NULL;
    -    }
    -  }
    -  return parser;
    +  return parserCreate(encodingName, memsuite, nameSep, NULL);
     }
     
     static XML_Parser
    @@ -737,9 +763,20 @@ parserCreate(const XML_Char *encodingNam
         FREE(parser);
         return NULL;
       }
    +#ifdef XML_ATTR_INFO
    +  attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo));
    +  if (attInfo == NULL) {
    +    FREE(atts);
    +    FREE(parser);
    +    return NULL;
    +  }
    +#endif
       dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
       if (dataBuf == NULL) {
         FREE(atts);
    +#ifdef XML_ATTR_INFO
    +    FREE(attInfo);
    +#endif
         FREE(parser);
         return NULL;
       }
    @@ -752,6 +789,9 @@ parserCreate(const XML_Char *encodingNam
         if (_dtd == NULL) {
           FREE(dataBuf);
           FREE(atts);
    +#ifdef XML_ATTR_INFO
    +      FREE(attInfo);
    +#endif
           FREE(parser);
           return NULL;
         }
    @@ -866,6 +906,7 @@ parserInit(XML_Parser parser, const XML_
       useForeignDTD = XML_FALSE;
       paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
     #endif
    +  hash_secret_salt = 0;
     }
     
     /* moves list of bindings to freeBindingList */
    @@ -913,7 +954,7 @@ XML_ParserReset(XML_Parser parser, const
       poolClear(&temp2Pool);
       parserInit(parser, encodingName);
       dtdReset(_dtd, &parser->m_mem);
    -  return setContext(parser, implicitContext);
    +  return XML_TRUE;
     }
     
     enum XML_Status XMLCALL
    @@ -982,6 +1023,12 @@ XML_ExternalEntityParserCreate(XML_Parse
       int oldInEntityValue = prologState.inEntityValue;
     #endif
       XML_Bool oldns_triplets = ns_triplets;
    +  /* Note that the new parser shares the same hash secret as the old
    +     parser, so that dtdCopy and copyEntityTable can lookup values
    +     from hash tables associated with either parser without us having
    +     to worry which hash secrets each table has.
    +  */
    +  unsigned long oldhash_secret_salt = hash_secret_salt;
     
     #ifdef XML_DTD
       if (!context)
    @@ -1035,13 +1082,14 @@ XML_ExternalEntityParserCreate(XML_Parse
         externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
       defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
       ns_triplets = oldns_triplets;
    +  hash_secret_salt = oldhash_secret_salt;
       parentParser = oldParser;
     #ifdef XML_DTD
       paramEntityParsing = oldParamEntityParsing;
       prologState.inEntityValue = oldInEntityValue;
       if (context) {
     #endif /* XML_DTD */
    -    if (!dtdCopy(_dtd, oldDtd, &parser->m_mem)
    +    if (!dtdCopy(oldParser, _dtd, oldDtd, &parser->m_mem)
           || !setContext(parser, context)) {
           XML_ParserFree(parser);
           return NULL;
    @@ -1130,6 +1178,9 @@ XML_ParserFree(XML_Parser parser)
     #endif /* XML_DTD */
         dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem);
       FREE((void *)atts);
    +#ifdef XML_ATTR_INFO
    +  FREE((void *)attInfo);
    +#endif
       FREE(groupConnector);
       FREE(buffer);
       FREE(dataBuf);
    @@ -1210,6 +1261,14 @@ XML_GetIdAttributeIndex(XML_Parser parse
       return idAttIndex;
     }
     
    +#ifdef XML_ATTR_INFO
    +const XML_AttrInfo * XMLCALL
    +XML_GetAttributeInfo(XML_Parser parser)
    +{
    +  return attInfo;
    +}
    +#endif
    +
     void XMLCALL
     XML_SetElementHandler(XML_Parser parser,
                           XML_StartElementHandler start,
    @@ -1426,6 +1485,17 @@ XML_SetParamEntityParsing(XML_Parser par
     #endif
     }
     
    +int XMLCALL
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
    
    From owner-svn-src-vendor@FreeBSD.ORG  Tue Feb 26 00:58:04 2013
    Return-Path: 
    Delivered-To: svn-src-vendor@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 800C154B;
     Tue, 26 Feb 2013 00:58:04 +0000 (UTC)
     (envelope-from delphij@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 43C6E221;
     Tue, 26 Feb 2013 00:58:04 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q0w4VW092340;
     Tue, 26 Feb 2013 00:58:04 GMT (envelope-from delphij@svn.freebsd.org)
    Received: (from delphij@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q0w4Eh092339;
     Tue, 26 Feb 2013 00:58:04 GMT (envelope-from delphij@svn.freebsd.org)
    Message-Id: <201302260058.r1Q0w4Eh092339@svn.freebsd.org>
    From: Xin LI 
    Date: Tue, 26 Feb 2013 00:58:04 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-vendor@freebsd.org
    Subject: svn commit: r247295 - vendor/expat/2.1.0
    X-SVN-Group: vendor
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-vendor@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: SVN commit messages for the vendor work area tree
     
    List-Unsubscribe: ,
     
    List-Archive: 
    List-Post: 
    List-Help: 
    List-Subscribe: ,
     
    X-List-Received-Date: Tue, 26 Feb 2013 00:58:04 -0000
    
    Author: delphij
    Date: Tue Feb 26 00:58:03 2013
    New Revision: 247295
    URL: http://svnweb.freebsd.org/changeset/base/247295
    
    Log:
      Tag expat 2.1.0.
    
    Added:
      vendor/expat/2.1.0/
         - copied from r247294, vendor/expat/dist/
    
    From owner-svn-src-vendor@FreeBSD.ORG  Tue Feb 26 08:51:39 2013
    Return-Path: 
    Delivered-To: svn-src-vendor@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id B599E991;
     Tue, 26 Feb 2013 08:51:39 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id A64D16F3;
     Tue, 26 Feb 2013 08:51:39 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q8pd5g038774;
     Tue, 26 Feb 2013 08:51:39 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q8pdZt038773;
     Tue, 26 Feb 2013 08:51:39 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201302260851.r1Q8pdZt038773@svn.freebsd.org>
    From: Martin Matuska 
    Date: Tue, 26 Feb 2013 08:51:39 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-vendor@freebsd.org
    Subject: svn commit: r247315 - vendor-sys/illumos/dist/uts/common/fs/zfs
    X-SVN-Group: vendor-sys
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-vendor@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: SVN commit messages for the vendor work area tree
     
    List-Unsubscribe: ,
     
    List-Archive: 
    List-Post: 
    List-Help: 
    List-Subscribe: ,
     
    X-List-Received-Date: Tue, 26 Feb 2013 08:51:39 -0000
    
    Author: mm
    Date: Tue Feb 26 08:51:39 2013
    New Revision: 247315
    URL: http://svnweb.freebsd.org/changeset/base/247315
    
    Log:
      Update vendor-sys/illumos/dist to illumos-gate 13968:e4988c7d0403
      
      Illumos ZFS issues:
        3552 condensing one space map burns 3 seconds of CPU in spa_sync() thread
             (fix race condition)
    
    Modified:
      vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c	Tue Feb 26 08:17:34 2013	(r247314)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c	Tue Feb 26 08:51:39 2013	(r247315)
    @@ -1383,6 +1383,13 @@ metaslab_group_alloc(metaslab_group_t *m
     				mutex_exit(&mg->mg_lock);
     				return (-1ULL);
     			}
    +
    +			/*
    +			 * If the selected metaslab is condensing, skip it.
    +			 */
    +			if (msp->ms_map->sm_condensing)
    +				continue;
    +
     			was_active = msp->ms_weight & METASLAB_ACTIVE_MASK;
     			if (activation_weight == METASLAB_WEIGHT_PRIMARY)
     				break;
    @@ -1423,16 +1430,6 @@ metaslab_group_alloc(metaslab_group_t *m
     		mutex_enter(&msp->ms_lock);
     
     		/*
    -		 * If this metaslab is currently condensing then pick again as
    -		 * we can't manipulate this metaslab until it's committed
    -		 * to disk.
    -		 */
    -		if (msp->ms_map->sm_condensing) {
    -			mutex_exit(&msp->ms_lock);
    -			continue;
    -		}
    -
    -		/*
     		 * Ensure that the metaslab we have selected is still
     		 * capable of handling our request. It's possible that
     		 * another thread may have changed the weight while we
    @@ -1458,6 +1455,16 @@ metaslab_group_alloc(metaslab_group_t *m
     			continue;
     		}
     
    +		/*
    +		 * If this metaslab is currently condensing then pick again as
    +		 * we can't manipulate this metaslab until it's committed
    +		 * to disk.
    +		 */
    +		if (msp->ms_map->sm_condensing) {
    +			mutex_exit(&msp->ms_lock);
    +			continue;
    +		}
    +
     		if ((offset = space_map_alloc(msp->ms_map, asize)) != -1ULL)
     			break;
     
    
    From owner-svn-src-vendor@FreeBSD.ORG  Tue Feb 26 08:53:34 2013
    Return-Path: 
    Delivered-To: svn-src-vendor@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id A52AEB14;
     Tue, 26 Feb 2013 08:53:34 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 7AB96707;
     Tue, 26 Feb 2013 08:53:34 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q8rYBE039071;
     Tue, 26 Feb 2013 08:53:34 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q8rX9x039066;
     Tue, 26 Feb 2013 08:53:33 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201302260853.r1Q8rX9x039066@svn.freebsd.org>
    From: Martin Matuska 
    Date: Tue, 26 Feb 2013 08:53:33 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-vendor@freebsd.org
    Subject: svn commit: r247316 - vendor-sys/illumos/dist/common/zfs
     vendor-sys/illumos/dist/uts/common/fs/zfs
     vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/man/man1m
    X-SVN-Group: vendor-sys
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-vendor@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: SVN commit messages for the vendor work area tree
     
    List-Unsubscribe: ,
     
    List-Archive: 
    List-Post: 
    List-Help: 
    List-Subscribe: ,
     
    X-List-Received-Date: Tue, 26 Feb 2013 08:53:34 -0000
    
    Author: mm
    Date: Tue Feb 26 08:53:33 2013
    New Revision: 247316
    URL: http://svnweb.freebsd.org/changeset/base/247316
    
    Log:
      Update vendor/illumos/dist and vendor-sys/illumos/dist
      to illumos-gate 13969:b2c7608044b7
      
      Illumos ZFS issues:
        3588 provide zfs properties for logical (uncompressed) space used and
             referenced
    
    Modified:
      vendor-sys/illumos/dist/common/zfs/zfs_prop.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c
      vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h
    
    Changes in other areas also in this revision:
    Modified:
      vendor/illumos/dist/man/man1m/zfs.1m
    
    Modified: vendor-sys/illumos/dist/common/zfs/zfs_prop.c
    ==============================================================================
    --- vendor-sys/illumos/dist/common/zfs/zfs_prop.c	Tue Feb 26 08:51:39 2013	(r247315)
    +++ vendor-sys/illumos/dist/common/zfs/zfs_prop.c	Tue Feb 26 08:53:33 2013	(r247316)
    @@ -20,7 +20,7 @@
      */
     /*
      * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    - * Copyright (c) 2011 by Delphix. All rights reserved.
    + * Copyright (c) 2012 by Delphix. All rights reserved.
      * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
      */
     
    @@ -350,6 +350,10 @@ zfs_prop_init(void)
     	    ZFS_TYPE_SNAPSHOT, "", "USERREFS");
     	zprop_register_number(ZFS_PROP_WRITTEN, "written", 0, PROP_READONLY,
     	    ZFS_TYPE_DATASET, "", "WRITTEN");
    +	zprop_register_number(ZFS_PROP_LOGICALUSED, "logicalused", 0,
    +	    PROP_READONLY, ZFS_TYPE_DATASET, "", "LUSED");
    +	zprop_register_number(ZFS_PROP_LOGICALREFERENCED, "logicalreferenced",
    +	    0, PROP_READONLY, ZFS_TYPE_DATASET, "", "LREFER");
     
     	/* default number properties */
     	zprop_register_number(ZFS_PROP_QUOTA, "quota", 0, PROP_DEFAULT,
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c	Tue Feb 26 08:51:39 2013	(r247315)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c	Tue Feb 26 08:53:33 2013	(r247316)
    @@ -2247,6 +2247,8 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvl
     	    ds->ds_phys->ds_compressed_bytes);
     
     	dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, ratio);
    +	dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALREFERENCED,
    +	    ds->ds_phys->ds_uncompressed_bytes);
     
     	if (dsl_dataset_is_snapshot(ds)) {
     		dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO, ratio);
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c	Tue Feb 26 08:51:39 2013	(r247315)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c	Tue Feb 26 08:53:33 2013	(r247316)
    @@ -530,6 +530,8 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *n
     	    dd->dd_phys->dd_compressed_bytes == 0 ? 100 :
     	    (dd->dd_phys->dd_uncompressed_bytes * 100 /
     	    dd->dd_phys->dd_compressed_bytes));
    +	dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALUSED,
    +	    dd->dd_phys->dd_uncompressed_bytes);
     	if (dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN) {
     		dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDSNAP,
     		    dd->dd_phys->dd_used_breakdown[DD_USED_SNAP]);
    
    Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h	Tue Feb 26 08:51:39 2013	(r247315)
    +++ vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h	Tue Feb 26 08:53:33 2013	(r247316)
    @@ -138,6 +138,8 @@ typedef enum {
     	ZFS_PROP_REFRATIO,
     	ZFS_PROP_WRITTEN,
     	ZFS_PROP_CLONES,
    +	ZFS_PROP_LOGICALUSED,
    +	ZFS_PROP_LOGICALREFERENCED,
     	ZFS_NUM_PROPS
     } zfs_prop_t;
     
    
    From owner-svn-src-vendor@FreeBSD.ORG  Tue Feb 26 08:53:35 2013
    Return-Path: 
    Delivered-To: svn-src-vendor@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 0EACAB15;
     Tue, 26 Feb 2013 08:53:35 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id CFFFF708;
     Tue, 26 Feb 2013 08:53:34 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1Q8rY1I039077;
     Tue, 26 Feb 2013 08:53:34 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1Q8rYvg039076;
     Tue, 26 Feb 2013 08:53:34 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201302260853.r1Q8rYvg039076@svn.freebsd.org>
    From: Martin Matuska 
    Date: Tue, 26 Feb 2013 08:53:34 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-vendor@freebsd.org
    Subject: svn commit: r247316 - vendor-sys/illumos/dist/common/zfs
     vendor-sys/illumos/dist/uts/common/fs/zfs
     vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/man/man1m
    X-SVN-Group: vendor
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-vendor@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: SVN commit messages for the vendor work area tree
     
    List-Unsubscribe: ,
     
    List-Archive: 
    List-Post: 
    List-Help: 
    List-Subscribe: ,
     
    X-List-Received-Date: Tue, 26 Feb 2013 08:53:35 -0000
    
    Author: mm
    Date: Tue Feb 26 08:53:33 2013
    New Revision: 247316
    URL: http://svnweb.freebsd.org/changeset/base/247316
    
    Log:
      Update vendor/illumos/dist and vendor-sys/illumos/dist
      to illumos-gate 13969:b2c7608044b7
      
      Illumos ZFS issues:
        3588 provide zfs properties for logical (uncompressed) space used and
             referenced
    
    Modified:
      vendor/illumos/dist/man/man1m/zfs.1m
    
    Changes in other areas also in this revision:
    Modified:
      vendor-sys/illumos/dist/common/zfs/zfs_prop.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c
      vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h
    
    Modified: vendor/illumos/dist/man/man1m/zfs.1m
    ==============================================================================
    --- vendor/illumos/dist/man/man1m/zfs.1m	Tue Feb 26 08:51:39 2013	(r247315)
    +++ vendor/illumos/dist/man/man1m/zfs.1m	Tue Feb 26 08:53:33 2013	(r247316)
    @@ -535,6 +535,40 @@ by using the \fBzfs destroy\fR \fB-d\fR 
     .sp
     .ne 2
     .na
    +\fB\fBlogicalreferenced\fR\fR
    +.ad
    +.sp .6
    +.RS 4n
    +The amount of space that is "logically" accessible by this dataset.  See
    +the \fBreferenced\fR property.  The logical space ignores the effect of
    +the \fBcompression\fR and \fBcopies\fR properties, giving a quantity
    +closer to the amount of data that applications see.  However, it does
    +include space consumed by metadata.
    +.sp
    +This property can also be referred to by its shortened column name,
    +\fBlrefer\fR.
    +.RE
    +
    +.sp
    +.ne 2
    +.na
    +\fB\fBlogicalused\fR\fR
    +.ad
    +.sp .6
    +.RS 4n
    +The amount of space that is "logically" consumed by this dataset and all
    +its descendents.  See the \fBused\fR property.  The logical space
    +ignores the effect of the \fBcompression\fR and \fBcopies\fR properties,
    +giving a quantity closer to the amount of data that applications see.
    +However, it does include space consumed by metadata.
    +.sp
    +This property can also be referred to by its shortened column name,
    +\fBlused\fR.
    +.RE
    +
    +.sp
    +.ne 2
    +.na
     \fB\fBmounted\fR\fR
     .ad
     .sp .6
    
    From owner-svn-src-vendor@FreeBSD.ORG  Fri Mar  1 20:48:08 2013
    Return-Path: 
    Delivered-To: svn-src-vendor@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 47C0DD7D;
     Fri,  1 Mar 2013 20:48:08 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 2F768174D;
     Fri,  1 Mar 2013 20:48:08 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21Km8EL085262;
     Fri, 1 Mar 2013 20:48:08 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21Km7IK085259;
     Fri, 1 Mar 2013 20:48:07 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201303012048.r21Km7IK085259@svn.freebsd.org>
    From: Martin Matuska 
    Date: Fri, 1 Mar 2013 20:48:07 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-vendor@freebsd.org
    Subject: svn commit: r247575 - vendor-sys/illumos/dist/uts/common/fs/zfs
    X-SVN-Group: vendor-sys
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-vendor@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: SVN commit messages for the vendor work area tree
     
    List-Unsubscribe: ,
     
    List-Archive: 
    List-Post: 
    List-Help: 
    List-Subscribe: ,
     
    X-List-Received-Date: Fri, 01 Mar 2013 20:48:08 -0000
    
    Author: mm
    Date: Fri Mar  1 20:48:07 2013
    New Revision: 247575
    URL: http://svnweb.freebsd.org/changeset/base/247575
    
    Log:
      Update vendor-sys/illumos/dist to illumos-gate 13970:c9a5683da38e
      
      Illumos ZFS issues:
        3543 Feature flags causes assertion in spa.c to miss certain cases
    
    Modified:
      vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c	Fri Mar  1 20:36:59 2013	(r247574)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c	Fri Mar  1 20:48:07 2013	(r247575)
    @@ -5747,7 +5747,7 @@ spa_sync_version(void *arg1, void *arg2,
     	 */
     	ASSERT(tx->tx_txg != TXG_INITIAL);
     
    -	ASSERT(version <= SPA_VERSION);
    +	ASSERT(SPA_VERSION_IS_SUPPORTED(version));
     	ASSERT(version >= spa_version(spa));
     
     	spa->spa_uberblock.ub_version = version;
    @@ -6276,7 +6276,7 @@ spa_upgrade(spa_t *spa, uint64_t version
     	 * future version would result in an unopenable pool, this shouldn't be
     	 * possible.
     	 */
    -	ASSERT(spa->spa_uberblock.ub_version <= SPA_VERSION);
    +	ASSERT(SPA_VERSION_IS_SUPPORTED(spa->spa_uberblock.ub_version));
     	ASSERT(version >= spa->spa_uberblock.ub_version);
     
     	spa->spa_uberblock.ub_version = version;
    
    From owner-svn-src-vendor@FreeBSD.ORG  Fri Mar  1 20:49:57 2013
    Return-Path: 
    Delivered-To: svn-src-vendor@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 7A206202;
     Fri,  1 Mar 2013 20:49:57 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 57CF91762;
     Fri,  1 Mar 2013 20:49:57 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21KnvWQ085608;
     Fri, 1 Mar 2013 20:49:57 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21Knu1t085604;
     Fri, 1 Mar 2013 20:49:56 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201303012049.r21Knu1t085604@svn.freebsd.org>
    From: Martin Matuska 
    Date: Fri, 1 Mar 2013 20:49:56 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-vendor@freebsd.org
    Subject: svn commit: r247578 - in vendor-sys/illumos/dist/uts/common/fs/zfs: .
     sys
    X-SVN-Group: vendor-sys
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-vendor@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: SVN commit messages for the vendor work area tree
     
    List-Unsubscribe: ,
     
    List-Archive: 
    List-Post: 
    List-Help: 
    List-Subscribe: ,
     
    X-List-Received-Date: Fri, 01 Mar 2013 20:49:57 -0000
    
    Author: mm
    Date: Fri Mar  1 20:49:56 2013
    New Revision: 247578
    URL: http://svnweb.freebsd.org/changeset/base/247578
    
    Log:
      Update vendor-sys/illumos/dist to illumos-gate 13971:d1648d817bd6
      
      Illumos ZFS issues:
        3581 spa_zio_taskq[ZIO_TYPE_FREE][ZIO_TASKQ_ISSUE]->tq_lock is piping hot
    
    Modified:
      vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c	Fri Mar  1 20:48:53 2013	(r247577)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c	Fri Mar  1 20:49:56 2013	(r247578)
    @@ -77,23 +77,25 @@
     #include "zfs_comutil.h"
     
     typedef enum zti_modes {
    -	zti_mode_fixed,			/* value is # of threads (min 1) */
    -	zti_mode_online_percent,	/* value is % of online CPUs */
    -	zti_mode_batch,			/* cpu-intensive; value is ignored */
    -	zti_mode_null,			/* don't create a taskq */
    -	zti_nmodes
    +	ZTI_MODE_FIXED,			/* value is # of threads (min 1) */
    +	ZTI_MODE_ONLINE_PERCENT,	/* value is % of online CPUs */
    +	ZTI_MODE_BATCH,			/* cpu-intensive; value is ignored */
    +	ZTI_MODE_NULL,			/* don't create a taskq */
    +	ZTI_NMODES
     } zti_modes_t;
     
    -#define	ZTI_FIX(n)	{ zti_mode_fixed, (n) }
    -#define	ZTI_PCT(n)	{ zti_mode_online_percent, (n) }
    -#define	ZTI_BATCH	{ zti_mode_batch, 0 }
    -#define	ZTI_NULL	{ zti_mode_null, 0 }
    +#define	ZTI_P(n, q)	{ ZTI_MODE_FIXED, (n), (q) }
    +#define	ZTI_PCT(n)	{ ZTI_MODE_ONLINE_PERCENT, (n), 1 }
    +#define	ZTI_BATCH	{ ZTI_MODE_BATCH, 0, 1 }
    +#define	ZTI_NULL	{ ZTI_MODE_NULL, 0, 0 }
     
    -#define	ZTI_ONE		ZTI_FIX(1)
    +#define	ZTI_N(n)	ZTI_P(n, 1)
    +#define	ZTI_ONE		ZTI_N(1)
     
     typedef struct zio_taskq_info {
    -	enum zti_modes zti_mode;
    +	zti_modes_t zti_mode;
     	uint_t zti_value;
    +	uint_t zti_count;
     } zio_taskq_info_t;
     
     static const char *const zio_taskq_types[ZIO_TASKQ_TYPES] = {
    @@ -101,17 +103,30 @@ static const char *const zio_taskq_types
     };
     
     /*
    - * Define the taskq threads for the following I/O types:
    - * 	NULL, READ, WRITE, FREE, CLAIM, and IOCTL
    + * This table defines the taskq settings for each ZFS I/O type. When
    + * initializing a pool, we use this table to create an appropriately sized
    + * taskq. Some operations are low volume and therefore have a small, static
    + * number of threads assigned to their taskqs using the ZTI_N(#) or ZTI_ONE
    + * macros. Other operations process a large amount of data; the ZTI_BATCH
    + * macro causes us to create a taskq oriented for throughput. Some operations
    + * are so high frequency and short-lived that the taskq itself can become a a
    + * point of lock contention. The ZTI_P(#, #) macro indicates that we need an
    + * additional degree of parallelism specified by the number of threads per-
    + * taskq and the number of taskqs; when dispatching an event in this case, the
    + * particular taskq is chosen at random.
    + *
    + * The different taskq priorities are to handle the different contexts (issue
    + * and interrupt) and then to reserve threads for ZIO_PRIORITY_NOW I/Os that
    + * need to be handled with minimum delay.
      */
     const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] = {
     	/* ISSUE	ISSUE_HIGH	INTR		INTR_HIGH */
    -	{ ZTI_ONE,	ZTI_NULL,	ZTI_ONE,	ZTI_NULL },
    -	{ ZTI_FIX(8),	ZTI_NULL,	ZTI_BATCH,	ZTI_NULL },
    -	{ ZTI_BATCH,	ZTI_FIX(5),	ZTI_FIX(8),	ZTI_FIX(5) },
    -	{ ZTI_FIX(100),	ZTI_NULL,	ZTI_ONE,	ZTI_NULL },
    -	{ ZTI_ONE,	ZTI_NULL,	ZTI_ONE,	ZTI_NULL },
    -	{ ZTI_ONE,	ZTI_NULL,	ZTI_ONE,	ZTI_NULL },
    +	{ ZTI_ONE,	ZTI_NULL,	ZTI_ONE,	ZTI_NULL }, /* NULL */
    +	{ ZTI_N(8),	ZTI_NULL,	ZTI_BATCH,	ZTI_NULL }, /* READ */
    +	{ ZTI_BATCH,	ZTI_N(5),	ZTI_N(8),	ZTI_N(5) }, /* WRITE */
    +	{ ZTI_P(12, 8),	ZTI_NULL,	ZTI_ONE,	ZTI_NULL }, /* FREE */
    +	{ ZTI_ONE,	ZTI_NULL,	ZTI_ONE,	ZTI_NULL }, /* CLAIM */
    +	{ ZTI_ONE,	ZTI_NULL,	ZTI_ONE,	ZTI_NULL }, /* IOCTL */
     };
     
     static dsl_syncfunc_t spa_sync_version;
    @@ -794,48 +809,120 @@ spa_get_errlists(spa_t *spa, avl_tree_t 
     	    offsetof(spa_error_entry_t, se_avl));
     }
     
    -static taskq_t *
    -spa_taskq_create(spa_t *spa, const char *name, enum zti_modes mode,
    -    uint_t value)
    +static void
    +spa_taskqs_init(spa_t *spa, zio_type_t t, zio_taskq_type_t q)
     {
    +	const zio_taskq_info_t *ztip = &zio_taskqs[t][q];
    +	enum zti_modes mode = ztip->zti_mode;
    +	uint_t value = ztip->zti_value;
    +	uint_t count = ztip->zti_count;
    +	spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q];
    +	char name[32];
     	uint_t flags = 0;
     	boolean_t batch = B_FALSE;
     
    -	switch (mode) {
    -	case zti_mode_null:
    -		return (NULL);		/* no taskq needed */
    -
    -	case zti_mode_fixed:
    -		ASSERT3U(value, >=, 1);
    -		value = MAX(value, 1);
    -		break;
    +	if (mode == ZTI_MODE_NULL) {
    +		tqs->stqs_count = 0;
    +		tqs->stqs_taskq = NULL;
    +		return;
    +	}
     
    -	case zti_mode_batch:
    -		batch = B_TRUE;
    -		flags |= TASKQ_THREADS_CPU_PCT;
    -		value = zio_taskq_batch_pct;
    -		break;
    +	ASSERT3U(count, >, 0);
     
    -	case zti_mode_online_percent:
    -		flags |= TASKQ_THREADS_CPU_PCT;
    -		break;
    +	tqs->stqs_count = count;
    +	tqs->stqs_taskq = kmem_alloc(count * sizeof (taskq_t *), KM_SLEEP);
     
    -	default:
    -		panic("unrecognized mode for %s taskq (%u:%u) in "
    -		    "spa_activate()",
    -		    name, mode, value);
    -		break;
    +	for (uint_t i = 0; i < count; i++) {
    +		taskq_t *tq;
    +
    +		switch (mode) {
    +		case ZTI_MODE_FIXED:
    +			ASSERT3U(value, >=, 1);
    +			value = MAX(value, 1);
    +			break;
    +
    +		case ZTI_MODE_BATCH:
    +			batch = B_TRUE;
    +			flags |= TASKQ_THREADS_CPU_PCT;
    +			value = zio_taskq_batch_pct;
    +			break;
    +
    +		case ZTI_MODE_ONLINE_PERCENT:
    +			flags |= TASKQ_THREADS_CPU_PCT;
    +			break;
    +
    +		default:
    +			panic("unrecognized mode for %s_%s taskq (%u:%u) in "
    +			    "spa_activate()",
    +			    zio_type_name[t], zio_taskq_types[q], mode, value);
    +			break;
    +		}
    +
    +		if (count > 1) {
    +			(void) snprintf(name, sizeof (name), "%s_%s_%u",
    +			    zio_type_name[t], zio_taskq_types[q], i);
    +		} else {
    +			(void) snprintf(name, sizeof (name), "%s_%s",
    +			    zio_type_name[t], zio_taskq_types[q]);
    +		}
    +
    +		if (zio_taskq_sysdc && spa->spa_proc != &p0) {
    +			if (batch)
    +				flags |= TASKQ_DC_BATCH;
    +
    +			tq = taskq_create_sysdc(name, value, 50, INT_MAX,
    +			    spa->spa_proc, zio_taskq_basedc, flags);
    +		} else {
    +			tq = taskq_create_proc(name, value, maxclsyspri, 50,
    +			    INT_MAX, spa->spa_proc, flags);
    +		}
    +
    +		tqs->stqs_taskq[i] = tq;
     	}
    +}
    +
    +static void
    +spa_taskqs_fini(spa_t *spa, zio_type_t t, zio_taskq_type_t q)
    +{
    +	spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q];
     
    -	if (zio_taskq_sysdc && spa->spa_proc != &p0) {
    -		if (batch)
    -			flags |= TASKQ_DC_BATCH;
    +	if (tqs->stqs_taskq == NULL) {
    +		ASSERT0(tqs->stqs_count);
    +		return;
    +	}
     
    -		return (taskq_create_sysdc(name, value, 50, INT_MAX,
    -		    spa->spa_proc, zio_taskq_basedc, flags));
    +	for (uint_t i = 0; i < tqs->stqs_count; i++) {
    +		ASSERT3P(tqs->stqs_taskq[i], !=, NULL);
    +		taskq_destroy(tqs->stqs_taskq[i]);
     	}
    -	return (taskq_create_proc(name, value, maxclsyspri, 50, INT_MAX,
    -	    spa->spa_proc, flags));
    +
    +	kmem_free(tqs->stqs_taskq, tqs->stqs_count * sizeof (taskq_t *));
    +	tqs->stqs_taskq = NULL;
    +}
    +
    +/*
    + * Dispatch a task to the appropriate taskq for the ZFS I/O type and priority.
    + * Note that a type may have multiple discrete taskqs to avoid lock contention
    + * on the taskq itself. In that case we choose which taskq at random by using
    + * the low bits of gethrtime().
    + */
    +void
    +spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q,
    +    task_func_t *func, void *arg, uint_t flags, taskq_ent_t *ent)
    +{
    +	spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q];
    +	taskq_t *tq;
    +
    +	ASSERT3P(tqs->stqs_taskq, !=, NULL);
    +	ASSERT3U(tqs->stqs_count, !=, 0);
    +
    +	if (tqs->stqs_count == 1) {
    +		tq = tqs->stqs_taskq[0];
    +	} else {
    +		tq = tqs->stqs_taskq[gethrtime() % tqs->stqs_count];
    +	}
    +
    +	taskq_dispatch_ent(tq, func, arg, flags, ent);
     }
     
     static void
    @@ -843,16 +930,7 @@ spa_create_zio_taskqs(spa_t *spa)
     {
     	for (int t = 0; t < ZIO_TYPES; t++) {
     		for (int q = 0; q < ZIO_TASKQ_TYPES; q++) {
    -			const zio_taskq_info_t *ztip = &zio_taskqs[t][q];
    -			enum zti_modes mode = ztip->zti_mode;
    -			uint_t value = ztip->zti_value;
    -			char name[32];
    -
    -			(void) snprintf(name, sizeof (name),
    -			    "%s_%s", zio_type_name[t], zio_taskq_types[q]);
    -
    -			spa->spa_zio_taskq[t][q] =
    -			    spa_taskq_create(spa, name, mode, value);
    +			spa_taskqs_init(spa, t, q);
     		}
     	}
     }
    @@ -1009,9 +1087,7 @@ spa_deactivate(spa_t *spa)
     
     	for (int t = 0; t < ZIO_TYPES; t++) {
     		for (int q = 0; q < ZIO_TASKQ_TYPES; q++) {
    -			if (spa->spa_zio_taskq[t][q] != NULL)
    -				taskq_destroy(spa->spa_zio_taskq[t][q]);
    -			spa->spa_zio_taskq[t][q] = NULL;
    +			spa_taskqs_fini(spa, t, q);
     		}
     	}
     
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h	Fri Mar  1 20:48:53 2013	(r247577)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h	Fri Mar  1 20:49:56 2013	(r247578)
    @@ -80,16 +80,16 @@ typedef struct spa_config_dirent {
     	char		*scd_path;
     } spa_config_dirent_t;
     
    -enum zio_taskq_type {
    +typedef enum zio_taskq_type {
     	ZIO_TASKQ_ISSUE = 0,
     	ZIO_TASKQ_ISSUE_HIGH,
     	ZIO_TASKQ_INTERRUPT,
     	ZIO_TASKQ_INTERRUPT_HIGH,
     	ZIO_TASKQ_TYPES
    -};
    +} zio_taskq_type_t;
     
     /*
    - * State machine for the zpool-pooname process.  The states transitions
    + * State machine for the zpool-poolname process.  The states transitions
      * are done as follows:
      *
      *	From		   To			Routine
    @@ -107,6 +107,11 @@ typedef enum spa_proc_state {
     	SPA_PROC_GONE		/* spa_thread() is exiting, spa_proc = &p0 */
     } spa_proc_state_t;
     
    +typedef struct spa_taskqs {
    +	uint_t stqs_count;
    +	taskq_t **stqs_taskq;
    +} spa_taskqs_t;
    +
     struct spa {
     	/*
     	 * Fields protected by spa_namespace_lock.
    @@ -125,7 +130,7 @@ struct spa {
     	uint8_t		spa_sync_on;		/* sync threads are running */
     	spa_load_state_t spa_load_state;	/* current load operation */
     	uint64_t	spa_import_flags;	/* import specific flags */
    -	taskq_t		*spa_zio_taskq[ZIO_TYPES][ZIO_TASKQ_TYPES];
    +	spa_taskqs_t	spa_zio_taskq[ZIO_TYPES][ZIO_TASKQ_TYPES];
     	dsl_pool_t	*spa_dsl_pool;
     	boolean_t	spa_is_initializing;	/* true while opening pool */
     	metaslab_class_t *spa_normal_class;	/* normal data class */
    @@ -245,6 +250,9 @@ struct spa {
     
     extern const char *spa_config_path;
     
    +extern void spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q,
    +    task_func_t *func, void *arg, uint_t flags, taskq_ent_t *ent);
    +
     #ifdef	__cplusplus
     }
     #endif
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c	Fri Mar  1 20:48:53 2013	(r247577)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c	Fri Mar  1 20:49:56 2013	(r247578)
    @@ -224,7 +224,7 @@ vdev_file_io_start(zio_t *zio)
     	bp->b_private = vf->vf_vnode;
     	bp->b_iodone = (int (*)())vdev_file_io_intr;
     
    -	taskq_dispatch_ent(spa->spa_zio_taskq[ZIO_TYPE_FREE][ZIO_TASKQ_ISSUE],
    +	spa_taskq_dispatch_ent(spa, ZIO_TYPE_FREE, ZIO_TASKQ_ISSUE,
     	    vdev_file_io_strategy, bp, 0, &zio->io_tqent);
     
     	return (ZIO_PIPELINE_STOP);
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c	Fri Mar  1 20:48:53 2013	(r247577)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c	Fri Mar  1 20:49:56 2013	(r247578)
    @@ -1107,7 +1107,7 @@ zio_free_bp_init(zio_t *zio)
      */
     
     static void
    -zio_taskq_dispatch(zio_t *zio, enum zio_taskq_type q, boolean_t cutinline)
    +zio_taskq_dispatch(zio_t *zio, zio_taskq_type_t q, boolean_t cutinline)
     {
     	spa_t *spa = zio->io_spa;
     	zio_type_t t = zio->io_type;
    @@ -1128,10 +1128,11 @@ zio_taskq_dispatch(zio_t *zio, enum zio_
     		t = ZIO_TYPE_NULL;
     
     	/*
    -	 * If this is a high priority I/O, then use the high priority taskq.
    +	 * If this is a high priority I/O, then use the high priority taskq if
    +	 * available.
     	 */
     	if (zio->io_priority == ZIO_PRIORITY_NOW &&
    -	    spa->spa_zio_taskq[t][q + 1] != NULL)
    +	    spa->spa_zio_taskq[t][q + 1].stqs_count != 0)
     		q++;
     
     	ASSERT3U(q, <, ZIO_TASKQ_TYPES);
    @@ -1142,19 +1143,24 @@ zio_taskq_dispatch(zio_t *zio, enum zio_
     	 * to dispatch the zio to another taskq at the same time.
     	 */
     	ASSERT(zio->io_tqent.tqent_next == NULL);
    -	taskq_dispatch_ent(spa->spa_zio_taskq[t][q],
    -	    (task_func_t *)zio_execute, zio, flags, &zio->io_tqent);
    +	spa_taskq_dispatch_ent(spa, t, q, (task_func_t *)zio_execute, zio,
    +	    flags, &zio->io_tqent);
     }
     
     static boolean_t
    -zio_taskq_member(zio_t *zio, enum zio_taskq_type q)
    +zio_taskq_member(zio_t *zio, zio_taskq_type_t q)
     {
     	kthread_t *executor = zio->io_executor;
     	spa_t *spa = zio->io_spa;
     
    -	for (zio_type_t t = 0; t < ZIO_TYPES; t++)
    -		if (taskq_member(spa->spa_zio_taskq[t][q], executor))
    -			return (B_TRUE);
    +	for (zio_type_t t = 0; t < ZIO_TYPES; t++) {
    +		spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q];
    +		uint_t i;
    +		for (i = 0; i < tqs->stqs_count; i++) {
    +			if (taskq_member(tqs->stqs_taskq[i], executor))
    +				return (B_TRUE);
    +		}
    +	}
     
     	return (B_FALSE);
     }
    @@ -3017,10 +3023,9 @@ zio_done(zio_t *zio)
     			 * Hand it off to the otherwise-unused claim taskq.
     			 */
     			ASSERT(zio->io_tqent.tqent_next == NULL);
    -			taskq_dispatch_ent(
    -			    spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE],
    -			    (task_func_t *)zio_reexecute, zio, 0,
    -			    &zio->io_tqent);
    +			spa_taskq_dispatch_ent(spa, ZIO_TYPE_CLAIM,
    +			    ZIO_TASKQ_ISSUE, (task_func_t *)zio_reexecute, zio,
    +			    0, &zio->io_tqent);
     		}
     		return (ZIO_PIPELINE_STOP);
     	}
    
    From owner-svn-src-vendor@FreeBSD.ORG  Fri Mar  1 21:01:47 2013
    Return-Path: 
    Delivered-To: svn-src-vendor@freebsd.org
    Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
     by hub.freebsd.org (Postfix) with ESMTP id 5203D5E5;
     Fri,  1 Mar 2013 21:01:47 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 3464017C7;
     Fri,  1 Mar 2013 21:01:47 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21L1lhL090760;
     Fri, 1 Mar 2013 21:01:47 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21L1jFF090742;
     Fri, 1 Mar 2013 21:01:45 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201303012101.r21L1jFF090742@svn.freebsd.org>
    From: Martin Matuska 
    Date: Fri, 1 Mar 2013 21:01:45 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-vendor@freebsd.org
    Subject: svn commit: r247580 - vendor-sys/illumos/dist/common/nvpair
     vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs
     vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/ill...
    X-SVN-Group: vendor-sys
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-vendor@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: SVN commit messages for the vendor work area tree
     
    List-Unsubscribe: ,
     
    List-Archive: 
    List-Post: 
    List-Help: 
    List-Subscribe: ,
     
    X-List-Received-Date: Fri, 01 Mar 2013 21:01:47 -0000
    
    Author: mm
    Date: Fri Mar  1 21:01:45 2013
    New Revision: 247580
    URL: http://svnweb.freebsd.org/changeset/base/247580
    
    Log:
      Update vendor/illumos/dist and vendor-sys/illumos/dist
      to illumos-gate 13973:4972ab336f54
      
      Illumos ZFS issues:
        3464 zfs synctask code needs restructuring
    
    Added:
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_send.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_destroy.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_userhold.h
    Modified:
      vendor-sys/illumos/dist/common/nvpair/fnvpair.c
      vendor-sys/illumos/dist/uts/common/Makefile.files
      vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/bplist.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_synctask.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/refcount.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/rrwlock.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_tx.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dir.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_prop.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_synctask.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/refcount.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/rrwlock.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/space_map.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/txg.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfeature.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_debug.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_znode.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ctldir.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c
      vendor-sys/illumos/dist/uts/common/sys/nvpair.h
    
    Changes in other areas also in this revision:
    Modified:
      vendor/illumos/dist/cmd/zdb/zdb.c
      vendor/illumos/dist/cmd/zfs/zfs_main.c
      vendor/illumos/dist/cmd/zhack/zhack.c
      vendor/illumos/dist/cmd/ztest/ztest.c
      vendor/illumos/dist/lib/libzfs/common/libzfs.h
      vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
      vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c
      vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
      vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h
      vendor/illumos/dist/lib/libzpool/common/kernel.c
      vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h
      vendor/illumos/dist/man/man1m/zfs.1m
    
    Modified: vendor-sys/illumos/dist/common/nvpair/fnvpair.c
    ==============================================================================
    --- vendor-sys/illumos/dist/common/nvpair/fnvpair.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor-sys/illumos/dist/common/nvpair/fnvpair.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -26,6 +26,7 @@
     #include 
     #include 
     #include 
    +#include 
     #ifndef _KERNEL
     #include 
     #endif
    @@ -114,6 +115,18 @@ fnvlist_merge(nvlist_t *dst, nvlist_t *s
     	VERIFY0(nvlist_merge(dst, src, KM_SLEEP));
     }
     
    +size_t
    +fnvlist_num_pairs(nvlist_t *nvl)
    +{
    +	size_t count = 0;
    +	nvpair_t *pair;
    +
    +	for (pair = nvlist_next_nvpair(nvl, 0); pair != NULL;
    +	    pair = nvlist_next_nvpair(nvl, pair))
    +		count++;
    +	return (count);
    +}
    +
     void
     fnvlist_add_boolean(nvlist_t *nvl, const char *name)
     {
    
    Modified: vendor-sys/illumos/dist/uts/common/Makefile.files
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/Makefile.files	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor-sys/illumos/dist/uts/common/Makefile.files	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -1346,8 +1346,10 @@ ZFS_COMMON_OBJS +=		\
     	dsl_dir.o		\
     	dsl_dataset.o		\
     	dsl_deadlist.o		\
    +	dsl_destroy.o		\
     	dsl_pool.o		\
     	dsl_synctask.o		\
    +	dsl_userhold.o		\
     	dmu_zfetch.o		\
     	dsl_deleg.o		\
     	dsl_prop.o		\
    @@ -1358,6 +1360,7 @@ ZFS_COMMON_OBJS +=		\
     	lzjb.o			\
     	metaslab.o		\
     	refcount.o		\
    +	rrwlock.o		\
     	sa.o			\
     	sha256.o		\
     	spa.o			\
    @@ -1417,7 +1420,6 @@ ZFS_OBJS +=			\
     	zfs_onexit.o		\
     	zfs_replay.o		\
     	zfs_rlock.o		\
    -	rrwlock.o		\
     	zfs_vfsops.o		\
     	zfs_vnops.o		\
     	zvol.o
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -1633,12 +1633,12 @@ arc_buf_free(arc_buf_t *buf, void *tag)
     	}
     }
     
    -int
    +boolean_t
     arc_buf_remove_ref(arc_buf_t *buf, void* tag)
     {
     	arc_buf_hdr_t *hdr = buf->b_hdr;
     	kmutex_t *hash_lock = HDR_LOCK(hdr);
    -	int no_callback = (buf->b_efunc == NULL);
    +	boolean_t no_callback = (buf->b_efunc == NULL);
     
     	if (hdr->b_state == arc_anon) {
     		ASSERT(hdr->b_datacnt == 1);
    @@ -1843,7 +1843,7 @@ arc_evict(arc_state_t *state, uint64_t s
     		ARCSTAT_INCR(arcstat_mutex_miss, missed);
     
     	/*
    -	 * We have just evicted some date into the ghost state, make
    +	 * We have just evicted some data into the ghost state, make
     	 * sure we also adjust the ghost state size if necessary.
     	 */
     	if (arc_no_grow &&
    @@ -2622,7 +2622,7 @@ arc_bcopy_func(zio_t *zio, arc_buf_t *bu
     {
     	if (zio == NULL || zio->io_error == 0)
     		bcopy(buf->b_data, arg, buf->b_hdr->b_size);
    -	VERIFY(arc_buf_remove_ref(buf, arg) == 1);
    +	VERIFY(arc_buf_remove_ref(buf, arg));
     }
     
     /* a generic arc_done_func_t */
    @@ -2631,7 +2631,7 @@ arc_getbuf_func(zio_t *zio, arc_buf_t *b
     {
     	arc_buf_t **bufp = arg;
     	if (zio && zio->io_error) {
    -		VERIFY(arc_buf_remove_ref(buf, arg) == 1);
    +		VERIFY(arc_buf_remove_ref(buf, arg));
     		*bufp = NULL;
     	} else {
     		*bufp = buf;
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/bplist.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/bplist.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/bplist.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -20,6 +20,7 @@
      */
     /*
      * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2012 by Delphix. All rights reserved.
      */
     
     #include 
    @@ -52,6 +53,12 @@ bplist_append(bplist_t *bpl, const blkpt
     	mutex_exit(&bpl->bpl_lock);
     }
     
    +/*
    + * To aid debugging, we keep the most recently removed entry.  This way if
    + * we are in the callback, we can easily locate the entry.
    + */
    +static bplist_entry_t *bplist_iterate_last_removed;
    +
     void
     bplist_iterate(bplist_t *bpl, bplist_itor_t *func, void *arg, dmu_tx_t *tx)
     {
    @@ -59,6 +66,7 @@ bplist_iterate(bplist_t *bpl, bplist_ito
     
     	mutex_enter(&bpl->bpl_lock);
     	while (bpe = list_head(&bpl->bpl_list)) {
    +		bplist_iterate_last_removed = bpe;
     		list_remove(&bpl->bpl_list, bpe);
     		mutex_exit(&bpl->bpl_lock);
     		func(arg, &bpe->bpe_blk, tx);
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -392,6 +392,10 @@ bpobj_enqueue_subobj(bpobj_t *bpo, uint6
     		    DMU_OT_BPOBJ_SUBOBJ, SPA_MAXBLOCKSIZE, DMU_OT_NONE, 0, tx);
     	}
     
    +	dmu_object_info_t doi;
    +	ASSERT0(dmu_object_info(bpo->bpo_os, bpo->bpo_phys->bpo_subobjs, &doi));
    +	ASSERT3U(doi.doi_type, ==, DMU_OT_BPOBJ_SUBOBJ);
    +
     	mutex_enter(&bpo->bpo_lock);
     	dmu_write(bpo->bpo_os, bpo->bpo_phys->bpo_subobjs,
     	    bpo->bpo_phys->bpo_num_subobjs * sizeof (subobj),
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -39,7 +39,7 @@
     #include 
     
     static void dbuf_destroy(dmu_buf_impl_t *db);
    -static int dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx);
    +static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx);
     static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx);
     
     /*
    @@ -499,7 +499,7 @@ dbuf_read_done(zio_t *zio, arc_buf_t *bu
     	} else {
     		ASSERT(db->db_blkid != DMU_BONUS_BLKID);
     		ASSERT3P(db->db_buf, ==, NULL);
    -		VERIFY(arc_buf_remove_ref(buf, db) == 1);
    +		VERIFY(arc_buf_remove_ref(buf, db));
     		db->db_state = DB_UNCACHED;
     	}
     	cv_broadcast(&db->db_changed);
    @@ -828,10 +828,12 @@ dbuf_free_range(dnode_t *dn, uint64_t st
     			continue;
     
     		/* found a level 0 buffer in the range */
    -		if (dbuf_undirty(db, tx))
    +		mutex_enter(&db->db_mtx);
    +		if (dbuf_undirty(db, tx)) {
    +			/* mutex has been dropped and dbuf destroyed */
     			continue;
    +		}
     
    -		mutex_enter(&db->db_mtx);
     		if (db->db_state == DB_UNCACHED ||
     		    db->db_state == DB_NOFILL ||
     		    db->db_state == DB_EVICTING) {
    @@ -958,7 +960,7 @@ dbuf_new_size(dmu_buf_impl_t *db, int si
     
     	mutex_enter(&db->db_mtx);
     	dbuf_set_data(db, buf);
    -	VERIFY(arc_buf_remove_ref(obuf, db) == 1);
    +	VERIFY(arc_buf_remove_ref(obuf, db));
     	db->db.db_size = size;
     
     	if (db->db_level == 0) {
    @@ -1258,7 +1260,10 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t 
     	return (dr);
     }
     
    -static int
    +/*
    + * Return TRUE if this evicted the dbuf.
    + */
    +static boolean_t
     dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
     {
     	dnode_t *dn;
    @@ -1267,18 +1272,17 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_
     
     	ASSERT(txg != 0);
     	ASSERT(db->db_blkid != DMU_BONUS_BLKID);
    +	ASSERT0(db->db_level);
    +	ASSERT(MUTEX_HELD(&db->db_mtx));
     
    -	mutex_enter(&db->db_mtx);
     	/*
     	 * If this buffer is not dirty, we're done.
     	 */
     	for (drp = &db->db_last_dirty; (dr = *drp) != NULL; drp = &dr->dr_next)
     		if (dr->dr_txg <= txg)
     			break;
    -	if (dr == NULL || dr->dr_txg < txg) {
    -		mutex_exit(&db->db_mtx);
    -		return (0);
    -	}
    +	if (dr == NULL || dr->dr_txg < txg)
    +		return (B_FALSE);
     	ASSERT(dr->dr_txg == txg);
     	ASSERT(dr->dr_dbuf == db);
     
    @@ -1286,24 +1290,12 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_
     	dn = DB_DNODE(db);
     
     	/*
    -	 * If this buffer is currently held, we cannot undirty
    -	 * it, since one of the current holders may be in the
    -	 * middle of an update.  Note that users of dbuf_undirty()
    -	 * should not place a hold on the dbuf before the call.
    -	 * Also note: we can get here with a spill block, so
    -	 * test for that similar to how dbuf_dirty does.
    +	 * Note:  This code will probably work even if there are concurrent
    +	 * holders, but it is untested in that scenerio, as the ZPL and
    +	 * ztest have additional locking (the range locks) that prevents
    +	 * that type of concurrent access.
     	 */
    -	if (refcount_count(&db->db_holds) > db->db_dirtycnt) {
    -		mutex_exit(&db->db_mtx);
    -		/* Make sure we don't toss this buffer at sync phase */
    -		if (db->db_blkid != DMU_SPILL_BLKID) {
    -			mutex_enter(&dn->dn_mtx);
    -			dnode_clear_range(dn, db->db_blkid, 1, tx);
    -			mutex_exit(&dn->dn_mtx);
    -		}
    -		DB_DNODE_EXIT(db);
    -		return (0);
    -	}
    +	ASSERT3U(refcount_count(&db->db_holds), ==, db->db_dirtycnt);
     
     	dprintf_dbuf(db, "size=%llx\n", (u_longlong_t)db->db.db_size);
     
    @@ -1332,21 +1324,13 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_
     	}
     	DB_DNODE_EXIT(db);
     
    -	if (db->db_level == 0) {
    -		if (db->db_state != DB_NOFILL) {
    -			dbuf_unoverride(dr);
    +	if (db->db_state != DB_NOFILL) {
    +		dbuf_unoverride(dr);
     
    -			ASSERT(db->db_buf != NULL);
    -			ASSERT(dr->dt.dl.dr_data != NULL);
    -			if (dr->dt.dl.dr_data != db->db_buf)
    -				VERIFY(arc_buf_remove_ref(dr->dt.dl.dr_data,
    -				    db) == 1);
    -		}
    -	} else {
     		ASSERT(db->db_buf != NULL);
    -		ASSERT(list_head(&dr->dt.di.dr_children) == NULL);
    -		mutex_destroy(&dr->dt.di.dr_mtx);
    -		list_destroy(&dr->dt.di.dr_children);
    +		ASSERT(dr->dt.dl.dr_data != NULL);
    +		if (dr->dt.dl.dr_data != db->db_buf)
    +			VERIFY(arc_buf_remove_ref(dr->dt.dl.dr_data, db));
     	}
     	kmem_free(dr, sizeof (dbuf_dirty_record_t));
     
    @@ -1358,13 +1342,12 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_
     
     		ASSERT(db->db_state == DB_NOFILL || arc_released(buf));
     		dbuf_set_data(db, NULL);
    -		VERIFY(arc_buf_remove_ref(buf, db) == 1);
    +		VERIFY(arc_buf_remove_ref(buf, db));
     		dbuf_evict(db);
    -		return (1);
    +		return (B_TRUE);
     	}
     
    -	mutex_exit(&db->db_mtx);
    -	return (0);
    +	return (B_FALSE);
     }
     
     #pragma weak dmu_buf_will_dirty = dbuf_will_dirty
    @@ -1463,7 +1446,7 @@ dbuf_assign_arcbuf(dmu_buf_impl_t *db, a
     		mutex_exit(&db->db_mtx);
     		(void) dbuf_dirty(db, tx);
     		bcopy(buf->b_data, db->db.db_data, db->db.db_size);
    -		VERIFY(arc_buf_remove_ref(buf, db) == 1);
    +		VERIFY(arc_buf_remove_ref(buf, db));
     		xuio_stat_wbuf_copied();
     		return;
     	}
    @@ -1481,10 +1464,10 @@ dbuf_assign_arcbuf(dmu_buf_impl_t *db, a
     				arc_release(db->db_buf, db);
     			}
     			dr->dt.dl.dr_data = buf;
    -			VERIFY(arc_buf_remove_ref(db->db_buf, db) == 1);
    +			VERIFY(arc_buf_remove_ref(db->db_buf, db));
     		} else if (dr == NULL || dr->dt.dl.dr_data != db->db_buf) {
     			arc_release(db->db_buf, db);
    -			VERIFY(arc_buf_remove_ref(db->db_buf, db) == 1);
    +			VERIFY(arc_buf_remove_ref(db->db_buf, db));
     		}
     		db->db_buf = NULL;
     	}
    @@ -2067,10 +2050,10 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db,
     			 * This dbuf has anonymous data associated with it.
     			 */
     			dbuf_set_data(db, NULL);
    -			VERIFY(arc_buf_remove_ref(buf, db) == 1);
    +			VERIFY(arc_buf_remove_ref(buf, db));
     			dbuf_evict(db);
     		} else {
    -			VERIFY(arc_buf_remove_ref(db->db_buf, db) == 0);
    +			VERIFY(!arc_buf_remove_ref(db->db_buf, db));
     
     			/*
     			 * A dbuf will be eligible for eviction if either the
    @@ -2567,7 +2550,7 @@ dbuf_write_done(zio_t *zio, arc_buf_t *b
     		if (db->db_state != DB_NOFILL) {
     			if (dr->dt.dl.dr_data != db->db_buf)
     				VERIFY(arc_buf_remove_ref(dr->dt.dl.dr_data,
    -				    db) == 1);
    +				    db));
     			else if (!arc_released(db->db_buf))
     				arc_set_callback(db->db_buf, dbuf_do_evict, db);
     		}
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -1194,7 +1194,7 @@ void
     dmu_return_arcbuf(arc_buf_t *buf)
     {
     	arc_return_buf(buf, FTAG);
    -	VERIFY(arc_buf_remove_ref(buf, FTAG) == 1);
    +	VERIFY(arc_buf_remove_ref(buf, FTAG));
     }
     
     /*
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -20,6 +20,7 @@
      */
     /*
      * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2012 by Delphix. All rights reserved.
      */
     
     #include 
    @@ -155,51 +156,49 @@ diff_cb(spa_t *spa, zilog_t *zilog, cons
     }
     
     int
    -dmu_diff(objset_t *tosnap, objset_t *fromsnap, struct vnode *vp, offset_t *offp)
    +dmu_diff(const char *tosnap_name, const char *fromsnap_name,
    +    struct vnode *vp, offset_t *offp)
     {
     	struct diffarg da;
    -	dsl_dataset_t *ds = tosnap->os_dsl_dataset;
    -	dsl_dataset_t *fromds = fromsnap->os_dsl_dataset;
    -	dsl_dataset_t *findds;
    -	dsl_dataset_t *relds;
    -	int err = 0;
    +	dsl_dataset_t *fromsnap;
    +	dsl_dataset_t *tosnap;
    +	dsl_pool_t *dp;
    +	int error;
    +	uint64_t fromtxg;
     
    -	/* make certain we are looking at snapshots */
    -	if (!dsl_dataset_is_snapshot(ds) || !dsl_dataset_is_snapshot(fromds))
    +	if (strchr(tosnap_name, '@') == NULL ||
    +	    strchr(fromsnap_name, '@') == NULL)
     		return (EINVAL);
     
    -	/* fromsnap must be earlier and from the same lineage as tosnap */
    -	if (fromds->ds_phys->ds_creation_txg >= ds->ds_phys->ds_creation_txg)
    +	error = dsl_pool_hold(tosnap_name, FTAG, &dp);
    +	if (error != 0)
    +		return (error);
    +
    +	error = dsl_dataset_hold(dp, tosnap_name, FTAG, &tosnap);
    +	if (error != 0) {
    +		dsl_pool_rele(dp, FTAG);
    +		return (error);
    +	}
    +
    +	error = dsl_dataset_hold(dp, fromsnap_name, FTAG, &fromsnap);
    +	if (error != 0) {
    +		dsl_dataset_rele(tosnap, FTAG);
    +		dsl_pool_rele(dp, FTAG);
    +		return (error);
    +	}
    +
    +	if (!dsl_dataset_is_before(tosnap, fromsnap)) {
    +		dsl_dataset_rele(fromsnap, FTAG);
    +		dsl_dataset_rele(tosnap, FTAG);
    +		dsl_pool_rele(dp, FTAG);
     		return (EXDEV);
    -
    -	relds = NULL;
    -	findds = ds;
    -
    -	while (fromds->ds_dir != findds->ds_dir) {
    -		dsl_pool_t *dp = ds->ds_dir->dd_pool;
    -
    -		if (!dsl_dir_is_clone(findds->ds_dir)) {
    -			if (relds)
    -				dsl_dataset_rele(relds, FTAG);
    -			return (EXDEV);
    -		}
    -
    -		rw_enter(&dp->dp_config_rwlock, RW_READER);
    -		err = dsl_dataset_hold_obj(dp,
    -		    findds->ds_dir->dd_phys->dd_origin_obj, FTAG, &findds);
    -		rw_exit(&dp->dp_config_rwlock);
    -
    -		if (relds)
    -			dsl_dataset_rele(relds, FTAG);
    -
    -		if (err)
    -			return (EXDEV);
    -
    -		relds = findds;
     	}
     
    -	if (relds)
    -		dsl_dataset_rele(relds, FTAG);
    +	fromtxg = fromsnap->ds_phys->ds_creation_txg;
    +	dsl_dataset_rele(fromsnap, FTAG);
    +
    +	dsl_dataset_long_hold(tosnap, FTAG);
    +	dsl_pool_rele(dp, FTAG);
     
     	da.da_vp = vp;
     	da.da_offp = offp;
    @@ -207,15 +206,18 @@ dmu_diff(objset_t *tosnap, objset_t *fro
     	da.da_ddr.ddr_first = da.da_ddr.ddr_last = 0;
     	da.da_err = 0;
     
    -	err = traverse_dataset(ds, fromds->ds_phys->ds_creation_txg,
    +	error = traverse_dataset(tosnap, fromtxg,
     	    TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA, diff_cb, &da);
     
    -	if (err) {
    -		da.da_err = err;
    +	if (error != 0) {
    +		da.da_err = error;
     	} else {
     		/* we set the da.da_err we return as side-effect */
     		(void) write_record(&da);
     	}
     
    +	dsl_dataset_long_rele(tosnap, FTAG);
    +	dsl_dataset_rele(tosnap, FTAG);
    +
     	return (da.da_err);
     }
    
    Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c
    ==============================================================================
    --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -44,6 +44,7 @@
     #include 
     #include 
     #include 
    +#include 
     
     /*
      * Needed to close a window in dnode_move() that allows the objset to be freed
    @@ -280,7 +281,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat
     		err = arc_read(NULL, spa, os->os_rootbp,
     		    arc_getbuf_func, &os->os_phys_buf,
     		    ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_CANFAIL, &aflags, &zb);
    -		if (err) {
    +		if (err != 0) {
     			kmem_free(os, sizeof (objset_t));
     			/* convert checksum errors into IO errors */
     			if (err == ECKSUM)
    @@ -320,34 +321,49 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat
     	 * checksum/compression/copies.
     	 */
     	if (ds) {
    -		err = dsl_prop_register(ds, "primarycache",
    +		err = dsl_prop_register(ds,
    +		    zfs_prop_to_name(ZFS_PROP_PRIMARYCACHE),
     		    primary_cache_changed_cb, os);
    -		if (err == 0)
    -			err = dsl_prop_register(ds, "secondarycache",
    +		if (err == 0) {
    +			err = dsl_prop_register(ds,
    +			    zfs_prop_to_name(ZFS_PROP_SECONDARYCACHE),
     			    secondary_cache_changed_cb, os);
    +		}
     		if (!dsl_dataset_is_snapshot(ds)) {
    -			if (err == 0)
    -				err = dsl_prop_register(ds, "checksum",
    +			if (err == 0) {
    +				err = dsl_prop_register(ds,
    +				    zfs_prop_to_name(ZFS_PROP_CHECKSUM),
     				    checksum_changed_cb, os);
    -			if (err == 0)
    -				err = dsl_prop_register(ds, "compression",
    +			}
    +			if (err == 0) {
    +				err = dsl_prop_register(ds,
    +				    zfs_prop_to_name(ZFS_PROP_COMPRESSION),
     				    compression_changed_cb, os);
    -			if (err == 0)
    -				err = dsl_prop_register(ds, "copies",
    +			}
    +			if (err == 0) {
    +				err = dsl_prop_register(ds,
    +				    zfs_prop_to_name(ZFS_PROP_COPIES),
     				    copies_changed_cb, os);
    -			if (err == 0)
    -				err = dsl_prop_register(ds, "dedup",
    +			}
    +			if (err == 0) {
    +				err = dsl_prop_register(ds,
    +				    zfs_prop_to_name(ZFS_PROP_DEDUP),
     				    dedup_changed_cb, os);
    -			if (err == 0)
    -				err = dsl_prop_register(ds, "logbias",
    +			}
    +			if (err == 0) {
    +				err = dsl_prop_register(ds,
    +				    zfs_prop_to_name(ZFS_PROP_LOGBIAS),
     				    logbias_changed_cb, os);
    -			if (err == 0)
    -				err = dsl_prop_register(ds, "sync",
    +			}
    +			if (err == 0) {
    +				err = dsl_prop_register(ds,
    +				    zfs_prop_to_name(ZFS_PROP_SYNC),
     				    sync_changed_cb, os);
    +			}
     		}
    -		if (err) {
    +		if (err != 0) {
     			VERIFY(arc_buf_remove_ref(os->os_phys_buf,
    -			    &os->os_phys_buf) == 1);
    +			    &os->os_phys_buf));
     			kmem_free(os, sizeof (objset_t));
     			return (err);
     		}
    @@ -425,44 +441,66 @@ dmu_objset_from_ds(dsl_dataset_t *ds, ob
     	return (err);
     }
     
    -/* called from zpl */
    +/*
    + * Holds the pool while the objset is held.  Therefore only one objset
    + * can be held at a time.
    + */
     int
     dmu_objset_hold(const char *name, void *tag, objset_t **osp)
     {
    +	dsl_pool_t *dp;
     	dsl_dataset_t *ds;
     	int err;
     
    -	err = dsl_dataset_hold(name, tag, &ds);
    -	if (err)
    +	err = dsl_pool_hold(name, tag, &dp);
    +	if (err != 0)
     		return (err);
    +	err = dsl_dataset_hold(dp, name, tag, &ds);
    +	if (err != 0) {
    +		dsl_pool_rele(dp, tag);
    +		return (err);
    +	}
     
     	err = dmu_objset_from_ds(ds, osp);
    -	if (err)
    +	if (err != 0) {
     		dsl_dataset_rele(ds, tag);
    +		dsl_pool_rele(dp, tag);
    +	}
     
     	return (err);
     }
     
    -/* called from zpl */
    +/*
    + * dsl_pool must not be held when this is called.
    + * Upon successful return, there will be a longhold on the dataset,
    + * and the dsl_pool will not be held.
    + */
     int
     dmu_objset_own(const char *name, dmu_objset_type_t type,
         boolean_t readonly, void *tag, objset_t **osp)
     {
    +	dsl_pool_t *dp;
     	dsl_dataset_t *ds;
     	int err;
     
    -	err = dsl_dataset_own(name, B_FALSE, tag, &ds);
    -	if (err)
    +	err = dsl_pool_hold(name, FTAG, &dp);
    +	if (err != 0)
     		return (err);
    +	err = dsl_dataset_own(dp, name, tag, &ds);
    +	if (err != 0) {
    +		dsl_pool_rele(dp, FTAG);
    +		return (err);
    +	}
     
     	err = dmu_objset_from_ds(ds, osp);
    -	if (err) {
    +	dsl_pool_rele(dp, FTAG);
    +	if (err != 0) {
     		dsl_dataset_disown(ds, tag);
     	} else if (type != DMU_OST_ANY && type != (*osp)->os_phys->os_type) {
    -		dmu_objset_disown(*osp, tag);
    +		dsl_dataset_disown(ds, tag);
     		return (EINVAL);
     	} else if (!readonly && dsl_dataset_is_snapshot(ds)) {
    -		dmu_objset_disown(*osp, tag);
    +		dsl_dataset_disown(ds, tag);
     		return (EROFS);
     	}
     	return (err);
    @@ -471,7 +509,9 @@ dmu_objset_own(const char *name, dmu_obj
     void
     dmu_objset_rele(objset_t *os, void *tag)
     {
    +	dsl_pool_t *dp = dmu_objset_pool(os);
     	dsl_dataset_rele(os->os_dsl_dataset, tag);
    +	dsl_pool_rele(dp, tag);
     }
     
     void
    @@ -480,7 +520,7 @@ dmu_objset_disown(objset_t *os, void *ta
     	dsl_dataset_disown(os->os_dsl_dataset, tag);
     }
     
    -int
    +void
     dmu_objset_evict_dbufs(objset_t *os)
     {
     	dnode_t *dn;
    @@ -515,9 +555,7 @@ dmu_objset_evict_dbufs(objset_t *os)
     		mutex_enter(&os->os_lock);
     		dn = next_dn;
     	}
    -	dn = list_head(&os->os_dnodes);
     	mutex_exit(&os->os_lock);
    -	return (dn != DMU_META_DNODE(os));
     }
     
     void
    @@ -530,33 +568,37 @@ dmu_objset_evict(objset_t *os)
     
     	if (ds) {
     		if (!dsl_dataset_is_snapshot(ds)) {
    -			VERIFY(0 == dsl_prop_unregister(ds, "checksum",
    +			VERIFY0(dsl_prop_unregister(ds,
    +			    zfs_prop_to_name(ZFS_PROP_CHECKSUM),
     			    checksum_changed_cb, os));
    -			VERIFY(0 == dsl_prop_unregister(ds, "compression",
    +			VERIFY0(dsl_prop_unregister(ds,
    +			    zfs_prop_to_name(ZFS_PROP_COMPRESSION),
     			    compression_changed_cb, os));
    -			VERIFY(0 == dsl_prop_unregister(ds, "copies",
    +			VERIFY0(dsl_prop_unregister(ds,
    +			    zfs_prop_to_name(ZFS_PROP_COPIES),
     			    copies_changed_cb, os));
    -			VERIFY(0 == dsl_prop_unregister(ds, "dedup",
    +			VERIFY0(dsl_prop_unregister(ds,
    +			    zfs_prop_to_name(ZFS_PROP_DEDUP),
     			    dedup_changed_cb, os));
    -			VERIFY(0 == dsl_prop_unregister(ds, "logbias",
    +			VERIFY0(dsl_prop_unregister(ds,
    +			    zfs_prop_to_name(ZFS_PROP_LOGBIAS),
     			    logbias_changed_cb, os));
    -			VERIFY(0 == dsl_prop_unregister(ds, "sync",
    +			VERIFY0(dsl_prop_unregister(ds,
    +			    zfs_prop_to_name(ZFS_PROP_SYNC),
     			    sync_changed_cb, os));
     		}
    -		VERIFY(0 == dsl_prop_unregister(ds, "primarycache",
    +		VERIFY0(dsl_prop_unregister(ds,
    +		    zfs_prop_to_name(ZFS_PROP_PRIMARYCACHE),
     		    primary_cache_changed_cb, os));
    -		VERIFY(0 == dsl_prop_unregister(ds, "secondarycache",
    +		VERIFY0(dsl_prop_unregister(ds,
    +		    zfs_prop_to_name(ZFS_PROP_SECONDARYCACHE),
     		    secondary_cache_changed_cb, os));
     	}
     
     	if (os->os_sa)
     		sa_tear_down(os);
     
    -	/*
    -	 * We should need only a single pass over the dnode list, since
    -	 * nothing can be added to the list at this point.
    -	 */
    -	(void) dmu_objset_evict_dbufs(os);
    +	dmu_objset_evict_dbufs(os);
     
     	dnode_special_close(&os->os_meta_dnode);
     	if (DMU_USERUSED_DNODE(os)) {
    @@ -567,7 +609,7 @@ dmu_objset_evict(objset_t *os)
     
     	ASSERT3P(list_head(&os->os_dnodes), ==, NULL);
     
    -	VERIFY(arc_buf_remove_ref(os->os_phys_buf, &os->os_phys_buf) == 1);
    +	VERIFY(arc_buf_remove_ref(os->os_phys_buf, &os->os_phys_buf));
     
     	/*
     	 * This is a barrier to prevent the objset from going away in
    @@ -599,10 +641,11 @@ dmu_objset_create_impl(spa_t *spa, dsl_d
     	dnode_t *mdn;
     
     	ASSERT(dmu_tx_is_syncing(tx));
    +
     	if (ds != NULL)
    -		VERIFY(0 == dmu_objset_from_ds(ds, &os));
    +		VERIFY0(dmu_objset_from_ds(ds, &os));
     	else
    -		VERIFY(0 == dmu_objset_open_impl(spa, NULL, bp, &os));
    +		VERIFY0(dmu_objset_open_impl(spa, NULL, bp, &os));
     
     	mdn = DMU_META_DNODE(os);
     
    @@ -650,359 +693,181 @@ dmu_objset_create_impl(spa_t *spa, dsl_d
     	return (os);
     }
     
    -struct oscarg {
    -	void (*userfunc)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx);
    -	void *userarg;
    -	dsl_dataset_t *clone_origin;
    -	const char *lastname;
    -	dmu_objset_type_t type;
    -	uint64_t flags;
    -	cred_t *cr;
    -};
    +typedef struct dmu_objset_create_arg {
    +	const char *doca_name;
    +	cred_t *doca_cred;
    +	void (*doca_userfunc)(objset_t *os, void *arg,
    +	    cred_t *cr, dmu_tx_t *tx);
    +	void *doca_userarg;
    +	dmu_objset_type_t doca_type;
    +	uint64_t doca_flags;
    +} dmu_objset_create_arg_t;
     
     /*ARGSUSED*/
     static int
    -dmu_objset_create_check(void *arg1, void *arg2, dmu_tx_t *tx)
    +dmu_objset_create_check(void *arg, dmu_tx_t *tx)
     {
    -	dsl_dir_t *dd = arg1;
    -	struct oscarg *oa = arg2;
    -	objset_t *mos = dd->dd_pool->dp_meta_objset;
    -	int err;
    -	uint64_t ddobj;
    +	dmu_objset_create_arg_t *doca = arg;
    +	dsl_pool_t *dp = dmu_tx_pool(tx);
    +	dsl_dir_t *pdd;
    +	const char *tail;
    +	int error;
    +
    +	if (strchr(doca->doca_name, '@') != NULL)
    +		return (EINVAL);
     
    -	err = zap_lookup(mos, dd->dd_phys->dd_child_dir_zapobj,
    -	    oa->lastname, sizeof (uint64_t), 1, &ddobj);
    -	if (err != ENOENT)
    -		return (err ? err : EEXIST);
    -
    -	if (oa->clone_origin != NULL) {
    -		/* You can't clone across pools. */
    -		if (oa->clone_origin->ds_dir->dd_pool != dd->dd_pool)
    -			return (EXDEV);
    -
    -		/* You can only clone snapshots, not the head datasets. */
    -		if (!dsl_dataset_is_snapshot(oa->clone_origin))
    -			return (EINVAL);
    +	error = dsl_dir_hold(dp, doca->doca_name, FTAG, &pdd, &tail);
    +	if (error != 0)
    +		return (error);
    +	if (tail == NULL) {
    +		dsl_dir_rele(pdd, FTAG);
    +		return (EEXIST);
     	}
    +	dsl_dir_rele(pdd, FTAG);
     
     	return (0);
     }
     
     static void
    -dmu_objset_create_sync(void *arg1, void *arg2, dmu_tx_t *tx)
    +dmu_objset_create_sync(void *arg, dmu_tx_t *tx)
     {
    -	dsl_dir_t *dd = arg1;
    -	spa_t *spa = dd->dd_pool->dp_spa;
    -	struct oscarg *oa = arg2;
    -	uint64_t obj;
    +	dmu_objset_create_arg_t *doca = arg;
    +	dsl_pool_t *dp = dmu_tx_pool(tx);
    +	dsl_dir_t *pdd;
    +	const char *tail;
     	dsl_dataset_t *ds;
    +	uint64_t obj;
     	blkptr_t *bp;
    +	objset_t *os;
     
    -	ASSERT(dmu_tx_is_syncing(tx));
    +	VERIFY0(dsl_dir_hold(dp, doca->doca_name, FTAG, &pdd, &tail));
     
    -	obj = dsl_dataset_create_sync(dd, oa->lastname,
    -	    oa->clone_origin, oa->flags, oa->cr, tx);
    +	obj = dsl_dataset_create_sync(pdd, tail, NULL, doca->doca_flags,
    +	    doca->doca_cred, tx);
     
    -	VERIFY3U(0, ==, dsl_dataset_hold_obj(dd->dd_pool, obj, FTAG, &ds));
    +	VERIFY0(dsl_dataset_hold_obj(pdd->dd_pool, obj, FTAG, &ds));
     	bp = dsl_dataset_get_blkptr(ds);
    -	if (BP_IS_HOLE(bp)) {
    -		objset_t *os =
    -		    dmu_objset_create_impl(spa, ds, bp, oa->type, tx);
    +	os = dmu_objset_create_impl(pdd->dd_pool->dp_spa,
    +	    ds, bp, doca->doca_type, tx);
     
    -		if (oa->userfunc)
    -			oa->userfunc(os, oa->userarg, oa->cr, tx);
    +	if (doca->doca_userfunc != NULL) {
    +		doca->doca_userfunc(os, doca->doca_userarg,
    +		    doca->doca_cred, tx);
     	}
     
    -	if (oa->clone_origin == NULL) {
    -		spa_history_log_internal_ds(ds, "create", tx, "");
    -	} else {
    -		char namebuf[MAXNAMELEN];
    -		dsl_dataset_name(oa->clone_origin, namebuf);
    -		spa_history_log_internal_ds(ds, "clone", tx,
    -		    "origin=%s (%llu)", namebuf, oa->clone_origin->ds_object);
    -	}
    +	spa_history_log_internal_ds(ds, "create", tx, "");
     	dsl_dataset_rele(ds, FTAG);
    +	dsl_dir_rele(pdd, FTAG);
     }
     
     int
     dmu_objset_create(const char *name, dmu_objset_type_t type, uint64_t flags,
         void (*func)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx), void *arg)
     {
    -	dsl_dir_t *pdd;
    -	const char *tail;
    -	int err = 0;
    -	struct oscarg oa = { 0 };
    +	dmu_objset_create_arg_t doca;
     
    -	ASSERT(strchr(name, '@') == NULL);
    -	err = dsl_dir_open(name, FTAG, &pdd, &tail);
    -	if (err)
    -		return (err);
    -	if (tail == NULL) {
    -		dsl_dir_close(pdd, FTAG);
    -		return (EEXIST);
    -	}
    +	doca.doca_name = name;
    +	doca.doca_cred = CRED();
    +	doca.doca_flags = flags;
    +	doca.doca_userfunc = func;
    +	doca.doca_userarg = arg;
    +	doca.doca_type = type;
    +
    +	return (dsl_sync_task(name,
    +	    dmu_objset_create_check, dmu_objset_create_sync, &doca, 5));
    +}
    +
    +typedef struct dmu_objset_clone_arg {
    +	const char *doca_clone;
    +	const char *doca_origin;
    +	cred_t *doca_cred;
    +} dmu_objset_clone_arg_t;
     
    -	oa.userfunc = func;
    -	oa.userarg = arg;
    -	oa.lastname = tail;
    -	oa.type = type;
    -	oa.flags = flags;
    -	oa.cr = CRED();
    -
    -	err = dsl_sync_task_do(pdd->dd_pool, dmu_objset_create_check,
    -	    dmu_objset_create_sync, pdd, &oa, 5);
    -	dsl_dir_close(pdd, FTAG);
    -	return (err);
    -}
    -
    -int
    -dmu_objset_clone(const char *name, dsl_dataset_t *clone_origin, uint64_t flags)
    +/*ARGSUSED*/
    +static int
    +dmu_objset_clone_check(void *arg, dmu_tx_t *tx)
     {
    +	dmu_objset_clone_arg_t *doca = arg;
     	dsl_dir_t *pdd;
     	const char *tail;
    -	int err = 0;
    -	struct oscarg oa = { 0 };
    +	int error;
    +	dsl_dataset_t *origin;
    +	dsl_pool_t *dp = dmu_tx_pool(tx);
     
    -	ASSERT(strchr(name, '@') == NULL);
    -	err = dsl_dir_open(name, FTAG, &pdd, &tail);
    -	if (err)
    -		return (err);
    +	if (strchr(doca->doca_clone, '@') != NULL)
    +		return (EINVAL);
    +
    +	error = dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail);
    +	if (error != 0)
    +		return (error);
     	if (tail == NULL) {
    -		dsl_dir_close(pdd, FTAG);
    +		dsl_dir_rele(pdd, FTAG);
     		return (EEXIST);
     	}
    -
    -	oa.lastname = tail;
    -	oa.clone_origin = clone_origin;
    -	oa.flags = flags;
    -	oa.cr = CRED();
    -
    -	err = dsl_sync_task_do(pdd->dd_pool, dmu_objset_create_check,
    -	    dmu_objset_create_sync, pdd, &oa, 5);
    -	dsl_dir_close(pdd, FTAG);
    -	return (err);
    -}
    -
    -int
    -dmu_objset_destroy(const char *name, boolean_t defer)
    -{
    -	dsl_dataset_t *ds;
    -	int error;
    -
    -	error = dsl_dataset_own(name, B_TRUE, FTAG, &ds);
    -	if (error == 0) {
    -		error = dsl_dataset_destroy(ds, FTAG, defer);
    -		/* dsl_dataset_destroy() closes the ds. */
    +	/* You can't clone across pools. */
    +	if (pdd->dd_pool != dp) {
    +		dsl_dir_rele(pdd, FTAG);
    +		return (EXDEV);
     	}
    +	dsl_dir_rele(pdd, FTAG);
     
    -	return (error);
    -}
    -
    -typedef struct snapallarg {
    -	dsl_sync_task_group_t *saa_dstg;
    -	boolean_t saa_needsuspend;
    -	nvlist_t *saa_props;
    -
    -	/* the following are used only if 'temporary' is set: */
    -	boolean_t saa_temporary;
    -	const char *saa_htag;
    -	struct dsl_ds_holdarg *saa_ha;
    -	dsl_dataset_t *saa_newds;
    -} snapallarg_t;
    -
    -typedef struct snaponearg {
    -	const char *soa_longname; /* long snap name */
    -	const char *soa_snapname; /* short snap name */
    -	snapallarg_t *soa_saa;
    -} snaponearg_t;
    -
    -static int
    -snapshot_check(void *arg1, void *arg2, dmu_tx_t *tx)
    -{
    -	objset_t *os = arg1;
    -	snaponearg_t *soa = arg2;
    -	snapallarg_t *saa = soa->soa_saa;
    -	int error;
    -
    -	/* The props have already been checked by zfs_check_userprops(). */
    -
    -	error = dsl_dataset_snapshot_check(os->os_dsl_dataset,
    -	    soa->soa_snapname, tx);
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
    
    From owner-svn-src-vendor@FreeBSD.ORG  Fri Mar  1 21:01:48 2013
    Return-Path: 
    Delivered-To: svn-src-vendor@freebsd.org
    Received: from mx1.freebsd.org (mx1.freebsd.org
     [IPv6:2001:1900:2254:206a::19:1])
     by hub.freebsd.org (Postfix) with ESMTP id 975BA5E6;
     Fri,  1 Mar 2013 21:01:48 +0000 (UTC) (envelope-from mm@FreeBSD.org)
    Received: from svn.freebsd.org (svn.freebsd.org
     [IPv6:2001:1900:2254:2068::e6a:0])
     by mx1.freebsd.org (Postfix) with ESMTP id 79AD517C8;
     Fri,  1 Mar 2013 21:01:48 +0000 (UTC)
    Received: from svn.freebsd.org ([127.0.1.70])
     by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21L1m70090775;
     Fri, 1 Mar 2013 21:01:48 GMT (envelope-from mm@svn.freebsd.org)
    Received: (from mm@localhost)
     by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21L1lBk090765;
     Fri, 1 Mar 2013 21:01:47 GMT (envelope-from mm@svn.freebsd.org)
    Message-Id: <201303012101.r21L1lBk090765@svn.freebsd.org>
    From: Martin Matuska 
    Date: Fri, 1 Mar 2013 21:01:47 +0000 (UTC)
    To: src-committers@freebsd.org, svn-src-all@freebsd.org,
     svn-src-vendor@freebsd.org
    Subject: svn commit: r247580 - vendor-sys/illumos/dist/common/nvpair
     vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs
     vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/ill...
    X-SVN-Group: vendor
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-BeenThere: svn-src-vendor@freebsd.org
    X-Mailman-Version: 2.1.14
    Precedence: list
    List-Id: SVN commit messages for the vendor work area tree
     
    List-Unsubscribe: ,
     
    List-Archive: 
    List-Post: 
    List-Help: 
    List-Subscribe: ,
     
    X-List-Received-Date: Fri, 01 Mar 2013 21:01:48 -0000
    
    Author: mm
    Date: Fri Mar  1 21:01:45 2013
    New Revision: 247580
    URL: http://svnweb.freebsd.org/changeset/base/247580
    
    Log:
      Update vendor/illumos/dist and vendor-sys/illumos/dist
      to illumos-gate 13973:4972ab336f54
      
      Illumos ZFS issues:
        3464 zfs synctask code needs restructuring
    
    Modified:
      vendor/illumos/dist/cmd/zdb/zdb.c
      vendor/illumos/dist/cmd/zfs/zfs_main.c
      vendor/illumos/dist/cmd/zhack/zhack.c
      vendor/illumos/dist/cmd/ztest/ztest.c
      vendor/illumos/dist/lib/libzfs/common/libzfs.h
      vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
      vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c
      vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
      vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h
      vendor/illumos/dist/lib/libzpool/common/kernel.c
      vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h
      vendor/illumos/dist/man/man1m/zfs.1m
    
    Changes in other areas also in this revision:
    Added:
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_send.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_destroy.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_userhold.h
    Modified:
      vendor-sys/illumos/dist/common/nvpair/fnvpair.c
      vendor-sys/illumos/dist/uts/common/Makefile.files
      vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/bplist.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/bpobj.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_diff.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_send.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deleg.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_prop.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_synctask.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/refcount.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/rrwlock.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_tx.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dir.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_prop.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_synctask.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/refcount.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/rrwlock.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/space_map.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/txg.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfeature.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_debug.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_znode.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil.h
      vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ctldir.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c
      vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c
      vendor-sys/illumos/dist/uts/common/sys/nvpair.h
    
    Modified: vendor/illumos/dist/cmd/zdb/zdb.c
    ==============================================================================
    --- vendor/illumos/dist/cmd/zdb/zdb.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor/illumos/dist/cmd/zdb/zdb.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -1658,7 +1658,9 @@ dump_dir(objset_t *os)
     	int print_header = 1;
     	int i, error;
     
    +	dsl_pool_config_enter(dmu_objset_pool(os), FTAG);
     	dmu_objset_fast_stat(os, &dds);
    +	dsl_pool_config_exit(dmu_objset_pool(os), FTAG);
     
     	if (dds.dds_type < DMU_OST_NUMTYPES)
     		type = objset_types[dds.dds_type];
    @@ -2109,7 +2111,6 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog
     
     		zio_nowait(zio_read(NULL, spa, bp, data, size,
     		    zdb_blkptr_done, zcb, ZIO_PRIORITY_ASYNC_READ, flags, zb));
    -
     	}
     
     	zcb->zcb_readfails = 0;
    @@ -2297,8 +2298,10 @@ dump_block_stats(spa_t *spa)
     	 */
     	(void) bpobj_iterate_nofree(&spa->spa_deferred_bpobj,
     	    count_block_cb, &zcb, NULL);
    -	(void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj,
    -	    count_block_cb, &zcb, NULL);
    +	if (spa_version(spa) >= SPA_VERSION_DEADLISTS) {
    +		(void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj,
    +		    count_block_cb, &zcb, NULL);
    +	}
     	if (spa_feature_is_active(spa,
     	    &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
     		VERIFY3U(0, ==, bptree_iterate(spa->spa_meta_objset,
    
    Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c
    ==============================================================================
    --- vendor/illumos/dist/cmd/zfs/zfs_main.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor/illumos/dist/cmd/zfs/zfs_main.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -898,6 +898,7 @@ typedef struct destroy_cbdata {
     	boolean_t	cb_parsable;
     	boolean_t	cb_dryrun;
     	nvlist_t	*cb_nvl;
    +	nvlist_t	*cb_batchedsnaps;
     
     	/* first snap in contiguous run */
     	char		*cb_firstsnap;
    @@ -994,9 +995,27 @@ destroy_callback(zfs_handle_t *zhp, void
     		zfs_close(zhp);
     		return (0);
     	}
    +	if (cb->cb_dryrun) {
    +		zfs_close(zhp);
    +		return (0);
    +	}
    +
    +	/*
    +	 * We batch up all contiguous snapshots (even of different
    +	 * filesystems) and destroy them with one ioctl.  We can't
    +	 * simply do all snap deletions and then all fs deletions,
    +	 * because we must delete a clone before its origin.
    +	 */
    +	if (zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) {
    +		fnvlist_add_boolean(cb->cb_batchedsnaps, name);
    +	} else {
    +		int error = zfs_destroy_snaps_nvl(g_zfs,
    +		    cb->cb_batchedsnaps, B_FALSE);
    +		fnvlist_free(cb->cb_batchedsnaps);
    +		cb->cb_batchedsnaps = fnvlist_alloc();
     
    -	if (!cb->cb_dryrun) {
    -		if (zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 ||
    +		if (error != 0 ||
    +		    zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 ||
     		    zfs_destroy(zhp, cb->cb_defer_destroy) != 0) {
     			zfs_close(zhp);
     			return (-1);
    @@ -1152,8 +1171,10 @@ static int
     zfs_do_destroy(int argc, char **argv)
     {
     	destroy_cbdata_t cb = { 0 };
    +	int rv = 0;
    +	int err = 0;
     	int c;
    -	zfs_handle_t *zhp;
    +	zfs_handle_t *zhp = NULL;
     	char *at;
     	zfs_type_t type = ZFS_TYPE_DATASET;
     
    @@ -1207,11 +1228,9 @@ zfs_do_destroy(int argc, char **argv)
     
     	at = strchr(argv[0], '@');
     	if (at != NULL) {
    -		int err = 0;
     
     		/* Build the list of snaps to destroy in cb_nvl. */
    -		if (nvlist_alloc(&cb.cb_nvl, NV_UNIQUE_NAME, 0) != 0)
    -			nomem();
    +		cb.cb_nvl = fnvlist_alloc();
     
     		*at = '\0';
     		zhp = zfs_open(g_zfs, argv[0],
    @@ -1222,17 +1241,15 @@ zfs_do_destroy(int argc, char **argv)
     		cb.cb_snapspec = at + 1;
     		if (gather_snapshots(zfs_handle_dup(zhp), &cb) != 0 ||
     		    cb.cb_error) {
    -			zfs_close(zhp);
    -			nvlist_free(cb.cb_nvl);
    -			return (1);
    +			rv = 1;
    +			goto out;
     		}
     
     		if (nvlist_empty(cb.cb_nvl)) {
     			(void) fprintf(stderr, gettext("could not find any "
     			    "snapshots to destroy; check snapshot names.\n"));
    -			zfs_close(zhp);
    -			nvlist_free(cb.cb_nvl);
    -			return (1);
    +			rv = 1;
    +			goto out;
     		}
     
     		if (cb.cb_verbose) {
    @@ -1251,18 +1268,26 @@ zfs_do_destroy(int argc, char **argv)
     		}
     
     		if (!cb.cb_dryrun) {
    -			if (cb.cb_doclones)
    +			if (cb.cb_doclones) {
    +				cb.cb_batchedsnaps = fnvlist_alloc();
     				err = destroy_clones(&cb);
    +				if (err == 0) {
    +					err = zfs_destroy_snaps_nvl(g_zfs,
    +					    cb.cb_batchedsnaps, B_FALSE);
    +				}
    +				if (err != 0) {
    +					rv = 1;
    +					goto out;
    +				}
    +			}
     			if (err == 0) {
    -				err = zfs_destroy_snaps_nvl(zhp, cb.cb_nvl,
    +				err = zfs_destroy_snaps_nvl(g_zfs, cb.cb_nvl,
     				    cb.cb_defer_destroy);
     			}
     		}
     
    -		zfs_close(zhp);
    -		nvlist_free(cb.cb_nvl);
     		if (err != 0)
    -			return (1);
    +			rv = 1;
     	} else {
     		/* Open the given dataset */
     		if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL)
    @@ -1283,8 +1308,8 @@ zfs_do_destroy(int argc, char **argv)
     			    zfs_get_name(zhp));
     			(void) fprintf(stderr, gettext("use 'zpool destroy %s' "
     			    "to destroy the pool itself\n"), zfs_get_name(zhp));
    -			zfs_close(zhp);
    -			return (1);
    +			rv = 1;
    +			goto out;
     		}
     
     		/*
    @@ -1294,30 +1319,42 @@ zfs_do_destroy(int argc, char **argv)
     		if (!cb.cb_doclones &&
     		    zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent,
     		    &cb) != 0) {
    -			zfs_close(zhp);
    -			return (1);
    +			rv = 1;
    +			goto out;
     		}
     
     		if (cb.cb_error) {
    -			zfs_close(zhp);
    -			return (1);
    +			rv = 1;
    +			goto out;
     		}
     
    +		cb.cb_batchedsnaps = fnvlist_alloc();
     		if (zfs_iter_dependents(zhp, B_FALSE, destroy_callback,
     		    &cb) != 0) {
    -			zfs_close(zhp);
    -			return (1);
    +			rv = 1;
    +			goto out;
     		}
     
     		/*
     		 * Do the real thing.  The callback will close the
     		 * handle regardless of whether it succeeds or not.
     		 */
    -		if (destroy_callback(zhp, &cb) != 0)
    -			return (1);
    +		err = destroy_callback(zhp, &cb);
    +		zhp = NULL;
    +		if (err == 0) {
    +			err = zfs_destroy_snaps_nvl(g_zfs,
    +			    cb.cb_batchedsnaps, cb.cb_defer_destroy);
    +		}
    +		if (err != 0)
    +			rv = 1;
     	}
     
    -	return (0);
    +out:
    +	fnvlist_free(cb.cb_batchedsnaps);
    +	fnvlist_free(cb.cb_nvl);
    +	if (zhp != NULL)
    +		zfs_close(zhp);
    +	return (rv);
     }
     
     static boolean_t
    @@ -5052,28 +5089,12 @@ cleanup2:
     	return (error);
     }
     
    -/*
    - * zfs allow [-r] [-t]   ...
    - *
    - *	-r	Recursively hold
    - *	-t	Temporary hold (hidden option)
    - *
    - * Apply a user-hold with the given tag to the list of snapshots.
    - */
     static int
     zfs_do_allow(int argc, char **argv)
     {
     	return (zfs_do_allow_unallow_impl(argc, argv, B_FALSE));
     }
     
    -/*
    - * zfs unallow [-r] [-t]   ...
    - *
    - *	-r	Recursively hold
    - *	-t	Temporary hold (hidden option)
    - *
    - * Apply a user-hold with the given tag to the list of snapshots.
    - */
     static int
     zfs_do_unallow(int argc, char **argv)
     {
    @@ -5087,7 +5108,6 @@ zfs_do_hold_rele_impl(int argc, char **a
     	int i;
     	const char *tag;
     	boolean_t recursive = B_FALSE;
    -	boolean_t temphold = B_FALSE;
     	const char *opts = holding ? "rt" : "r";
     	int c;
     
    @@ -5097,9 +5117,6 @@ zfs_do_hold_rele_impl(int argc, char **a
     		case 'r':
     			recursive = B_TRUE;
     			break;
    -		case 't':
    -			temphold = B_TRUE;
    -			break;
     		case '?':
     			(void) fprintf(stderr, gettext("invalid option '%c'\n"),
     			    optopt);
    @@ -5148,7 +5165,7 @@ zfs_do_hold_rele_impl(int argc, char **a
     		}
     		if (holding) {
     			if (zfs_hold(zhp, delim+1, tag, recursive,
    -			    temphold, B_FALSE, -1, 0, 0) != 0)
    +			    B_FALSE, -1) != 0)
     				++errors;
     		} else {
     			if (zfs_release(zhp, delim+1, tag, recursive) != 0)
    @@ -5164,7 +5181,6 @@ zfs_do_hold_rele_impl(int argc, char **a
      * zfs hold [-r] [-t]   ...
      *
      *	-r	Recursively hold
    - *	-t	Temporary hold (hidden option)
      *
      * Apply a user-hold with the given tag to the list of snapshots.
      */
    
    Modified: vendor/illumos/dist/cmd/zhack/zhack.c
    ==============================================================================
    --- vendor/illumos/dist/cmd/zhack/zhack.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor/illumos/dist/cmd/zhack/zhack.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -46,6 +46,7 @@
     #include 
     #include 
     #include 
    +#include 
     #undef ZFS_MAXNAMELEN
     #undef verify
     #include 
    @@ -273,10 +274,10 @@ zhack_do_feature_stat(int argc, char **a
     }
     
     static void
    -feature_enable_sync(void *arg1, void *arg2, dmu_tx_t *tx)
    +feature_enable_sync(void *arg, dmu_tx_t *tx)
     {
    -	spa_t *spa = arg1;
    -	zfeature_info_t *feature = arg2;
    +	spa_t *spa = dmu_tx_pool(tx)->dp_spa;
    +	zfeature_info_t *feature = arg;
     
     	spa_feature_enable(spa, feature, tx);
     	spa_history_log_internal(spa, "zhack enable feature", tx,
    @@ -344,8 +345,8 @@ zhack_do_feature_enable(int argc, char *
     	if (0 == zap_contains(mos, spa->spa_feat_desc_obj, feature.fi_guid))
     		fatal("feature already enabled: %s", feature.fi_guid);
     
    -	VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL,
    -	    feature_enable_sync, spa, &feature, 5));
    +	VERIFY0(dsl_sync_task(spa_name(spa), NULL,
    +	    feature_enable_sync, &feature, 5));
     
     	spa_close(spa, FTAG);
     
    @@ -353,10 +354,10 @@ zhack_do_feature_enable(int argc, char *
     }
     
     static void
    -feature_incr_sync(void *arg1, void *arg2, dmu_tx_t *tx)
    +feature_incr_sync(void *arg, dmu_tx_t *tx)
     {
    -	spa_t *spa = arg1;
    -	zfeature_info_t *feature = arg2;
    +	spa_t *spa = dmu_tx_pool(tx)->dp_spa;
    +	zfeature_info_t *feature = arg;
     
     	spa_feature_incr(spa, feature, tx);
     	spa_history_log_internal(spa, "zhack feature incr", tx,
    @@ -364,10 +365,10 @@ feature_incr_sync(void *arg1, void *arg2
     }
     
     static void
    -feature_decr_sync(void *arg1, void *arg2, dmu_tx_t *tx)
    +feature_decr_sync(void *arg, dmu_tx_t *tx)
     {
    -	spa_t *spa = arg1;
    -	zfeature_info_t *feature = arg2;
    +	spa_t *spa = dmu_tx_pool(tx)->dp_spa;
    +	zfeature_info_t *feature = arg;
     
     	spa_feature_decr(spa, feature, tx);
     	spa_history_log_internal(spa, "zhack feature decr", tx,
    @@ -442,8 +443,8 @@ zhack_do_feature_ref(int argc, char **ar
     	if (decr && !spa_feature_is_active(spa, &feature))
     		fatal("feature refcount already 0: %s", feature.fi_guid);
     
    -	VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL,
    -	    decr ? feature_decr_sync : feature_incr_sync, spa, &feature, 5));
    +	VERIFY0(dsl_sync_task(spa_name(spa), NULL,
    +	    decr ? feature_decr_sync : feature_incr_sync, &feature, 5));
     
     	spa_close(spa, FTAG);
     }
    
    Modified: vendor/illumos/dist/cmd/ztest/ztest.c
    ==============================================================================
    --- vendor/illumos/dist/cmd/ztest/ztest.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor/illumos/dist/cmd/ztest/ztest.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -103,10 +103,12 @@
     #include 
     #include 
     #include 
    +#include 
     #include 
     #include 
     #include 
     #include 
    +#include 
     #include 
     #include 
     #include 
    @@ -365,7 +367,7 @@ ztest_info_t ztest_info[] = {
     	{ ztest_scrub,				1,	&zopt_rarely	},
     	{ ztest_spa_upgrade,			1,	&zopt_rarely	},
     	{ ztest_dsl_dataset_promote_busy,	1,	&zopt_rarely	},
    -	{ ztest_vdev_attach_detach,		1,	&zopt_rarely	},
    +	{ ztest_vdev_attach_detach,		1,	&zopt_sometimes	},
     	{ ztest_vdev_LUN_growth,		1,	&zopt_rarely	},
     	{ ztest_vdev_add_remove,		1,
     	    &ztest_opts.zo_vdevtime				},
    @@ -1006,9 +1008,8 @@ ztest_dsl_prop_set_uint64(char *osname, 
     	uint64_t curval;
     	int error;
     
    -	error = dsl_prop_set(osname, propname,
    -	    (inherit ? ZPROP_SRC_NONE : ZPROP_SRC_LOCAL),
    -	    sizeof (value), 1, &value);
    +	error = dsl_prop_set_int(osname, propname,
    +	    (inherit ? ZPROP_SRC_NONE : ZPROP_SRC_LOCAL), value);
     
     	if (error == ENOSPC) {
     		ztest_record_enospc(FTAG);
    @@ -1016,8 +1017,7 @@ ztest_dsl_prop_set_uint64(char *osname, 
     	}
     	ASSERT0(error);
     
    -	VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval),
    -	    1, &curval, setpoint), ==, 0);
    +	VERIFY0(dsl_prop_get_integer(osname, propname, &curval, setpoint));
     
     	if (ztest_opts.zo_verbose >= 6) {
     		VERIFY(zfs_prop_index_to_string(prop, curval, &valname) == 0);
    @@ -2479,8 +2479,7 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui
     	int error;
     
     	VERIFY(mutex_lock(&ztest_vdev_lock) == 0);
    -	leaves =
    -	    MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz;
    +	leaves = MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz;
     
     	spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
     
    @@ -3180,7 +3179,7 @@ ztest_objset_destroy_cb(const char *name
     	/*
     	 * Verify that the dataset contains a directory object.
     	 */
    -	VERIFY3U(0, ==, dmu_objset_hold(name, FTAG, &os));
    +	VERIFY0(dmu_objset_own(name, DMU_OST_OTHER, B_TRUE, FTAG, &os));
     	error = dmu_object_info(os, ZTEST_DIROBJ, &doi);
     	if (error != ENOENT) {
     		/* We could have crashed in the middle of destroying it */
    @@ -3188,12 +3187,16 @@ ztest_objset_destroy_cb(const char *name
     		ASSERT3U(doi.doi_type, ==, DMU_OT_ZAP_OTHER);
     		ASSERT3S(doi.doi_physical_blocks_512, >=, 0);
     	}
    -	dmu_objset_rele(os, FTAG);
    +	dmu_objset_disown(os, FTAG);
     
     	/*
     	 * Destroy the dataset.
     	 */
    -	VERIFY3U(0, ==, dmu_objset_destroy(name, B_FALSE));
    +	if (strchr(name, '@') != NULL) {
    +		VERIFY0(dsl_destroy_snapshot(name, B_FALSE));
    +	} else {
    +		VERIFY0(dsl_destroy_head(name));
    +	}
     	return (0);
     }
     
    @@ -3203,16 +3206,17 @@ ztest_snapshot_create(char *osname, uint
     	char snapname[MAXNAMELEN];
     	int error;
     
    -	(void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
    -	    (u_longlong_t)id);
    +	(void) snprintf(snapname, sizeof (snapname), "%llu", (u_longlong_t)id);
     
    -	error = dmu_objset_snapshot_one(osname, strchr(snapname, '@') + 1);
    +	error = dmu_objset_snapshot_one(osname, snapname);
     	if (error == ENOSPC) {
     		ztest_record_enospc(FTAG);
     		return (B_FALSE);
     	}
    -	if (error != 0 && error != EEXIST)
    -		fatal(0, "ztest_snapshot_create(%s) = %d", snapname, error);
    +	if (error != 0 && error != EEXIST) {
    +		fatal(0, "ztest_snapshot_create(%s@%s) = %d", osname,
    +		    snapname, error);
    +	}
     	return (B_TRUE);
     }
     
    @@ -3225,7 +3229,7 @@ ztest_snapshot_destroy(char *osname, uin
     	(void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
     	    (u_longlong_t)id);
     
    -	error = dmu_objset_destroy(snapname, B_FALSE);
    +	error = dsl_destroy_snapshot(snapname, B_FALSE);
     	if (error != 0 && error != ENOENT)
     		fatal(0, "ztest_snapshot_destroy(%s) = %d", snapname, error);
     	return (B_TRUE);
    @@ -3271,7 +3275,8 @@ ztest_dmu_objset_create_destroy(ztest_ds
     	/*
     	 * Verify that the destroyed dataset is no longer in the namespace.
     	 */
    -	VERIFY3U(ENOENT, ==, dmu_objset_hold(name, FTAG, &os));
    +	VERIFY3U(ENOENT, ==, dmu_objset_own(name, DMU_OST_OTHER, B_TRUE,
    +	    FTAG, &os));
     
     	/*
     	 * Verify that we can create a new dataset.
    @@ -3286,8 +3291,7 @@ ztest_dmu_objset_create_destroy(ztest_ds
     		fatal(0, "dmu_objset_create(%s) = %d", name, error);
     	}
     
    -	VERIFY3U(0, ==,
    -	    dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os));
    +	VERIFY0(dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os));
     
     	ztest_zd_init(&zdtmp, NULL, os);
     
    @@ -3363,21 +3367,21 @@ ztest_dsl_dataset_cleanup(char *osname, 
     	(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
     	(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
     
    -	error = dmu_objset_destroy(clone2name, B_FALSE);
    +	error = dsl_destroy_head(clone2name);
     	if (error && error != ENOENT)
    -		fatal(0, "dmu_objset_destroy(%s) = %d", clone2name, error);
    -	error = dmu_objset_destroy(snap3name, B_FALSE);
    +		fatal(0, "dsl_destroy_head(%s) = %d", clone2name, error);
    +	error = dsl_destroy_snapshot(snap3name, B_FALSE);
     	if (error && error != ENOENT)
    -		fatal(0, "dmu_objset_destroy(%s) = %d", snap3name, error);
    -	error = dmu_objset_destroy(snap2name, B_FALSE);
    +		fatal(0, "dsl_destroy_snapshot(%s) = %d", snap3name, error);
    +	error = dsl_destroy_snapshot(snap2name, B_FALSE);
     	if (error && error != ENOENT)
    -		fatal(0, "dmu_objset_destroy(%s) = %d", snap2name, error);
    -	error = dmu_objset_destroy(clone1name, B_FALSE);
    +		fatal(0, "dsl_destroy_snapshot(%s) = %d", snap2name, error);
    +	error = dsl_destroy_head(clone1name);
     	if (error && error != ENOENT)
    -		fatal(0, "dmu_objset_destroy(%s) = %d", clone1name, error);
    -	error = dmu_objset_destroy(snap1name, B_FALSE);
    +		fatal(0, "dsl_destroy_head(%s) = %d", clone1name, error);
    +	error = dsl_destroy_snapshot(snap1name, B_FALSE);
     	if (error && error != ENOENT)
    -		fatal(0, "dmu_objset_destroy(%s) = %d", snap1name, error);
    +		fatal(0, "dsl_destroy_snapshot(%s) = %d", snap1name, error);
     }
     
     /*
    @@ -3386,8 +3390,7 @@ ztest_dsl_dataset_cleanup(char *osname, 
     void
     ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
     {
    -	objset_t *clone;
    -	dsl_dataset_t *ds;
    +	objset_t *os;
     	char snap1name[MAXNAMELEN];
     	char clone1name[MAXNAMELEN];
     	char snap2name[MAXNAMELEN];
    @@ -3415,12 +3418,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_
     		fatal(0, "dmu_take_snapshot(%s) = %d", snap1name, error);
     	}
     
    -	error = dmu_objset_hold(snap1name, FTAG, &clone);
    -	if (error)
    -		fatal(0, "dmu_open_snapshot(%s) = %d", snap1name, error);
    -
    -	error = dmu_objset_clone(clone1name, dmu_objset_ds(clone), 0);
    -	dmu_objset_rele(clone, FTAG);
    +	error = dmu_objset_clone(clone1name, snap1name);
     	if (error) {
     		if (error == ENOSPC) {
     			ztest_record_enospc(FTAG);
    @@ -3447,12 +3445,7 @@ ztest_dsl_dataset_promote_busy(ztest_ds_
     		fatal(0, "dmu_open_snapshot(%s) = %d", snap3name, error);
     	}
     
    -	error = dmu_objset_hold(snap3name, FTAG, &clone);
    -	if (error)
    -		fatal(0, "dmu_open_snapshot(%s) = %d", snap3name, error);
    -
    -	error = dmu_objset_clone(clone2name, dmu_objset_ds(clone), 0);
    -	dmu_objset_rele(clone, FTAG);
    +	error = dmu_objset_clone(clone2name, snap3name);
     	if (error) {
     		if (error == ENOSPC) {
     			ztest_record_enospc(FTAG);
    @@ -3461,14 +3454,14 @@ ztest_dsl_dataset_promote_busy(ztest_ds_
     		fatal(0, "dmu_objset_create(%s) = %d", clone2name, error);
     	}
     
    -	error = dsl_dataset_own(snap2name, B_FALSE, FTAG, &ds);
    +	error = dmu_objset_own(snap2name, DMU_OST_ANY, B_TRUE, FTAG, &os);
     	if (error)
    -		fatal(0, "dsl_dataset_own(%s) = %d", snap2name, error);
    +		fatal(0, "dmu_objset_own(%s) = %d", snap2name, error);
     	error = dsl_dataset_promote(clone2name, NULL);
     	if (error != EBUSY)
     		fatal(0, "dsl_dataset_promote(%s), %d, not EBUSY", clone2name,
     		    error);
    -	dsl_dataset_disown(ds, FTAG);
    +	dmu_objset_disown(os, FTAG);
     
     out:
     	ztest_dsl_dataset_cleanup(osname, id);
    @@ -4280,7 +4273,7 @@ ztest_zap_parallel(ztest_ds_t *zd, uint6
     	}
     
     	count = -1ULL;
    -	VERIFY(zap_count(os, object, &count) == 0);
    +	VERIFY0(zap_count(os, object, &count));
     	ASSERT(count != -1ULL);
     
     	/*
    @@ -4591,6 +4584,22 @@ ztest_spa_prop_get_set(ztest_ds_t *zd, u
     	(void) rw_unlock(&ztest_name_lock);
     }
     
    +static int
    +user_release_one(const char *snapname, const char *holdname)
    +{
    +	nvlist_t *snaps, *holds;
    +	int error;
    +
    +	snaps = fnvlist_alloc();
    +	holds = fnvlist_alloc();
    +	fnvlist_add_boolean(holds, holdname);
    +	fnvlist_add_nvlist(snaps, snapname, holds);
    +	fnvlist_free(holds);
    +	error = dsl_dataset_user_release(snaps, NULL);
    +	fnvlist_free(snaps);
    +	return (error);
    +}
    +
     /*
      * Test snapshot hold/release and deferred destroy.
      */
    @@ -4605,22 +4614,30 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, 
     	char clonename[100];
     	char tag[100];
     	char osname[MAXNAMELEN];
    +	nvlist_t *holds;
     
     	(void) rw_rdlock(&ztest_name_lock);
     
     	dmu_objset_name(os, osname);
     
    -	(void) snprintf(snapname, 100, "sh1_%llu", id);
    -	(void) snprintf(fullname, 100, "%s@%s", osname, snapname);
    -	(void) snprintf(clonename, 100, "%s/ch1_%llu", osname, id);
    -	(void) snprintf(tag, 100, "%tag_%llu", id);
    +	(void) snprintf(snapname, sizeof (snapname), "sh1_%llu", id);
    +	(void) snprintf(fullname, sizeof (fullname), "%s@%s", osname, snapname);
    +	(void) snprintf(clonename, sizeof (clonename),
    +	    "%s/ch1_%llu", osname, id);
    +	(void) snprintf(tag, sizeof (tag), "tag_%llu", id);
     
     	/*
     	 * Clean up from any previous run.
     	 */
    -	(void) dmu_objset_destroy(clonename, B_FALSE);
    -	(void) dsl_dataset_user_release(osname, snapname, tag, B_FALSE);
    -	(void) dmu_objset_destroy(fullname, B_FALSE);
    +	error = dsl_destroy_head(clonename);
    +	if (error != ENOENT)
    +		ASSERT0(error);
    +	error = user_release_one(fullname, tag);
    +	if (error != ESRCH && error != ENOENT)
    +		ASSERT0(error);
    +	error = dsl_destroy_snapshot(fullname, B_FALSE);
    +	if (error != ENOENT)
    +		ASSERT0(error);
     
     	/*
     	 * Create snapshot, clone it, mark snap for deferred destroy,
    @@ -4635,12 +4652,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, 
     		fatal(0, "dmu_objset_snapshot(%s) = %d", fullname, error);
     	}
     
    -	error = dmu_objset_hold(fullname, FTAG, &origin);
    -	if (error)
    -		fatal(0, "dmu_objset_hold(%s) = %d", fullname, error);
    -
    -	error = dmu_objset_clone(clonename, dmu_objset_ds(origin), 0);
    -	dmu_objset_rele(origin, FTAG);
    +	error = dmu_objset_clone(clonename, fullname);
     	if (error) {
     		if (error == ENOSPC) {
     			ztest_record_enospc("dmu_objset_clone");
    @@ -4649,15 +4661,15 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, 
     		fatal(0, "dmu_objset_clone(%s) = %d", clonename, error);
     	}
     
    -	error = dmu_objset_destroy(fullname, B_TRUE);
    +	error = dsl_destroy_snapshot(fullname, B_TRUE);
     	if (error) {
    -		fatal(0, "dmu_objset_destroy(%s, B_TRUE) = %d",
    +		fatal(0, "dsl_destroy_snapshot(%s, B_TRUE) = %d",
     		    fullname, error);
     	}
     
    -	error = dmu_objset_destroy(clonename, B_FALSE);
    +	error = dsl_destroy_head(clonename);
     	if (error)
    -		fatal(0, "dmu_objset_destroy(%s) = %d", clonename, error);
    +		fatal(0, "dsl_destroy_head(%s) = %d", clonename, error);
     
     	error = dmu_objset_hold(fullname, FTAG, &origin);
     	if (error != ENOENT)
    @@ -4677,28 +4689,31 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, 
     		fatal(0, "dmu_objset_snapshot(%s) = %d", fullname, error);
     	}
     
    -	error = dsl_dataset_user_hold(osname, snapname, tag, B_FALSE,
    -	    B_TRUE, -1);
    +	holds = fnvlist_alloc();
    +	fnvlist_add_string(holds, fullname, tag);
    +	error = dsl_dataset_user_hold(holds, 0, NULL);
    +	fnvlist_free(holds);
    +
     	if (error)
     		fatal(0, "dsl_dataset_user_hold(%s)", fullname, tag);
     
    -	error = dmu_objset_destroy(fullname, B_FALSE);
    +	error = dsl_destroy_snapshot(fullname, B_FALSE);
     	if (error != EBUSY) {
    -		fatal(0, "dmu_objset_destroy(%s, B_FALSE) = %d",
    +		fatal(0, "dsl_destroy_snapshot(%s, B_FALSE) = %d",
     		    fullname, error);
     	}
     
    -	error = dmu_objset_destroy(fullname, B_TRUE);
    +	error = dsl_destroy_snapshot(fullname, B_TRUE);
     	if (error) {
    -		fatal(0, "dmu_objset_destroy(%s, B_TRUE) = %d",
    +		fatal(0, "dsl_destroy_snapshot(%s, B_TRUE) = %d",
     		    fullname, error);
     	}
     
    -	error = dsl_dataset_user_release(osname, snapname, tag, B_FALSE);
    +	error = user_release_one(fullname, tag);
     	if (error)
    -		fatal(0, "dsl_dataset_user_release(%s)", fullname, tag);
    +		fatal(0, "user_release_one(%s)", fullname, tag);
     
    -	VERIFY(dmu_objset_hold(fullname, FTAG, &origin) == ENOENT);
    +	VERIFY3U(dmu_objset_hold(fullname, FTAG, &origin), ==, ENOENT);
     
     out:
     	(void) rw_unlock(&ztest_name_lock);
    @@ -4952,8 +4967,12 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_
     	 */
     	for (int i = 0; i < copies; i++) {
     		uint64_t offset = i * blocksize;
    -		VERIFY0(dmu_buf_hold(os, object, offset, FTAG, &db,
    -		    DMU_READ_NO_PREFETCH));
    +		int error = dmu_buf_hold(os, object, offset, FTAG, &db,
    +		    DMU_READ_NO_PREFETCH);
    +		if (error != 0) {
    +			fatal(B_FALSE, "dmu_buf_hold(%p, %llu, %llu) = %u",
    +			    os, (long long)object, (long long) offset, error);
    +		}
     		ASSERT(db->db_offset == offset);
     		ASSERT(db->db_size == blocksize);
     		ASSERT(ztest_pattern_match(db->db_data, db->db_size, pattern) ||
    @@ -5163,6 +5182,7 @@ ztest_spa_import_export(char *oldname, c
     	nvlist_t *config, *newconfig;
     	uint64_t pool_guid;
     	spa_t *spa;
    +	int error;
     
     	if (ztest_opts.zo_verbose >= 4) {
     		(void) printf("import/export: old = %s, new = %s\n",
    @@ -5207,7 +5227,12 @@ ztest_spa_import_export(char *oldname, c
     	/*
     	 * Import it under the new name.
     	 */
    -	VERIFY3U(0, ==, spa_import(newname, config, NULL, 0));
    +	error = spa_import(newname, config, NULL, 0);
    +	if (error != 0) {
    +		dump_nvlist(config, 0);
    +		fatal(B_FALSE, "couldn't import pool %s as %s: error %u",
    +		    oldname, newname, error);
    +	}
     
     	ztest_walk_pool_directory("pools after import");
     
    @@ -5414,7 +5439,7 @@ ztest_dataset_open(int d)
     	}
     	ASSERT(error == 0 || error == EEXIST);
     
    -	VERIFY0(dmu_objset_hold(name, zd, &os));
    +	VERIFY0(dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, zd, &os));
     	(void) rw_unlock(&ztest_name_lock);
     
     	ztest_zd_init(zd, ZTEST_GET_SHARED_DS(d), os);
    @@ -5455,7 +5480,7 @@ ztest_dataset_close(int d)
     	ztest_ds_t *zd = &ztest_ds[d];
     
     	zil_close(zd->zd_zilog);
    -	dmu_objset_rele(zd->zd_os, zd);
    +	dmu_objset_disown(zd->zd_os, zd);
     
     	ztest_zd_fini(zd);
     }
    @@ -5499,13 +5524,14 @@ ztest_run(ztest_shared_t *zs)
     	 * Open our pool.
     	 */
     	kernel_init(FREAD | FWRITE);
    -	VERIFY(spa_open(ztest_opts.zo_pool, &spa, FTAG) == 0);
    +	VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG));
     	spa->spa_debug = B_TRUE;
     	ztest_spa = spa;
     
    -	VERIFY3U(0, ==, dmu_objset_hold(ztest_opts.zo_pool, FTAG, &os));
    +	VERIFY0(dmu_objset_own(ztest_opts.zo_pool,
    +	    DMU_OST_ANY, B_TRUE, FTAG, &os));
     	zs->zs_guid = dmu_objset_fsid_guid(os);
    -	dmu_objset_rele(os, FTAG);
    +	dmu_objset_disown(os, FTAG);
     
     	spa->spa_dedup_ditto = 2 * ZIO_DEDUPDITTO_MIN;
     
    
    Modified: vendor/illumos/dist/lib/libzfs/common/libzfs.h
    ==============================================================================
    --- vendor/illumos/dist/lib/libzfs/common/libzfs.h	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor/illumos/dist/lib/libzfs/common/libzfs.h	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -550,7 +550,7 @@ extern int zfs_create(libzfs_handle_t *,
     extern int zfs_create_ancestors(libzfs_handle_t *, const char *);
     extern int zfs_destroy(zfs_handle_t *, boolean_t);
     extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);
    -extern int zfs_destroy_snaps_nvl(zfs_handle_t *, nvlist_t *, boolean_t);
    +extern int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t);
     extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
     extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);
     extern int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps,
    @@ -593,8 +593,8 @@ extern int zfs_send(zfs_handle_t *, cons
         sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **);
     
     extern int zfs_promote(zfs_handle_t *);
    -extern int zfs_hold(zfs_handle_t *, const char *, const char *, boolean_t,
    -    boolean_t, boolean_t, int, uint64_t, uint64_t);
    +extern int zfs_hold(zfs_handle_t *, const char *, const char *,
    +    boolean_t, boolean_t, int);
     extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t);
     extern int zfs_get_holds(zfs_handle_t *, nvlist_t **);
     extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *);
    
    Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
    ==============================================================================
    --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c	Fri Mar  1 20:51:53 2013	(r247579)
    +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c	Fri Mar  1 21:01:45 2013	(r247580)
    @@ -1973,10 +1973,7 @@ get_clones_cb(zfs_handle_t *zhp, void *a
     	    NULL, NULL, 0, B_TRUE) != 0)
     		goto out;
     	if (strcmp(gca->buf, gca->origin) == 0) {
    -		if (nvlist_add_boolean(gca->value, zfs_get_name(zhp)) != 0) {
    -			zfs_close(zhp);
    -			return (no_memory(zhp->zfs_hdl));
    -		}
    +		fnvlist_add_boolean(gca->value, zfs_get_name(zhp));
     		gca->numclones--;
     	}
     
    @@ -3142,45 +3139,49 @@ zfs_destroy_snaps(zfs_handle_t *zhp, cha
     		    dgettext(TEXT_DOMAIN, "cannot destroy '%s@%s'"),
     		    zhp->zfs_name, snapname);
     	} else {
    -		ret = zfs_destroy_snaps_nvl(zhp, dd.nvl, defer);
    +		ret = zfs_destroy_snaps_nvl(zhp->zfs_hdl, dd.nvl, defer);
     	}
     	nvlist_free(dd.nvl);
     	return (ret);
     }
     
     /*
    - * Destroys all the snapshots named in the nvlist.  They must be underneath
    - * the zhp (either snapshots of it, or snapshots of its descendants).
    + * Destroys all the snapshots named in the nvlist.
      */
     int
    -zfs_destroy_snaps_nvl(zfs_handle_t *zhp, nvlist_t *snaps, boolean_t defer)
    +zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
     {
     	int ret;
     	nvlist_t *errlist;
     
     	ret = lzc_destroy_snaps(snaps, defer, &errlist);
     
    -	if (ret != 0) {
    -		for (nvpair_t *pair = nvlist_next_nvpair(errlist, NULL);
    -		    pair != NULL; pair = nvlist_next_nvpair(errlist, pair)) {
    -			char errbuf[1024];
    -			(void) snprintf(errbuf, sizeof (errbuf),
    -			    dgettext(TEXT_DOMAIN, "cannot destroy snapshot %s"),
    -			    nvpair_name(pair));
    +	if (ret == 0)
    +		return (0);
     
    -			switch (fnvpair_value_int32(pair)) {
    -			case EEXIST:
    -				zfs_error_aux(zhp->zfs_hdl,
    -				    dgettext(TEXT_DOMAIN,
    -				    "snapshot is cloned"));
    -				ret = zfs_error(zhp->zfs_hdl, EZFS_EXISTS,
    -				    errbuf);
    -				break;
    -			default:
    -				ret = zfs_standard_error(zhp->zfs_hdl, errno,
    -				    errbuf);
    -				break;
    -			}
    +	if (nvlist_next_nvpair(errlist, NULL) == NULL) {
    +		char errbuf[1024];
    +		(void) snprintf(errbuf, sizeof (errbuf),
    +		    dgettext(TEXT_DOMAIN, "cannot destroy snapshots"));
    +
    +		ret = zfs_standard_error(hdl, ret, errbuf);
    +	}
    +	for (nvpair_t *pair = nvlist_next_nvpair(errlist, NULL);
    +	    pair != NULL; pair = nvlist_next_nvpair(errlist, pair)) {
    +		char errbuf[1024];
    +		(void) snprintf(errbuf, sizeof (errbuf),
    +		    dgettext(TEXT_DOMAIN, "cannot destroy snapshot %s"),
    +		    nvpair_name(pair));
    +
    +		switch (fnvpair_value_int32(pair)) {
    +		case EEXIST:
    +			zfs_error_aux(hdl,
    +			    dgettext(TEXT_DOMAIN, "snapshot is cloned"));
    +			ret = zfs_error(hdl, EZFS_EXISTS, errbuf);
    +			break;
    +		default:
    +			ret = zfs_standard_error(hdl, errno, errbuf);
    +			break;
     		}
     	}
     
    @@ -4047,7 +4048,7 @@ zfs_userspace(zfs_handle_t *zhp, zfs_use
     
     		zc.zc_nvlist_dst_size = sizeof (buf);
     		if (zfs_ioctl(hdl, ZFS_IOC_USERSPACE_MANY, &zc) != 0) {
    -			char errbuf[ZFS_MAXNAMELEN + 32];
    +			char errbuf[1024];
     
     			(void) snprintf(errbuf, sizeof (errbuf),
     			    dgettext(TEXT_DOMAIN,
    @@ -4069,37 +4070,83 @@ zfs_userspace(zfs_handle_t *zhp, zfs_use
     	return (0);
     }
     
    +struct holdarg {
    +	nvlist_t *nvl;
    +	const char *snapname;
    +	const char *tag;
    +	boolean_t recursive;
    +};
    +
    +static int
    +zfs_hold_one(zfs_handle_t *zhp, void *arg)
    +{
    +	struct holdarg *ha = arg;
    +	zfs_handle_t *szhp;
    +	char name[ZFS_MAXNAMELEN];
    +	int rv = 0;
    +
    +	(void) snprintf(name, sizeof (name),
    +	    "%s@%s", zhp->zfs_name, ha->snapname);
    +
    +	szhp = make_dataset_handle(zhp->zfs_hdl, name);
    +	if (szhp) {
    +		fnvlist_add_string(ha->nvl, name, ha->tag);
    +		zfs_close(szhp);
    +	}
    +
    +	if (ha->recursive)
    +		rv = zfs_iter_filesystems(zhp, zfs_hold_one, ha);
    +	zfs_close(zhp);
    +	return (rv);
    +}
    +
     int
     zfs_hold(zfs_handle_t *zhp, const char *snapname, const char *tag,
    -    boolean_t recursive, boolean_t temphold, boolean_t enoent_ok,
    -    int cleanup_fd, uint64_t dsobj, uint64_t createtxg)
    +    boolean_t recursive, boolean_t enoent_ok, int cleanup_fd)
     {
    -	zfs_cmd_t zc = { 0 };
    +	int ret;
    +	struct holdarg ha;
    +	nvlist_t *errors;
     	libzfs_handle_t *hdl = zhp->zfs_hdl;
    +	char errbuf[1024];
    +	nvpair_t *elem;
     
    -	ASSERT(!recursive || dsobj == 0);
    +	ha.nvl = fnvlist_alloc();
    +	ha.snapname = snapname;
    +	ha.tag = tag;
    +	ha.recursive = recursive;
    +	(void) zfs_hold_one(zfs_handle_dup(zhp), &ha);
    +	ret = lzc_hold(ha.nvl, cleanup_fd, &errors);
    +	fnvlist_free(ha.nvl);
     
    -	(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
    -	(void) strlcpy(zc.zc_value, snapname, sizeof (zc.zc_value));
    -	if (strlcpy(zc.zc_string, tag, sizeof (zc.zc_string))
    -	    >= sizeof (zc.zc_string))
    -		return (zfs_error(hdl, EZFS_TAGTOOLONG, tag));
    -	zc.zc_cookie = recursive;
    -	zc.zc_temphold = temphold;
    -	zc.zc_cleanup_fd = cleanup_fd;
    -	zc.zc_sendobj = dsobj;
    -	zc.zc_createtxg = createtxg;
    +	if (ret == 0)
    +		return (0);
     
    -	if (zfs_ioctl(hdl, ZFS_IOC_HOLD, &zc) != 0) {
    -		char errbuf[ZFS_MAXNAMELEN+32];
    +	if (nvlist_next_nvpair(errors, NULL) == NULL) {
    +		/* no hold-specific errors */
    +		(void) snprintf(errbuf, sizeof (errbuf),
    +		    dgettext(TEXT_DOMAIN, "cannot hold"));
    +		switch (ret) {
    +		case ENOTSUP:
    +			zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
    +			    "pool must be upgraded"));
    +			(void) zfs_error(hdl, EZFS_BADVERSION, errbuf);
    +			break;
    +		case EINVAL:
    +			(void) zfs_error(hdl, EZFS_BADTYPE, errbuf);
    +			break;
    +		default:
    
    *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***