From owner-svn-src-projects@FreeBSD.ORG Sun Aug 14 23:26:33 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E40E106566C; Sun, 14 Aug 2011 23:26:33 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E10E8FC0A; Sun, 14 Aug 2011 23:26:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7ENQXDo084010; Sun, 14 Aug 2011 23:26:33 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7ENQWJh084008; Sun, 14 Aug 2011 23:26:33 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201108142326.p7ENQWJh084008@svn.freebsd.org> From: "Justin T. Gibbs" Date: Sun, 14 Aug 2011 23:26:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224872 - projects/zfsd/head/usr.bin/kdump X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 23:26:33 -0000 Author: gibbs Date: Sun Aug 14 23:26:32 2011 New Revision: 224872 URL: http://svn.freebsd.org/changeset/base/224872 Log: Fix building kdump. The new scsi_ses.h requires and . Sponsored by: Spectra Logic Corporation Modified: projects/zfsd/head/usr.bin/kdump/mkioctls Modified: projects/zfsd/head/usr.bin/kdump/mkioctls ============================================================================== --- projects/zfsd/head/usr.bin/kdump/mkioctls Sun Aug 14 22:53:02 2011 (r224871) +++ projects/zfsd/head/usr.bin/kdump/mkioctls Sun Aug 14 23:26:32 2011 (r224872) @@ -54,6 +54,8 @@ BEGIN { print "#include " print "#include " print "#include " + print "#include " + print "#include " print "" print "const char *ioctlname(u_long val);" print "" From owner-svn-src-projects@FreeBSD.ORG Mon Aug 15 20:31:29 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C30D1065672; Mon, 15 Aug 2011 20:31:29 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07F9E8FC15; Mon, 15 Aug 2011 20:31:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FKVTYp026347; Mon, 15 Aug 2011 20:31:29 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FKVSCV026318; Mon, 15 Aug 2011 20:31:28 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201108152031.p7FKVSCV026318@svn.freebsd.org> From: "Justin T. Gibbs" Date: Mon, 15 Aug 2011 20:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224899 - in projects/zfsd/head: . bin/ps cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common contrib/bsnmp/snmp_usm contrib/g... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 20:31:29 -0000 Author: gibbs Date: Mon Aug 15 20:31:27 2011 New Revision: 224899 URL: http://svn.freebsd.org/changeset/base/224899 Log: Integrate FreeBSD/head into projects/zfsd/head as of SVN revision 224870. Added: projects/zfsd/head/crypto/openssh/README.hpn - copied unchanged from r224870, head/crypto/openssh/README.hpn projects/zfsd/head/lib/libarchive/test/test_open_failure.c - copied unchanged from r224870, head/lib/libarchive/test/test_open_failure.c projects/zfsd/head/lib/libc/amd64/string/stpcpy.S - copied unchanged from r224870, head/lib/libc/amd64/string/stpcpy.S projects/zfsd/head/lib/libc/amd64/string/strcpy.c - copied unchanged from r224870, head/lib/libc/amd64/string/strcpy.c projects/zfsd/head/lib/libc/sys/cap_new.2 - copied unchanged from r224870, head/lib/libc/sys/cap_new.2 projects/zfsd/head/sys/boot/powerpc/ps3/ps3cdrom.c - copied unchanged from r224870, head/sys/boot/powerpc/ps3/ps3cdrom.c projects/zfsd/head/sys/powerpc/ps3/ps3cdrom.c - copied unchanged from r224870, head/sys/powerpc/ps3/ps3cdrom.c projects/zfsd/head/tools/regression/security/cap_test/cap_test.t - copied unchanged from r224870, head/tools/regression/security/cap_test/cap_test.t projects/zfsd/head/tools/regression/security/cap_test/cap_test_capabilities.c - copied unchanged from r224870, head/tools/regression/security/cap_test/cap_test_capabilities.c projects/zfsd/head/tools/regression/security/cap_test/cap_test_fcntl.c - copied unchanged from r224870, head/tools/regression/security/cap_test/cap_test_fcntl.c projects/zfsd/head/tools/regression/security/cap_test/cap_test_relative.c - copied unchanged from r224870, head/tools/regression/security/cap_test/cap_test_relative.c projects/zfsd/head/tools/tools/ath/athradar/ - copied from r224870, head/tools/tools/ath/athradar/ projects/zfsd/head/tools/tools/cxgbtool/ - copied from r224870, head/tools/tools/cxgbtool/ Deleted: projects/zfsd/head/lib/libc/amd64/string/strcpy.S projects/zfsd/head/usr.sbin/cxgbtool/ projects/zfsd/head/usr.sbin/named.reload/ Modified: projects/zfsd/head/MAINTAINERS projects/zfsd/head/Makefile.inc1 projects/zfsd/head/bin/ps/keyword.c projects/zfsd/head/bin/ps/print.c projects/zfsd/head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 projects/zfsd/head/cddl/contrib/opensolaris/cmd/ztest/ztest.c projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c projects/zfsd/head/contrib/bsnmp/snmp_usm/snmp_usm.3 projects/zfsd/head/contrib/gcc/cp/ChangeLog projects/zfsd/head/contrib/gcc/cp/decl.c projects/zfsd/head/contrib/gdb/FREEBSD-diffs projects/zfsd/head/contrib/gdb/gdb/sparc64fbsd-tdep.c projects/zfsd/head/contrib/one-true-awk/FIXES projects/zfsd/head/contrib/one-true-awk/awkgram.y projects/zfsd/head/contrib/one-true-awk/b.c projects/zfsd/head/contrib/one-true-awk/lex.c projects/zfsd/head/contrib/one-true-awk/lib.c projects/zfsd/head/contrib/one-true-awk/main.c projects/zfsd/head/contrib/one-true-awk/makefile projects/zfsd/head/contrib/one-true-awk/proto.h projects/zfsd/head/contrib/one-true-awk/run.c projects/zfsd/head/contrib/one-true-awk/tran.c projects/zfsd/head/contrib/top/display.c projects/zfsd/head/contrib/top/top.c projects/zfsd/head/crypto/openssh/buffer.c (contents, props changed) projects/zfsd/head/crypto/openssh/buffer.h (contents, props changed) projects/zfsd/head/crypto/openssh/channels.c (contents, props changed) projects/zfsd/head/crypto/openssh/channels.h (contents, props changed) projects/zfsd/head/crypto/openssh/cipher.c (contents, props changed) projects/zfsd/head/crypto/openssh/clientloop.c (contents, props changed) projects/zfsd/head/crypto/openssh/compat.c (contents, props changed) projects/zfsd/head/crypto/openssh/compat.h (contents, props changed) projects/zfsd/head/crypto/openssh/kex.c (contents, props changed) projects/zfsd/head/crypto/openssh/kex.h (contents, props changed) projects/zfsd/head/crypto/openssh/misc.c (contents, props changed) projects/zfsd/head/crypto/openssh/misc.h (contents, props changed) projects/zfsd/head/crypto/openssh/myproposal.h (contents, props changed) projects/zfsd/head/crypto/openssh/packet.c (contents, props changed) projects/zfsd/head/crypto/openssh/packet.h (contents, props changed) projects/zfsd/head/crypto/openssh/readconf.c projects/zfsd/head/crypto/openssh/readconf.h (contents, props changed) projects/zfsd/head/crypto/openssh/servconf.c projects/zfsd/head/crypto/openssh/servconf.h (contents, props changed) projects/zfsd/head/crypto/openssh/serverloop.c (contents, props changed) projects/zfsd/head/crypto/openssh/session.c projects/zfsd/head/crypto/openssh/sftp.1 projects/zfsd/head/crypto/openssh/sftp.c (contents, props changed) projects/zfsd/head/crypto/openssh/ssh.c projects/zfsd/head/crypto/openssh/sshconnect.c projects/zfsd/head/crypto/openssh/sshconnect2.c (contents, props changed) projects/zfsd/head/crypto/openssh/sshd.c projects/zfsd/head/crypto/openssh/sshd_config projects/zfsd/head/crypto/openssh/version.c projects/zfsd/head/crypto/openssh/version.h projects/zfsd/head/etc/Makefile projects/zfsd/head/etc/rc.d/kld projects/zfsd/head/gnu/usr.bin/gdb/arch/sparc64/Makefile projects/zfsd/head/gnu/usr.bin/gdb/arch/sparc64/init.c projects/zfsd/head/lib/libarchive/archive_read.c projects/zfsd/head/lib/libarchive/archive_read_support_compression_uu.c projects/zfsd/head/lib/libarchive/archive_read_support_format_iso9660.c projects/zfsd/head/lib/libarchive/archive_read_support_format_mtree.c projects/zfsd/head/lib/libarchive/archive_write_open_fd.c projects/zfsd/head/lib/libarchive/archive_write_open_file.c projects/zfsd/head/lib/libarchive/archive_write_open_filename.c projects/zfsd/head/lib/libarchive/archive_write_set_compression_xz.c projects/zfsd/head/lib/libarchive/archive_write_set_format_zip.c projects/zfsd/head/lib/libarchive/test/Makefile projects/zfsd/head/lib/libarchive/test/test_read_format_mtree.c projects/zfsd/head/lib/libarchive/test/test_write_compress_lzma.c projects/zfsd/head/lib/libarchive/test/test_write_compress_xz.c projects/zfsd/head/lib/libc/amd64/string/Makefile.inc projects/zfsd/head/lib/libc/net/ethers.3 projects/zfsd/head/lib/libc/net/sctp_sys_calls.c projects/zfsd/head/lib/libc/stdlib/Makefile.inc projects/zfsd/head/lib/libc/sys/Makefile.inc projects/zfsd/head/lib/libc/sys/Symbol.map projects/zfsd/head/lib/libc/sys/dup.2 projects/zfsd/head/lib/libkvm/kvm_ia64.c projects/zfsd/head/lib/libkvm/kvm_proc.c projects/zfsd/head/lib/libmemstat/libmemstat.3 projects/zfsd/head/lib/libmemstat/memstat.c projects/zfsd/head/lib/libmemstat/memstat.h projects/zfsd/head/lib/libmemstat/memstat_internal.h projects/zfsd/head/lib/libmemstat/memstat_malloc.c projects/zfsd/head/lib/libmemstat/memstat_uma.c projects/zfsd/head/lib/libproc/proc_create.c projects/zfsd/head/lib/libprocstat/libprocstat.c projects/zfsd/head/lib/libprocstat/libprocstat.h projects/zfsd/head/lib/libthread_db/arch/amd64/libpthread_md.c projects/zfsd/head/lib/libthread_db/arch/sparc64/libpthread_md.c projects/zfsd/head/lib/libthread_db/libthr_db.c projects/zfsd/head/lib/libusbhid/parse.c projects/zfsd/head/lib/libz/Makefile projects/zfsd/head/libexec/tftpd/tftp-transfer.c projects/zfsd/head/libexec/tftpd/tftpd.8 projects/zfsd/head/release/Makefile.sysinstall projects/zfsd/head/release/amd64/make-memstick.sh projects/zfsd/head/release/doc/en_US.ISO8859-1/hardware/article.sgml projects/zfsd/head/release/i386/make-memstick.sh projects/zfsd/head/release/powerpc/make-memstick.sh projects/zfsd/head/release/powerpc/mkisoimages.sh projects/zfsd/head/sbin/ifconfig/af_inet.c projects/zfsd/head/sbin/ifconfig/af_inet6.c projects/zfsd/head/sbin/ifconfig/ifconfig.c projects/zfsd/head/sbin/ifconfig/ifieee80211.c projects/zfsd/head/sbin/mount/mount.c projects/zfsd/head/sbin/rcorder/rcorder.8 projects/zfsd/head/share/man/man4/dc.4 projects/zfsd/head/share/man/man4/gif.4 projects/zfsd/head/share/man/man4/hptiop.4 projects/zfsd/head/share/man/man4/lmc.4 projects/zfsd/head/share/man/man4/mpt.4 projects/zfsd/head/share/man/man4/pcm.4 projects/zfsd/head/share/man/man4/rue.4 projects/zfsd/head/share/man/man4/smp.4 projects/zfsd/head/share/man/man4/stf.4 projects/zfsd/head/share/man/man4/wi.4 projects/zfsd/head/share/man/man5/reiserfs.5 projects/zfsd/head/share/man/man8/crash.8 projects/zfsd/head/share/man/man8/diskless.8 projects/zfsd/head/share/man/man9/taskqueue.9 projects/zfsd/head/share/man/man9/vfs_getopt.9 projects/zfsd/head/sys/amd64/amd64/genassym.c projects/zfsd/head/sys/amd64/amd64/intr_machdep.c projects/zfsd/head/sys/amd64/amd64/machdep.c projects/zfsd/head/sys/amd64/amd64/pmap.c projects/zfsd/head/sys/amd64/amd64/support.S projects/zfsd/head/sys/amd64/conf/GENERIC projects/zfsd/head/sys/amd64/include/param.h projects/zfsd/head/sys/amd64/linux32/linux32_machdep.c projects/zfsd/head/sys/arm/arm/irq_dispatch.S projects/zfsd/head/sys/arm/arm/pmap.c projects/zfsd/head/sys/arm/conf/AVILA projects/zfsd/head/sys/arm/conf/BWCT projects/zfsd/head/sys/arm/conf/CAMBRIA projects/zfsd/head/sys/arm/conf/CNS11XXNAS projects/zfsd/head/sys/arm/conf/CRB projects/zfsd/head/sys/arm/conf/DB-78XXX projects/zfsd/head/sys/arm/conf/DB-88F5XXX projects/zfsd/head/sys/arm/conf/DB-88F6XXX projects/zfsd/head/sys/arm/conf/DOCKSTAR projects/zfsd/head/sys/arm/conf/EP80219 projects/zfsd/head/sys/arm/conf/GUMSTIX projects/zfsd/head/sys/arm/conf/HL200 projects/zfsd/head/sys/arm/conf/HL201 projects/zfsd/head/sys/arm/conf/IQ31244 projects/zfsd/head/sys/arm/conf/KB920X projects/zfsd/head/sys/arm/conf/LN2410SBC projects/zfsd/head/sys/arm/conf/NSLU projects/zfsd/head/sys/arm/conf/QILA9G20 projects/zfsd/head/sys/arm/conf/SAM9G20EK projects/zfsd/head/sys/arm/conf/SHEEVAPLUG projects/zfsd/head/sys/arm/conf/SIMICS projects/zfsd/head/sys/arm/conf/TS7800 projects/zfsd/head/sys/arm/include/param.h projects/zfsd/head/sys/arm/sa11x0/sa11x0_irq.S projects/zfsd/head/sys/boot/common/util.c projects/zfsd/head/sys/boot/forth/loader.conf projects/zfsd/head/sys/boot/forth/loader.conf.5 projects/zfsd/head/sys/boot/powerpc/ps3/Makefile projects/zfsd/head/sys/boot/powerpc/ps3/conf.c projects/zfsd/head/sys/boot/powerpc/ps3/devicename.c projects/zfsd/head/sys/boot/powerpc/ps3/lv1call.S projects/zfsd/head/sys/boot/powerpc/ps3/lv1call.h projects/zfsd/head/sys/boot/powerpc/ps3/main.c projects/zfsd/head/sys/boot/powerpc/ps3/ps3stor.c projects/zfsd/head/sys/cam/ata/ata_da.c projects/zfsd/head/sys/cam/cam_periph.c projects/zfsd/head/sys/cam/cam_xpt.c projects/zfsd/head/sys/cam/cam_xpt.h projects/zfsd/head/sys/cddl/compat/opensolaris/sys/file.h projects/zfsd/head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c projects/zfsd/head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h projects/zfsd/head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h projects/zfsd/head/sys/compat/freebsd32/freebsd32.h projects/zfsd/head/sys/compat/freebsd32/freebsd32_ioctl.c projects/zfsd/head/sys/compat/linprocfs/linprocfs.c projects/zfsd/head/sys/compat/linux/linux_file.c projects/zfsd/head/sys/compat/linux/linux_ioctl.c projects/zfsd/head/sys/compat/linux/linux_socket.c projects/zfsd/head/sys/compat/linux/linux_stats.c projects/zfsd/head/sys/compat/svr4/svr4_fcntl.c projects/zfsd/head/sys/compat/svr4/svr4_filio.c projects/zfsd/head/sys/compat/svr4/svr4_ioctl.c projects/zfsd/head/sys/compat/svr4/svr4_misc.c projects/zfsd/head/sys/compat/svr4/svr4_stream.c projects/zfsd/head/sys/conf/NOTES projects/zfsd/head/sys/conf/files.powerpc projects/zfsd/head/sys/conf/newvers.sh projects/zfsd/head/sys/conf/options projects/zfsd/head/sys/dev/aac/aac_linux.c projects/zfsd/head/sys/dev/acpica/acpi_pcib_acpi.c projects/zfsd/head/sys/dev/ahci/ahci.c projects/zfsd/head/sys/dev/ahci/ahci.h projects/zfsd/head/sys/dev/amr/amr_linux.c projects/zfsd/head/sys/dev/ata/ata-pci.c projects/zfsd/head/sys/dev/ata/ata-pci.h projects/zfsd/head/sys/dev/ata/chipsets/ata-acard.c projects/zfsd/head/sys/dev/ata/chipsets/ata-acerlabs.c projects/zfsd/head/sys/dev/ata/chipsets/ata-intel.c projects/zfsd/head/sys/dev/ata/chipsets/ata-nvidia.c projects/zfsd/head/sys/dev/ata/chipsets/ata-promise.c projects/zfsd/head/sys/dev/ath/ath_dfs/null/dfs_null.c projects/zfsd/head/sys/dev/ath/ath_hal/ah.c projects/zfsd/head/sys/dev/ath/ath_hal/ah.h projects/zfsd/head/sys/dev/ath/ath_hal/ah_desc.h projects/zfsd/head/sys/dev/ath/ath_hal/ah_eeprom.h projects/zfsd/head/sys/dev/ath/ath_hal/ah_eeprom_9287.c projects/zfsd/head/sys/dev/ath/ath_hal/ah_eeprom_v14.c projects/zfsd/head/sys/dev/ath/ath_hal/ah_eeprom_v14.h projects/zfsd/head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c projects/zfsd/head/sys/dev/ath/ath_hal/ah_internal.h projects/zfsd/head/sys/dev/ath/ath_hal/ah_regdomain.c projects/zfsd/head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_ctry.h projects/zfsd/head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regenum.h projects/zfsd/head/sys/dev/ath/ath_hal/ar5212/ar5212.h projects/zfsd/head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c projects/zfsd/head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c projects/zfsd/head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c projects/zfsd/head/sys/dev/ath/ath_hal/ar5416/ar5416.h projects/zfsd/head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c projects/zfsd/head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c projects/zfsd/head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c projects/zfsd/head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c projects/zfsd/head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c projects/zfsd/head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c projects/zfsd/head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c projects/zfsd/head/sys/dev/ath/ath_hal/ar9002/ar9280.c projects/zfsd/head/sys/dev/ath/ath_hal/ar9002/ar9280.h projects/zfsd/head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c projects/zfsd/head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c projects/zfsd/head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c projects/zfsd/head/sys/dev/ath/if_ath.c projects/zfsd/head/sys/dev/ath/if_ath_sysctl.c projects/zfsd/head/sys/dev/ath/if_athdfs.h projects/zfsd/head/sys/dev/ath/if_athioctl.h projects/zfsd/head/sys/dev/ath/if_athvar.h projects/zfsd/head/sys/dev/hptiop/hptiop.c projects/zfsd/head/sys/dev/hwpmc/hwpmc_logging.c projects/zfsd/head/sys/dev/ipmi/ipmi_linux.c projects/zfsd/head/sys/dev/iscsi/initiator/iscsi.c projects/zfsd/head/sys/dev/isp/isp.c projects/zfsd/head/sys/dev/isp/isp_freebsd.c projects/zfsd/head/sys/dev/isp/isp_freebsd.h projects/zfsd/head/sys/dev/isp/isp_pci.c projects/zfsd/head/sys/dev/isp/ispvar.h projects/zfsd/head/sys/dev/mfi/mfi_linux.c projects/zfsd/head/sys/dev/mmc/mmcsd.c projects/zfsd/head/sys/dev/mpt/mpilib/mpi_ioc.h projects/zfsd/head/sys/dev/mpt/mpt.c projects/zfsd/head/sys/dev/mpt/mpt.h projects/zfsd/head/sys/dev/mpt/mpt_cam.c projects/zfsd/head/sys/dev/mpt/mpt_debug.c projects/zfsd/head/sys/dev/mpt/mpt_pci.c projects/zfsd/head/sys/dev/mpt/mpt_raid.c projects/zfsd/head/sys/dev/mpt/mpt_raid.h projects/zfsd/head/sys/dev/mpt/mpt_user.c projects/zfsd/head/sys/dev/pci/pci.c projects/zfsd/head/sys/dev/re/if_re.c projects/zfsd/head/sys/dev/snp/snp.c projects/zfsd/head/sys/dev/tdfx/tdfx_linux.c projects/zfsd/head/sys/dev/usb/input/ums.c projects/zfsd/head/sys/dev/usb/net/if_aue.c projects/zfsd/head/sys/dev/usb/net/if_axe.c projects/zfsd/head/sys/dev/usb/net/if_mos.c projects/zfsd/head/sys/dev/usb/net/if_rue.c projects/zfsd/head/sys/dev/usb/net/if_udav.c projects/zfsd/head/sys/dev/usb/serial/u3g.c projects/zfsd/head/sys/dev/usb/usb_dev.c projects/zfsd/head/sys/dev/usb/usb_device.c projects/zfsd/head/sys/dev/usb/usb_device.h projects/zfsd/head/sys/dev/usb/usb_request.c projects/zfsd/head/sys/dev/usb/usbdevs projects/zfsd/head/sys/dev/usb/usbdi.h projects/zfsd/head/sys/fs/cd9660/iso.h projects/zfsd/head/sys/fs/coda/coda_psdev.c projects/zfsd/head/sys/fs/devfs/devfs_devs.c projects/zfsd/head/sys/fs/fdescfs/fdesc_vnops.c projects/zfsd/head/sys/fs/msdosfs/msdosfsmount.h projects/zfsd/head/sys/fs/nfsclient/nfs_clnode.c projects/zfsd/head/sys/fs/nfsclient/nfs_clport.c projects/zfsd/head/sys/fs/nfsclient/nfs_clvnops.c projects/zfsd/head/sys/fs/nfsclient/nfsnode.h projects/zfsd/head/sys/fs/nfsserver/nfs_nfsdport.c projects/zfsd/head/sys/fs/nfsserver/nfs_nfsdserv.c projects/zfsd/head/sys/fs/ntfs/ntfs.h projects/zfsd/head/sys/fs/portalfs/portal_vfsops.c projects/zfsd/head/sys/fs/portalfs/portal_vnops.c projects/zfsd/head/sys/fs/smbfs/smbfs.h projects/zfsd/head/sys/gnu/fs/xfs/xfs_dfrag.c projects/zfsd/head/sys/i386/conf/GENERIC projects/zfsd/head/sys/i386/conf/XBOX projects/zfsd/head/sys/i386/conf/XEN projects/zfsd/head/sys/i386/i386/genassym.c projects/zfsd/head/sys/i386/i386/intr_machdep.c projects/zfsd/head/sys/i386/i386/machdep.c projects/zfsd/head/sys/i386/i386/pmap.c projects/zfsd/head/sys/i386/i386/support.s projects/zfsd/head/sys/i386/ibcs2/ibcs2_fcntl.c projects/zfsd/head/sys/i386/ibcs2/ibcs2_ioctl.c projects/zfsd/head/sys/i386/ibcs2/ibcs2_misc.c projects/zfsd/head/sys/i386/ibcs2/imgact_coff.c projects/zfsd/head/sys/i386/include/param.h projects/zfsd/head/sys/i386/linux/linux_machdep.c projects/zfsd/head/sys/i386/xen/pmap.c projects/zfsd/head/sys/ia64/conf/DEFAULTS projects/zfsd/head/sys/ia64/ia64/dump_machdep.c projects/zfsd/head/sys/ia64/ia64/locore.S projects/zfsd/head/sys/ia64/ia64/nexus.c projects/zfsd/head/sys/ia64/ia64/pmap.c projects/zfsd/head/sys/ia64/include/param.h projects/zfsd/head/sys/kern/capabilities.conf projects/zfsd/head/sys/kern/init_sysent.c projects/zfsd/head/sys/kern/kern_clock.c projects/zfsd/head/sys/kern/kern_conf.c projects/zfsd/head/sys/kern/kern_descrip.c projects/zfsd/head/sys/kern/kern_event.c projects/zfsd/head/sys/kern/kern_exec.c projects/zfsd/head/sys/kern/kern_intr.c projects/zfsd/head/sys/kern/kern_jail.c projects/zfsd/head/sys/kern/kern_linker.c projects/zfsd/head/sys/kern/kern_lock.c projects/zfsd/head/sys/kern/kern_proc.c projects/zfsd/head/sys/kern/kern_resource.c projects/zfsd/head/sys/kern/kern_shutdown.c projects/zfsd/head/sys/kern/sched_ule.c projects/zfsd/head/sys/kern/subr_pcpu.c projects/zfsd/head/sys/kern/subr_smp.c projects/zfsd/head/sys/kern/sys_capability.c projects/zfsd/head/sys/kern/sys_generic.c projects/zfsd/head/sys/kern/syscalls.c projects/zfsd/head/sys/kern/tty.c projects/zfsd/head/sys/kern/uipc_mqueue.c projects/zfsd/head/sys/kern/uipc_sem.c projects/zfsd/head/sys/kern/uipc_syscalls.c projects/zfsd/head/sys/kern/vfs_acl.c projects/zfsd/head/sys/kern/vfs_aio.c projects/zfsd/head/sys/kern/vfs_extattr.c projects/zfsd/head/sys/kern/vfs_lookup.c projects/zfsd/head/sys/kern/vfs_mount.c projects/zfsd/head/sys/kern/vfs_subr.c projects/zfsd/head/sys/kern/vfs_syscalls.c projects/zfsd/head/sys/mips/cavium/asm_octeon.S projects/zfsd/head/sys/mips/cavium/octeon_mp.c projects/zfsd/head/sys/mips/conf/XLP projects/zfsd/head/sys/mips/conf/XLP64 projects/zfsd/head/sys/mips/conf/XLPN32 projects/zfsd/head/sys/mips/include/param.h projects/zfsd/head/sys/mips/mips/dump_machdep.c projects/zfsd/head/sys/mips/mips/exception.S projects/zfsd/head/sys/mips/mips/pmap.c projects/zfsd/head/sys/net/if_lagg.c projects/zfsd/head/sys/net/route.c projects/zfsd/head/sys/net80211/ieee80211_proto.c projects/zfsd/head/sys/net80211/ieee80211_scan_sta.c projects/zfsd/head/sys/netgraph/ng_ether.c projects/zfsd/head/sys/netgraph/ng_mppc.c projects/zfsd/head/sys/netgraph/ng_parse.c projects/zfsd/head/sys/netgraph/ng_socket.c projects/zfsd/head/sys/netinet/in.c projects/zfsd/head/sys/netinet/ip_divert.c projects/zfsd/head/sys/netinet/sctp.h projects/zfsd/head/sys/netinet/sctp_asconf.c projects/zfsd/head/sys/netinet/sctp_cc_functions.c projects/zfsd/head/sys/netinet/sctp_constants.h projects/zfsd/head/sys/netinet/sctp_header.h projects/zfsd/head/sys/netinet/sctp_indata.c projects/zfsd/head/sys/netinet/sctp_input.c projects/zfsd/head/sys/netinet/sctp_output.c projects/zfsd/head/sys/netinet/sctp_output.h projects/zfsd/head/sys/netinet/sctp_pcb.c projects/zfsd/head/sys/netinet/sctp_pcb.h projects/zfsd/head/sys/netinet/sctp_structs.h projects/zfsd/head/sys/netinet/sctp_sysctl.c projects/zfsd/head/sys/netinet/sctp_sysctl.h projects/zfsd/head/sys/netinet/sctp_timer.c projects/zfsd/head/sys/netinet/sctp_timer.h projects/zfsd/head/sys/netinet/sctp_uio.h projects/zfsd/head/sys/netinet/sctp_usrreq.c projects/zfsd/head/sys/netinet/sctp_var.h projects/zfsd/head/sys/netinet/sctputil.c projects/zfsd/head/sys/netinet6/sctp6_usrreq.c projects/zfsd/head/sys/nfsclient/nfs_bio.c projects/zfsd/head/sys/nfsclient/nfs_node.c projects/zfsd/head/sys/nfsclient/nfs_vfsops.c projects/zfsd/head/sys/nfsclient/nfs_vnops.c projects/zfsd/head/sys/nfsclient/nfsnode.h projects/zfsd/head/sys/nfsserver/nfs_srvkrpc.c projects/zfsd/head/sys/pc98/conf/GENERIC projects/zfsd/head/sys/pc98/pc98/machdep.c projects/zfsd/head/sys/pci/if_rlreg.h projects/zfsd/head/sys/powerpc/aim/locore32.S projects/zfsd/head/sys/powerpc/aim/locore64.S projects/zfsd/head/sys/powerpc/aim/mmu_oea.c projects/zfsd/head/sys/powerpc/aim/mmu_oea64.c projects/zfsd/head/sys/powerpc/booke/locore.S projects/zfsd/head/sys/powerpc/booke/platform_bare.c projects/zfsd/head/sys/powerpc/booke/pmap.c projects/zfsd/head/sys/powerpc/conf/MPC85XX projects/zfsd/head/sys/powerpc/include/param.h projects/zfsd/head/sys/powerpc/include/pmap.h projects/zfsd/head/sys/powerpc/mpc85xx/atpic.c projects/zfsd/head/sys/powerpc/powermac/fcu.c projects/zfsd/head/sys/security/audit/audit.h projects/zfsd/head/sys/security/audit/audit_arg.c projects/zfsd/head/sys/security/audit/audit_bsm.c projects/zfsd/head/sys/security/audit/audit_private.h projects/zfsd/head/sys/security/mac/mac_syscalls.c projects/zfsd/head/sys/sparc64/conf/GENERIC projects/zfsd/head/sys/sparc64/include/param.h projects/zfsd/head/sys/sparc64/sparc64/dump_machdep.c projects/zfsd/head/sys/sparc64/sparc64/exception.S projects/zfsd/head/sys/sparc64/sparc64/intr_machdep.c projects/zfsd/head/sys/sparc64/sparc64/mp_machdep.c projects/zfsd/head/sys/sparc64/sparc64/pmap.c projects/zfsd/head/sys/sparc64/sparc64/tsb.c projects/zfsd/head/sys/sys/capability.h projects/zfsd/head/sys/sys/file.h projects/zfsd/head/sys/sys/filedesc.h projects/zfsd/head/sys/sys/interrupt.h projects/zfsd/head/sys/sys/mount.h projects/zfsd/head/sys/sys/namei.h projects/zfsd/head/sys/sys/param.h projects/zfsd/head/sys/sys/pcpu.h projects/zfsd/head/sys/sys/resourcevar.h projects/zfsd/head/sys/sys/syscall.h projects/zfsd/head/sys/sys/syscall.mk projects/zfsd/head/sys/sys/sysproto.h projects/zfsd/head/sys/sys/systm.h projects/zfsd/head/sys/sys/user.h projects/zfsd/head/sys/ufs/ffs/ffs_alloc.c projects/zfsd/head/sys/ufs/ffs/ffs_softdep.c projects/zfsd/head/sys/ufs/ffs/ffs_vfsops.c projects/zfsd/head/sys/ufs/ffs/ffs_vnops.c projects/zfsd/head/sys/ufs/ufs/inode.h projects/zfsd/head/sys/vm/device_pager.c projects/zfsd/head/sys/vm/swap_pager.c projects/zfsd/head/sys/vm/swap_pager.h projects/zfsd/head/sys/vm/vm_contig.c projects/zfsd/head/sys/vm/vm_kern.c projects/zfsd/head/sys/vm/vm_mmap.c projects/zfsd/head/sys/vm/vm_object.c projects/zfsd/head/sys/vm/vm_page.c projects/zfsd/head/sys/vm/vm_page.h projects/zfsd/head/tools/regression/netinet/tcpdrop/tcpdrop.c projects/zfsd/head/tools/regression/security/cap_test/Makefile projects/zfsd/head/tools/regression/security/cap_test/cap_test.c projects/zfsd/head/tools/regression/security/cap_test/cap_test.h projects/zfsd/head/tools/regression/security/cap_test/cap_test_capmode.c projects/zfsd/head/tools/regression/security/cap_test/cap_test_sysctl.c projects/zfsd/head/tools/tools/README projects/zfsd/head/tools/tools/ath/Makefile projects/zfsd/head/tools/tools/sysdoc/tunables.mdoc projects/zfsd/head/usr.bin/ar/write.c projects/zfsd/head/usr.bin/catman/catman.c projects/zfsd/head/usr.bin/cpio/Makefile projects/zfsd/head/usr.bin/man/man.1 projects/zfsd/head/usr.bin/netstat/sctp.c projects/zfsd/head/usr.bin/procstat/procstat.1 projects/zfsd/head/usr.bin/procstat/procstat.c projects/zfsd/head/usr.bin/procstat/procstat.h projects/zfsd/head/usr.bin/procstat/procstat_cred.c projects/zfsd/head/usr.bin/procstat/procstat_files.c projects/zfsd/head/usr.bin/procstat/procstat_kstack.c projects/zfsd/head/usr.bin/procstat/procstat_threads.c projects/zfsd/head/usr.bin/tail/forward.c projects/zfsd/head/usr.bin/tar/Makefile projects/zfsd/head/usr.bin/top/machine.c projects/zfsd/head/usr.bin/unzip/unzip.1 projects/zfsd/head/usr.bin/usbhidaction/usbhidaction.c projects/zfsd/head/usr.bin/usbhidctl/usbhid.c projects/zfsd/head/usr.bin/vmstat/vmstat.c projects/zfsd/head/usr.bin/xlint/lint1/tree.c projects/zfsd/head/usr.sbin/Makefile projects/zfsd/head/usr.sbin/bsdinstall/scripts/mirrorselect projects/zfsd/head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 projects/zfsd/head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 projects/zfsd/head/usr.sbin/diskinfo/diskinfo.c projects/zfsd/head/usr.sbin/faithd/faithd.8 projects/zfsd/head/usr.sbin/jail/jail.8 projects/zfsd/head/usr.sbin/jls/jls.c projects/zfsd/head/usr.sbin/makefs/cd9660.c projects/zfsd/head/usr.sbin/makefs/cd9660.h projects/zfsd/head/usr.sbin/makefs/cd9660/cd9660_conversion.c projects/zfsd/head/usr.sbin/makefs/cd9660/cd9660_eltorito.c projects/zfsd/head/usr.sbin/makefs/cd9660/cd9660_write.c projects/zfsd/head/usr.sbin/makefs/cd9660/iso9660_rrip.c projects/zfsd/head/usr.sbin/mergemaster/mergemaster.8 projects/zfsd/head/usr.sbin/mergemaster/mergemaster.sh projects/zfsd/head/usr.sbin/mfiutil/mfi_show.c projects/zfsd/head/usr.sbin/pmcstat/pmcstat.c projects/zfsd/head/usr.sbin/pmcstat/pmcstat.h projects/zfsd/head/usr.sbin/pmcstat/pmcstat_log.c projects/zfsd/head/usr.sbin/pw/pw_user.c projects/zfsd/head/usr.sbin/service/service.8 Directory Properties: projects/zfsd/head/ (props changed) projects/zfsd/head/cddl/contrib/opensolaris/ (props changed) projects/zfsd/head/contrib/ee/ (props changed) projects/zfsd/head/contrib/expat/ (props changed) projects/zfsd/head/contrib/file/ (props changed) projects/zfsd/head/contrib/gdb/ (props changed) projects/zfsd/head/contrib/gnu-sort/ (props changed) projects/zfsd/head/contrib/groff/ (props changed) projects/zfsd/head/contrib/less/ (props changed) projects/zfsd/head/contrib/libpcap/ (props changed) projects/zfsd/head/contrib/ncurses/ (props changed) projects/zfsd/head/contrib/one-true-awk/ (props changed) projects/zfsd/head/contrib/openbsm/ (props changed) projects/zfsd/head/contrib/openpam/ (props changed) projects/zfsd/head/contrib/pf/ (props changed) projects/zfsd/head/contrib/tcpdump/ (props changed) projects/zfsd/head/contrib/tcsh/ (props changed) projects/zfsd/head/contrib/tnftp/ (props changed) projects/zfsd/head/contrib/tzcode/stdtime/ (props changed) projects/zfsd/head/contrib/tzcode/zic/ (props changed) projects/zfsd/head/contrib/tzdata/ (props changed) projects/zfsd/head/contrib/wpa/ (props changed) projects/zfsd/head/lib/libutil/ (props changed) projects/zfsd/head/lib/libz/ (props changed) projects/zfsd/head/sbin/ (props changed) projects/zfsd/head/sbin/ipfw/ (props changed) projects/zfsd/head/share/mk/bsd.arch.inc.mk (props changed) projects/zfsd/head/sys/contrib/dev/acpica/ (props changed) projects/zfsd/head/usr.bin/csup/ (props changed) projects/zfsd/head/usr.bin/procstat/ (props changed) projects/zfsd/head/usr.sbin/rtadvctl/ (props changed) projects/zfsd/head/usr.sbin/rtadvd/ (props changed) Modified: projects/zfsd/head/MAINTAINERS ============================================================================== --- projects/zfsd/head/MAINTAINERS Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/MAINTAINERS Mon Aug 15 20:31:27 2011 (r224899) @@ -115,7 +115,6 @@ lib/libsdp emax Pre-commit review prefe usr.bin/bluetooth emax Pre-commit review preferred. usr.sbin/bluetooth emax Pre-commit review preferred. gnu/usr.bin/send-pr bugmaster Pre-commit review requested. -ncurses rafan Heads-up appreciated, try not to break it. *env(3) secteam Due to the problematic security history of this code, please have patches reviewed by secteam. share/zoneinfo edwin Heads-up appreciated, since our data is coming Modified: projects/zfsd/head/Makefile.inc1 ============================================================================== --- projects/zfsd/head/Makefile.inc1 Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/Makefile.inc1 Mon Aug 15 20:31:27 2011 (r224899) @@ -1014,6 +1014,10 @@ _lex= usr.bin/lex _yacc= usr.bin/yacc .endif +.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 +_awk= usr.bin/awk +.endif + .if ${BOOTSTRAPPING} < 700018 _gensnmptree= usr.sbin/bsnmpd/gensnmptree .endif @@ -1052,6 +1056,7 @@ bootstrap-tools: ${_groff} \ ${_ar} \ ${_dtc} \ + ${_awk} \ usr.bin/lorder \ usr.bin/makewhatis \ ${_mklocale} \ Modified: projects/zfsd/head/bin/ps/keyword.c ============================================================================== --- projects/zfsd/head/bin/ps/keyword.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/bin/ps/keyword.c Mon Aug 15 20:31:27 2011 (r224899) @@ -82,7 +82,7 @@ static VAR var[] = { {"class", "CLASS", NULL, LJUST, loginclass, s_loginclass, MAXLOGNAME-1, 0, CHAR, NULL, 0}, {"comm", "COMMAND", NULL, LJUST, ucomm, s_comm, - COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0}, + COMMLEN + TDNAMLEN + 1, 0, CHAR, NULL, 0}, {"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0, CHAR, NULL, 0}, {"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d", @@ -212,7 +212,7 @@ static VAR var[] = { {"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0}, {"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0}, {"ucomm", "UCOMM", NULL, LJUST, ucomm, s_comm, - COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0}, + COMMLEN + TDNAMLEN + 1, 0, CHAR, NULL, 0}, {"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT, UIDFMT, 0}, {"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0}, Modified: projects/zfsd/head/bin/ps/print.c ============================================================================== --- projects/zfsd/head/bin/ps/print.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/bin/ps/print.c Mon Aug 15 20:31:27 2011 (r224899) @@ -136,7 +136,7 @@ command(KINFO *k, VARENT *ve) (void)printf("%s", k->ki_d.prefix); (void)printf("%s", k->ki_p->ki_comm); if (showthreads && k->ki_p->ki_numthreads > 1) - (void)printf("/%s", k->ki_p->ki_ocomm); + (void)printf("/%s", k->ki_p->ki_tdname); } else (void)printf("%-*s", v->width, k->ki_p->ki_comm); return; @@ -190,7 +190,7 @@ command(KINFO *k, VARENT *ve) void ucomm(KINFO *k, VARENT *ve) { - char tmpbuff[COMMLEN + OCOMMLEN + 2]; + char tmpbuff[COMMLEN + TDNAMLEN + 2]; VAR *v; v = ve->var; @@ -199,12 +199,12 @@ ucomm(KINFO *k, VARENT *ve) (void)printf("%s", k->ki_d.prefix); (void)printf("%s", k->ki_p->ki_comm); if (showthreads && k->ki_p->ki_numthreads > 1) - printf("/%s", k->ki_p->ki_ocomm); + printf("/%s", k->ki_p->ki_tdname); } else { bzero(tmpbuff, sizeof(tmpbuff)); if (showthreads && k->ki_p->ki_numthreads > 1) sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, - k->ki_p->ki_ocomm); + k->ki_p->ki_tdname); else sprintf(tmpbuff, "%s", k->ki_p->ki_comm); (void)printf("%-*s", v->width, tmpbuff); @@ -218,7 +218,7 @@ tdnam(KINFO *k, VARENT *ve) v = ve->var; if (showthreads && k->ki_p->ki_numthreads > 1) - (void)printf("%-*s", v->width, k->ki_p->ki_ocomm); + (void)printf("%-*s", v->width, k->ki_p->ki_tdname); else (void)printf("%-*s", v->width, " "); } @@ -943,12 +943,12 @@ loginclass(KINFO *k, VARENT *ve) int s_comm(KINFO *k) { - char tmpbuff[COMMLEN + OCOMMLEN + 2]; + char tmpbuff[COMMLEN + TDNAMLEN + 2]; bzero(tmpbuff, sizeof(tmpbuff)); if (showthreads && k->ki_p->ki_numthreads > 1) sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, - k->ki_p->ki_ocomm); + k->ki_p->ki_tdname); else sprintf(tmpbuff, "%s", k->ki_p->ki_comm); return (strlen(tmpbuff)); Modified: projects/zfsd/head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- projects/zfsd/head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Aug 15 20:31:27 2011 (r224899) @@ -6,6 +6,7 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.\" Copyright 2011 Nexenta Systems, Inc. All rights reserved. .\" Copyright 2011 by Delphix. All rights reserved. .TH zfs 1M "24 Sep 2009" "SunOS 5.11" "System Administration Commands" .SH NAME @@ -642,7 +643,7 @@ When the property value is set to \fBpas .ad .sp .6 .RS 4n -Controls how an \fBACL\fR is modified during \fBchmod\fR(2). A file system with an \fBaclmode\fR property of \fBdiscard\fR deletes all \fBACL\fR entries that do not represent the mode of the file. An \fBaclmode\fR property of \fBgroupmask\fR (the default) reduces user or group permissions. The permissions are reduced, such that they are no greater than the group permission bits, unless it is a user entry that has the same \fBUID\fR as the owner of the file or directory. In this case, the \fBACL\fR permissions are reduced so that they are no greater than owner permission bits. A file system with an \fBaclmode\fR property of \fBpassthrough\fR indicates that no changes are made to the \fBACL\fR other than generating the necessary \fBACL\fR entries to represent the new mode of the file or directory. +Controls how an \fBACL\fR is modified during \fBchmod\fR(2). A file system with an \fBaclmode\fR property of \fBdiscard\fR (the default) deletes all \fBACL\fR entries that do not represent the mode of the file. An \fBaclmode\fR property of \fBgroupmask\fR reduces permissions granted in all \fBALLOW\fR entries found in the \fBACL\fR such that they are no greater than the group permissions specified by \fBchmod\fR. A file system with an \fBaclmode\fR property of \fBpassthrough\fR indicates that no changes are made to the \fBACL\fR other than creating or updating the necessary \fBACL\fR entries to represent the new mode of the file or directory. .RE .sp @@ -2697,7 +2698,7 @@ pool/home/bob setuid on pool/home/bob readonly off default pool/home/bob zoned off default pool/home/bob snapdir hidden default -pool/home/bob aclmode groupmask default +pool/home/bob aclmode discard default pool/home/bob aclinherit restricted default pool/home/bob canmount on default pool/home/bob shareiscsi off default Modified: projects/zfsd/head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- projects/zfsd/head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Aug 15 20:31:27 2011 (r224899) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. */ /* @@ -204,6 +205,7 @@ typedef struct ztest_od { */ typedef struct ztest_ds { objset_t *zd_os; + rwlock_t zd_zilog_lock; zilog_t *zd_zilog; uint64_t zd_seq; ztest_od_t *zd_od; /* debugging aid */ @@ -237,6 +239,7 @@ ztest_func_t ztest_dmu_commit_callbacks; ztest_func_t ztest_zap; ztest_func_t ztest_zap_parallel; ztest_func_t ztest_zil_commit; +ztest_func_t ztest_zil_remount; ztest_func_t ztest_dmu_read_write_zcopy; ztest_func_t ztest_dmu_objset_create_destroy; ztest_func_t ztest_dmu_prealloc; @@ -272,6 +275,7 @@ ztest_info_t ztest_info[] = { { ztest_zap_parallel, 100, &zopt_always }, { ztest_split_pool, 1, &zopt_always }, { ztest_zil_commit, 1, &zopt_incessant }, + { ztest_zil_remount, 1, &zopt_sometimes }, { ztest_dmu_read_write_zcopy, 1, &zopt_often }, { ztest_dmu_objset_create_destroy, 1, &zopt_often }, { ztest_dsl_prop_get_set, 1, &zopt_often }, @@ -985,6 +989,7 @@ ztest_zd_init(ztest_ds_t *zd, objset_t * zd->zd_seq = 0; dmu_objset_name(os, zd->zd_name); + VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++) @@ -1964,6 +1969,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object if (ztest_random(2) == 0) io_type = ZTEST_IO_WRITE_TAG; + (void) rw_rdlock(&zd->zd_zilog_lock); + switch (io_type) { case ZTEST_IO_WRITE_TAG: @@ -1999,6 +2006,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object break; } + (void) rw_unlock(&zd->zd_zilog_lock); + umem_free(data, blocksize); } @@ -2053,6 +2062,8 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ { zilog_t *zilog = zd->zd_zilog; + (void) rw_rdlock(&zd->zd_zilog_lock); + zil_commit(zilog, ztest_random(ZTEST_OBJECTS)); /* @@ -2064,6 +2075,31 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); zd->zd_seq = zilog->zl_commit_lr_seq; mutex_exit(&zilog->zl_lock); + + (void) rw_unlock(&zd->zd_zilog_lock); +} + +/* + * This function is designed to simulate the operations that occur during a + * mount/unmount operation. We hold the dataset across these operations in an + * attempt to expose any implicit assumptions about ZIL management. + */ +/* ARGSUSED */ +void +ztest_zil_remount(ztest_ds_t *zd, uint64_t id) +{ + objset_t *os = zd->zd_os; + + (void) rw_wrlock(&zd->zd_zilog_lock); + + /* zfsvfs_teardown() */ + zil_close(zd->zd_zilog); + + /* zfsvfs_setup() */ + VERIFY(zil_open(os, ztest_get_data) == zd->zd_zilog); + zil_replay(os, zd, ztest_replay_vector); + + (void) rw_unlock(&zd->zd_zilog_lock); } /* @@ -5137,6 +5173,7 @@ ztest_run(ztest_shared_t *zs) */ kernel_init(FREAD | FWRITE); VERIFY(spa_open(zs->zs_pool, &spa, FTAG) == 0); + spa->spa_debug = B_TRUE; zs->zs_spa = spa; spa->spa_dedup_ditto = 2 * ZIO_DEDUPDITTO_MIN; Modified: projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon Aug 15 20:31:27 2011 (r224899) @@ -4289,7 +4289,8 @@ zfs_jail(zfs_handle_t *zhp, int jailid, libzfs_handle_t *hdl = zhp->zfs_hdl; zfs_cmd_t zc = { 0 }; char errbuf[1024]; - int cmd, ret; + unsigned long cmd; + int ret; if (attach) { (void) snprintf(errbuf, sizeof (errbuf), Modified: projects/zfsd/head/contrib/bsnmp/snmp_usm/snmp_usm.3 ============================================================================== --- projects/zfsd/head/contrib/bsnmp/snmp_usm/snmp_usm.3 Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/bsnmp/snmp_usm/snmp_usm.3 Mon Aug 15 20:31:27 2011 (r224899) @@ -115,7 +115,7 @@ allowed. This column is used to create new USM user entries or delete existing ones from the table. .El -.EL +.El .Sh FILES .Bl -tag -width "XXXXXXXXX" .It Pa /usr/share/snmp/defs/usm_tree.def Modified: projects/zfsd/head/contrib/gcc/cp/ChangeLog ============================================================================== --- projects/zfsd/head/contrib/gcc/cp/ChangeLog Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/gcc/cp/ChangeLog Mon Aug 15 20:31:27 2011 (r224899) @@ -1,3 +1,9 @@ +2007-09-29 Jason Merrill + + PR c++/33094 + * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member + constant to not have DECL_EXTERNAL if it's file-local. + 2007-08-24 Jakub Jelinek PR c++/31941 Modified: projects/zfsd/head/contrib/gcc/cp/decl.c ============================================================================== --- projects/zfsd/head/contrib/gcc/cp/decl.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/gcc/cp/decl.c Mon Aug 15 20:31:27 2011 (r224899) @@ -4968,7 +4968,7 @@ make_rtl_for_nonlocal_decl (tree decl, t /* An in-class declaration of a static data member should be external; it is only a declaration, and not a definition. */ if (init == NULL_TREE) - gcc_assert (DECL_EXTERNAL (decl)); + gcc_assert (DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl)); } /* We don't create any RTL for local variables. */ Modified: projects/zfsd/head/contrib/gdb/FREEBSD-diffs ============================================================================== --- projects/zfsd/head/contrib/gdb/FREEBSD-diffs Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/gdb/FREEBSD-diffs Mon Aug 15 20:31:27 2011 (r224899) @@ -927,3 +927,39 @@ diff -N gdb/config/ia64/tm-fbsd.h +#include "ia64/tm-ia64.h" + +#endif /* TM_FBSD_H */ +Index: gdb/sparc64fbsd-tdep.c +=================================================================== +--- gdb/sparc64fbsd-tdep.c (revision 223862) ++++ gdb/sparc64fbsd-tdep.c (working copy) +@@ -64,6 +64,31 @@ sparc64fbsd_supply_fpregset (const struct regset * + { + sparc64_supply_fpregset (regcache, regnum, fpregs); + } ++ ++void ++supply_gregset (const void *gregs) ++{ ++ sparc64_supply_gregset (&sparc64fbsd_gregset, current_regcache, -1, gregs); ++} ++ ++void ++supply_fpregset (const void *fpregs) ++{ ++ sparc64_supply_fpregset (current_regcache, -1, fpregs); ++} ++ ++void ++fill_gregset (void *gregs, int regnum) ++{ ++ sparc64_collect_gregset (&sparc64fbsd_gregset, current_regcache, regnum, ++ gregs); ++} ++ ++void ++fill_fpregset (void *fpregs, int regnum) ++{ ++ sparc64_collect_fpregset (current_regcache, regnum, fpregs); ++} + + + /* Signal trampolines. */ Modified: projects/zfsd/head/contrib/gdb/gdb/sparc64fbsd-tdep.c ============================================================================== --- projects/zfsd/head/contrib/gdb/gdb/sparc64fbsd-tdep.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/gdb/gdb/sparc64fbsd-tdep.c Mon Aug 15 20:31:27 2011 (r224899) @@ -64,6 +64,31 @@ sparc64fbsd_supply_fpregset (const struc { sparc64_supply_fpregset (regcache, regnum, fpregs); } + +void +supply_gregset (const void *gregs) +{ + sparc64_supply_gregset (&sparc64fbsd_gregset, current_regcache, -1, gregs); +} + +void +supply_fpregset (const void *fpregs) +{ + sparc64_supply_fpregset (current_regcache, -1, fpregs); +} + +void +fill_gregset (void *gregs, int regnum) +{ + sparc64_collect_gregset (&sparc64fbsd_gregset, current_regcache, regnum, + gregs); +} + +void +fill_fpregset (void *fpregs, int regnum) +{ + sparc64_collect_fpregset (current_regcache, regnum, fpregs); +} /* Signal trampolines. */ Modified: projects/zfsd/head/contrib/one-true-awk/FIXES ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/FIXES Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/FIXES Mon Aug 15 20:31:27 2011 (r224899) @@ -25,6 +25,28 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +Aug 10, 2011: + another fix to avoid core dump with delete(ARGV); again, many thanks + to ruslan ermilov. + +Aug 7, 2011: + split(s, a, //) now behaves the same as split(s, a, "") + +Jun 12, 2011: + /pat/, \n /pat/ {...} is now legal, though bad style to use. + + added checks to new -v code that permits -vnospace; thanks to + ruslan ermilov for spotting this and providing the patch. + + removed fixed limit on number of open files; thanks to aleksey + cheusov and christos zoulos. + + fixed day 1 bug that resurrected deleted elements of ARGV when + used as filenames (in lib.c). + + minor type fiddles to make gcc -Wall -pedantic happier (but not + totally so); turned on -fno-strict-aliasing in makefile. + May 6, 2011: added #ifdef for isblank. now allows -ffoo as well as -f foo arguments. Modified: projects/zfsd/head/contrib/one-true-awk/awkgram.y ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/awkgram.y Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/awkgram.y Mon Aug 15 20:31:27 2011 (r224899) @@ -174,8 +174,8 @@ pa_pat: pa_stat: pa_pat { $$ = stat2(PASTAT, $1, stat2(PRINT, rectonode(), NIL)); } | pa_pat lbrace stmtlist '}' { $$ = stat2(PASTAT, $1, $3); } - | pa_pat ',' pa_pat { $$ = pa2stat($1, $3, stat2(PRINT, rectonode(), NIL)); } - | pa_pat ',' pa_pat lbrace stmtlist '}' { $$ = pa2stat($1, $3, $5); } + | pa_pat ',' opt_nl pa_pat { $$ = pa2stat($1, $4, stat2(PRINT, rectonode(), NIL)); } + | pa_pat ',' opt_nl pa_pat lbrace stmtlist '}' { $$ = pa2stat($1, $4, $6); } | lbrace stmtlist '}' { $$ = stat2(PASTAT, NIL, $2); } | XBEGIN lbrace stmtlist '}' { beginloc = linkum(beginloc, $3); $$ = 0; } Modified: projects/zfsd/head/contrib/one-true-awk/b.c ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/b.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/b.c Mon Aug 15 20:31:27 2011 (r224899) @@ -234,7 +234,7 @@ void freetr(Node *p) /* free parse tree /* in the parsing of regular expressions, metacharacters like . have */ /* to be seen literally; \056 is not a metacharacter. */ -int hexstr(char **pp) /* find and eval hex string at pp, return new p */ +int hexstr(uschar **pp) /* find and eval hex string at pp, return new p */ { /* only pick up one 8-bit byte (2 chars) */ uschar *p; int n = 0; @@ -248,16 +248,16 @@ int hexstr(char **pp) /* find and eval h else if (*p >= 'A' && *p <= 'F') n = 16 * n + *p - 'A' + 10; } - *pp = (char *) p; + *pp = (uschar *) p; return n; } #define isoctdigit(c) ((c) >= '0' && (c) <= '7') /* multiple use of arg */ -int quoted(char **pp) /* pick up next thing after a \\ */ +int quoted(uschar **pp) /* pick up next thing after a \\ */ /* and increment *pp */ { - char *p = *pp; + uschar *p = *pp; int c; if ((c = *p++) == 't') @@ -314,13 +314,13 @@ char *cclenter(const char *argp) /* add bp = buf; for (i = 0; (c = *p++) != 0; ) { if (c == '\\') { - c = quoted((char **) &p); + c = quoted(&p); } else if (c == '-' && i > 0 && bp[-1] != 0) { if (*p != 0) { c = bp[-1]; c2 = *p++; if (c2 == '\\') - c2 = quoted((char **) &p); + c2 = quoted(&p); if (collate_range_cmp(c, c2) > 0) { bp--; i--; @@ -807,7 +807,7 @@ int relex(void) /* lexical analyzer for case ')': return c; case '\\': - rlxval = quoted((char **) &prestr); + rlxval = quoted(&prestr); return CHAR; default: rlxval = c; Modified: projects/zfsd/head/contrib/one-true-awk/lex.c ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/lex.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/lex.c Mon Aug 15 20:31:27 2011 (r224899) @@ -411,7 +411,7 @@ int string(void) } *px = 0; unput(c); - sscanf(xbuf, "%x", &n); + sscanf(xbuf, "%x", (unsigned int *) &n); *bp++ = n; break; } Modified: projects/zfsd/head/contrib/one-true-awk/lib.c ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/lib.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/lib.c Mon Aug 15 20:31:27 2011 (r224899) @@ -89,8 +89,13 @@ void initgetrec(void) char *p; for (i = 1; i < *ARGC; i++) { - if (!isclvar(p = getargv(i))) { /* find 1st real filename */ - setsval(lookup("FILENAME", symtab), getargv(i)); + p = getargv(i); /* find 1st real filename */ + if (p == NULL || *p == '\0') { /* deleted or zapped */ + argno++; + continue; + } + if (!isclvar(p)) { + setsval(lookup("FILENAME", symtab), p); return; } setclvar(p); /* a commandline assignment before filename */ @@ -124,7 +129,7 @@ int getrec(char **pbuf, int *pbufsize, i dprintf( ("argno=%d, file=|%s|\n", argno, file) ); if (infile == NULL) { /* have to open a new file */ file = getargv(argno); - if (*file == '\0') { /* it's been zapped */ + if (file == NULL || *file == '\0') { /* deleted or zapped */ argno++; continue; } @@ -187,6 +192,7 @@ int readrec(char **pbuf, int *pbufsize, if (strlen(*FS) >= sizeof(inputFS)) FATAL("field separator %.10s... is too long", *FS); + /*fflush(stdout); avoids some buffering problem but makes it 25% slower*/ strcpy(inputFS, *FS); /* for subsequent field splitting */ if ((sep = **RS) == 0) { sep = '\n'; @@ -227,6 +233,8 @@ char *getargv(int n) /* get ARGV[n] */ extern Array *ARGVtab; sprintf(temp, "%d", n); + if (lookup(temp, ARGVtab) == NULL) + return NULL; x = setsymtab(temp, "", 0.0, STR, ARGVtab); s = getsval(x); dprintf( ("getargv(%d) returns |%s|\n", n, s) ); @@ -477,14 +485,14 @@ void recbld(void) /* create $0 from $1.. if (!adjbuf(&record, &recsize, 2+r-record, recsize, &r, "recbld 3")) FATAL("built giant record `%.30s...'", record); *r = '\0'; - dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, fldtab[0]) ); + dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); if (freeable(fldtab[0])) xfree(fldtab[0]->sval); fldtab[0]->tval = REC | STR | DONTFREE; fldtab[0]->sval = record; - dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, fldtab[0]) ); + dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); dprintf( ("recbld = |%s|\n", record) ); donerec = 1; } Modified: projects/zfsd/head/contrib/one-true-awk/main.c ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/main.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/main.c Mon Aug 15 20:31:27 2011 (r224899) @@ -25,7 +25,7 @@ THIS SOFTWARE. #include __FBSDID("$FreeBSD$"); -const char *version = "version 20110506 (FreeBSD)"; +const char *version = "version 20110810 (FreeBSD)"; #define DEBUG #include @@ -125,10 +125,20 @@ int main(int argc, char *argv[]) WARNING("field separator FS is empty"); break; case 'v': /* -v a=1 to be done NOW. one -v for each */ - if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1])) - setclvar(argv[1]); - else if (argv[1][2] != '\0') - setclvar(&argv[1][2]); + if (argv[1][2] != 0) { /* arg is -vsomething */ + if (isclvar(&argv[1][2])) + setclvar(&argv[1][2]); + else + FATAL("invalid -v option argument: %s", &argv[1][2]); + } else { /* arg is -v something */ + argc--; argv++; + if (argc <= 1) + FATAL("no variable name"); + if (isclvar(argv[1])) + setclvar(argv[1]); + else + FATAL("invalid -v option argument: %s", argv[1]); + } break; case 'd': dbg = atoi(&argv[1][2]); Modified: projects/zfsd/head/contrib/one-true-awk/makefile ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/makefile Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/makefile Mon Aug 15 20:31:27 2011 (r224899) @@ -30,7 +30,7 @@ CC = gcc -Wall -g CC = cc CC = gcc -Wall -g -Wwrite-strings CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov -CC = gcc -O4 +CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing YACC = bison -y YACC = yacc Modified: projects/zfsd/head/contrib/one-true-awk/proto.h ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/proto.h Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/proto.h Mon Aug 15 20:31:27 2011 (r224899) @@ -43,8 +43,8 @@ extern fa *mkdfa(const char *, int); extern int makeinit(fa *, int); extern void penter(Node *); extern void freetr(Node *); -extern int hexstr(char **); -extern int quoted(char **); +extern int hexstr(uschar **); +extern int quoted(uschar **); extern char *cclenter(const char *); extern void overflo(const char *); extern void cfoll(fa *, Node *); Modified: projects/zfsd/head/contrib/one-true-awk/run.c ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/run.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/run.c Mon Aug 15 20:31:27 2011 (r224899) @@ -1239,6 +1239,12 @@ Cell *split(Node **a, int nnn) /* split( ap->sval = (char *) makesymtab(NSYMTAB); n = 0; + if (arg3type == REGEXPR && strlen((char*)((fa*)a[2])->restr) == 0) { + /* split(s, a, //); have to arrange that it looks like empty sep */ + arg3type = 0; + fs = ""; + sep = 0; + } if (*s != '\0' && (strlen(fs) > 1 || arg3type == REGEXPR)) { /* reg expr */ fa *pfa; if (arg3type == REGEXPR) { /* it's ready already */ @@ -1621,17 +1627,25 @@ struct files { FILE *fp; const char *fname; int mode; /* '|', 'a', 'w' => LE/LT, GT */ -} files[FOPEN_MAX] ={ - { NULL, "/dev/stdin", LT }, /* watch out: don't free this! */ - { NULL, "/dev/stdout", GT }, - { NULL, "/dev/stderr", GT } -}; +} *files; + +int nfiles; void stdinit(void) /* in case stdin, etc., are not constants */ { - files[0].fp = stdin; - files[1].fp = stdout; - files[2].fp = stderr; + nfiles = FOPEN_MAX; + files = calloc(nfiles, sizeof(*files)); + if (files == NULL) + FATAL("can't allocate file memory for %u files", nfiles); + files[0].fp = stdin; + files[0].fname = "/dev/stdin"; + files[0].mode = LT; + files[1].fp = stdout; + files[1].fname = "/dev/stdout"; + files[1].mode = GT; + files[2].fp = stderr; + files[2].fname = "/dev/stderr"; + files[2].mode = GT; } FILE *openfile(int a, const char *us) @@ -1642,7 +1656,7 @@ FILE *openfile(int a, const char *us) if (*s == '\0') FATAL("null file name in print or getline"); - for (i=0; i < FOPEN_MAX; i++) + for (i=0; i < nfiles; i++) if (files[i].fname && strcmp(s, files[i].fname) == 0) { if (a == files[i].mode || (a==APPEND && files[i].mode==GT)) return files[i].fp; @@ -1652,11 +1666,19 @@ FILE *openfile(int a, const char *us) if (a == FFLUSH) /* didn't find it, so don't create it! */ return NULL; - for (i=0; i < FOPEN_MAX; i++) + for (i=0; i < nfiles; i++) if (files[i].fp == 0) break; - if (i >= FOPEN_MAX) - FATAL("%s makes too many open files", s); + if (i >= nfiles) { + struct files *nf; + int nnf = nfiles + FOPEN_MAX; + nf = realloc(files, nnf * sizeof(*nf)); + if (nf == NULL) + FATAL("cannot grow files for %s and %d files", s, nnf); + memset(&nf[nfiles], 0, FOPEN_MAX * sizeof(*nf)); + nfiles = nnf; + files = nf; + } fflush(stdout); /* force a semblance of order */ m = a; if (a == GT) { @@ -1684,7 +1706,7 @@ const char *filename(FILE *fp) { int i; - for (i = 0; i < FOPEN_MAX; i++) + for (i = 0; i < nfiles; i++) if (fp == files[i].fp) return files[i].fname; return "???"; @@ -1699,7 +1721,7 @@ Cell *closefile(Node **a, int n) x = execute(a[0]); getsval(x); stat = -1; - for (i = 0; i < FOPEN_MAX; i++) { + for (i = 0; i < nfiles; i++) { if (files[i].fname && strcmp(x->sval, files[i].fname) == 0) { if (ferror(files[i].fp)) WARNING( "i/o error occurred on %s", files[i].fname ); @@ -1743,7 +1765,7 @@ void flush_all(void) { int i; - for (i = 0; i < FOPEN_MAX; i++) + for (i = 0; i < nfiles; i++) if (files[i].fp) fflush(files[i].fp); } Modified: projects/zfsd/head/contrib/one-true-awk/tran.c ============================================================================== --- projects/zfsd/head/contrib/one-true-awk/tran.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/one-true-awk/tran.c Mon Aug 15 20:31:27 2011 (r224899) @@ -212,7 +212,7 @@ Cell *setsymtab(const char *n, const cha if (n != NULL && (p = lookup(n, tp)) != NULL) { dprintf( ("setsymtab found %p: n=%s s=\"%s\" f=%g t=%o\n", - p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); + (void*)p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); return(p); } p = (Cell *) malloc(sizeof(Cell)); @@ -231,7 +231,7 @@ Cell *setsymtab(const char *n, const cha p->cnext = tp->tab[h]; tp->tab[h] = p; dprintf( ("setsymtab set %p: n=%s s=\"%s\" f=%g t=%o\n", - p, p->nval, p->sval, p->fval, p->tval) ); + (void*)p, p->nval, p->sval, p->fval, p->tval) ); return(p); } @@ -298,7 +298,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f) / xfree(vp->sval); /* free any previous string */ vp->tval &= ~STR; /* mark string invalid */ vp->tval |= NUM; /* mark number ok */ - dprintf( ("setfval %p: %s = %g, t=%o\n", vp, NN(vp->nval), f, vp->tval) ); + dprintf( ("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, vp->tval) ); return vp->fval = f; } @@ -318,7 +318,7 @@ char *setsval(Cell *vp, const char *s) / int fldno; dprintf( ("starting setsval %p: %s = \"%s\", t=%o, r,f=%d,%d\n", - vp, NN(vp->nval), s, vp->tval, donerec, donefld) ); + (void*)vp, NN(vp->nval), s, vp->tval, donerec, donefld) ); if ((vp->tval & (NUM | STR)) == 0) funnyvar(vp, "assign to"); if (isfld(vp)) { @@ -338,7 +338,7 @@ char *setsval(Cell *vp, const char *s) / vp->tval |= STR; vp->tval &= ~DONTFREE; dprintf( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n", - vp, NN(vp->nval), t,t, vp->tval, donerec, donefld) ); + (void*)vp, NN(vp->nval), t,t, vp->tval, donerec, donefld) ); return(vp->sval = t); } @@ -355,7 +355,8 @@ Awkfloat getfval(Cell *vp) /* get float if (is_number(vp->sval) && !(vp->tval&CON)) vp->tval |= NUM; /* make NUM only sparingly */ } - dprintf( ("getfval %p: %s = %g, t=%o\n", vp, NN(vp->nval), vp->fval, vp->tval) ); + dprintf( ("getfval %p: %s = %g, t=%o\n", + (void*)vp, NN(vp->nval), vp->fval, vp->tval) ); return(vp->fval); } @@ -381,7 +382,8 @@ static char *get_str_val(Cell *vp, char vp->tval &= ~DONTFREE; vp->tval |= STR; } - dprintf( ("getsval %p: %s = \"%s (%p)\", t=%o\n", vp, NN(vp->nval), vp->sval, vp->sval, vp->tval) ); + dprintf( ("getsval %p: %s = \"%s (%p)\", t=%o\n", + (void*)vp, NN(vp->nval), vp->sval, vp->sval, vp->tval) ); return(vp->sval); } Modified: projects/zfsd/head/contrib/top/display.c ============================================================================== --- projects/zfsd/head/contrib/top/display.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/top/display.c Mon Aug 15 20:31:27 2011 (r224899) @@ -156,18 +156,30 @@ int display_updatecpus(statics) struct statics *statics; { + register int *lp; register int lines; register int i; /* call resize to do the dirty work */ lines = display_resize(); - num_cpus = statics->ncpus; + if (pcpu_stats) + num_cpus = statics->ncpus; + else + num_cpus = 1; cpustates_column = 5; /* CPU: */ if (num_cpus != 1) cpustates_column += 2; /* CPU 0: */ for (i = num_cpus; i > 9; i /= 10) cpustates_column++; + /* fill the "last" array with all -1s, to insure correct updating */ + lp = lcpustates; + i = num_cpustates * num_cpus; + while (--i >= 0) + { + *lp++ = -1; + } + return(lines); } @@ -197,7 +209,7 @@ struct statics *statics; num_swap = string_count(swap_names); lswap = (int *)malloc(num_swap * sizeof(int)); num_cpustates = string_count(cpustate_names); - lcpustates = (int *)malloc(num_cpustates * sizeof(int) * num_cpus); + lcpustates = (int *)malloc(num_cpustates * sizeof(int) * statics->ncpus); cpustate_columns = (int *)malloc(num_cpustates * sizeof(int)); memory_names = statics->memory_names; Modified: projects/zfsd/head/contrib/top/top.c ============================================================================== --- projects/zfsd/head/contrib/top/top.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/contrib/top/top.c Mon Aug 15 20:31:27 2011 (r224899) @@ -1029,8 +1029,8 @@ restart: case CMD_wcputog: ps.wcpu = !ps.wcpu; new_message(MT_standout | MT_delayed, - " Displaying %sCPU", - ps.wcpu ? "W" : ""); + " Displaying %s CPU", + ps.wcpu ? "weighted" : "raw"); header_text = format_header(uname_field); reset_display(); putchar('\r'); @@ -1094,7 +1094,7 @@ restart: new_message(MT_standout | MT_delayed, " Displaying %sCPU statistics.", pcpu_stats ? "per-" : "global "); - toggle_pcpustats(&statics); + toggle_pcpustats(); max_topn = display_updatecpus(&statics); reset_display(); putchar('\r'); Copied: projects/zfsd/head/crypto/openssh/README.hpn (from r224870, head/crypto/openssh/README.hpn) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/crypto/openssh/README.hpn Mon Aug 15 20:31:27 2011 (r224899, copy of r224870, head/crypto/openssh/README.hpn) @@ -0,0 +1,120 @@ +Notes: + +NONE CIPHER: + To use the NONE option you must have the NoneEnabled switch set on the server + and you MUST have *both* NoneEnabled and NoneSwitch set to yes on the client. + The NONE feature works with ALL ssh subsystems (as far as we can tell) + as long as there is no tty allocated. + If a user uses the -T switch to prevent a tty being created the NONE cipher + will be disabled. + + +PERFORMANCE: + The performance increase will only be as good as the network and TCP stack + tuning on the reciever side of the connection allows. As a rule of thumb a + user will need at least 10Mb/s connection with a 100ms RTT to see a doubling + of performance. + The HPN-SSH home page http://www.psc.edu/networking/projects/hpn-ssh + describes this in greater detail. + + +BUFFER SIZES: +- if HPN is disabled the receive buffer size will be set to the OpenSSH default + of 64K. + +- if a HPN system connects to a non-HPN system the receive buffer will + be set to the HPNBufferSize value. The default is 2MB but user adjustable. + +- If a HPN to HPN connection is established a number of different things might + happen based on the user options and conditions. + + Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set + Result: HPN Buffer Size = up to 64MB + This is the default state. The HPN buffer size will grow to a maximum of + 64MB as the TCP receive buffer grows. The maximum HPN Buffer size of 64MB + is geared towards 10GigE transcontinental connections. + + Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set + Result: HPN Buffer Size = TCP receive buffer value. + Users on non-autotuning systesm should disable TCPRcvBufPoll in the + ssh_cofig and sshd_config + + Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set + Result: HPN Buffer Size = minmum of TCP receive buffer and HPNBufferSize. + This would be the system defined TCP receive buffer (RWIN). + + Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf SET + Result: HPN Buffer Size = minmum of TCPRcvBuf and HPNBufferSize. + Generally there is no need to set both. + + Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set + Result: HPN Buffer Size = grows to HPNBufferSize + The buffer will grow up to the maximum size specified here. + + Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf SET + Result: HPN Buffer Size = minmum of TCPRcvBuf and HPNBufferSize. + Generally there is no need to set both of these, especially on autotuning + systems. However, if the users wishes to override the autotuning this would + be one way to do it. + + Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf SET + Result: HPN Buffer Size = TCPRcvBuf. + This will override autotuning and set the TCP recieve buffer to the user + defined value. + + +HPN SPECIFIC CONFIGURATION OPTIONS: + +- HPNDisabled=[yes/no] client/server + In some situations, such as transfers on a local area network, the impact + of the HPN code produces a net decrease in performance. In these cases it is + helpful to disable the HPN functionality. By default HPNDisabled is set to no. + +- HPNBufferSize=[int]KB client/server + This is the default buffer size the HPN functionality uses when interacting + with non-HPN SSH installations. Conceptually this is similar to the TcpRcvBuf + option as applied to the internal SSH flow control. This value can range from + 1KB to 64MB (1-65536). Use of oversized or undersized buffers can cause + performance problems depending on the roud trip time of the network path. + The default size of this buffer is 2MB. + +- TcpRcvBufPoll=[yes/no] client/server + Enable or disable the polling of the TCP receive buffer through the life + of the connection. You would want to make sure that this option is enabled + for systems making use of autotuning kernels (linux 2.4.24+, 2.6, MS Vista, + FreeBSD 7.x and later). Default is yes. + +- TcpRcvBuf=[int]KB client + Set the TCP socket receive buffer to n Kilobytes. It can be set up to the + maximum socket size allowed by the system. This is useful in situations where + the TCP receive window is set low but the maximum buffer size is set higher + (as is typical). This works on a per TCP connection basis. You can also use + this to artifically limit the transfer rate of the connection. In these cases + the throughput will be no more than n/RTT. The minimum buffer size is 1KB. + Default is the current system wide TCP receive buffer size. + +- NoneEnabled=[yes/no] client/server + Enable or disable the use of the None cipher. Care must always be used when + enabling this as it will allow users to send data in the clear. However, it + is important to note that authentication information remains encrypted even + if this option is enabled. Set to no by default. + +- NoneSwitch=[yes/no] client + Switch the encryption cipher being used to the None cipher after + authentication takes place. NoneEnabled must be enabled on both the client + and server side of the connection. When the connection switches to the NONE + cipher a warning is sent to STDERR. The connection attempt will fail with an + error if a client requests a NoneSwitch from the server that does not + explicitly have NoneEnabled set to yes. + Note: The NONE cipher cannot be used in interactive (shell) sessions and it + will fail silently. Set to no by default. + + +CREDITS: + + This patch was conceived, designed, and led by Chris Rapier (rapier@psc.edu) + The majority of the actual coding for versions up to HPN12v1 was performed + by Michael Stevens (mstevens@andrew.cmu.edu). + The MT-AES-CTR cipher was implemented by Ben Bennet (ben@psc.edu). + This work was financed, in part, by Cisco System, Inc., the National Library + of Medicine, and the National Science Foundation. Modified: projects/zfsd/head/crypto/openssh/buffer.c ============================================================================== --- projects/zfsd/head/crypto/openssh/buffer.c Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/crypto/openssh/buffer.c Mon Aug 15 20:31:27 2011 (r224899) @@ -1,4 +1,5 @@ /* $OpenBSD: buffer.c,v 1.32 2010/02/09 03:56:28 djm Exp $ */ +/* $FreeBSD$ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -25,7 +26,7 @@ #include "log.h" #define BUFFER_MAX_CHUNK 0x100000 -#define BUFFER_MAX_LEN 0xa00000 +#define BUFFER_MAX_LEN 0x4000000 /* 64MB */ #define BUFFER_ALLOCSZ 0x008000 /* Initializes the buffer structure. */ @@ -165,6 +166,13 @@ buffer_len(const Buffer *buffer) return buffer->end - buffer->offset; } +/* Returns the maximum number of bytes of data that may be in the buffer. */ +u_int +buffer_get_max_len(void) +{ + return (BUFFER_MAX_LEN); +} + /* Gets data from the beginning of the buffer. */ int Modified: projects/zfsd/head/crypto/openssh/buffer.h ============================================================================== --- projects/zfsd/head/crypto/openssh/buffer.h Mon Aug 15 19:29:25 2011 (r224898) +++ projects/zfsd/head/crypto/openssh/buffer.h Mon Aug 15 20:31:27 2011 (r224899) @@ -1,4 +1,5 @@ /* $OpenBSD: buffer.h,v 1.21 2010/08/31 11:54:45 djm Exp $ */ +/* $FreeBSD$ */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Tue Aug 16 04:35:43 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F5CE1065672; Tue, 16 Aug 2011 04:35:43 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA5A48FC13; Tue, 16 Aug 2011 04:35:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7G4Zg1t041038; Tue, 16 Aug 2011 04:35:42 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7G4ZgNO041036; Tue, 16 Aug 2011 04:35:42 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201108160435.p7G4ZgNO041036@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 16 Aug 2011 04:35:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224901 - projects/zfsd/head/sys/fs/devfs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 04:35:43 -0000 Author: gibbs Date: Tue Aug 16 04:35:42 2011 New Revision: 224901 URL: http://svn.freebsd.org/changeset/base/224901 Log: Correct the rendering of device aliases that reside in subdirectories of a devfs. devfs/devfs_vnops.c: In devfs_readlink(), convert the devfs root relative path of an alias's parent, that is recorded in the alias, into a fully qualified path that includes the root of the containing devfs. This avoids the ugliness of generating a relative path by prepending "../"'s. For a non-jailed process, the "symlink root" is the devfs's mount point. For a jailed process, we must remove any jail prefix in the mount point so that our response matches the user process's world view. Sponsored by: Spectra Logic Corporation Modified: projects/zfsd/head/sys/fs/devfs/devfs_vnops.c Modified: projects/zfsd/head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- projects/zfsd/head/sys/fs/devfs/devfs_vnops.c Tue Aug 16 00:43:25 2011 (r224900) +++ projects/zfsd/head/sys/fs/devfs/devfs_vnops.c Tue Aug 16 04:35:42 2011 (r224901) @@ -1248,8 +1248,53 @@ static int devfs_readlink(struct vop_readlink_args *ap) { struct devfs_dirent *de; + struct cdev_priv *cdp; de = ap->a_vp->v_data; + cdp = de->de_cdp; + + if (cdp != NULL && (cdp->cdp_c.si_flags & SI_ALIAS) != 0) { + struct devfs_mount *dmp; + struct prison *pr; + char *mp; + int mp_len; + int pr_path_len; + int err; + + /* + * For device aliases, construct an absolute symlink (to + * shorten its length and avoid the ugliness of a relative + * link) by prepending the fully qualified path to the root + * of this devfs. For a non-jailed process, the devfs root + * is our mount point. For a jailed process, we must remove + * any jail prefix in our mount point so that our response + * matches the user process's world view. + */ + dmp = VFSTODEVFS(ap->a_vp->v_mount); + mp = dmp->dm_mount->mnt_stat.f_mntonname; + mp_len = strlen(mp); + + pr = ap->a_cred->cr_prison; + pr_path_len = strlen(pr->pr_path); + + if (strncmp(pr->pr_path, mp, pr_path_len) == 0 + && mp[pr_path_len] == '/') { + mp += pr_path_len; + mp_len -= pr_path_len; + } + + err = uiomove(mp, mp_len, ap->a_uio); + if (err != 0) + return (err); + + /* + * Devfs cannot be the root file system, so its + * mount point must always be terminated by a '/'. + */ + err = uiomove("/", 1, ap->a_uio); + if (err != 0) + return (err); + } return (uiomove(de->de_symlink, strlen(de->de_symlink), ap->a_uio)); } From owner-svn-src-projects@FreeBSD.ORG Tue Aug 16 12:57:17 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2192D1065673 for ; Tue, 16 Aug 2011 12:57:17 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id CAB058FC13 for ; Tue, 16 Aug 2011 12:57:16 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 166144BB; Tue, 16 Aug 2011 14:41:16 +0200 (CEST) Date: Tue, 16 Aug 2011 14:41:02 +0200 From: Pawel Jakub Dawidek To: "Justin T. Gibbs" Message-ID: <20110816124102.GA1674@garage.freebsd.pl> References: <201108160435.p7G4ZgNO041036@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline In-Reply-To: <201108160435.p7G4ZgNO041036@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224901 - projects/zfsd/head/sys/fs/devfs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 12:57:17 -0000 --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 16, 2011 at 04:35:42AM +0000, Justin T. Gibbs wrote: > Author: gibbs > Date: Tue Aug 16 04:35:42 2011 > New Revision: 224901 > URL: http://svn.freebsd.org/changeset/base/224901 >=20 > Log: > Correct the rendering of device aliases that reside in subdirectories > of a devfs. > =20 > devfs/devfs_vnops.c: > In devfs_readlink(), convert the devfs root relative path > of an alias's parent, that is recorded in the alias, into a > fully qualified path that includes the root of the containing > devfs. This avoids the ugliness of generating a relative path > by prepending "../"'s. For a non-jailed process, the "symlink > root" is the devfs's mount point. For a jailed process, we > must remove any jail prefix in the mount point so that our > response matches the user process's world view. Note that currently realpath for both mount point and jail root is resolved by userland tools (mount(8) and jail(8)). It is still possible that someone will use nmount(2) or jail(2) system calls directly and will pass not a realpath, but something else (eg. ../../foo/bar). Because of this simple strncmp() is no reliable. The given paths should be resolved for those syscalls within the kernel using vn_fullpath_global(), then it would be more reliable. It still won't work when file system is mount, then its parent directory is renamed and jail created on now different path, but might be good enough. The best solution would be to build paths based on mount point vnode and jail's root vnode when needed. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk5KZV4ACgkQForvXbEpPzSntACgltTddTTdyXn9fBe8WPpG7O85 iK8AoI9x7m22BdWA9M0fMmTGCMMAHDaz =S01v -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1-- From owner-svn-src-projects@FreeBSD.ORG Tue Aug 16 16:28:12 2011 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 214EE106564A; Tue, 16 Aug 2011 16:28:12 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id CBD8A8FC12; Tue, 16 Aug 2011 16:28:11 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id E7D4757F; Tue, 16 Aug 2011 18:28:09 +0200 (CEST) Date: Tue, 16 Aug 2011 18:27:57 +0200 From: Pawel Jakub Dawidek To: "Justin T. Gibbs" Message-ID: <20110816162755.GB1712@garage.freebsd.pl> References: <201108160435.p7G4ZgNO041036@svn.freebsd.org> <20110816124102.GA1674@garage.freebsd.pl> <4E4A9984.2040305@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XOIedfhf+7KOe/yw" Content-Disposition: inline In-Reply-To: <4E4A9984.2040305@FreeBSD.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224901 - projects/zfsd/head/sys/fs/devfs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 16:28:12 -0000 --XOIedfhf+7KOe/yw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 16, 2011 at 10:23:32AM -0600, Justin T. Gibbs wrote: > > It still won't work when file system is mount, then its parent > > directory is renamed and jail created on now different path >=20 > I can't quite parse what you mean here. Can you provide an example? Hmm, something went wrong. Example might be clearer indeed: # mkdir -p /foo/bar # mount /dev/ada0p1 /foo/bar # mv /foo /baz # jail /baz/bar ... /foo/bar is stale here as his parent directory was renamed. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --XOIedfhf+7KOe/yw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk5KmosACgkQForvXbEpPzQ0uQCgpwfaupZBo3dVgGRo3fL7HXIz iy0AniiDgNWgFkNZG9inMa3WmCPy9TSn =gZsd -----END PGP SIGNATURE----- --XOIedfhf+7KOe/yw-- From owner-svn-src-projects@FreeBSD.ORG Tue Aug 16 16:49:51 2011 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53CCF1065670; Tue, 16 Aug 2011 16:49:51 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from aslan.scsiguy.com (mail.scsiguy.com [70.89.174.89]) by mx1.freebsd.org (Postfix) with ESMTP id 08DD88FC17; Tue, 16 Aug 2011 16:49:50 +0000 (UTC) Received: from Justins-MacBook-Pro.local (207-225-98-3.dia.static.qwest.net [207.225.98.3]) (authenticated bits=0) by aslan.scsiguy.com (8.14.4/8.14.4) with ESMTP id p7GGP5aN009180 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 16 Aug 2011 10:25:05 -0600 (MDT) (envelope-from gibbs@FreeBSD.org) Message-ID: <4E4A9984.2040305@FreeBSD.org> Date: Tue, 16 Aug 2011 10:23:32 -0600 From: "Justin T. Gibbs" Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201108160435.p7G4ZgNO041036@svn.freebsd.org> <20110816124102.GA1674@garage.freebsd.pl> In-Reply-To: <20110816124102.GA1674@garage.freebsd.pl> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (aslan.scsiguy.com [70.89.174.89]); Tue, 16 Aug 2011 10:25:05 -0600 (MDT) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224901 - projects/zfsd/head/sys/fs/devfs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gibbs@FreeBSD.org List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 16:49:51 -0000 On 8/16/11 6:41 AM, Pawel Jakub Dawidek wrote: > On Tue, Aug 16, 2011 at 04:35:42AM +0000, Justin T. Gibbs wrote: > > Author: gibbs > > Date: Tue Aug 16 04:35:42 2011 > > New Revision: 224901 > > URL: http://svn.freebsd.org/changeset/base/224901 > > > > Log: > > Correct the rendering of device aliases that reside in subdirectories > > of a devfs. > > > > devfs/devfs_vnops.c: > > In devfs_readlink(), convert the devfs root relative path > > of an alias's parent, that is recorded in the alias, into a > > fully qualified path that includes the root of the containing > > devfs. This avoids the ugliness of generating a relative path > > by prepending "../"'s. For a non-jailed process, the "symlink > > root" is the devfs's mount point. For a jailed process, we > > must remove any jail prefix in the mount point so that our > > response matches the user process's world view. > > Note that currently realpath for both mount point and jail root is > resolved by userland tools (mount(8) and jail(8)). It is still possible > that someone will use nmount(2) or jail(2) system calls directly and > will pass not a realpath, but something else (eg. ../../foo/bar). > Because of this simple strncmp() is no reliable. There is at least one other location in the kernel that make similar similar assumptions to those made in my changes to devfs_readlink(): prison_canseemount(). I'm sure there are others. > The given paths should be resolved for those syscalls within the kernel using > vn_fullpath_global(), then it would be more reliable. By "those syscalls", you mean nmount(2) and jail(8)? It would be nice to contain the "canonicalization logic" to as few places as possible or provide a clean API to do these conversions. > It still won't work when file system is mount, then its parent > directory is renamed and jail created on now different path I can't quite parse what you mean here. Can you provide an example? Thanks, Justin From owner-svn-src-projects@FreeBSD.ORG Tue Aug 16 19:46:13 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 746AC106564A; Tue, 16 Aug 2011 19:46:13 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62DFB8FC14; Tue, 16 Aug 2011 19:46:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GJkDLo070849; Tue, 16 Aug 2011 19:46:13 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GJkDBu070847; Tue, 16 Aug 2011 19:46:13 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201108161946.p7GJkDBu070847@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 16 Aug 2011 19:46:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224913 - projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 19:46:13 -0000 Author: gibbs Date: Tue Aug 16 19:46:13 2011 New Revision: 224913 URL: http://svn.freebsd.org/changeset/base/224913 Log: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c: When attaching to a vdev by GUIDs, verify both the pool and vdev GUIDS instead of just the vdev GUID. Sponsored by: Spectra Logic Corporation Modified: projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 16 14:25:41 2011 (r224912) +++ projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 16 19:46:13 2011 (r224913) @@ -170,20 +170,26 @@ vdev_geom_detach(void *arg, int flag __u } } -static uint64_t -nvlist_get_guid(nvlist_t *list) +static void +nvlist_get_guids(nvlist_t *list, uint64_t *pguid, uint64_t *vguid) { nvpair_t *elem = NULL; - uint64_t value; + *vguid = 0; + *pguid = 0; while ((elem = nvlist_next_nvpair(list, elem)) != NULL) { - if (nvpair_type(elem) == DATA_TYPE_UINT64 && - strcmp(nvpair_name(elem), "guid") == 0) { - VERIFY(nvpair_value_uint64(elem, &value) == 0); - return (value); + if (nvpair_type(elem) != DATA_TYPE_UINT64) + continue; + + if (strcmp(nvpair_name(elem), ZPOOL_CONFIG_POOL_GUID) == 0) { + VERIFY(nvpair_value_uint64(elem, pguid) == 0); + } else if (strcmp(nvpair_name(elem), ZPOOL_CONFIG_GUID) == 0) { + VERIFY(nvpair_value_uint64(elem, vguid) == 0); } + + if (*pguid != 0 && *vguid != 0) + break; } - return (0); } static int @@ -221,8 +227,8 @@ vdev_geom_io(struct g_consumer *cp, int return (error); } -static uint64_t -vdev_geom_read_guid(struct g_consumer *cp) +static void +vdev_geom_read_guids(struct g_consumer *cp, uint64_t *pguid, uint64_t *vguid) { struct g_provider *pp; vdev_label_t *label; @@ -230,13 +236,14 @@ vdev_geom_read_guid(struct g_consumer *c size_t buflen; uint64_t psize; off_t offset, size; - uint64_t guid; int error, l, len; g_topology_assert_not(); + *pguid = 0; + *vguid = 0; pp = cp->provider; - ZFS_LOG(1, "Reading guid from %s...", pp->name); + ZFS_LOG(1, "Reading guids from %s...", pp->name); psize = pp->mediasize; psize = P2ALIGN(psize, (uint64_t)sizeof(vdev_label_t)); @@ -244,7 +251,6 @@ vdev_geom_read_guid(struct g_consumer *c size = sizeof(*label) + pp->sectorsize - ((sizeof(*label) - 1) % pp->sectorsize) - 1; - guid = 0; label = kmem_alloc(size, KM_SLEEP); buflen = sizeof(label->vl_vdev_phys.vp_nvlist); @@ -262,16 +268,16 @@ vdev_geom_read_guid(struct g_consumer *c if (nvlist_unpack(buf, buflen, &config, 0) != 0) continue; - guid = nvlist_get_guid(config); + nvlist_get_guids(config, pguid, vguid); nvlist_free(config); - if (guid != 0) + if (*pguid != 0 && *vguid != 0) break; } kmem_free(label, size); - if (guid != 0) - ZFS_LOG(1, "guid for %s is %ju", pp->name, (uintmax_t)guid); - return (guid); + if (*pguid != 0 && *vguid != 0) + ZFS_LOG(1, "guids for %s are %ju:%ju", pp->name, + (uintmax_t)*pguid, (uintmax_t)*vguid); } static void @@ -283,13 +289,14 @@ vdev_geom_taste_orphan(struct g_consumer } static struct g_consumer * -vdev_geom_attach_by_guid(uint64_t guid) +vdev_geom_attach_by_guids(vdev_t *vd) { struct g_class *mp; struct g_geom *gp, *zgp; struct g_provider *pp; struct g_consumer *cp, *zcp; uint64_t pguid; + uint64_t vguid; g_topology_assert(); @@ -314,11 +321,12 @@ vdev_geom_attach_by_guid(uint64_t guid) continue; } g_topology_unlock(); - pguid = vdev_geom_read_guid(zcp); + vdev_geom_read_guids(zcp, &pguid, &vguid); g_topology_lock(); g_access(zcp, -1, 0, 0); g_detach(zcp); - if (pguid != guid) + if (pguid != spa_guid(vd->vdev_spa) || + vguid != vd->vdev_guid) continue; cp = vdev_geom_attach(pp); if (cp == NULL) { @@ -341,7 +349,7 @@ end: } static struct g_consumer * -vdev_geom_open_by_guid(vdev_t *vd) +vdev_geom_open_by_guids(vdev_t *vd) { struct g_consumer *cp; char *buf; @@ -349,8 +357,9 @@ vdev_geom_open_by_guid(vdev_t *vd) g_topology_assert(); - ZFS_LOG(1, "Searching by guid [%ju].", (uintmax_t)vd->vdev_guid); - cp = vdev_geom_attach_by_guid(vd->vdev_guid); + ZFS_LOG(1, "Searching by guids [%ju:%ju].", + (uintmax_t)spa_guid(vd->vdev_spa), (uintmax_t)vd->vdev_guid); + cp = vdev_geom_attach_by_guids(vd); if (cp != NULL) { len = strlen(cp->provider->name) + strlen("/dev/") + 1; buf = kmem_alloc(len, KM_SLEEP); @@ -359,10 +368,12 @@ vdev_geom_open_by_guid(vdev_t *vd) spa_strfree(vd->vdev_path); vd->vdev_path = buf; - ZFS_LOG(1, "Attach by guid [%ju] succeeded, provider %s.", + ZFS_LOG(1, "Attach by guids [%ju:%ju] succeeded, provider %s.", + (uintmax_t)spa_guid(vd->vdev_spa), (uintmax_t)vd->vdev_guid, vd->vdev_path); } else { - ZFS_LOG(1, "Search by guid [%ju] failed.", + ZFS_LOG(1, "Search by guids [%ju:%ju] failed.", + (uintmax_t)spa_guid(vd->vdev_spa), (uintmax_t)vd->vdev_guid); } @@ -374,7 +385,8 @@ vdev_geom_open_by_path(vdev_t *vd, int c { struct g_provider *pp; struct g_consumer *cp; - uint64_t guid; + uint64_t pguid; + uint64_t vguid; g_topology_assert(); @@ -386,16 +398,19 @@ vdev_geom_open_by_path(vdev_t *vd, int c if (cp != NULL && check_guid && ISP2(pp->sectorsize) && pp->sectorsize <= VDEV_PAD_SIZE) { g_topology_unlock(); - guid = vdev_geom_read_guid(cp); + vdev_geom_read_guids(cp, &pguid, &vguid); g_topology_lock(); - if (guid != vd->vdev_guid) { + if (pguid != spa_guid(vd->vdev_spa) || + vguid != vd->vdev_guid) { vdev_geom_detach(cp, 0); cp = NULL; ZFS_LOG(1, "guid mismatch for provider %s: " - "%ju != %ju.", vd->vdev_path, - (uintmax_t)vd->vdev_guid, (uintmax_t)guid); + "%ju:%ju != %ju:%ju.", vd->vdev_path, + (uintmax_t)spa_guid(vd->vdev_spa), + (uintmax_t)vd->vdev_guid, + (uintmax_t)pguid, (uintmax_t)vguid); } else { - ZFS_LOG(1, "guid match for provider %s.", + ZFS_LOG(1, "guids match for provider %s.", vd->vdev_path); } } @@ -442,7 +457,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi * moved around so try all other GEOM providers * to find one with the right guid. */ - cp = vdev_geom_open_by_guid(vd); + cp = vdev_geom_open_by_guids(vd); } } From owner-svn-src-projects@FreeBSD.ORG Tue Aug 16 20:29:03 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A60A9106566B; Tue, 16 Aug 2011 20:29:03 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9504A8FC16; Tue, 16 Aug 2011 20:29:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GKT3L3072287; Tue, 16 Aug 2011 20:29:03 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GKT3Ea072285; Tue, 16 Aug 2011 20:29:03 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201108162029.p7GKT3Ea072285@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 16 Aug 2011 20:29:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224916 - projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 20:29:03 -0000 Author: gibbs Date: Tue Aug 16 20:29:03 2011 New Revision: 224916 URL: http://svn.freebsd.org/changeset/base/224916 Log: Modify the geom vdev provider's open behavior so that it will only unconditionally open a device by path if the open is part of a pool create, pool split, or device add operation, and a search of all known geom provider's label data doesn't yield a device with matching pool and vdev GUIDs. This fixes a bug where the wrong disk could be associated with a vdev's configuration data when device devfs paths change due to insert and remove events. While, ZFS detects this kind of coding mixup and immediately flags the device as faulted before the confusion can cause permanent data loss, a reboot was necessary in order to resurrect the configuration. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c: Modify the open behavior to: - Open by recorded device path with GUID matching - If that fails, search all geom providers for a device with matching GUIDs. - If that fails and we are opening a "new to a pool configuration" vdev, open by path. - Otherwise fail the open. Sponsored by: Spectra Logic Corporation Modified: projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 16 20:13:17 2011 (r224915) +++ projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 16 20:29:03 2011 (r224916) @@ -442,23 +442,37 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi error = 0; /* - * If we're creating or splitting a pool, just find the GEOM provider - * by its name and ignore GUID mismatches. + * Try using the recorded path for this device, but only + * accept it if its label data contains the expected GUIDs. */ - if (vd->vdev_spa->spa_load_state == SPA_LOAD_NONE || - vd->vdev_spa->spa_splitting_newspa == B_TRUE) + cp = vdev_geom_open_by_path(vd, 1); + if (cp == NULL) { + /* + * The device at vd->vdev_path doesn't have the + * expected GUIDs. The disks might have merely + * moved around so try all other GEOM providers + * to find one with the right GUIDs. + */ + cp = vdev_geom_open_by_guids(vd); + } + + if (cp == NULL && + ((vd->vdev_prevstate == VDEV_STATE_UNKNOWN && + vd->vdev_spa->spa_load_state == SPA_LOAD_NONE) || + vd->vdev_spa->spa_splitting_newspa == B_TRUE)) { + /* + * We are dealing with a vdev that hasn't been previosly + * opened (since boot), and we are not loading an + * existing pool configuration (e.g. this operations is + * an add of a vdev to new or * existing pool) or we are + * in the process of splitting a pool. Find the GEOM + * provider by its name, ignoring GUID mismatches. + * + * XXPOLICY: It would be safer to only allow a device + * that is unlabeled or labeled but missing + * GUID information to be opened in this fashion. + */ cp = vdev_geom_open_by_path(vd, 0); - else { - cp = vdev_geom_open_by_path(vd, 1); - if (cp == NULL) { - /* - * The device at vd->vdev_path doesn't have the - * expected guid. The disks might have merely - * moved around so try all other GEOM providers - * to find one with the right guid. - */ - cp = vdev_geom_open_by_guids(vd); - } } if (cp == NULL) { From owner-svn-src-projects@FreeBSD.ORG Tue Aug 16 22:20:45 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A195D1065673; Tue, 16 Aug 2011 22:20:45 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 906508FC19; Tue, 16 Aug 2011 22:20:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GMKj7o075682; Tue, 16 Aug 2011 22:20:45 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GMKjke075680; Tue, 16 Aug 2011 22:20:45 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201108162220.p7GMKjke075680@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 16 Aug 2011 22:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224920 - projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 22:20:45 -0000 Author: gibbs Date: Tue Aug 16 22:20:45 2011 New Revision: 224920 URL: http://svn.freebsd.org/changeset/base/224920 Log: Close several race conditions in the ZFS vdev geom module, most triggered by concurrent ZFS reprobe and GEOM orphan processing. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c: o Make vdev_geom_close() synchronous instead of deferring its work to a GEOM event handler. This prevents a future open call from referencing a consumer that is scheduled for destruction. o Move initialization of the consumer private pointer (which references the ZFS vdev object using this consumer) into vdev_geom_attach(). This guarantees that an orphan event received during the small windows where the topology lock is dropped in open processing, is effective in marking a vdev as needing to be removed. o Move clearing of the consumer private pointer from vdev_geom_close() into vdev_geom_detach(). When vdev_geom_open() fails, vdev_geom_detach is called directly, which used to bypass this necessary step. o Modify vdev_geom_orphan handler to ignore a consumer that that is no longer associated with a vdev. Sponsored by: Spectra Logic Corporation Modified: projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 16 21:51:29 2011 (r224919) +++ projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 16 22:20:45 2011 (r224920) @@ -64,6 +64,10 @@ vdev_geom_orphan(struct g_consumer *cp) g_topology_assert(); vd = cp->private; + if (vd == NULL) { + /* Vdev close in progress. Ignore the event. */ + return; + } /* * Orphan callbacks occur from the GEOM event thread. @@ -85,7 +89,7 @@ vdev_geom_orphan(struct g_consumer *cp) } static struct g_consumer * -vdev_geom_attach(struct g_provider *pp) +vdev_geom_attach(struct g_provider *pp, vdev_t *vd) { struct g_geom *gp; struct g_consumer *cp; @@ -140,20 +144,27 @@ vdev_geom_attach(struct g_provider *pp) ZFS_LOG(1, "Used existing consumer for %s.", pp->name); } } + cp->private = vd; return (cp); } static void -vdev_geom_detach(void *arg, int flag __unused) +vdev_geom_detach(void *arg) { struct g_geom *gp; struct g_consumer *cp; + vdev_t *vd; g_topology_assert(); cp = arg; gp = cp->geom; ZFS_LOG(1, "Closing access to %s.", cp->provider->name); + vd = cp->private; + if (vd != NULL) { + vd->vdev_tsd = NULL; + cp->private = NULL; + } g_access(cp, -1, 0, -1); /* Destroy consumer on last close. */ if (cp->acr == 0 && cp->ace == 0) { @@ -328,7 +339,7 @@ vdev_geom_attach_by_guids(vdev_t *vd) if (pguid != spa_guid(vd->vdev_spa) || vguid != vd->vdev_guid) continue; - cp = vdev_geom_attach(pp); + cp = vdev_geom_attach(pp, vd); if (cp == NULL) { printf("ZFS WARNING: Unable to attach to %s.\n", pp->name); @@ -394,7 +405,7 @@ vdev_geom_open_by_path(vdev_t *vd, int c pp = g_provider_by_name(vd->vdev_path + sizeof("/dev/") - 1); if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); - cp = vdev_geom_attach(pp); + cp = vdev_geom_attach(pp, vd); if (cp != NULL && check_guid && ISP2(pp->sectorsize) && pp->sectorsize <= VDEV_PAD_SIZE) { g_topology_unlock(); @@ -402,7 +413,7 @@ vdev_geom_open_by_path(vdev_t *vd, int c g_topology_lock(); if (pguid != spa_guid(vd->vdev_spa) || vguid != vd->vdev_guid) { - vdev_geom_detach(cp, 0); + vdev_geom_detach(cp); cp = NULL; ZFS_LOG(1, "guid mismatch for provider %s: " "%ju:%ju != %ju:%ju.", vd->vdev_path, @@ -482,7 +493,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi !ISP2(cp->provider->sectorsize)) { ZFS_LOG(1, "Provider %s has unsupported sectorsize.", vd->vdev_path); - vdev_geom_detach(cp, 0); + vdev_geom_detach(cp); error = EINVAL; cp = NULL; } else if (cp->acw == 0 && (spa_mode(vd->vdev_spa) & FWRITE) != 0) { @@ -499,10 +510,11 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi if (error != 0) { printf("ZFS WARNING: Unable to open %s for writing (error=%d).\n", vd->vdev_path, error); - vdev_geom_detach(cp, 0); + vdev_geom_detach(cp); cp = NULL; } } + g_topology_unlock(); PICKUP_GIANT(); if (cp == NULL) { @@ -510,7 +522,6 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi return (error); } - cp->private = vd; vd->vdev_tsd = cp; pp = cp->provider; @@ -547,9 +558,9 @@ vdev_geom_close(vdev_t *vd) cp = vd->vdev_tsd; if (cp == NULL) return; - vd->vdev_tsd = NULL; - vd->vdev_delayed_close = B_FALSE; - g_post_event(vdev_geom_detach, cp, M_WAITOK, NULL); + g_topology_lock(); + vdev_geom_detach(cp); + g_topology_unlock(); } static void From owner-svn-src-projects@FreeBSD.ORG Tue Aug 16 22:33:06 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56F73106566B; Tue, 16 Aug 2011 22:33:06 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45AC08FC13; Tue, 16 Aug 2011 22:33:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GMX6kZ076070; Tue, 16 Aug 2011 22:33:06 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GMX6OD076068; Tue, 16 Aug 2011 22:33:06 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201108162233.p7GMX6OD076068@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 16 Aug 2011 22:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224921 - projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 22:33:06 -0000 Author: gibbs Date: Tue Aug 16 22:33:05 2011 New Revision: 224921 URL: http://svn.freebsd.org/changeset/base/224921 Log: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c: Subscribe to attribute change notifications and update vdev physical path information (in core and on disk) when a GEOM::physpath event indicates they have changed. Sponsored by: Spectra Logic Corporation Modified: projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 16 22:20:45 2011 (r224920) +++ projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 16 22:33:05 2011 (r224921) @@ -88,6 +88,59 @@ vdev_geom_orphan(struct g_consumer *cp) spa_async_request(vd->vdev_spa, SPA_ASYNC_REMOVE); } +static void +vdev_geom_attrchanged(struct g_consumer *cp, const char *attr) +{ + vdev_t *vd; + spa_t *spa; + char *physpath; + int error, physpath_len; + + g_topology_assert(); + + if (strcmp(attr, "GEOM::physpath") != 0) + return; + + if (g_access(cp, 1, 0, 0) != 0) + return; + + /* + * Record/Update physical path information for this device. + */ + vd = cp->private; + spa = vd->vdev_spa; + physpath_len = MAXPATHLEN; + physpath = g_malloc(physpath_len, M_WAITOK|M_ZERO); + error = g_io_getattr("GEOM::physpath", cp, &physpath_len, physpath); + g_access(cp, -1, 0, 0); + if (error == 0) { + char *old_physpath; + + old_physpath = vd->vdev_physpath; + vd->vdev_physpath = spa_strdup(physpath); + spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); + + if (old_physpath != NULL) { + int held_lock; + + held_lock = spa_config_held(spa, SCL_STATE, RW_WRITER); + if (held_lock == 0) { + g_topology_unlock(); + spa_config_enter(spa, SCL_STATE, FTAG, + RW_WRITER); + } + + spa_strfree(old_physpath); + + if (held_lock == 0) { + spa_config_exit(spa, SCL_STATE, FTAG); + g_topology_lock(); + } + } + } + g_free(physpath); +} + static struct g_consumer * vdev_geom_attach(struct g_provider *pp, vdev_t *vd) { @@ -108,6 +161,7 @@ vdev_geom_attach(struct g_provider *pp, if (gp == NULL) { gp = g_new_geomf(&zfs_vdev_class, "zfs::vdev"); gp->orphan = vdev_geom_orphan; + gp->attrchanged = vdev_geom_attrchanged; cp = g_new_consumer(gp); if (g_attach(cp, pp) != 0) { g_wither_geom(gp, ENXIO); @@ -144,7 +198,12 @@ vdev_geom_attach(struct g_provider *pp, ZFS_LOG(1, "Used existing consumer for %s.", pp->name); } } + cp->private = vd; + + /* Fetch initial physical path information for this device. */ + vdev_geom_attrchanged(cp, "GEOM::physpath"); + return (cp); } @@ -521,9 +580,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; return (error); } - - vd->vdev_tsd = cp; pp = cp->provider; + vd->vdev_tsd = cp; /* * Determine the actual size of the device. @@ -541,12 +599,6 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi */ vd->vdev_nowritecache = B_FALSE; - if (vd->vdev_physpath != NULL) - spa_strfree(vd->vdev_physpath); - bufsize = sizeof("/dev/") + strlen(pp->name); - vd->vdev_physpath = kmem_alloc(bufsize, KM_SLEEP); - snprintf(vd->vdev_physpath, bufsize, "/dev/%s", pp->name); - return (0); } From owner-svn-src-projects@FreeBSD.ORG Tue Aug 16 23:47:53 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDAC6106566B; Tue, 16 Aug 2011 23:47:53 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAE2B8FC1A; Tue, 16 Aug 2011 23:47:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GNlrjp078335; Tue, 16 Aug 2011 23:47:53 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GNlr4s078328; Tue, 16 Aug 2011 23:47:53 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201108162347.p7GNlr4s078328@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 16 Aug 2011 23:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224922 - in projects/zfsd/head: cddl/sbin cddl/sbin/zfsd etc/defaults etc/mtree etc/rc.d X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 23:47:53 -0000 Author: gibbs Date: Tue Aug 16 23:47:53 2011 New Revision: 224922 URL: http://svn.freebsd.org/changeset/base/224922 Log: Add ZFSD, a ZFS fault management daemon. This daemon has the following features: o When a vdev for an active pool is inserted into the system, it will re-integrate it with the pool. o When an unlabeled or inactive disk is inserted into the same physical location as a missing member of a pool with the "autoreplace" attribute set, the inserted disk will be used to replace the missing disk. o When the cumulative soft-error count for a vdev exceeds 50 errors, the vdev will be marked degraded, alerting users to a potential problem. The error counts are persisted across reboots. The daemon is written to be easily extended for more advanced fault management policies and to handle new features such as spare pool management. cddl/sbin/zfsd/zpool_list.cc: cddl/sbin/zfsd/zpool_list.h: ZpoolList is a standard container allowing filtering and iteration of imported ZFS pool information. cddl/sbin/zfsd/callout.cc: cddl/sbin/zfsd/callout.h: Timer services built on top of the POSIX interval timer API. cddl/sbin/zfsd/vdev.cc: cddl/sbin/zfsd/vdev.h: Wrapper class used to provide easy access to Vdev nvlist data. cddl/sbin/zfsd/zfsd.cc: cddl/sbin/zfsd/zfsd.h: Daemon main, devctl socket handling, and global application state exported through the ZfsDaemon singleton. cddl/sbin/zfsd/case_file.cc: cddl/sbin/zfsd/case_file.h: CaseFile objects aggregate vdev faults that may require ZFSD action in order to maintain the health of a ZFS pool. They also handle serialization/deserialization of fault data to persistent storage. cddl/sbin/zfsd/vdev_iterator.cc: cddl/sbin/zfsd/vdev_iterator.h: Helper class for traversing and finding vdev objects within a pool configuration. cddl/sbin/zfsd/dev_ctl_event.cc: cddl/sbin/zfsd/dev_ctl_event.h: Class hierarchy used to express events received via the devctl API. cddl/sbin/zfsd/zfsd_exception.cc: cddl/sbin/zfsd/zfsd_exception.h: Definition of exceptions explicitly thrown by ZFSD. cddl/sbin/zfsd/Makefile: cddl/sbin/Makefile: Add zfsd to the build. etc/rc.d/zfsd: Rc script for ZFSD. etc/defaults/rc.conf: ZFSD defaults, just like ZFS, to being disabled. etc/mtree/BSD.root.dist: Create the etc/zfs/cases directory used to store persistent fault data. Sponsored by: Spectra Logic Corporation Added: projects/zfsd/head/cddl/sbin/zfsd/ projects/zfsd/head/cddl/sbin/zfsd/Makefile projects/zfsd/head/cddl/sbin/zfsd/callout.cc projects/zfsd/head/cddl/sbin/zfsd/callout.h projects/zfsd/head/cddl/sbin/zfsd/case_file.cc projects/zfsd/head/cddl/sbin/zfsd/case_file.h projects/zfsd/head/cddl/sbin/zfsd/dev_ctl_event.cc projects/zfsd/head/cddl/sbin/zfsd/dev_ctl_event.h projects/zfsd/head/cddl/sbin/zfsd/vdev.cc projects/zfsd/head/cddl/sbin/zfsd/vdev.h projects/zfsd/head/cddl/sbin/zfsd/vdev_iterator.cc projects/zfsd/head/cddl/sbin/zfsd/vdev_iterator.h projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc projects/zfsd/head/cddl/sbin/zfsd/zfsd.h projects/zfsd/head/cddl/sbin/zfsd/zfsd_exception.cc projects/zfsd/head/cddl/sbin/zfsd/zfsd_exception.h projects/zfsd/head/cddl/sbin/zfsd/zpool_list.cc projects/zfsd/head/cddl/sbin/zfsd/zpool_list.h projects/zfsd/head/etc/rc.d/zfsd Modified: projects/zfsd/head/cddl/sbin/Makefile projects/zfsd/head/etc/defaults/rc.conf projects/zfsd/head/etc/mtree/BSD.root.dist Modified: projects/zfsd/head/cddl/sbin/Makefile ============================================================================== --- projects/zfsd/head/cddl/sbin/Makefile Tue Aug 16 22:33:05 2011 (r224921) +++ projects/zfsd/head/cddl/sbin/Makefile Tue Aug 16 23:47:53 2011 (r224922) @@ -2,11 +2,14 @@ .include -SUBDIR= ${_zfs} ${_zpool} +SUBDIR= ${_zfs} ${_zpool} ${_zfsd} .if ${MK_ZFS} != "no" _zfs= zfs _zpool= zpool +. if ${MK_CXX} != "no" +_zfsd= zfsd +. endif .endif .include Added: projects/zfsd/head/cddl/sbin/zfsd/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/cddl/sbin/zfsd/Makefile Tue Aug 16 23:47:53 2011 (r224922) @@ -0,0 +1,49 @@ +# $FreeBSD$ + +PROG_CXX= zfsd +SRCS= callout.cc \ + case_file.cc \ + dev_ctl_event.cc \ + vdev.cc \ + vdev_iterator.cc \ + zfsd.cc \ + zfsd_exception.cc \ + zpool_list.cc + +NO_MAN= YES + +WARNS?= 0 + +INCFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common +INCFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include +INCFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem +INCFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris +INCFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head +INCFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common +INCFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libumem/common +INCFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common +INCFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair +INCFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs +INCFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common +INCFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs +INCFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys + +CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} + +#NO_SHARED?= YES + +DPADD= ${LIBZFS} ${LIBUTIL} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} \ + ${LIBNVPAIR} ${LIBUUTIL} +LDADD= -lzfs -lutil -lgeom -lbsdxml -lsbuf -lnvpair -luutil + +#DPADD= ${LIBAVL} ${LIBZFS} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} \ +# ${LIBM} ${LIBNVPAIR} ${LIBUUTIL} ${LIBUTIL} +#LDADD= -lavl -lzfs -lgeom -lbsdxml -lsbuf \ +# -lm -lnvpair -luutil -lutil + +cscope: + find ${.CURDIR} -type f -a \( -name "*.[ch]" -o -name "*.cc" \) \ + > ${.CURDIR}/cscope.files + cd ${.CURDIR} && cscope -buq ${INCFLAGS} + +.include Added: projects/zfsd/head/cddl/sbin/zfsd/callout.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/cddl/sbin/zfsd/callout.cc Tue Aug 16 23:47:53 2011 (r224922) @@ -0,0 +1,162 @@ +/*- + * Copyright (c) 2011 Spectra Logic Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * Authors: Justin T. Gibbs (Spectra Logic Corporation) + */ + +#include +#include + +#include "callout.h" +#include "zfsd.h" +#include "zfsd_exception.h" + +std::list Callout::s_activeCallouts; +bool Callout::s_alarmFired(false); + +void +Callout::Init() +{ + signal(SIGALRM, Callout::AlarmSignalHandler); +} + +inline bool +Callout::Stop() +{ + if (!IsPending()) + return (false); + + for (std::list::iterator it(s_activeCallouts.begin()); + it != s_activeCallouts.end(); it++) { + if (*it != this) + continue; + + it = s_activeCallouts.erase(it); + if (it != s_activeCallouts.end()) { + + /* + * Maintain correct interval for the + * callouts that follow the just removed + * entry. + */ + timeradd(&(*it)->m_interval, &m_interval, + &(*it)->m_interval); + } + break; + } + m_pending = false; + return (true); +} + +bool +Callout::Reset(const timeval &interval, CalloutFunc_t *func, void *arg) +{ + bool cancelled(false); + + if (!timerisset(&interval)) + throw ZfsdException("Callout::Reset: interval of 0"); + + cancelled = Stop(); + + m_interval = interval; + m_func = func; + m_arg = arg; + m_pending = true; + + std::list::iterator it(s_activeCallouts.begin()); + for (; it != s_activeCallouts.end(); it++) { + + if (timercmp(&(*it)->m_interval, &m_interval, <=)) { + /* + * Decrease our interval by those that come + * before us. + */ + timersub(&m_interval, &(*it)->m_interval, &m_interval); + } else { + /* + * Account for the time between the newly + * inserted event and those that follow. + */ + timersub(&(*it)->m_interval, &m_interval, + &(*it)->m_interval); + break; + } + } + s_activeCallouts.insert(it, this); + + + if (s_activeCallouts.front() == this) { + itimerval timerval = { {0, 0}, m_interval }; + + setitimer(ITIMER_REAL, &timerval, NULL); + } + + return (cancelled); +} + +void +Callout::AlarmSignalHandler(int) +{ + s_alarmFired = true; + ZfsDaemon::WakeEventLoop(); +} + +void +Callout::ExpireCallouts() +{ + if (!s_alarmFired) + return; + + s_alarmFired = false; + if (s_activeCallouts.empty()) { + /* Callout removal/SIGALRM race was lost. */ + return; + } + + /* + * Expire the first callout (the one we used to set the + * interval timer) as well as any callouts following that + * expire at the same time (have a zero interval from + * the callout before it). + */ + do { + Callout *cur(s_activeCallouts.front()); + s_activeCallouts.pop_front(); + cur->m_pending = false; + cur->m_func(cur->m_arg); + } while (!s_activeCallouts.empty() + && timerisset(&s_activeCallouts.front()->m_interval) == 0); + + if (!s_activeCallouts.empty()) { + Callout *next(s_activeCallouts.front()); + itimerval timerval = { { 0, 0 }, next->m_interval }; + + setitimer(ITIMER_REAL, &timerval, NULL); + } +} Added: projects/zfsd/head/cddl/sbin/zfsd/callout.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/cddl/sbin/zfsd/callout.h Tue Aug 16 23:47:53 2011 (r224922) @@ -0,0 +1,170 @@ +/*- + * Copyright (c) 2011 Spectra Logic Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * Authors: Justin T. Gibbs (Spectra Logic Corporation) + */ + +/** + * \file callout.h + * + * \brief Interface for timer based callback services. + */ + +#ifndef _CALLOUT_H_ +#define _CALLOUT_H_ + +#include + +#include + +/** + * \brief Type of the function callback from a Callout. + */ +typedef void CalloutFunc_t(void *); + +/** + * \brief Interface to a schedulable one-shot timer with the granlarity + * of the system clock (see setitimer(2)). + * + * Determination of callback expiration is triggered by the SIGALRM + * signal. Callout callbacks are always delivered from Zfsd's event + * processing loop. + * + * Periodic actions can be triggered via the Callout mechanisms by + * resetting the Callout from within its callback. + */ +class Callout +{ +public: + + /** + * Initialize the Callout subsystem. + */ + static void Init(); + + /** + * Function called (via SIGALRM) when our interval + * timer expires. + */ + static void AlarmSignalHandler(int); + + /** + * Execute callbacks for all callouts that have the same + * expiration time as the first callout in the list. + */ + static void ExpireCallouts(); + + /** Constructor. */ + Callout(); + + /** + * returns true if callout has not been stopped, + * or deactivated since the last time the callout was + * reset. + */ + bool IsActive() const; + + /** + * Returns true if callout is still waiting to expire. + */ + bool IsPending() const; + + /** + * Disestablish a callout. + */ + bool Stop(); + + /** + * \brief Establish or change a timeout. + * + * \param interval Timeval indicating the time which must elapse + * before this callout fires. + * \param func Pointer to the callback funtion + * \param arg Argument pointer to pass to callback function + * + * \return Cancelation status. + * true: The previous callback was pending and therfore + * was cancelled. + * false: The callout was not pending at the time of this + * reset request. + * In all cases, a new callout is established. + */ + bool Reset(const timeval &interval, CalloutFunc_t *func, void *arg); + +private: + /** + * All active callouts sorted by expiration time. The callout + * with the nearest expiration time is at the head of the list. + */ + static std::list s_activeCallouts; + + /** + * The interval timer has expired. This variable is set from + * signal handler context and tested from Zfsd::EventLoop() + * context via ExpireCallouts(). + */ + static bool s_alarmFired; + + /** + * Time, realtive to others in the active list, until + * this callout is fired. + */ + timeval m_interval; + + /** Callback function argument. */ + void *m_arg; + + /** + * The callback function associated with this timer + * entry. + */ + CalloutFunc_t *m_func; + + /** State of this callout. */ + bool m_pending; +}; + +//- Callout public const methods ---------------------------------------------- +inline bool +Callout::IsPending() const +{ + return (m_pending); +} + +//- Callout public methods ---------------------------------------------------- +inline +Callout::Callout() + : m_arg(0), + m_func(NULL), + m_pending(false) +{ + timerclear(&m_interval); +} + +#endif /* CALLOUT_H_ */ Added: projects/zfsd/head/cddl/sbin/zfsd/case_file.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/zfsd/head/cddl/sbin/zfsd/case_file.cc Tue Aug 16 23:47:53 2011 (r224922) @@ -0,0 +1,684 @@ +/*- + * Copyright (c) 2011 Spectra Logic Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * Authors: Justin T. Gibbs (Spectra Logic Corporation) + */ + +/** + * \file case_file.cc + * + * We keep case files for any leaf vdev that is not in the optimal state. + * However, we only serialize to disk those events that need to be preserved + * across reboots. For now, this is just a log of soft errors which we + * accumulate in order to mark a device as degraded. + */ +#include +#include +#include +#include +#include + +#include "case_file.h" +#include "vdev.h" +#include "zfsd.h" +#include "zfsd_exception.h" +#include "zpool_list.h" + +/*============================ Namespace Control =============================*/ +using std::auto_ptr; +using std::hex; +using std::stringstream; +using std::setfill; +using std::setw; + +/*--------------------------------- CaseFile ---------------------------------*/ +//- CaseFile Static Data ------------------------------------------------------- +CaseFileList CaseFile::s_activeCases; +const string CaseFile::s_caseFilePath = "/etc/zfs/cases"; +const timeval CaseFile::s_removeGracePeriod = { 60 /*sec*/, 0 /*usec*/}; + +//- CaseFile Static Public Methods --------------------------------------------- +CaseFile * +CaseFile::Find(uint64_t poolGUID, uint64_t vdevGUID) +{ + for (CaseFileList::iterator curCase = s_activeCases.begin(); + curCase != s_activeCases.end(); curCase++) { + + if ((*curCase)->PoolGUID() != poolGUID + || (*curCase)->VdevGUID() != vdevGUID) + continue; + + /* + * We only carry one active case per-vdev. + */ + return (*curCase); + } + return (NULL); +} + +CaseFile * +CaseFile::Find(const string &physPath) +{ + for (CaseFileList::iterator curCase = s_activeCases.begin(); + curCase != s_activeCases.end(); curCase++) { + + if ((*curCase)->PhysicalPath() != physPath) + continue; + + return (*curCase); + } + return (NULL); +} + +CaseFile & +CaseFile::Create(Vdev &vdev) +{ + CaseFile *activeCase; + + activeCase = Find(vdev.PoolGUID(), vdev.GUID()); + if (activeCase == NULL) + activeCase = new CaseFile(vdev); + + return (*activeCase); +} + +void +CaseFile::DeSerialize() +{ + struct dirent **caseFiles; + + int numCaseFiles(scandir(s_caseFilePath.c_str(), &caseFiles, + DeSerializeSelector, /*compar*/NULL)); + + if (numCaseFiles == 0 || numCaseFiles == -1) + return; + + for (int i = 0; i < numCaseFiles; i++) { + + DeSerializeFile(caseFiles[i]->d_name); + free(caseFiles[i]); + } + free(caseFiles); +} + +void +CaseFile::LogAll() +{ + for (CaseFileList::iterator curCase = s_activeCases.begin(); + curCase != s_activeCases.end(); curCase++) + (*curCase)->Log(); +} + +void +CaseFile::PurgeAll() +{ + /* CaseFiles remove themselves from this list on destruction. */ + while (s_activeCases.size() != 0) + delete s_activeCases.front(); +} + +//- CaseFile Public Methods ---------------------------------------------------- +bool +CaseFile::RefreshVdevState() +{ + ZpoolList zpl(ZpoolList::ZpoolByGUID, &m_poolGUID); + if (zpl.empty()) { + syslog(LOG_INFO, + "CaseFile::RefreshVdevState: Unknown pool for " + "Vdev(%ju,%ju).\n", + m_poolGUID, m_vdevGUID); + return (false); + } + + zpool_handle_t *casePool(zpl.front()); + nvlist_t *vdevConfig = VdevIterator(casePool).Find(VdevGUID()); + if (vdevConfig == NULL) { + syslog(LOG_INFO, + "CaseFile::RefreshVdevState: Unknown Vdev(%s,%s).\n", + PoolGUIDString().c_str(), PoolGUIDString().c_str()); + return (false); + } + Vdev caseVdev(casePool, vdevConfig); + + m_vdevState = caseVdev.State(); + m_vdevPhysPath = caseVdev.PhysicalPath(); + return (true); +} + +bool +CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev) +{ + ZpoolList zpl(ZpoolList::ZpoolByGUID, &m_poolGUID); + + if (zpl.empty() || !RefreshVdevState()) { + /* + * The pool or vdev for this case file is no longer + * part of the configuration. This can happen + * if we process a device arrival notification + * before seeing the ZFS configuration change + * event. + */ + syslog(LOG_INFO, + "CaseFile::ReEvaluate(%s,%s) Pool/Vdev unconfigured. " + "Closing\n", + PoolGUIDString().c_str(), + VdevGUIDString().c_str()); + Close(); + + /* + * Since this event was not used to close this + * case, do not report it as consumed. + */ + return (/*consumed*/false); + } + zpool_handle_t *pool(zpl.front()); + + if (VdevState() > VDEV_STATE_CANT_OPEN) { + /* + * For now, newly discovered devices only help for + * devices that are missing. In the future, we might + * use a newly inserted spare to replace a degraded + * or faulted device. + */ + return (false); + } + + if (vdev != NULL + && vdev->PoolGUID() == m_poolGUID + && vdev->GUID() == m_vdevGUID) { + + zpool_vdev_online(pool, vdev->GUIDString().c_str(), + ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, + &m_vdevState); + syslog(LOG_INFO, "Onlined vdev(%s/%s:%s). State now %s.\n", + zpool_get_name(pool), vdev->GUIDString().c_str(), + devPath.c_str(), + zpool_state_to_name(VdevState(), VDEV_AUX_NONE)); + + /* + * Check the vdev state post the online action to see + * if we can retire this case. + */ + CloseIfSolved(); + + return (/*consumed*/true); + } + + /* + * If the auto-replace policy is enabled, and we have physical + * path information, try a physical path replacement. + */ + if (zpool_get_prop_int(pool, ZPOOL_PROP_AUTOREPLACE, NULL) == 0) { + syslog(LOG_INFO, + "CaseFile(%s:%s:%s): AutoReplace not set. " + "Ignoring device insertion.\n", + PoolGUIDString().c_str(), + VdevGUIDString().c_str(), + zpool_state_to_name(VdevState(), VDEV_AUX_NONE)); + return (false); + } + + if (PhysicalPath().empty()) { + syslog(LOG_INFO, + "CaseFile(%s:%s:%s): No vdev physical path information. " + "Ignoring device insertion.\n", + PoolGUIDString().c_str(), + VdevGUIDString().c_str(), + zpool_state_to_name(VdevState(), VDEV_AUX_NONE)); + return (false); + } + + if (physPath != PhysicalPath()) { + syslog(LOG_INFO, + "CaseFile(%s:%s:%s): Physical path mismatch. " + "Ignoring device insertion.\n", + PoolGUIDString().c_str(), + VdevGUIDString().c_str(), + zpool_state_to_name(VdevState(), VDEV_AUX_NONE)); + return (false); + } + + /* Write a label on the newly inserted disk. */ + if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str()) != 0) { + syslog(LOG_ERR, + "Replace vdev(%s/%s) by physical path (label): %s: %s\n", + zpool_get_name(pool), VdevGUIDString().c_str(), + libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + return (/*consumed*/false); + } + + /* + * Build a root vdev/leaf vdev configuration suitable for + * zpool_vdev_attach. Only enough data for the kernel to find + * the device (i.e. type and disk device node path) are needed. + */ + nvlist_t *nvroot(NULL); + nvlist_t *newvd(NULL); + if (nvlist_alloc(&nvroot, NV_UNIQUE_NAME, 0) != 0 + || nvlist_alloc(&newvd, NV_UNIQUE_NAME, 0) != 0) { + syslog(LOG_ERR, "Replace vdev(%s/%s) by physical path: " + "Unable to allocate configuration data.\n", + zpool_get_name(pool), VdevGUIDString().c_str()); + if (nvroot != NULL) + nvlist_free(nvroot); + return (/*consumed*/false); + } + + if (nvlist_add_string(newvd, ZPOOL_CONFIG_TYPE, VDEV_TYPE_DISK) != 0 + || nvlist_add_string(newvd, ZPOOL_CONFIG_PATH, devPath.c_str()) != 0 + || nvlist_add_string(nvroot, ZPOOL_CONFIG_TYPE, VDEV_TYPE_ROOT) != 0 + || nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, + &newvd, 1) != 0) { + syslog(LOG_ERR, "Replace vdev(%s/%s) by physical path: " + "Unable to initialize configuration data.\n", + zpool_get_name(pool), VdevGUIDString().c_str()); + nvlist_free(newvd); + nvlist_free(nvroot); + return (1); + } + + /* Data was copied when added to the root vdev. */ + nvlist_free(newvd); + + if (zpool_vdev_attach(pool, VdevGUIDString().c_str(), + devPath.c_str(), nvroot, + /*replace*/B_TRUE) != 0) { + syslog(LOG_ERR, + "Replace vdev(%s/%s) by physical path(attach): %s: %s\n", + zpool_get_name(pool), VdevGUIDString().c_str(), + libzfs_error_action(g_zfsHandle), + libzfs_error_description(g_zfsHandle)); + } else { + syslog(LOG_INFO, "Replacing vdev(%s/%s) with %s\n", + zpool_get_name(pool), VdevGUIDString().c_str(), + devPath.c_str()); + } + nvlist_free(nvroot); + + return (true); +} + +bool +CaseFile::ReEvaluate(const ZfsEvent &event) +{ + bool consumed(false); + + if (!RefreshVdevState()) { + /* + * The pool or vdev for this case file is no longer + * part of the configuration. This can happen + * if we process a device arrival notification + * before seeing the ZFS configuration change + * event. + */ + syslog(LOG_INFO, + "CaseFile::ReEvaluate(%s,%s) Pool/Vdev unconfigured. " + "Closing\n", + PoolGUIDString().c_str(), + VdevGUIDString().c_str()); + Close(); + + /* + * Since this event was not used to close this + * case, do not report it as consumed. + */ + return (/*consumed*/false); + } + + if (event.Value("type") == "misc.fs.zfs.vdev_remove") { + /* + * The Vdev we represent has been removed from the + * configuration. This case is no longer of value. + */ + Close(); + + return (/*consumed*/true); + } + + if (event.Value("class") == "resource.fs.zfs.removed") { + + /* + * Discard any tentative I/O error events for + * this case. They were most likely caused by the + * hot-unplug of this device. + */ + PurgeTentativeEvents(); + + /* + * Rescan the drives in the system to see if a recent + * drive arrival can be used to solve this case. + */ + ZfsDaemon::RequestSystemRescan(); + + consumed = true; + } else if (event.Value("class") == "ereport.fs.zfs.io" + || event.Value("class") == "ereport.fs.zfs.checksum") { + + m_tentativeEvents.push_front(event.DeepCopy()); + if (!m_tentativeTimer.IsPending()) + m_tentativeTimer.Reset(s_removeGracePeriod, + OnGracePeriodEnded, this); + consumed = true; + } + + bool closed(CloseIfSolved()); + + return (consumed || closed); +} + +bool +CaseFile::CloseIfSolved() +{ + if (m_events.empty() + && m_tentativeEvents.empty()) { + + /* + * We currently do not track or take actions on + * devices in the degraded or faulted state. + * Once we have support for spare pools, we'll + * retain these cases so that any spares added in + * the future can be applied to them. + */ + if (VdevState() > VDEV_STATE_CANT_OPEN + && VdevState() <= VDEV_STATE_HEALTHY) { + Close(); + return (true); + } + + /* + * Re-serialize the case in order to remove any + * previous event data. + */ + Serialize(); + } + + return (false); +} + +void +CaseFile::Log() +{ + syslog(LOG_INFO, "CaseFile(%s,%s,%s)\n", PoolGUIDString().c_str(), + VdevGUIDString().c_str(), PhysicalPath().c_str()); + syslog(LOG_INFO, "\tVdev State = %s\n", + zpool_state_to_name(VdevState(), VDEV_AUX_NONE)); + if (m_tentativeEvents.size() != 0) { + syslog(LOG_INFO, "\t=== Tentative Events ===\n"); + for (DevCtlEventList::iterator event(m_tentativeEvents.begin()); + event != m_tentativeEvents.end(); event++) + (*event)->Log(LOG_INFO); + } + if (m_events.size() != 0) { + syslog(LOG_INFO, "\t=== Events ===\n"); + for (DevCtlEventList::iterator event(m_events.begin()); + event != m_events.end(); event++) + (*event)->Log(LOG_INFO); + } +} + +//- CaseFile Static Protected Methods ------------------------------------------ +void +CaseFile::OnGracePeriodEnded(void *arg) +{ + CaseFile &casefile(*static_cast(arg)); + + casefile.OnGracePeriodEnded(); +} + +int +CaseFile::DeSerializeSelector(const struct dirent *dirEntry) +{ + uintmax_t poolGUID; + uintmax_t vdevGUID; + + if (dirEntry->d_type == DT_REG + && sscanf(dirEntry->d_name, "pool_%ju_vdev_%ju.case", + &poolGUID, &vdevGUID) == 2) + return (1); + return (0); +} + +void +CaseFile::DeSerializeFile(const char *fileName) +{ + string fullName(s_caseFilePath + '/' + fileName); + string evString; + CaseFile *existingCaseFile(NULL); + CaseFile *caseFile(NULL); + int fd(-1); + + try { + uintmax_t poolGUID; + uintmax_t vdevGUID; + nvlist_t *vdevConf; + + sscanf(fileName, "pool_%ju_vdev_%ju.case", + &poolGUID, &vdevGUID); + existingCaseFile = Find(poolGUID, vdevGUID); + if (existingCaseFile != NULL) { + /* + * If the vdev is already degraded or faulted, + * there's no point in keeping the state around + * that we use to put a drive into the degraded + * state. However, if the vdev is simply missing, + * preseve the case data in the hopes that it will + * return. + */ + caseFile = existingCaseFile; + vdev_state curState(caseFile->VdevState()); + if (curState > VDEV_STATE_CANT_OPEN + && curState < VDEV_STATE_HEALTHY) { + unlink(fileName); + return; + } + } else { + ZpoolList zpl(ZpoolList::ZpoolByGUID, &poolGUID); + if (zpl.empty() + || (vdevConf = VdevIterator(zpl.front()) + .Find(vdevGUID)) == NULL) { + /* + * Either the pool no longer exists + * of this vdev is no longer a member of + * the pool. + */ + unlink(fullName.c_str()); + return; + } + + /* + * Any vdev we find that does not have a case file + * must be in the healthy state and thus worthy of + * continued SERD data tracking. + */ + caseFile = new CaseFile(Vdev(zpl.front(), vdevConf)); + } + + fd = open(fullName.c_str(), O_RDONLY); + if (fd == -1) { + throw ZfsdException("CaseFile::DeSerialize: Unable to " + "read %s.\n", fileName); + return; + } + + /* Re-load EventData */ + EventBuffer eventBuffer(fd); + while (eventBuffer.ExtractEvent(evString)) { + DevCtlEvent *event(DevCtlEvent::CreateEvent(evString)); + caseFile->m_events.push_back(event); + } + close(fd); + } catch (const ParseException &exp) { + + exp.Log(evString); + if (caseFile != existingCaseFile) + delete caseFile; + close(fd); + + /* + * Since we can't parse the file, unlink it so we don't + * trip over it again. + */ + unlink(fileName); + } catch (const ZfsdException &zfsException) { + + zfsException.Log(); + if (caseFile != existingCaseFile) + delete caseFile; + } +} + +//- CaseFile Protected Methods ------------------------------------------------- +CaseFile::CaseFile(const Vdev &vdev) + : m_poolGUID(vdev.PoolGUID()), + m_vdevGUID(vdev.GUID()), + m_vdevState(vdev.State()), + m_vdevPhysPath(vdev.PhysicalPath()) +{ + stringstream guidString; + + guidString << m_vdevGUID; + m_vdevGUIDString = guidString.str(); + guidString.str(""); + guidString << m_poolGUID; + m_poolGUIDString = guidString.str(); + + s_activeCases.push_back(this); + + syslog(LOG_INFO, "Creating new CaseFile:\n"); + Log(); +} + +CaseFile::~CaseFile() +{ + PurgeEvents(); + PurgeTentativeEvents(); + m_tentativeTimer.Stop(); + s_activeCases.remove(this); +} + +void +CaseFile::PurgeEvents() +{ + for (DevCtlEventList::iterator event(m_events.begin()); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Aug 17 09:29:43 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 402E7106566C; Wed, 17 Aug 2011 09:29:43 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id E9B118FC16; Wed, 17 Aug 2011 09:29:42 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 5CB2F885; Wed, 17 Aug 2011 11:29:41 +0200 (CEST) Date: Wed, 17 Aug 2011 11:29:27 +0200 From: Pawel Jakub Dawidek To: "Justin T. Gibbs" Message-ID: <20110817092927.GA1660@garage.freebsd.pl> References: <201108162220.p7GMKjke075680@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <201108162220.p7GMKjke075680@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224920 - projects/zfsd/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 09:29:43 -0000 --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 16, 2011 at 10:20:45PM +0000, Justin T. Gibbs wrote: > Author: gibbs > Date: Tue Aug 16 22:20:45 2011 > New Revision: 224920 > URL: http://svn.freebsd.org/changeset/base/224920 >=20 > Log: > Close several race conditions in the ZFS vdev geom module, most trigger= ed > by concurrent ZFS reprobe and GEOM orphan processing. > =20 > sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c: > o Make vdev_geom_close() synchronous instead of deferring > its work to a GEOM event handler. This prevents a future > open call from referencing a consumer that is scheduled for > destruction. [...] > @@ -547,9 +558,9 @@ vdev_geom_close(vdev_t *vd) > cp =3D vd->vdev_tsd; > if (cp =3D=3D NULL) > return; > - vd->vdev_tsd =3D NULL; > - vd->vdev_delayed_close =3D B_FALSE; > - g_post_event(vdev_geom_detach, cp, M_WAITOK, NULL); > + g_topology_lock(); > + vdev_geom_detach(cp); > + g_topology_unlock(); This reverts the @104422 change I made. The reason for deatching vdev =66rom the GEOM event thread was that I was experiencing deadlocks when trying to acquire the topology lock in vdev_geom_close(). It was long time ago, so the deadlock might not be there anymore as there were a lot of changes to the locking in the meantime (it might have been due to LOR between the topology lock and the spa_namespace_lock/spa_config, which is no longer a problem). Just FYI. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --EeQfGwPcQSOJBaQU Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk5LifcACgkQForvXbEpPzRYYACgoI6a02GAG4GADJz8y70ooY0u qJEAoK2Kh0BThSRikY34vHvBYsuI0BsN =Xss2 -----END PGP SIGNATURE----- --EeQfGwPcQSOJBaQU-- From owner-svn-src-projects@FreeBSD.ORG Thu Aug 18 18:15:59 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2C44106564A; Thu, 18 Aug 2011 18:15:59 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99D9C8FC14; Thu, 18 Aug 2011 18:15:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7IIFxPb068518; Thu, 18 Aug 2011 18:15:59 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7IIFxtV068517; Thu, 18 Aug 2011 18:15:59 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201108181815.p7IIFxtV068517@svn.freebsd.org> From: Sean Bruno Date: Thu, 18 Aug 2011 18:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224985 - projects/sbruno-xenplayground X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 18:15:59 -0000 Author: sbruno Date: Thu Aug 18 18:15:59 2011 New Revision: 224985 URL: http://svn.freebsd.org/changeset/base/224985 Log: Pay no attention to this directory, in here madness waits. Added: - copied from r224984, head/ Directory Properties: projects/sbruno-xenplayground/ (props changed) From owner-svn-src-projects@FreeBSD.ORG Thu Aug 18 18:50:27 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 1AA2C1065670; Thu, 18 Aug 2011 18:50:27 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id B12D514EABE; Thu, 18 Aug 2011 18:50:23 +0000 (UTC) Message-ID: <4E4D5EEF.40205@FreeBSD.org> Date: Thu, 18 Aug 2011 11:50:23 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:6.0) Gecko/20110817 Thunderbird/6.0 MIME-Version: 1.0 To: Ben Kaduk References: <201108181815.p7IIFxtV068517@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, Sean Bruno , src-committers@freebsd.org Subject: Re: svn commit: r224985 - projects/sbruno-xenplayground X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 18:50:27 -0000 On 08/18/2011 11:28, Ben Kaduk wrote: > On Thu, Aug 18, 2011 at 2:15 PM, Sean Bruno wrote: >> Author: sbruno >> Date: Thu Aug 18 18:15:59 2011 >> New Revision: 224985 >> URL: http://svn.freebsd.org/changeset/base/224985 >> >> Log: >> Pay no attention to this directory, in here madness waits. >> >> Added: >> - copied from r224984, head/ >> Directory Properties: >> projects/sbruno-xenplayground/ (props changed) > > Not that it's particularly worth caring, but projects/$user-foo seems > like it might be a better fit in user/$user/foo ... projects/ is for things that are likely'ish to be merged user/ is for things that are related to FreeBSD, but not likely to be merged into src/ hth, Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-projects@FreeBSD.ORG Thu Aug 18 18:54:17 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FD531065672; Thu, 18 Aug 2011 18:54:17 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1E0EE8FC13; Thu, 18 Aug 2011 18:54:16 +0000 (UTC) Received: by ywo32 with SMTP id 32so1992952ywo.13 for ; Thu, 18 Aug 2011 11:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=S1DtvkkraJsBAzX7Naaguwz1AreD79xMddIB86rtzkk=; b=GfIVCRgkN9Oj2oLodEkmNbtSK5cdYfOEAJCadYH0dhM3aINoHixNF4u+tTCqaFIcIF LDk79c9M00e8355CJMnEqcbILH3mNBeoWLX6XYAfmKmYuMw8dymt7/NaOCMho1JlOhmd Ecu2ScNz/7hIOuP2MDDLetOyzcXVywVO/uTy4= MIME-Version: 1.0 Received: by 10.236.154.199 with SMTP id h47mr127934yhk.81.1313692099520; Thu, 18 Aug 2011 11:28:19 -0700 (PDT) Received: by 10.236.110.5 with HTTP; Thu, 18 Aug 2011 11:28:19 -0700 (PDT) In-Reply-To: <201108181815.p7IIFxtV068517@svn.freebsd.org> References: <201108181815.p7IIFxtV068517@svn.freebsd.org> Date: Thu, 18 Aug 2011 14:28:19 -0400 Message-ID: From: Ben Kaduk To: Sean Bruno Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224985 - projects/sbruno-xenplayground X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 18:54:17 -0000 On Thu, Aug 18, 2011 at 2:15 PM, Sean Bruno wrote: > Author: sbruno > Date: Thu Aug 18 18:15:59 2011 > New Revision: 224985 > URL: http://svn.freebsd.org/changeset/base/224985 > > Log: > =A0Pay no attention to this directory, in here madness waits. > > Added: > =A0 =A0 - copied from r224984, head/ > Directory Properties: > =A0projects/sbruno-xenplayground/ =A0 (props changed) Not that it's particularly worth caring, but projects/$user-foo seems like it might be a better fit in user/$user/foo ... -Ben Kaduk From owner-svn-src-projects@FreeBSD.ORG Fri Aug 19 12:10:34 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DB26106566C; Fri, 19 Aug 2011 12:10:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D44678FC14; Fri, 19 Aug 2011 12:10:33 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 66A9F46B35; Fri, 19 Aug 2011 08:10:33 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 05C358A02F; Fri, 19 Aug 2011 08:10:33 -0400 (EDT) From: John Baldwin To: Doug Barton Date: Fri, 19 Aug 2011 07:51:23 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110617; KDE/4.5.5; amd64; ; ) References: <201108181815.p7IIFxtV068517@svn.freebsd.org> <4E4D5EEF.40205@FreeBSD.org> In-Reply-To: <4E4D5EEF.40205@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201108190751.23647.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 19 Aug 2011 08:10:33 -0400 (EDT) Cc: svn-src-projects@freebsd.org, Sean Bruno , src-committers@freebsd.org, Ben Kaduk Subject: Re: svn commit: r224985 - projects/sbruno-xenplayground X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 12:10:34 -0000 On Thursday, August 18, 2011 2:50:23 pm Doug Barton wrote: > On 08/18/2011 11:28, Ben Kaduk wrote: > > On Thu, Aug 18, 2011 at 2:15 PM, Sean Bruno wrote: > >> Author: sbruno > >> Date: Thu Aug 18 18:15:59 2011 > >> New Revision: 224985 > >> URL: http://svn.freebsd.org/changeset/base/224985 > >> > >> Log: > >> Pay no attention to this directory, in here madness waits. > >> > >> Added: > >> - copied from r224984, head/ > >> Directory Properties: > >> projects/sbruno-xenplayground/ (props changed) > > > > Not that it's particularly worth caring, but projects/$user-foo seems > > like it might be a better fit in user/$user/foo ... > > projects/ is for things that are likely'ish to be merged > user/ is for things that are related to FreeBSD, but not likely to be > merged into src/ Err, are you sure? The model in p4 that I tend to use is that user/$user/foo was for branches I will generally only use myself whereas projects/foo was for shared branches where multiple people can collaborate. Note that all of gabor's TRE stuff is in a user branch for example and that is certainly a merge candidate. I suspect Ben is more correct here. -- John Baldwin From owner-svn-src-projects@FreeBSD.ORG Fri Aug 19 12:35:27 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A39ED1065672; Fri, 19 Aug 2011 12:35:27 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 329A48FC0A; Fri, 19 Aug 2011 12:35:27 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 041E525D386D; Fri, 19 Aug 2011 12:35:25 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 38049BD3C59; Fri, 19 Aug 2011 12:35:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id ffnnBkuqPzef; Fri, 19 Aug 2011 12:35:24 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 2B38EBD3C36; Fri, 19 Aug 2011 12:35:24 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201108190751.23647.jhb@freebsd.org> Date: Fri, 19 Aug 2011 12:35:23 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201108181815.p7IIFxtV068517@svn.freebsd.org> <4E4D5EEF.40205@FreeBSD.org> <201108190751.23647.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1084) Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224985 - projects/sbruno-xenplayground X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 12:35:27 -0000 On Aug 19, 2011, at 11:51 AM, John Baldwin wrote: > On Thursday, August 18, 2011 2:50:23 pm Doug Barton wrote: >> On 08/18/2011 11:28, Ben Kaduk wrote: >>> On Thu, Aug 18, 2011 at 2:15 PM, Sean Bruno = wrote: >>>> Author: sbruno >>>> Date: Thu Aug 18 18:15:59 2011 >>>> New Revision: 224985 >>>> URL: http://svn.freebsd.org/changeset/base/224985 >>>>=20 >>>> Log: >>>> Pay no attention to this directory, in here madness waits. >>>>=20 >>>> Added: >>>> - copied from r224984, head/ >>>> Directory Properties: >>>> projects/sbruno-xenplayground/ (props changed) >>>=20 >>> Not that it's particularly worth caring, but projects/$user-foo = seems >>> like it might be a better fit in user/$user/foo ... >>=20 >> projects/ is for things that are likely'ish to be merged >> user/ is for things that are related to FreeBSD, but not likely to be=20= >> merged into src/ >=20 > Err, are you sure? The model in p4 that I tend to use is that > user/$user/foo was for branches I will generally only use myself = whereas=20 > projects/foo was for shared branches where multiple people can = collaborate. =20 > Note that all of gabor's TRE stuff is in a user branch for example and = that is=20 > certainly a merge candidate. I suspect Ben is more correct here. http://svnweb.freebsd.org/base/ROADMAP.txt?annotate=3D221478 vs. http://svnweb.freebsd.org/base/projects/GUIDELINES.txt?annotate=3D183722 --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-projects@FreeBSD.ORG Fri Aug 19 15:31:19 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 710BD1065673; Fri, 19 Aug 2011 15:31:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 47CFF8FC13; Fri, 19 Aug 2011 15:31:19 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id E02A646B2D; Fri, 19 Aug 2011 11:31:18 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7D1D08A02E; Fri, 19 Aug 2011 11:31:18 -0400 (EDT) From: John Baldwin To: "Bjoern A. Zeeb" Date: Fri, 19 Aug 2011 11:31:17 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110617; KDE/4.5.5; amd64; ; ) References: <201108181815.p7IIFxtV068517@svn.freebsd.org> <201108190751.23647.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Message-Id: <201108191131.17951.jhb@freebsd.org> Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 19 Aug 2011 11:31:18 -0400 (EDT) Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224985 - projects/sbruno-xenplayground X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 15:31:19 -0000 On Friday, August 19, 2011 8:35:23 am Bjoern A. Zeeb wrote: > > On Aug 19, 2011, at 11:51 AM, John Baldwin wrote: > > > On Thursday, August 18, 2011 2:50:23 pm Doug Barton wrote: > >> On 08/18/2011 11:28, Ben Kaduk wrote: > >>> On Thu, Aug 18, 2011 at 2:15 PM, Sean Bruno wrote: > >>>> Author: sbruno > >>>> Date: Thu Aug 18 18:15:59 2011 > >>>> New Revision: 224985 > >>>> URL: http://svn.freebsd.org/changeset/base/224985 > >>>> > >>>> Log: > >>>> Pay no attention to this directory, in here madness waits. > >>>> > >>>> Added: > >>>> - copied from r224984, head/ > >>>> Directory Properties: > >>>> projects/sbruno-xenplayground/ (props changed) > >>> > >>> Not that it's particularly worth caring, but projects/$user-foo seems > >>> like it might be a better fit in user/$user/foo ... > >> > >> projects/ is for things that are likely'ish to be merged > >> user/ is for things that are related to FreeBSD, but not likely to be > >> merged into src/ > > > > Err, are you sure? The model in p4 that I tend to use is that > > user/$user/foo was for branches I will generally only use myself whereas > > projects/foo was for shared branches where multiple people can collaborate. > > Note that all of gabor's TRE stuff is in a user branch for example and that is > > certainly a merge candidate. I suspect Ben is more correct here. > > http://svnweb.freebsd.org/base/ROADMAP.txt?annotate=221478 > vs. > http://svnweb.freebsd.org/base/projects/GUIDELINES.txt?annotate=183722 Humm, well, more reason for me to just stick to p4 (though the main reason is that it actually works). :) That aside, this branch doesn't sound like a definite merge candidate, or at least not something suitable for public consumption from the description. However, I think user vs projects is mostly academic. Both of them add bulk and public, forever history to the repo and making sure to only put stuff in the repo that is actually relevant is more important than the subdirectory it uses. -- John Baldwin From owner-svn-src-projects@FreeBSD.ORG Fri Aug 19 20:34:35 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6216D106566B; Fri, 19 Aug 2011 20:34:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38DA98FC08; Fri, 19 Aug 2011 20:34:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JKYZYf019080; Fri, 19 Aug 2011 20:34:35 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JKYZZs019079; Fri, 19 Aug 2011 20:34:35 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201108192034.p7JKYZZs019079@svn.freebsd.org> From: Sean Bruno Date: Fri, 19 Aug 2011 20:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225016 - projects/sbruno-xenplayground X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 20:34:35 -0000 Author: sbruno Date: Fri Aug 19 20:34:34 2011 New Revision: 225016 URL: http://svn.freebsd.org/changeset/base/225016 Log: Bikeshed, time of death 13:34 PST. Added: - copied from r225015, projects/sbruno-xenplayground/ Directory Properties: projects/xendom0/ (props changed) Deleted: projects/sbruno-xenplayground/ From owner-svn-src-projects@FreeBSD.ORG Sat Aug 20 09:31:52 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E728106566B; Sat, 20 Aug 2011 09:31:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D35E8FC0C; Sat, 20 Aug 2011 09:31:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7K9VqaV042754; Sat, 20 Aug 2011 09:31:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7K9VqxA042741; Sat, 20 Aug 2011 09:31:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108200931.p7K9VqxA042741@svn.freebsd.org> From: Alexander Motin Date: Sat, 20 Aug 2011 09:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225024 - in projects/zfsd/head: sbin/camcontrol sys/cam sys/cam/ata sys/cam/scsi sys/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 09:31:52 -0000 Author: mav Date: Sat Aug 20 09:31:52 2011 New Revision: 225024 URL: http://svn.freebsd.org/changeset/base/225024 Log: Add support for SATA Enclosure Management Bridge (SEMB). Modified: projects/zfsd/head/sbin/camcontrol/camcontrol.c projects/zfsd/head/sys/cam/ata/ata_all.c projects/zfsd/head/sys/cam/ata/ata_all.h projects/zfsd/head/sys/cam/ata/ata_da.c projects/zfsd/head/sys/cam/ata/ata_xpt.c projects/zfsd/head/sys/cam/cam_ccb.h projects/zfsd/head/sys/cam/cam_xpt.c projects/zfsd/head/sys/cam/scsi/scsi_all.h projects/zfsd/head/sys/cam/scsi/scsi_enc.c projects/zfsd/head/sys/cam/scsi/scsi_enc_internal.h projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c projects/zfsd/head/sys/sys/ata.h Modified: projects/zfsd/head/sbin/camcontrol/camcontrol.c ============================================================================== --- projects/zfsd/head/sbin/camcontrol/camcontrol.c Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sbin/camcontrol/camcontrol.c Sat Aug 20 09:31:52 2011 (r225024) @@ -456,7 +456,7 @@ getdevtree(void) case DEV_MATCH_DEVICE: { struct device_match_result *dev_result; char vendor[16], product[48], revision[16]; - char tmpstr[256]; + char fw[5], tmpstr[256]; dev_result = &ccb.cdm.matches[i].result.device_result; @@ -495,6 +495,25 @@ getdevtree(void) sizeof(revision)); sprintf(tmpstr, "<%s %s>", product, revision); + } else if (dev_result->protocol == PROTO_SEMB) { + struct sep_identify_data *sid; + + sid = (struct sep_identify_data *) + &dev_result->ident_data; + cam_strvis(vendor, sid->vendor_id, + sizeof(sid->vendor_id), + sizeof(vendor)); + cam_strvis(product, sid->product_id, + sizeof(sid->product_id), + sizeof(product)); + cam_strvis(revision, sid->product_rev, + sizeof(sid->product_rev), + sizeof(revision)); + cam_strvis(fw, sid->firmware_rev, + sizeof(sid->firmware_rev), + sizeof(fw)); + sprintf(tmpstr, "<%s %s %s %s>", + vendor, product, revision, fw); } else { sprintf(tmpstr, "<>"); } @@ -1131,7 +1150,7 @@ atacapprint(struct ata_params *parm) printf("firmware revision %.8s\n", parm->revision); printf("serial number %.20s\n", parm->serial); if (parm->enabled.extension & ATA_SUPPORT_64BITWWN) { - printf("WWN %02x%02x%02x%02x\n", + printf("WWN %04x%04x%04x%04x\n", parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]); } if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) { Modified: projects/zfsd/head/sys/cam/ata/ata_all.c ============================================================================== --- projects/zfsd/head/sys/cam/ata/ata_all.c Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/ata/ata_all.c Sat Aug 20 09:31:52 2011 (r225024) @@ -108,6 +108,16 @@ ata_op_string(struct ata_cmd *cmd) case 0x51: return ("CONFIGURE_STREAM"); case 0x60: return ("READ_FPDMA_QUEUED"); case 0x61: return ("WRITE_FPDMA_QUEUED"); + case 0x67: + if (cmd->features == 0xec) + return ("SEP_ATTN IDENTIFY"); + switch (cmd->lba_low) { + case 0x00: return ("SEP_ATTN READ BUFFER"); + case 0x02: return ("SEP_ATTN RECEIVE DIAGNOSTIC RESULTS"); + case 0x80: return ("SEP_ATTN WRITE BUFFER"); + case 0x82: return ("SEP_ATTN SEND DIAGNOSTIC"); + } + return ("SEP_ATTN"); case 0x70: return ("SEEK"); case 0x87: return ("CFA_TRANSLATE_SECTOR"); case 0x90: return ("EXECUTE_DEVICE_DIAGNOSTIC"); @@ -286,6 +296,21 @@ ata_print_ident(struct ata_params *ident printf(" device\n"); } +void +semb_print_ident(struct sep_identify_data *ident_data) +{ + char vendor[9], product[17], revision[5], fw[5], in[7], ins[5]; + + cam_strvis(vendor, ident_data->vendor_id, 8, sizeof(vendor)); + cam_strvis(product, ident_data->product_id, 16, sizeof(product)); + cam_strvis(revision, ident_data->product_rev, 4, sizeof(revision)); + cam_strvis(fw, ident_data->firmware_rev, 4, sizeof(fw)); + cam_strvis(in, ident_data->interface_id, 6, sizeof(in)); + cam_strvis(ins, ident_data->interface_rev, 4, sizeof(ins)); + printf("<%s %s %s %s> SEMB %s %s device\n", + vendor, product, revision, fw, in, ins); +} + uint32_t ata_logical_sector_size(struct ata_params *ident_data) { @@ -695,3 +720,45 @@ ata_static_identify_match(caddr_t identb } return (-1); } + +void +semb_receive_diagnostic_results(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), + uint8_t tag_action, int pcv, uint8_t page_code, + uint8_t *data_ptr, uint16_t length, uint32_t timeout) +{ + + length = min(length, 1020); + length = (length + 3) & ~3; + cam_fill_ataio(ataio, + retries, + cbfcnp, + /*flags*/CAM_DIR_IN, + tag_action, + data_ptr, + length, + timeout); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, + pcv ? page_code : 0, 0x02, length / 4); +} + +void +semb_send_diagnostic(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, uint16_t length, uint32_t timeout) +{ + + length = min(length, 1020); + length = (length + 3) & ~3; + cam_fill_ataio(ataio, + retries, + cbfcnp, + /*flags*/length ? CAM_DIR_OUT : CAM_DIR_NONE, + tag_action, + data_ptr, + length, + timeout); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, + length > 0 ? data_ptr[0] : 0, 0x82, length / 4); +} + Modified: projects/zfsd/head/sys/cam/ata/ata_all.h ============================================================================== --- projects/zfsd/head/sys/cam/ata/ata_all.h Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/ata/ata_all.h Sat Aug 20 09:31:52 2011 (r225024) @@ -83,6 +83,20 @@ struct ata_res { u_int8_t sector_count_exp; }; +struct sep_identify_data { + uint8_t length; /* Enclosure descriptor length */ + uint8_t subenc_id; /* Sub-enclosure identifier */ + uint8_t logical_id[8]; /* Enclosure logical identifier (WWN) */ + uint8_t vendor_id[8]; /* Vendor identification string */ + uint8_t product_id[16]; /* Product identification string */ + uint8_t product_rev[4]; /* Product revision string */ + uint8_t channel_id; /* Channel identifier */ + uint8_t firmware_rev[4];/* Firmware revision */ + uint8_t interface_id[6];/* Interface spec ("S-E-S "/"SAF-TE")*/ + uint8_t interface_rev[4];/* Interface spec revision */ + uint8_t vend_spec[11]; /* Vendor specific information */ +}; + int ata_version(int ver); char * ata_op_string(struct ata_cmd *cmd); @@ -126,4 +140,16 @@ int ata_speed2revision(u_int speed); int ata_identify_match(caddr_t identbuffer, caddr_t table_entry); int ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry); +void semb_print_ident(struct sep_identify_data *ident_data); + +void semb_receive_diagnostic_results(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), + uint8_t tag_action, int pcv, uint8_t page_code, + uint8_t *data_ptr, uint16_t allocation_length, uint32_t timeout); + +void semb_send_diagnostic(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, uint16_t param_list_length, + uint32_t timeout); + #endif Modified: projects/zfsd/head/sys/cam/ata/ata_da.c ============================================================================== --- projects/zfsd/head/sys/cam/ata/ata_da.c Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/ata/ata_da.c Sat Aug 20 09:31:52 2011 (r225024) @@ -754,6 +754,20 @@ adaasync(void *callback_arg, u_int32_t c "due to status 0x%x\n", status); break; } + case AC_ADVINFO_CHANGED: + { + uintptr_t buftype; + + buftype = (uintptr_t)arg; + if (buftype == CDAI_TYPE_PHYS_PATH) { + struct ada_softc *softc; + + softc = periph->softc; + disk_attr_changed(softc->disk, "GEOM::physpath", + M_NOWAIT); + } + break; + } case AC_SENT_BDR: case AC_BUS_RESET: { @@ -1066,8 +1080,8 @@ adaregister(struct cam_periph *periph, v * them and the only alternative would be to * not attach the device on failure. */ - xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE, - adaasync, periph, periph->path); + xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE | + AC_ADVINFO_CHANGED, adaasync, periph, periph->path); /* * Schedule a periodic event to occasionally send an Modified: projects/zfsd/head/sys/cam/ata/ata_xpt.c ============================================================================== --- projects/zfsd/head/sys/cam/ata/ata_xpt.c Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/ata/ata_xpt.c Sat Aug 20 09:31:52 2011 (r225024) @@ -93,6 +93,8 @@ typedef enum { PROBE_FULL_INQUIRY, PROBE_PM_PID, PROBE_PM_PRV, + PROBE_IDENTIFY_SES, + PROBE_IDENTIFY_SAFTE, PROBE_INVALID } probe_action; @@ -110,6 +112,8 @@ static char *probe_action_text[] = { "PROBE_FULL_INQUIRY", "PROBE_PM_PID", "PROBE_PM_PRV", + "PROBE_IDENTIFY_SES", + "PROBE_IDENTIFY_SAFTE", "PROBE_INVALID" }; @@ -260,7 +264,8 @@ probeschedule(struct cam_periph *periph) ccb = (union ccb *)TAILQ_FIRST(&softc->request_ccbs); if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) || - periph->path->device->protocol == PROTO_SATAPM) + periph->path->device->protocol == PROTO_SATAPM || + periph->path->device->protocol == PROTO_SEMB) PROBE_SET_ACTION(softc, PROBE_RESET); else PROBE_SET_ACTION(softc, PROBE_IDENTIFY); @@ -294,7 +299,8 @@ probestart(struct cam_periph *periph, un if (softc->restart) { softc->restart = 0; if ((path->device->flags & CAM_DEV_UNCONFIGURED) || - path->device->protocol == PROTO_SATAPM) + path->device->protocol == PROTO_SATAPM || + path->device->protocol == PROTO_SEMB) softc->action = PROBE_RESET; else softc->action = PROBE_IDENTIFY; @@ -609,6 +615,30 @@ negotiate: 10 * 1000); ata_pm_read_cmd(ataio, 1, 15); break; + case PROBE_IDENTIFY_SES: + cam_fill_ataio(ataio, + 1, + probedone, + /*flags*/CAM_DIR_IN, + 0, + /*data_ptr*/(u_int8_t *)&softc->ident_data, + /*dxfer_len*/sizeof(softc->ident_data), + 30 * 1000); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, 0xEC, 0x02, + sizeof(softc->ident_data) / 4); + break; + case PROBE_IDENTIFY_SAFTE: + cam_fill_ataio(ataio, + 1, + probedone, + /*flags*/CAM_DIR_IN, + 0, + /*data_ptr*/(u_int8_t *)&softc->ident_data, + /*dxfer_len*/sizeof(softc->ident_data), + 30 * 1000); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, 0xEC, 0x00, + sizeof(softc->ident_data) / 4); + break; case PROBE_INVALID: CAM_DEBUG(path, CAM_DEBUG_INFO, ("probestart: invalid action state\n")); @@ -745,12 +775,16 @@ probedone(struct cam_periph *periph, uni { struct ccb_trans_settings cts; struct ata_params *ident_buf; + struct scsi_inquiry_data *inq_buf; probe_softc *softc; struct cam_path *path; cam_status status; u_int32_t priority; u_int caps; - int found = 1; + int changed = 1, found = 1; + static const uint8_t fake_device_id_hdr[8] = + {0, SVPD_DEVICE_ID, 0, 12, + SVPD_ID_CODESET_BINARY, SVPD_ID_TYPE_NAA, 0, 8}; CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("probedone\n")); @@ -758,6 +792,7 @@ probedone(struct cam_periph *periph, uni path = done_ccb->ccb_h.path; priority = done_ccb->ccb_h.pinfo.priority; ident_buf = &path->device->ident_data; + inq_buf = &path->device->inq_data; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (softc->restart) { @@ -806,6 +841,18 @@ probedone(struct cam_periph *periph, uni } else if (softc->action == PROBE_SETDMAAA && status == CAM_ATA_STATUS_ERROR) { goto noerror; + + /* + * SES and SAF-TE SEPs have different IDENTIFY commands, + * but SATA specification doesn't tell how to identify them. + * Until better way found, just try another if first fail. + */ + } else if (softc->action == PROBE_IDENTIFY_SES && + status == CAM_ATA_STATUS_ERROR) { + PROBE_SET_ACTION(softc, PROBE_IDENTIFY_SAFTE); + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; } /* @@ -849,6 +896,10 @@ noerror: xpt_action((union ccb *)&cts); path->device->protocol = PROTO_SATAPM; PROBE_SET_ACTION(softc, PROBE_PM_PID); + } else if (sign == 0xc33c && + done_ccb->ccb_h.target_id != 15) { + path->device->protocol = PROTO_SEMB; + PROBE_SET_ACTION(softc, PROBE_IDENTIFY_SES); } else if (sign == 0xeb14 && done_ccb->ccb_h.target_id != 15) { path->device->protocol = PROTO_SCSI; @@ -868,7 +919,6 @@ noerror: { struct ccb_pathinq cpi; int16_t *ptr; - int changed = 1; ident_buf = &softc->ident_data; for (ptr = (int16_t *)ident_buf; @@ -923,6 +973,11 @@ noerror: path->device->serial_num = NULL; path->device->serial_num_len = 0; } + if (path->device->device_id != NULL) { + free(path->device->device_id, M_CAMXPT); + path->device->device_id = NULL; + path->device->device_id_len = 0; + } path->device->serial_num = (u_int8_t *)malloc((sizeof(ident_buf->serial) + 1), M_CAMXPT, M_NOWAIT); @@ -935,6 +990,18 @@ noerror: path->device->serial_num_len = strlen(path->device->serial_num); } + if (ident_buf->enabled.extension & + ATA_SUPPORT_64BITWWN) { + path->device->device_id = + malloc(16, M_CAMXPT, M_NOWAIT); + if (path->device->device_id != NULL) { + path->device->device_id_len = 16; + bcopy(&fake_device_id_hdr, + path->device->device_id, 8); + bcopy(ident_buf->wwn, + path->device->device_id + 8, 8); + } + } path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; } @@ -1079,11 +1146,9 @@ notsata: case PROBE_INQUIRY: case PROBE_FULL_INQUIRY: { - struct scsi_inquiry_data *inq_buf; u_int8_t periph_qual, len; path->device->flags |= CAM_DEV_INQUIRY_DATA_VALID; - inq_buf = &path->device->inq_data; periph_qual = SID_QUAL(inq_buf); @@ -1187,6 +1252,48 @@ notsata: xpt_async(AC_SCSI_AEN, done_ccb->ccb_h.path, done_ccb); } break; + case PROBE_IDENTIFY_SES: + case PROBE_IDENTIFY_SAFTE: + if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) { + /* Check that it is the same device. */ + if (bcmp(&softc->ident_data, ident_buf, 53)) { + /* Device changed. */ + xpt_async(AC_LOST_DEVICE, path, NULL); + } else { + bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params)); + changed = 0; + } + } + if (changed) { + bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params)); + /* Clean up from previous instance of this device */ + if (path->device->device_id != NULL) { + free(path->device->device_id, M_CAMXPT); + path->device->device_id = NULL; + path->device->device_id_len = 0; + } + path->device->device_id = + malloc(16, M_CAMXPT, M_NOWAIT); + if (path->device->device_id != NULL) { + path->device->device_id_len = 16; + bcopy(&fake_device_id_hdr, + path->device->device_id, 8); + bcopy(((uint8_t*)ident_buf) + 2, + path->device->device_id + 8, 8); + } + + path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; + } + + if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { + path->device->flags &= ~CAM_DEV_UNCONFIGURED; + xpt_acquire_device(path->device); + done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action(done_ccb); + xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, + done_ccb); + } + break; case PROBE_INVALID: CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_INFO, ("probedone: invalid action state\n")); @@ -1611,10 +1718,20 @@ ata_dev_advinfo(union ccb *start_ccb) device = start_ccb->ccb_h.path->device; cdai = &start_ccb->cdai; switch(cdai->buftype) { - case CDAI_TYPE_SERIAL_NUM: + case CDAI_TYPE_SCSI_DEVID: if (cdai->flags & CDAI_FLAG_STORE) + return; + cdai->provsiz = device->device_id_len; + if (device->device_id_len == 0) break; - start_ccb->ccb_h.status = CAM_REQ_CMP; + amt = device->device_id_len; + if (cdai->provsiz > cdai->bufsiz) + amt = cdai->bufsiz; + memcpy(cdai->buf, device->device_id, amt); + break; + case CDAI_TYPE_SERIAL_NUM: + if (cdai->flags & CDAI_FLAG_STORE) + return; cdai->provsiz = device->serial_num_len; if (device->serial_num_len == 0) break; @@ -1623,8 +1740,45 @@ ata_dev_advinfo(union ccb *start_ccb) amt = cdai->bufsiz; memcpy(cdai->buf, device->serial_num, amt); break; - default: + case CDAI_TYPE_PHYS_PATH: + if (cdai->flags & CDAI_FLAG_STORE) { + if (device->physpath != NULL) + free(device->physpath, M_CAMXPT); + device->physpath_len = cdai->bufsiz; + /* Clear existing buffer if zero length */ + if (cdai->bufsiz == 0) + break; + device->physpath = malloc(cdai->bufsiz, M_CAMXPT, M_NOWAIT); + if (device->physpath == NULL) { + start_ccb->ccb_h.status = CAM_REQ_ABORTED; + return; + } + memcpy(device->physpath, cdai->buf, cdai->bufsiz); + } else { + cdai->provsiz = device->physpath_len; + if (device->physpath_len == 0) + break; + amt = device->physpath_len; + if (cdai->provsiz > cdai->bufsiz) + amt = cdai->bufsiz; + memcpy(cdai->buf, device->physpath, amt); + } break; + default: + return; + } + start_ccb->ccb_h.status = CAM_REQ_CMP; + + if (cdai->flags & CDAI_FLAG_STORE) { + int owned; + + owned = mtx_owned(start_ccb->ccb_h.path->bus->sim->mtx); + if (owned == 0) + mtx_lock(start_ccb->ccb_h.path->bus->sim->mtx); + xpt_async(AC_ADVINFO_CHANGED, start_ccb->ccb_h.path, + (void *)(uintptr_t)cdai->buftype); + if (owned == 0) + mtx_unlock(start_ccb->ccb_h.path->bus->sim->mtx); } } Modified: projects/zfsd/head/sys/cam/cam_ccb.h ============================================================================== --- projects/zfsd/head/sys/cam/cam_ccb.h Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/cam_ccb.h Sat Aug 20 09:31:52 2011 (r225024) @@ -242,6 +242,7 @@ typedef enum { PROTO_ATA, /* AT Attachment */ PROTO_ATAPI, /* AT Attachment Packetized Interface */ PROTO_SATAPM, /* SATA Port Multiplier */ + PROTO_SEMB, /* SATA Enclosure Management Bridge */ } cam_proto; typedef enum { Modified: projects/zfsd/head/sys/cam/cam_xpt.c ============================================================================== --- projects/zfsd/head/sys/cam/cam_xpt.c Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/cam_xpt.c Sat Aug 20 09:31:52 2011 (r225024) @@ -1081,6 +1081,9 @@ xpt_announce_periph(struct cam_periph *p else if (path->device->protocol == PROTO_ATA || path->device->protocol == PROTO_SATAPM) ata_print_ident(&path->device->ident_data); + else if (path->device->protocol == PROTO_SEMB) + semb_print_ident( + (struct sep_identify_data *)&path->device->ident_data); else printf("Unknown protocol device\n"); if (bootverbose && path->device->serial_num_len > 0) { Modified: projects/zfsd/head/sys/cam/scsi/scsi_all.h ============================================================================== --- projects/zfsd/head/sys/cam/scsi/scsi_all.h Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/scsi/scsi_all.h Sat Aug 20 09:31:52 2011 (r225024) @@ -869,6 +869,8 @@ struct scsi_vpd_id_descriptor #define SCSI_PROTO_RDMA 0x04 #define SCSI_PROTO_iSCSI 0x05 #define SCSI_PROTO_SAS 0x06 +#define SCSI_PROTO_ADT 0x07 +#define SCSI_PROTO_ATA 0x08 #define SVPD_ID_PROTO_SHIFT 4 #define SVPD_ID_CODESET_BINARY 0x01 #define SVPD_ID_CODESET_ASCII 0x02 Modified: projects/zfsd/head/sys/cam/scsi/scsi_enc.c ============================================================================== --- projects/zfsd/head/sys/cam/scsi/scsi_enc.c Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/scsi/scsi_enc.c Sat Aug 20 09:31:52 2011 (r225024) @@ -74,7 +74,7 @@ static periph_dtor_t enc_dtor; static periph_start_t enc_start; static void enc_async(void *, uint32_t, struct cam_path *, void *); -static enctyp enc_type(void *, int); +static enctyp enc_type(struct ccb_getdev *); static struct periph_driver encdriver = { enc_init, "enc", @@ -183,7 +183,6 @@ enc_async(void *callback_arg, uint32_t c { struct ccb_getdev *cgd; cam_status status; - int inq_len; path_id_t path_id; cgd = (struct ccb_getdev *)arg; @@ -191,23 +190,7 @@ enc_async(void *callback_arg, uint32_t c break; } - if (cgd->protocol != PROTO_SCSI) - break; - - inq_len = cgd->inq_data.additional_length + 4; - - /* - * PROBLEM: WE NEED TO LOOK AT BYTES 48-53 TO SEE IF THIS - * PROBLEM: IS A SAF-TE DEVICE. - */ - switch (enc_type(&cgd->inq_data, inq_len)) { - case ENC_SES: - case ENC_SES_SCSI2: - case ENC_SES_PASSTHROUGH: - case ENC_SEN: - case ENC_SAFT: - break; - default: + if (enc_type(cgd) == ENC_NONE) { /* * Schedule announcement of the ENC bindings for * this device if it is managed by a SEP. @@ -564,7 +547,7 @@ enc_ioctl(struct cdev *dev, u_long cmd, int enc_runcmd(struct enc_softc *enc, char *cdb, int cdbl, char *dptr, int *dlenp) { - int error, dlen; + int error, dlen, tdlen; ccb_flags ddf; union ccb *ccb; @@ -587,9 +570,32 @@ enc_runcmd(struct enc_softc *enc, char * } ccb = cam_periph_getccb(enc->periph, 1); - cam_fill_csio(&ccb->csio, 0, enc_done, ddf, MSG_SIMPLE_Q_TAG, dptr, - dlen, sizeof (struct scsi_sense_data), cdbl, 60 * 1000); - bcopy(cdb, ccb->csio.cdb_io.cdb_bytes, cdbl); + if (enc->enc_type == ENC_SEMB_SES || enc->enc_type == ENC_SEMB_SAFT) { + tdlen = min(dlen, 1020); + tdlen = (tdlen + 3) & ~3; + cam_fill_ataio(&ccb->ataio, 0, enc_done, ddf, 0, dptr, tdlen, + 30 * 1000); + if (cdb[0] == RECEIVE_DIAGNOSTIC) + ata_28bit_cmd(&ccb->ataio, + ATA_SEP_ATTN, cdb[2], 0x02, tdlen / 4); + else if (cdb[0] == SEND_DIAGNOSTIC) + ata_28bit_cmd(&ccb->ataio, + ATA_SEP_ATTN, dlen > 0 ? dptr[0] : 0, + 0x82, tdlen / 4); + else if (cdb[0] == READ_BUFFER) + ata_28bit_cmd(&ccb->ataio, + ATA_SEP_ATTN, cdb[2], 0x00, tdlen / 4); + else + ata_28bit_cmd(&ccb->ataio, + ATA_SEP_ATTN, dlen > 0 ? dptr[0] : 0, + 0x80, tdlen / 4); + } else { + tdlen = dlen; + cam_fill_csio(&ccb->csio, 0, enc_done, ddf, MSG_SIMPLE_Q_TAG, + dptr, dlen, sizeof (struct scsi_sense_data), cdbl, + 60 * 1000); + bcopy(cdb, ccb->csio.cdb_io.cdb_bytes, cdbl); + } error = cam_periph_runccb(ccb, enc_error, ENC_CFLAGS, ENC_FLAGS, NULL); if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) @@ -600,7 +606,11 @@ enc_runcmd(struct enc_softc *enc, char * } } else { if (dptr) { - *dlenp = ccb->csio.resid; + if (ccb->ccb_h.func_code == XPT_ATA_IO) + *dlenp = ccb->ataio.resid; + else + *dlenp = ccb->csio.resid; + *dlenp += tdlen - dlen; } } xpt_release_ccb(ccb); @@ -639,10 +649,25 @@ enc_log(struct enc_softc *enc, const cha #define SAFTE_LEN SAFTE_END-SAFTE_START static enctyp -enc_type(void *buf, int buflen) +enc_type(struct ccb_getdev *cgd) { - unsigned char *iqd = buf; + int buflen; + unsigned char *iqd; + if (cgd->protocol == PROTO_SEMB) { + iqd = (unsigned char *)&cgd->ident_data; + if (STRNCMP(iqd + 43, "S-E-S", 5) == 0) + return (ENC_SEMB_SES); + else if (STRNCMP(iqd + 43, "SAF-TE", 6) == 0) + return (ENC_SEMB_SAFT); + return (ENC_NONE); + + } else if (cgd->protocol != PROTO_SCSI) + return (ENC_NONE); + + iqd = (unsigned char *)&cgd->inq_data; + buflen = min(sizeof(cgd->inq_data), + SID_ADDITIONAL_LENGTH(&cgd->inq_data)); if (buflen < 8+SEN_ID_LEN) return (ENC_NONE); @@ -743,14 +768,18 @@ enc_fsm_step(enc_softc_t *enc) if (error == 0) { - uint32_t resid; + uint32_t len; - resid = 0; - if (ccb != NULL) - resid = ccb->csio.dxfer_len - ccb->csio.resid; + len = 0; + if (ccb != NULL) { + if (ccb->ccb_h.func_code == XPT_ATA_IO) + len = ccb->ataio.dxfer_len - ccb->ataio.resid; + else + len = ccb->csio.dxfer_len - ccb->csio.resid; + } cam_periph_unlock(enc->periph); - cur_state->done(enc, cur_state, ccb, &buf, resid); + cur_state->done(enc, cur_state, ccb, &buf, len); cam_periph_lock(enc->periph); } @@ -880,16 +909,18 @@ enc_ctor(struct cam_periph *periph, void enc->periph = periph; enc->current_action = ENC_UPDATE_NONE; - enc->enc_type = enc_type(&cgd->inq_data, sizeof (cgd->inq_data)); + enc->enc_type = enc_type(cgd); sx_init(&enc->enc_cache_lock, "enccache"); switch (enc->enc_type) { case ENC_SES: case ENC_SES_SCSI2: case ENC_SES_PASSTHROUGH: + case ENC_SEMB_SES: err = ses_softc_init(enc, 1); break; case ENC_SAFT: + case ENC_SEMB_SAFT: err = safte_softc_init(enc, 1); break; case ENC_SEN: @@ -963,6 +994,12 @@ enc_ctor(struct cam_periph *periph, void case ENC_SAFT: tname = "SAF-TE Compliant Device"; break; + case ENC_SEMB_SES: + tname = "SEMB SES Device"; + break; + case ENC_SEMB_SAFT: + tname = "SEMB SAF-TE Device"; + break; } xpt_announce_periph(periph, tname); status = CAM_REQ_CMP; Modified: projects/zfsd/head/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- projects/zfsd/head/sys/cam/scsi/scsi_enc_internal.h Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/scsi/scsi_enc_internal.h Sat Aug 20 09:31:52 2011 (r225024) @@ -55,7 +55,9 @@ typedef enum { ENC_SES, ENC_SES_PASSTHROUGH, ENC_SEN, - ENC_SAFT + ENC_SAFT, + ENC_SEMB_SES, + ENC_SEMB_SAFT } enctyp; /* Platform Independent Driver Internal Definitions for enclosure devices. */ Modified: projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c Sat Aug 20 09:31:52 2011 (r225024) @@ -251,7 +251,7 @@ static enc_softc_cleanup_t ses_softc_cle #define SCSZ 0x8000 -static fsm_fill_handler_t ses_fill_rcv_diag_csio; +static fsm_fill_handler_t ses_fill_rcv_diag_io; static fsm_fill_handler_t ses_fill_control_request; static fsm_done_handler_t ses_process_config; static fsm_done_handler_t ses_process_status; @@ -269,7 +269,7 @@ struct enc_fsm_state enc_fsm_states[SES_ SesConfigPage, SCSZ, 60 * 1000, - ses_fill_rcv_diag_csio, + ses_fill_rcv_diag_io, ses_process_config, enc_error }, @@ -278,7 +278,7 @@ struct enc_fsm_state enc_fsm_states[SES_ SesStatusPage, SCSZ, 60 * 1000, - ses_fill_rcv_diag_csio, + ses_fill_rcv_diag_io, ses_process_status, enc_error }, @@ -287,7 +287,7 @@ struct enc_fsm_state enc_fsm_states[SES_ SesElementDescriptor, SCSZ, 60 * 1000, - ses_fill_rcv_diag_csio, + ses_fill_rcv_diag_io, ses_process_elm_descs, enc_error }, @@ -296,7 +296,7 @@ struct enc_fsm_state enc_fsm_states[SES_ SesAddlElementStatus, SCSZ, 60 * 1000, - ses_fill_rcv_diag_csio, + ses_fill_rcv_diag_io, ses_process_elm_addlstatus, enc_error }, @@ -1898,13 +1898,21 @@ out: } static int -ses_fill_rcv_diag_csio(enc_softc_t *enc, struct enc_fsm_state *state, +ses_fill_rcv_diag_io(enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t *buf) { - scsi_receive_diagnostic_results(&ccb->csio, /*retries*/5, + + if (enc->enc_type == ENC_SEMB_SES) { + semb_receive_diagnostic_results(&ccb->ataio, /*retries*/5, + enc_done, MSG_SIMPLE_Q_TAG, /*pcv*/1, + state->page_code, buf, state->buf_size, + state->timeout); + } else { + scsi_receive_diagnostic_results(&ccb->csio, /*retries*/5, enc_done, MSG_SIMPLE_Q_TAG, /*pcv*/1, state->page_code, buf, state->buf_size, SSD_FULL_SIZE, state->timeout); + } return (0); } @@ -2018,12 +2026,19 @@ ses_fill_control_request(enc_softc_t *en return (ENOENT); /* Fill out the ccb */ - scsi_send_diagnostic(&ccb->csio, /*retries*/5, enc_done, + if (enc->enc_type == ENC_SEMB_SES) { + semb_send_diagnostic(&ccb->ataio, /*retries*/5, enc_done, + MSG_SIMPLE_Q_TAG, + buf, ses_page_length(&ses_cache->status_page->hdr), + state->timeout); + } else { + scsi_send_diagnostic(&ccb->csio, /*retries*/5, enc_done, MSG_SIMPLE_Q_TAG, /*unit_offline*/0, /*device_offline*/0, /*self_test*/0, /*page_format*/1, /*self_test_code*/0, buf, ses_page_length(&ses_cache->status_page->hdr), SSD_FULL_SIZE, state->timeout); + } return (0); } Modified: projects/zfsd/head/sys/sys/ata.h ============================================================================== --- projects/zfsd/head/sys/sys/ata.h Sat Aug 20 08:20:10 2011 (r225023) +++ projects/zfsd/head/sys/sys/ata.h Sat Aug 20 09:31:52 2011 (r225024) @@ -318,6 +318,7 @@ struct ata_params { #define ATA_READ_VERIFY48 0x42 #define ATA_READ_FPDMA_QUEUED 0x60 /* read DMA NCQ */ #define ATA_WRITE_FPDMA_QUEUED 0x61 /* write DMA NCQ */ +#define ATA_SEP_ATTN 0x67 /* SEP request */ #define ATA_SEEK 0x70 /* seek */ #define ATA_PACKET_CMD 0xa0 /* packet command */ #define ATA_ATAPI_IDENTIFY 0xa1 /* get ATAPI params*/ From owner-svn-src-projects@FreeBSD.ORG Sat Aug 20 19:09:25 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D895A106567C; Sat, 20 Aug 2011 19:09:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C89E58FC0C; Sat, 20 Aug 2011 19:09:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KJ9PZQ065369; Sat, 20 Aug 2011 19:09:25 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KJ9PSK065364; Sat, 20 Aug 2011 19:09:25 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108201909.p7KJ9PSK065364@svn.freebsd.org> From: Alexander Motin Date: Sat, 20 Aug 2011 19:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225047 - projects/zfsd/head/sys/cam/scsi X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 19:09:25 -0000 Author: mav Date: Sat Aug 20 19:09:25 2011 New Revision: 225047 URL: http://svn.freebsd.org/changeset/base/225047 Log: Fetch list of supported diagnostic pages for SES to find whether optional Additional Element Status page is supported. If it's not, do not try to query it. Modified: projects/zfsd/head/sys/cam/scsi/scsi_all.h projects/zfsd/head/sys/cam/scsi/scsi_enc.c projects/zfsd/head/sys/cam/scsi/scsi_enc_internal.h projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c Modified: projects/zfsd/head/sys/cam/scsi/scsi_all.h ============================================================================== --- projects/zfsd/head/sys/cam/scsi/scsi_all.h Sat Aug 20 18:45:38 2011 (r225046) +++ projects/zfsd/head/sys/cam/scsi/scsi_all.h Sat Aug 20 19:09:25 2011 (r225047) @@ -992,6 +992,13 @@ struct scsi_vpd_id_scsi_name uint8_t name_string[256]; }; +struct scsi_diag_page { + uint8_t page_code; + uint8_t page_specific_flags; + uint8_t length[2]; + uint8_t params[0]; +}; + struct scsi_read_capacity { u_int8_t opcode; Modified: projects/zfsd/head/sys/cam/scsi/scsi_enc.c ============================================================================== --- projects/zfsd/head/sys/cam/scsi/scsi_enc.c Sat Aug 20 18:45:38 2011 (r225046) +++ projects/zfsd/head/sys/cam/scsi/scsi_enc.c Sat Aug 20 19:09:25 2011 (r225047) @@ -907,7 +907,7 @@ enc_ctor(struct cam_periph *periph, void goto out; } enc->periph = periph; - enc->current_action = ENC_UPDATE_NONE; + enc->current_action = ENC_UPDATE_INVALID; enc->enc_type = enc_type(cgd); sx_init(&enc->enc_cache_lock, "enccache"); Modified: projects/zfsd/head/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- projects/zfsd/head/sys/cam/scsi/scsi_enc_internal.h Sat Aug 20 18:45:38 2011 (r225046) +++ projects/zfsd/head/sys/cam/scsi/scsi_enc_internal.h Sat Aug 20 19:09:25 2011 (r225047) @@ -154,6 +154,7 @@ struct enc_softc { /* The action on which the state machine is currently working. */ uint32_t current_action; #define ENC_UPDATE_NONE 0x00 +#define ENC_UPDATE_INVALID 0xff /* Callout for auto-updating enclosure status */ struct callout status_updater; Modified: projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c Sat Aug 20 18:45:38 2011 (r225046) +++ projects/zfsd/head/sys/cam/scsi/scsi_enc_ses.c Sat Aug 20 19:09:25 2011 (r225047) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD: head/sys/cam/scsi/sc /* SES Diagnostic Page Codes */ typedef enum { + SesSupportedPages = 0x0, SesConfigPage = 0x1, SesControlPage = 0x2, SesStatusPage = SesControlPage, @@ -237,6 +238,7 @@ struct ses_iterator { typedef enum { SES_UPDATE_NONE, + SES_UPDATE_PAGES, SES_UPDATE_GETCONFIG, SES_UPDATE_GETSTATUS, SES_UPDATE_GETELMDESCS, @@ -253,6 +255,7 @@ static enc_softc_cleanup_t ses_softc_cle static fsm_fill_handler_t ses_fill_rcv_diag_io; static fsm_fill_handler_t ses_fill_control_request; +static fsm_done_handler_t ses_process_pages; static fsm_done_handler_t ses_process_config; static fsm_done_handler_t ses_process_status; static fsm_done_handler_t ses_process_elm_descs; @@ -265,6 +268,15 @@ struct enc_fsm_state enc_fsm_states[SES_ { { "SES_UPDATE_NONE", 0, 0, 0, NULL, NULL, NULL }, { + "SES_UPDATE_PAGES", + SesSupportedPages, + SCSZ, + 60 * 1000, + ses_fill_rcv_diag_io, + ses_process_pages, + enc_error + }, + { "SES_UPDATE_GETCONFIG", SesConfigPage, SCSZ, @@ -352,6 +364,7 @@ typedef struct ses_cache { typedef struct ses_softc { uint32_t ses_flags; #define SES_FLAG_TIMEDCOMP 0x01 +#define SES_FLAG_ADDLSTATUS 0x02 ses_control_reqlist_t ses_requests; ses_control_reqlist_t ses_pending_requests; @@ -1211,6 +1224,55 @@ out: } /** + * \brief Process the list of supported pages and update flags. + * + * \param enc SES device to query. + * \param buf Buffer containing the config page. + * \param xfer_len Length of the config page in the buffer. + * + * \return 0 on success, errno otherwise. + */ +static int +ses_process_pages(enc_softc_t *enc, struct enc_fsm_state *state, + union ccb *ccb, uint8_t **bufp, int xfer_len) +{ + ses_softc_t *ses; + struct scsi_diag_page *page; + int err, i, length; + + CAM_DEBUG(enc->periph->path, CAM_DEBUG_SUBTRACE, + ("entering %s(%p, %d)\n", __func__, bufp, xfer_len)); + ses = enc->enc_private; + err = -1; + + if (xfer_len < sizeof(*page)) { + ENC_LOG(enc, "Unable to parse Diag Pages List Header\n"); + err = EIO; + goto out; + } + page = (struct scsi_diag_page *)*bufp; + length = scsi_2btoul(page->length); + if (length + offsetof(struct scsi_diag_page, params) > xfer_len) { + ENC_LOG(enc, "Diag Pages List Too Long\n"); + goto out; + } + ENC_DLOG(enc, "%s: page length %d, xfer_len %d\n", + __func__, length, xfer_len); + + err = 0; + for (i = 0; i < length; i++) { + if (page->params[i] == SesAddlElementStatus) { + ses->ses_flags |= SES_FLAG_ADDLSTATUS; + break; + } + } + +out: + ENC_DLOG(enc, "%s: exiting with err %d\n", __func__, err); + return (err); +} + +/** * \brief Process the config page and update associated structures. * * \param enc SES device to query. @@ -1411,7 +1473,8 @@ out: else { enc_update_request(enc, SES_UPDATE_GETSTATUS); enc_update_request(enc, SES_UPDATE_GETELMDESCS); - enc_update_request(enc, SES_UPDATE_GETELMADDLSTATUS); + if (ses->ses_flags & SES_FLAG_ADDLSTATUS) + enc_update_request(enc, SES_UPDATE_GETELMADDLSTATUS); enc_update_request(enc, SES_PUBLISH_CACHE); } ENC_DLOG(enc, "%s: exiting with err %d\n", __func__, err); @@ -1817,6 +1880,7 @@ static int ses_process_elm_descs(enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int xfer_len) { + ses_softc_t *ses; struct ses_iterator iter; enc_element_t *element; int err; @@ -1829,6 +1893,7 @@ ses_process_elm_descs(enc_softc_t *enc, const struct ses_page_hdr *phdr; const struct ses_elm_desc_hdr *hdr; + ses = enc->enc_private; enc_cache = &enc->enc_daemon_cache; ses_cache = enc_cache->private; buf = *bufp; @@ -1891,8 +1956,10 @@ ses_process_elm_descs(enc_softc_t *enc, err = 0; out: - if (err == 0) - enc_update_request(enc, SES_UPDATE_GETELMADDLSTATUS); + if (err == 0) { + if (ses->ses_flags & SES_FLAG_ADDLSTATUS) + enc_update_request(enc, SES_UPDATE_GETELMADDLSTATUS); + } enc_update_request(enc, SES_PUBLISH_CACHE); return (err); } @@ -2633,8 +2700,12 @@ ses_handle_string(enc_softc_t *enc, enci static void ses_poll_status(enc_softc_t *enc) { + ses_softc_t *ses; + + ses = enc->enc_private; enc_update_request(enc, SES_UPDATE_GETSTATUS); - enc_update_request(enc, SES_UPDATE_GETELMADDLSTATUS); + if (ses->ses_flags & SES_FLAG_ADDLSTATUS) + enc_update_request(enc, SES_UPDATE_GETELMADDLSTATUS); } /** @@ -2710,6 +2781,8 @@ ses_softc_init(enc_softc_t *enc, int doi TAILQ_INIT(&ses_softc->ses_requests); TAILQ_INIT(&ses_softc->ses_pending_requests); + enc_update_request(enc, SES_UPDATE_PAGES); + // XXX: Move this to the FSM so it doesn't hang init if (0) (void) ses_set_timed_completion(enc, 1);