svn commit: r354716 - head/sys/dev/vmware/pvscsi

2019-11-14 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Nov 15 01:07:39 2019
New Revision: 354716
URL: https://svnweb.freebsd.org/changeset/base/354716

Log:
  Fix build with GCC
  
  Fix suggested by: jhb, scottl
  Sponsored by: Panzura

Modified:
  head/sys/dev/vmware/pvscsi/pvscsi.c

Modified: head/sys/dev/vmware/pvscsi/pvscsi.c
==
--- head/sys/dev/vmware/pvscsi/pvscsi.c Thu Nov 14 23:31:20 2019
(r354715)
+++ head/sys/dev/vmware/pvscsi/pvscsi.c Fri Nov 15 01:07:39 2019
(r354716)
@@ -54,7 +54,6 @@ MALLOC_DEFINE(M_PVSCSI, "pvscsi", "PVSCSI memory");
 #defineccb_pvscsi_sc   spriv_ptr1
 
 struct pvscsi_softc;
-static timeout_t pvscsi_timeout;
 struct pvscsi_hcb;
 struct pvscsi_dma;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r354715 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/vmware/pvscsi sys/i386/conf sys/modules/vmware sys/modules/vmware/pvscsi

2019-11-14 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Nov 14 23:31:20 2019
New Revision: 354715
URL: https://svnweb.freebsd.org/changeset/base/354715

Log:
  Add the pvscsi driver to the tree.
  
  This driver allows to usage of the paravirt SCSI controller
  in VMware products like ESXi.  The pvscsi driver provides a
  substantial performance improvement in block devices versus
  the emulated mpt and mps SCSI/SAS controllers.
  
  Error handling in this driver has not been extensively tested
  yet.
  
  Submitted by: vbha...@vmware.com
  Relnotes: yes
  Sponsored by: VMware, Panzura
  Differential Revision:D18613

Added:
  head/share/man/man4/pvscsi.4   (contents, props changed)
  head/sys/dev/vmware/pvscsi/
  head/sys/dev/vmware/pvscsi/LICENSE   (contents, props changed)
  head/sys/dev/vmware/pvscsi/pvscsi.c   (contents, props changed)
  head/sys/dev/vmware/pvscsi/pvscsi.h   (contents, props changed)
  head/sys/modules/vmware/pvscsi/
  head/sys/modules/vmware/pvscsi/Makefile   (contents, props changed)
Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/i386/conf/GENERIC
  head/sys/modules/vmware/Makefile

Added: head/share/man/man4/pvscsi.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/pvscsi.4Thu Nov 14 23:31:20 2019
(r354715)
@@ -0,0 +1,74 @@
+.\" Copyright (c) 2018 VMware, Inc.
+.\"
+.\" SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0)
+.\"
+.\" $FreeBSD$
+.Dd December 5, 2018
+.Dt PVSCSI 4
+.Os
+.Sh NAME
+.Nm pvscsi
+.Nd VMware Paravirtual SCSI Controller
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device pvscsi"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+pvscsi_load="YES"
+.Ed
+.Pp
+The following tunables are settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hw.pvscsi.request_ring_pages
+controls how many pages are allocated for the device request ring.
+A non-positive value will cause the driver to choose the value based on device
+capabilities.
+A non-zero value will use that many number of pages up to a maximum of 32.
+The default setting is 0.
+.It Va hw.pvscsi.max_queue_depth
+controls the queue size for the adapter.
+A non-positive value will cause the driver to choose the value based on number
+of request ring pages.
+A non-zero value will set the queue size up to a maximum allowed by the number
+of request ring pages.
+Default is 0.
+.It Va hw.pvscsi.use_msg
+setting to nonzero value enables the use of the PVSCSI message queue allowing
+for disk hot-add and remove without manual rescan needed.
+Default is 1.
+.It Va hw.pvscsi.use_msi
+setting to nonzero value enables the use of MSI interrupts.
+Default is 1.
+.It Va hw.pvscsi.use_msix
+setting to nonzero value enables the use of MSI-X interrupts.
+Default is 1.
+.It Va hw.pvscsi.use_req_call_threshold
+setting to nonzero value enables the request call threshold functionality.
+TODO.
+Default is 1.
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the VMware Paravirtual SCSI Controller (PVSCSI) in
+virtual machines by VMware.
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr da 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 13.0 .
+.Sh AUTHORS
+.An Vishal Bhakta Aq Mt vbha...@vmware.com .

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Thu Nov 14 21:58:40 2019(r354714)
+++ head/sys/amd64/conf/GENERIC Thu Nov 14 23:31:20 2019(r354715)
@@ -152,6 +152,7 @@ device  sym # NCR/Symbios 
Logic
 device trm # Tekram DC395U/UW/F DC315U adapters
 device isci# Intel C600 SAS controller
 device ocs_fc  # Emulex FC adapters
+device pvscsi  # VMware PVSCSI
 
 # ATA/SCSI peripherals
 device scbus   # SCSI bus (required for ATA/SCSI)

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Thu Nov 14 21:58:40 2019(r354714)
+++ head/sys/conf/files.amd64   Thu Nov 14 23:31:20 2019(r354715)
@@ -345,6 +345,7 @@ dev/vmware/vmci/vmci_kernel_if.coptionalvmci
 dev/vmware/vmci/vmci_qpair.c   optionalvmci
 dev/vmware/vmci/vmci_queue_pair.c  optionalvmci
 dev/vmware/vmci/vmci_resource.coptionalvmci
+dev/vmware/pvscsi/pvscsi.c optionalpvscsi
 dev/vmd/vmd.c  optionalvmd
 dev/vmd/vmd_bus.c  optionalvmd_bus
 dev/wbwd/wbwd.c  

Re: svn commit: r352707 - in head/sys: conf kern net sys

2019-10-12 Thread Josh Paetzel
;> --- linux_anon_inodefs.o ---
>>  >> >>> In file included from
>>  >> >>> 
>> /wrkdirs/usr/ports/graphics/drm-devel-kmod/work/kms-drm-dc414a9/linuxkpi/gplv2/src/linux_anon_inodefs.c:45:
>>  >> >>> In file included from
>>  >> >>> 
>> /wrkdirs/usr/ports/graphics/drm-devel-kmod/work/kms-drm-dc414a9/linuxkpi/gplv2/include/linux/debugfs.h:18:
>>  >> >>> In file included from
>>  >> >>> 
>> /wrkdirs/usr/ports/graphics/drm-devel-kmod/work/kms-drm-dc414a9/linuxkpi/gplv2/include/linux/fs.h:6:
>>  >> >>> In file included from
>>  >> >>> 
>> /wrkdirs/usr/ports/graphics/drm-devel-kmod/work/kms-drm-dc414a9/linuxkpi/gplv2/include/linux/shrinker.h:5:
>>  >> >>> In file included from
>>  >> >>> /usr/src/sys/compat/linuxkpi/common/include/linux/list.h:56:
>>  >> >>> In file included from /usr/src/sys/net/if_var.h:83:
>>  >> >>> /usr/src/sys/sys/epoch.h:44:10: fatal error: 'opt_epoch.h' file not 
>> found
>>  >> >>> #include "opt_epoch.h"
>>  >> >>> ^
>>  >> >>> --- linux_anon_inodes.o ---
>>  >> >>> 1 error generated.
>>  >> >>> *** [linux_anon_inodes.o] Error code 1
>>  >> >>>
>>  >> >>> make[2]: stopped in
>>  >> >>> 
>> /wrkdirs/usr/ports/graphics/drm-devel-kmod/work/kms-drm-dc414a9/linuxkpi
>>  >> >>> --- linux_anon_inodefs.o ---
>>  >> >>> 1 error generated.
>>  >> >>> *** [linux_anon_inodefs.o] Error code 1
>>  >> >>>
>>  >> >>> Interestingly enough, does not happen when drm-current-kmod is built 
>> as
>>  >> >>> part of buildkernel (using an existing installed package with SOURCE 
>> on).
>>  >> >>>
>>  >> >>
>>  >> >> FWIW, johalun noticed this yesterday and addressed it here:
>>  >> >> 
>> https://github.com/FreeBSDDesktop/kms-drm/commit/b486949e7e9f0cfe8dac5f0ac7fe1a660300981d
>>  >> >>
>>  >> > Ah, of course I would miss these commits in the kms-drm repo,
>>  >> > considering that I watch them roll in. Will wait for the updated
>>  >> > snapshots in ports.
>>  >> >
>>  >>
>>  >> I'll get to updating the ports as soon as I can.
>>  >> Regards
>>  >> --
>>  >> Niclas Zeising
>>  >> ___
>>  >> freebsd-...@freebsd.org mailing list
>>  >> https://lists.freebsd.org/mailman/listinfo/freebsd-x11
>>  >> To unsubscribe, send any mail to "freebsd-x11-unsubscr...@freebsd.org"

This commit broke emulators/open-vm-tools (which builds an out of tree if_vmx)

Should I chase a fix for it or wait for this to get resolved in src?

--

Thanks,

Josh Paetzel
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333146 - head/sys/dev/oce

2018-05-01 Thread Josh Paetzel
Author: jpaetzel
Date: Tue May  1 17:39:20 2018
New Revision: 333146
URL: https://svnweb.freebsd.org/changeset/base/333146

Log:
  Add ability to perform a firmware reset during driver initialization.
  
  Required by Lancer Gen 5 hardware.
  
  Submitted by: Ram Kishore Vegesna 
  Obtained from:Broadcom

Modified:
  head/sys/dev/oce/oce_if.h
  head/sys/dev/oce/oce_mbox.c

Modified: head/sys/dev/oce/oce_if.h
==
--- head/sys/dev/oce/oce_if.h   Tue May  1 17:32:43 2018(r333145)
+++ head/sys/dev/oce/oce_if.h   Tue May  1 17:39:20 2018(r333146)
@@ -1016,6 +1016,7 @@ void oce_free_lro(POCE_SOFTC sc);
  * Mailbox functions
  /
 int oce_fw_clean(POCE_SOFTC sc);
+int oce_wait_ready(POCE_SOFTC sc);
 int oce_reset_fun(POCE_SOFTC sc);
 int oce_mbox_init(POCE_SOFTC sc);
 int oce_mbox_dispatch(POCE_SOFTC sc, uint32_t tmo_sec);

Modified: head/sys/dev/oce/oce_mbox.c
==
--- head/sys/dev/oce/oce_mbox.c Tue May  1 17:32:43 2018(r333145)
+++ head/sys/dev/oce/oce_mbox.c Tue May  1 17:39:20 2018(r333146)
@@ -43,6 +43,34 @@
 #include "oce_if.h"
 extern uint32_t sfp_vpd_dump_buffer[TRANSCEIVER_DATA_NUM_ELE];
 
+int
+oce_wait_ready(POCE_SOFTC sc)
+{
+#define SLIPORT_READY_TIMEOUT 3
+   uint32_t sliport_status, i;
+
+   if (!IS_XE201(sc)) 
+   return (-1);
+
+   for (i = 0; i < SLIPORT_READY_TIMEOUT; i++) {
+   sliport_status = OCE_READ_REG32(sc, db, SLIPORT_STATUS_OFFSET);
+   if (sliport_status & SLIPORT_STATUS_RDY_MASK)
+   return 0;
+
+   if (sliport_status & SLIPORT_STATUS_ERR_MASK &&
+   !(sliport_status & SLIPORT_STATUS_RN_MASK)) {
+   device_printf(sc->dev, "Error detected in the card\n");
+   return EIO;
+   }
+
+   DELAY(1000);
+   }
+
+   device_printf(sc->dev, "Firmware wait timed out\n");
+
+   return (-1);
+}
+
 /**
  * @brief Reset (firmware) common function
  * @param sc   software handle to the device
@@ -56,26 +84,36 @@ oce_reset_fun(POCE_SOFTC sc)
struct ioctl_common_function_reset *fwcmd;
int rc = 0;
 
-   if (sc->flags & OCE_FLAGS_FUNCRESET_RQD) {
-   mb = OCE_DMAPTR(>bsmbx, struct oce_bmbx);
-   mbx = >mbx;
-   bzero(mbx, sizeof(struct oce_mbx));
+   if (IS_XE201(sc)) {
+   OCE_WRITE_REG32(sc, db, SLIPORT_CONTROL_OFFSET,
+   SLI_PORT_CONTROL_IP_MASK);
 
-   fwcmd = (struct ioctl_common_function_reset *)>payload;
-   mbx_common_req_hdr_init(>hdr, 0, 0,
-   MBX_SUBSYSTEM_COMMON,
-   OPCODE_COMMON_FUNCTION_RESET,
-   10, /* MBX_TIMEOUT_SEC */
-   sizeof(struct
-   ioctl_common_function_reset),
-   OCE_MBX_VER_V0);
+   rc = oce_wait_ready(sc);
+   if (rc) {
+   device_printf(sc->dev, "Firmware reset Failed\n");
+   }
 
-   mbx->u0.s.embedded = 1;
-   mbx->payload_length =
-   sizeof(struct ioctl_common_function_reset);
-
-   rc = oce_mbox_dispatch(sc, 2);
+   return rc;
}
+
+   mb = OCE_DMAPTR(>bsmbx, struct oce_bmbx);
+   mbx = >mbx;
+   bzero(mbx, sizeof(struct oce_mbx));
+
+   fwcmd = (struct ioctl_common_function_reset *)>payload;
+   mbx_common_req_hdr_init(>hdr, 0, 0,
+   MBX_SUBSYSTEM_COMMON,
+   OPCODE_COMMON_FUNCTION_RESET,
+   10, /* MBX_TIMEOUT_SEC */
+   sizeof(struct
+   ioctl_common_function_reset),
+   OCE_MBX_VER_V0);
+
+   mbx->u0.s.embedded = 1;
+   mbx->payload_length =
+   sizeof(struct ioctl_common_function_reset);
+
+   rc = oce_mbox_dispatch(sc, 2);
 
return rc;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r323778 - in head/sys: arm64/conf i386/conf powerpc/conf riscv/conf sparc64/conf

2017-09-19 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Sep 19 20:40:05 2017
New Revision: 323778
URL: https://svnweb.freebsd.org/changeset/base/323778

Log:
  Fix indentation for r323068
  
  PR:   220170
  Reported by:  lidl
  MFC after:3 days
  Pointyhat to: jpaetzel

Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/i386/conf/GENERIC
  head/sys/powerpc/conf/GENERIC
  head/sys/riscv/conf/GENERIC
  head/sys/sparc64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Tue Sep 19 20:33:22 2017(r323777)
+++ head/sys/arm64/conf/GENERIC Tue Sep 19 20:40:05 2017(r323778)
@@ -29,7 +29,7 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
-optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol

Modified: head/sys/i386/conf/GENERIC
==
--- head/sys/i386/conf/GENERIC  Tue Sep 19 20:33:22 2017(r323777)
+++ head/sys/i386/conf/GENERIC  Tue Sep 19 20:40:05 2017(r323778)
@@ -31,7 +31,7 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
-optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol

Modified: head/sys/powerpc/conf/GENERIC
==
--- head/sys/powerpc/conf/GENERIC   Tue Sep 19 20:33:22 2017
(r323777)
+++ head/sys/powerpc/conf/GENERIC   Tue Sep 19 20:40:05 2017
(r323778)
@@ -38,7 +38,7 @@ options   PREEMPTION  #Enable kernel thread 
preemption
 optionsINET#InterNETworking
 optionsINET6   #IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
-optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsSCTP#Stream Control Transmission Protocol
 optionsFFS #Berkeley Fast Filesystem

Modified: head/sys/riscv/conf/GENERIC
==
--- head/sys/riscv/conf/GENERIC Tue Sep 19 20:33:22 2017(r323777)
+++ head/sys/riscv/conf/GENERIC Tue Sep 19 20:40:05 2017(r323778)
@@ -34,7 +34,7 @@ options   INET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsIPSEC   # IP (v4/v6) security
-optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and tcpmd5
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem

Modified: head/sys/sparc64/conf/GENERIC
==
--- head/sys/sparc64/conf/GENERIC   Tue Sep 19 20:33:22 2017
(r323777)
+++ head/sys/sparc64/conf/GENERIC   Tue Sep 19 20:40:05 2017
(r323778)
@@ -31,7 +31,7 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
-optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # 

svn commit: r323103 - in head/sys: amd64/conf arm64/conf i386/conf powerpc/conf riscv/conf sparc64/conf

2017-09-01 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Sep  1 17:03:48 2017
New Revision: 323103
URL: https://svnweb.freebsd.org/changeset/base/323103

Log:
  Revert r323087
  
  This needs more thinking out and consensus, and the commit message
  was wrong AND there was a typo in the commit.
  
  pointyhat:jpaetzel

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/arm64/conf/GENERIC
  head/sys/i386/conf/GENERIC
  head/sys/powerpc/conf/GENERIC
  head/sys/riscv/conf/GENERIC
  head/sys/sparc64/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Fri Sep  1 16:56:37 2017(r323102)
+++ head/sys/amd64/conf/GENERIC Fri Sep  1 17:03:48 2017(r323103)
@@ -28,6 +28,7 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
+optionsIPSEC   # IP (v4/v6) security
 optionsIPSEC_SUPPORT   # Allow kldload of ipsec and tcpmd5
 optionsTCP_OFFLOAD # TCP offload
 optionsTCP_HHOOK   # hhook(9) framework for TCP

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Fri Sep  1 16:56:37 2017(r323102)
+++ head/sys/arm64/conf/GENERIC Fri Sep  1 17:03:48 2017(r323103)
@@ -29,6 +29,7 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol

Modified: head/sys/i386/conf/GENERIC
==
--- head/sys/i386/conf/GENERIC  Fri Sep  1 16:56:37 2017(r323102)
+++ head/sys/i386/conf/GENERIC  Fri Sep  1 17:03:48 2017(r323103)
@@ -30,6 +30,7 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
+optionsIPSEC   # IP (v4/v6) security
 optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsTCP_OFFLOAD # TCP offload

Modified: head/sys/powerpc/conf/GENERIC
==
--- head/sys/powerpc/conf/GENERIC   Fri Sep  1 16:56:37 2017
(r323102)
+++ head/sys/powerpc/conf/GENERIC   Fri Sep  1 17:03:48 2017
(r323103)
@@ -37,6 +37,7 @@ options   SCHED_ULE   #ULE scheduler
 optionsPREEMPTION  #Enable kernel thread preemption
 optionsINET#InterNETworking
 optionsINET6   #IPv6 communications protocols
+optionsIPSEC   # IP (v4/v6) security
 optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsSCTP#Stream Control Transmission Protocol

Modified: head/sys/riscv/conf/GENERIC
==
--- head/sys/riscv/conf/GENERIC Fri Sep  1 16:56:37 2017(r323102)
+++ head/sys/riscv/conf/GENERIC Fri Sep  1 17:03:48 2017(r323103)
@@ -33,6 +33,7 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsTCP_HHOOK   # hhook(9) framework for TCP
+optionsIPSEC   # IP (v4/v6) security
 optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol

Modified: head/sys/sparc64/conf/GENERIC
==
--- head/sys/sparc64/conf/GENERIC   Fri Sep  1 16:56:37 2017
(r323102)
+++ head/sys/sparc64/conf/GENERIC   Fri Sep  1 17:03:48 2017
(r323103)
@@ -30,6 +30,7 @@ options   SCHED_ULE   # ULE scheduler
 options   

svn commit: r323087 - in head/sys: amd64/conf arm64/conf i386/conf powerpc/conf riscv/conf sparc64/conf

2017-09-01 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Sep  1 15:54:53 2017
New Revision: 323087
URL: https://svnweb.freebsd.org/changeset/base/323087

Log:
  Take options IPSEC out of GENERIC
  
  PR:   220170
  Submitted by: delphij
  Reviewed by:  ae, glebius
  MFC after:2 weeks
  Differential Revision:D11806

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/arm64/conf/GENERIC
  head/sys/i386/conf/GENERIC
  head/sys/powerpc/conf/GENERIC
  head/sys/riscv/conf/GENERIC
  head/sys/sparc64/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Fri Sep  1 11:51:07 2017(r323086)
+++ head/sys/amd64/conf/GENERIC Fri Sep  1 15:54:53 2017(r323087)
@@ -28,7 +28,6 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
-optionsIPSEC   # IP (v4/v6) security
 optionsIPSEC_SUPPORT   # Allow kldload of ipsec and tcpmd5
 optionsTCP_OFFLOAD # TCP offload
 optionsTCP_HHOOK   # hhook(9) framework for TCP

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Fri Sep  1 11:51:07 2017(r323086)
+++ head/sys/arm64/conf/GENERIC Fri Sep  1 15:54:53 2017(r323087)
@@ -29,7 +29,6 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
-optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol

Modified: head/sys/i386/conf/GENERIC
==
--- head/sys/i386/conf/GENERIC  Fri Sep  1 11:51:07 2017(r323086)
+++ head/sys/i386/conf/GENERIC  Fri Sep  1 15:54:53 2017(r323087)
@@ -30,7 +30,6 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
-optionsIPSEC   # IP (v4/v6) security
 optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsTCP_OFFLOAD # TCP offload

Modified: head/sys/powerpc/conf/GENERIC
==
--- head/sys/powerpc/conf/GENERIC   Fri Sep  1 11:51:07 2017
(r323086)
+++ head/sys/powerpc/conf/GENERIC   Fri Sep  1 15:54:53 2017
(r323087)
@@ -37,7 +37,6 @@ options   SCHED_ULE   #ULE scheduler
 optionsPREEMPTION  #Enable kernel thread preemption
 optionsINET#InterNETworking
 optionsINET6   #IPv6 communications protocols
-optionsIPSEC   # IP (v4/v6) security
 optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsSCTP#Stream Control Transmission Protocol

Modified: head/sys/riscv/conf/GENERIC
==
--- head/sys/riscv/conf/GENERIC Fri Sep  1 11:51:07 2017(r323086)
+++ head/sys/riscv/conf/GENERIC Fri Sep  1 15:54:53 2017(r323087)
@@ -33,7 +33,6 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsTCP_HHOOK   # hhook(9) framework for TCP
-optionsIPSEC   # IP (v4/v6) security
 optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol

Modified: head/sys/sparc64/conf/GENERIC
==
--- head/sys/sparc64/conf/GENERIC   Fri Sep  1 11:51:07 2017
(r323086)
+++ head/sys/sparc64/conf/GENERIC   Fri Sep  1 15:54:53 2017
(r323087)
@@ -30,7 +30,6 @@ options   SCHED_ULE   # ULE scheduler
 options   

svn commit: r323068 - in head/sys: amd64/conf arm64/conf i386/conf powerpc/conf riscv/conf sparc64/conf

2017-08-31 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Aug 31 20:16:28 2017
New Revision: 323068
URL: https://svnweb.freebsd.org/changeset/base/323068

Log:
  Allow kldload tcpmd5
  
  PR:   220170
  MFC after:2 weeks

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/arm64/conf/GENERIC
  head/sys/i386/conf/GENERIC
  head/sys/powerpc/conf/GENERIC
  head/sys/riscv/conf/GENERIC
  head/sys/sparc64/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Thu Aug 31 18:39:18 2017(r323067)
+++ head/sys/amd64/conf/GENERIC Thu Aug 31 20:16:28 2017(r323068)
@@ -29,6 +29,7 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and tcpmd5
 optionsTCP_OFFLOAD # TCP offload
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsSCTP# Stream Control Transmission Protocol

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Thu Aug 31 18:39:18 2017(r323067)
+++ head/sys/arm64/conf/GENERIC Thu Aug 31 20:16:28 2017(r323068)
@@ -29,6 +29,7 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol

Modified: head/sys/i386/conf/GENERIC
==
--- head/sys/i386/conf/GENERIC  Thu Aug 31 18:39:18 2017(r323067)
+++ head/sys/i386/conf/GENERIC  Thu Aug 31 20:16:28 2017(r323068)
@@ -31,6 +31,7 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol

Modified: head/sys/powerpc/conf/GENERIC
==
--- head/sys/powerpc/conf/GENERIC   Thu Aug 31 18:39:18 2017
(r323067)
+++ head/sys/powerpc/conf/GENERIC   Thu Aug 31 20:16:28 2017
(r323068)
@@ -38,6 +38,7 @@ options   PREEMPTION  #Enable kernel thread 
preemption
 optionsINET#InterNETworking
 optionsINET6   #IPv6 communications protocols
 optionsIPSEC   # IP (v4/v6) security
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsSCTP#Stream Control Transmission Protocol
 optionsFFS #Berkeley Fast Filesystem

Modified: head/sys/riscv/conf/GENERIC
==
--- head/sys/riscv/conf/GENERIC Thu Aug 31 18:39:18 2017(r323067)
+++ head/sys/riscv/conf/GENERIC Thu Aug 31 20:16:28 2017(r323068)
@@ -34,6 +34,7 @@ options   INET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsTCP_HHOOK   # hhook(9) framework for TCP
 optionsIPSEC   # IP (v4/v6) security
+optionsIPSEC_SUPPORT   # Allow kldload of ipsec and 
tcpmd5
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem

Modified: head/sys/sparc64/conf/GENERIC
==
--- head/sys/sparc64/conf/GENERIC   Thu Aug 31 18:39:18 2017
(r323067)
+++ head/sys/sparc64/conf/GENERIC   Thu Aug 31 20:16:28 2017
(r323068)
@@ -31,6 +31,7 @@ options   PREEMPTION  # Enable kernel thread 
preemption
 optionsINET# 

svn commit: r320394 - head/sys/dev/bktr

2017-06-26 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Jun 27 03:57:31 2017
New Revision: 320394
URL: https://svnweb.freebsd.org/changeset/base/320394

Log:
  ioctl METEORGBRIG in bktr_core.c forgets to add 128 to value
  
  PR:   59289
  Submitted by: danovit...@vitsch.net

Modified:
  head/sys/dev/bktr/bktr_core.c

Modified: head/sys/dev/bktr/bktr_core.c
==
--- head/sys/dev/bktr/bktr_core.c   Tue Jun 27 03:45:09 2017
(r320393)
+++ head/sys/dev/bktr/bktr_core.c   Tue Jun 27 03:57:31 2017
(r320394)
@@ -1545,7 +1545,7 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cm
break;
 
case METEORGBRIG:   /* get brightness */
-   *(u_char *)arg = INB(bktr, BKTR_BRIGHT);
+   *(u_char *)arg = INB(bktr, BKTR_BRIGHT) + 128;
break;
 
case METEORSCSAT:   /* set chroma saturation */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r320393 - head/sys/dev/bktr

2017-06-26 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Jun 27 03:45:09 2017
New Revision: 320393
URL: https://svnweb.freebsd.org/changeset/base/320393

Log:
  driver incorrectly handles the setting of frame rates
  
  PR:   36415
  Submitted by: bra...@fokus.gmd.de

Modified:
  head/sys/dev/bktr/bktr_core.c

Modified: head/sys/dev/bktr/bktr_core.c
==
--- head/sys/dev/bktr/bktr_core.c   Tue Jun 27 01:57:22 2017
(r320392)
+++ head/sys/dev/bktr/bktr_core.c   Tue Jun 27 03:45:09 2017
(r320393)
@@ -972,7 +972,7 @@ video_open( bktr_ptr_t bktr )
bktr->flags |= METEOR_OPEN;
 
 #ifdef BT848_DUMP
-   dump_bt848( bt848 );
+   dump_bt848(bktr);
 #endif
 
 bktr->clr_on_start = FALSE;
@@ -1688,7 +1688,7 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cm
BT848_INT_VSYNC  |
BT848_INT_FMTCHG);
 #ifdef BT848_DUMP
-   dump_bt848( bt848 );
+   dump_bt848(bktr);
 #endif
break;

@@ -2522,7 +2522,7 @@ common_ioctl( bktr_ptr_t bktr, ioctl_cmd_t cmd, caddr_
 /*
  * 
  */
-#ifdef BT848_DEBUG 
+#if defined(BT848_DEBUG) || defined(BT848_DUMP)
 static int
 dump_bt848( bktr_ptr_t bktr )
 {
@@ -2542,7 +2542,7 @@ dump_bt848( bktr_ptr_t bktr )
   r[i], INL(bktr, r[i]),
   r[i+1], INL(bktr, r[i+1]),
   r[i+2], INL(bktr, r[i+2]),
-  r[i+3], INL(bktr, r[i+3]]));
+  r[i+3], INL(bktr, r[i+3]));
}
 
printf("%s: INT STAT %x \n", bktr_name(bktr),
@@ -3705,28 +3705,26 @@ start_capture( bktr_ptr_t bktr, unsigned type )
 
 
 /*
- * 
+ * Set the temporal decimation register to get the desired frame rate.
+ * We use the 'skip frame' modus always and always start dropping on an
+ * odd field.
  */
 static void
 set_fps( bktr_ptr_t bktr, u_short fps )
 {
struct format_params*fp;
-   int i_flag;
 
fp = _params[bktr->format_params];
 
switch(bktr->flags & METEOR_ONLY_FIELDS_MASK) {
case METEOR_ONLY_EVEN_FIELDS:
bktr->flags |= METEOR_WANT_EVEN;
-   i_flag = 1;
break;
case METEOR_ONLY_ODD_FIELDS:
bktr->flags |= METEOR_WANT_ODD;
-   i_flag = 1;
break;
default:
bktr->flags |= METEOR_WANT_MASK;
-   i_flag = 2;
break;
}
 
@@ -3737,7 +3735,7 @@ set_fps( bktr_ptr_t bktr, u_short fps )
OUTB(bktr, BKTR_TDEC, 0);
 
if (fps < fp->frame_rate)
-   OUTB(bktr, BKTR_TDEC, i_flag*(fp->frame_rate - fps) & 0x3f);
+   OUTB(bktr, BKTR_TDEC, (fp->frame_rate - fps) & 0x3f);
else
OUTB(bktr, BKTR_TDEC, 0);
return;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319670 - head/contrib/smbfs/lib/smb

2017-06-07 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Jun  8 00:48:26 2017
New Revision: 319670
URL: https://svnweb.freebsd.org/changeset/base/319670

Log:
  Fix SMBFS when saved passwords are greater than 18 characters
  
  PR:   132302
  Submitted by: dhorn2...@gmail.com g...@unixarea.de
  MFC after:1 week

Modified:
  head/contrib/smbfs/lib/smb/subr.c

Modified: head/contrib/smbfs/lib/smb/subr.c
==
--- head/contrib/smbfs/lib/smb/subr.c   Thu Jun  8 00:41:25 2017
(r319669)
+++ head/contrib/smbfs/lib/smb/subr.c   Thu Jun  8 00:48:26 2017
(r319670)
@@ -232,6 +232,8 @@ smb_simplecrypt(char *dst, const char *src)
  islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch);
ch ^= pos;
pos += 13;
+   if (pos > 256)
+   pos -= 256;
sprintf(dst, "%02x", ch);
dst += 2;
}
@@ -262,6 +264,8 @@ smb_simpledecrypt(char *dst, const char *src)
return EINVAL;
ch ^= pos;
pos += 13;
+   if (pos > 256)
+   pos -= 256;
if (isascii(ch))
ch = (isupper(ch) ? ('A' + (ch - 'A' + 13) % 26) :
  islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318401 - head/sys/dev/tws

2017-05-17 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 17 13:22:13 2017
New Revision: 318401
URL: https://svnweb.freebsd.org/changeset/base/318401

Log:
  Increase the number of LUNs this hardware can support.
  
  Experimentally we know this value works, but the hardware
  may support an even higher value.
  
  PR:   213876
  Reported by:  j.catry...@proximedia.be
  MFC after:1 week

Modified:
  head/sys/dev/tws/tws.h

Modified: head/sys/dev/tws/tws.h
==
--- head/sys/dev/tws/tws.h  Wed May 17 10:56:22 2017(r318400)
+++ head/sys/dev/tws/tws.h  Wed May 17 13:22:13 2017(r318401)
@@ -67,7 +67,7 @@ extern int tws_queue_depth;
 
 #define TWS_DRIVER_VERSION_STRING "10.80.00.005"
 #define TWS_MAX_NUM_UNITS 65 
-#define TWS_MAX_NUM_LUNS  16
+#define TWS_MAX_NUM_LUNS  32
 #define TWS_MAX_IRQS  2
 #define TWS_SCSI_INITIATOR_ID 66
 #define TWS_MAX_IO_SIZE   0x2 /* 128kB */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317648 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-05-01 Thread Josh Paetzel
Author: jpaetzel
Date: Mon May  1 12:56:12 2017
New Revision: 317648
URL: https://svnweb.freebsd.org/changeset/base/317648

Log:
  Fix misport of compressed ZFS send/recv from 317414
  
  Reported by:  Michael Jung 
  Reviewed by:  avg

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon May  1 
12:42:06 2017(r317647)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon May  1 
12:56:12 2017(r317648)
@@ -962,7 +962,7 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui
flags |= ZIO_FLAG_DONT_QUEUE;
 
zio = zio_create(pio, spa, txg, bp, NULL, size,
-   BP_GET_PSIZE(bp), NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_NOW,
+   size, NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_NOW,
flags, NULL, 0, NULL, ZIO_STAGE_OPEN, stage);
 
return (zio);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317541 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-04-27 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Apr 28 02:11:29 2017
New Revision: 317541
URL: https://svnweb.freebsd.org/changeset/base/317541

Log:
  MFV 316905
  
  7740 fix for 6513 only works in hole punching case, not truncation
  
  illumos/illumos-gate@7de35a3ed0c2e6d4256bd2fb05b48b3798aaf553
  
https://github.com/illumos/illumos-gate/commit/7de35a3ed0c2e6d4256bd2fb05b48b3798aaf553
  
  https://www.illumos.org/issues/7740
The problem is that dbuf_findbp will return ENOENT if the block it's
trying to find is beyond the end of the file. If that happens, we assume
there is no birth time, and so we lose that information when we write
out new blkptrs. We should teach dbuf_findbp to look for things that are
beyond the current end, but not beyond the absolute end of the file.
To verify, create a large file, truncate it to a short length, and then
write beyond the end. Check with zdb to make sure that there are no
holes with birth time zero (will appear as gaps).
  
  Reviewed by: Steve Gonczi 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Paul Dagnelie 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Fri Apr 28 
01:54:01 2017(r317540)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Fri Apr 28 
02:11:29 2017(r317541)
@@ -2161,8 +2161,6 @@ static int
 dbuf_findbp(dnode_t *dn, int level, uint64_t blkid, int fail_sparse,
 dmu_buf_impl_t **parentp, blkptr_t **bpp)
 {
-   int nlevels, epbs;
-
*parentp = NULL;
*bpp = NULL;
 
@@ -2181,17 +2179,35 @@ dbuf_findbp(dnode_t *dn, int level, uint
return (0);
}
 
-   if (dn->dn_phys->dn_nlevels == 0)
-   nlevels = 1;
-   else
-   nlevels = dn->dn_phys->dn_nlevels;
-
-   epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT;
+   int nlevels =
+   (dn->dn_phys->dn_nlevels == 0) ? 1 : dn->dn_phys->dn_nlevels;
+   int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT;
 
ASSERT3U(level * epbs, <, 64);
ASSERT(RW_LOCK_HELD(>dn_struct_rwlock));
+   /*
+* This assertion shouldn't trip as long as the max indirect block size
+* is less than 1M.  The reason for this is that up to that point,
+* the number of levels required to address an entire object with blocks
+* of size SPA_MINBLOCKSIZE satisfies nlevels * epbs + 1 <= 64.  In
+* other words, if N * epbs + 1 > 64, then if (N-1) * epbs + 1 > 55
+* (i.e. we can address the entire object), objects will all use at most
+* N-1 levels and the assertion won't overflow.  However, once epbs is
+* 13, 4 * 13 + 1 = 53, but 5 * 13 + 1 = 66.  Then, 4 levels will not be
+* enough to address an entire object, so objects will have 5 levels,
+* but then this assertion will overflow.
+*
+* All this is to say that if we ever increase DN_MAX_INDBLKSHIFT, we
+* need to redo this logic to handle overflows.
+*/
+   ASSERT(level >= nlevels ||
+   ((nlevels - level - 1) * epbs) +
+   highbit64(dn->dn_phys->dn_nblkptr) <= 64);
if (level >= nlevels ||
-   (blkid > (dn->dn_phys->dn_maxblkid >> (level * epbs {
+   blkid >= ((uint64_t)dn->dn_phys->dn_nblkptr <<
+   ((nlevels - level - 1) * epbs)) ||
+   (fail_sparse &&
+   blkid > (dn->dn_phys->dn_maxblkid >> (level * epbs {
/* the buffer has no parent yet */
return (SET_ERROR(ENOENT));
} else if (level < nlevels-1) {
@@ -2209,6 +2225,8 @@ dbuf_findbp(dnode_t *dn, int level, uint
}
*bpp = ((blkptr_t *)(*parentp)->db.db_data) +
(blkid & ((1ULL << epbs) - 1));
+   if (blkid > (dn->dn_phys->dn_maxblkid >> (level * epbs)))
+   ASSERT(BP_IS_HOLE(*bpp));
return (0);
} else {
/* the block is referenced from the dnode */

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Fri Apr 
28 01:54:01 2017(r317540)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Fri Apr 
28 02:11:29 2017(r317541)
@@ -58,6 +58,12 @@ extern "C" {
  */
 #defineDNODE_SHIFT 9   /* 512 bytes */
 #defineDN_MIN_INDBLKSHIFT  12  /* 

svn commit: r317533 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-04-27 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Apr 27 23:31:38 2017
New Revision: 317533
URL: https://svnweb.freebsd.org/changeset/base/317533

Log:
  MFV 316900
  
  7743 per-vdev-zaps have no initialize path on upgrade
  
  illumos/illumos-gate@555da5111b0f2552c42d057b211aba89c9c79f6c
  
https://github.com/illumos/illumos-gate/commit/555da5111b0f2552c42d057b211aba89c9c79f6c
  
  https://www.illumos.org/issues/7743
When loading a pool that had been created before the existance of
per-vdev zaps, on a system that knows about per-vdev zaps, the
per-vdev zaps will not be allocated and initialized.
This appears to be because the logic that would have done so, in
spa_sync_config_object(), is not reached under normal operation. It is
only reached if spa_config_dirty_list is non-empty.
The fix is to add another `AVZ_ACTION_` enum that will allow this code
to be reached when we detect that we're loading an old pool, even when
there are no dirty configs.
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Pavel Zakharov 
  Reviewed by: George Wilson 
  Reviewed by: Don Brady 
  Approved by: Robert Mustacchi 
  Author: Paul Dagnelie 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Thu Apr 27 
23:14:01 2017(r317532)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Thu Apr 27 
23:31:38 2017(r317533)
@@ -2731,10 +2731,14 @@ spa_load_impl(spa_t *spa, uint64_t pool_
error = spa_dir_prop(spa, DMU_POOL_VDEV_ZAP_MAP,
>spa_all_vdev_zaps);
 
-   if (error != ENOENT && error != 0) {
+   if (error == ENOENT) {
+   VERIFY(!nvlist_exists(mos_config,
+   ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS));
+   spa->spa_avz_action = AVZ_ACTION_INITIALIZE;
+   ASSERT0(vdev_count_verify_zaps(spa->spa_root_vdev));
+   } else if (error != 0) {
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
-   } else if (error == 0 && !nvlist_exists(mos_config,
-   ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) {
+   } else if (!nvlist_exists(mos_config, ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) {
/*
 * An older version of ZFS overwrote the sentinel value, so
 * we have orphaned per-vdev ZAPs in the MOS. Defer their
@@ -6498,6 +6502,7 @@ spa_sync_config_object(spa_t *spa, dmu_t
spa_config_enter(spa, SCL_STATE, FTAG, RW_READER);
 
ASSERT(spa->spa_avz_action == AVZ_ACTION_NONE ||
+   spa->spa_avz_action == AVZ_ACTION_INITIALIZE ||
spa->spa_all_vdev_zaps != 0);
 
if (spa->spa_avz_action == AVZ_ACTION_REBUILD) {

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h  Thu Apr 
27 23:14:01 2017(r317532)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h  Thu Apr 
27 23:31:38 2017(r317533)
@@ -120,7 +120,8 @@ typedef struct spa_taskqs {
 typedef enum spa_all_vdev_zap_action {
AVZ_ACTION_NONE = 0,
AVZ_ACTION_DESTROY, /* Destroy all per-vdev ZAPs and the AVZ. */
-   AVZ_ACTION_REBUILD  /* Populate the new AVZ, see spa_avz_rebuild */
+   AVZ_ACTION_REBUILD, /* Populate the new AVZ, see spa_avz_rebuild */
+   AVZ_ACTION_INITIALIZE
 } spa_avz_action_t;
 
 struct spa {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317527 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-04-27 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Apr 27 22:00:03 2017
New Revision: 317527
URL: https://svnweb.freebsd.org/changeset/base/317527

Log:
  MFV 316898
  
  7613 ms_freetree[4] is only used in syncing context
  
  illumos/illumos-gate@5f145778012b555e084eacc858ead9e1e42bd149
  
https://github.com/illumos/illumos-gate/commit/5f145778012b555e084eacc858ead9e1e42bd149
  
  https://www.illumos.org/issues/7613
metaslab_t:ms_freetree[TXG_SIZE] is only used in syncing context. We should
replace it with two trees: the freeing tree (ranges that we are freeing this
syncing txg) and the freed tree (ranges which have been freed this txg).
  
  Reviewed by: George Wilson 
  Reviewed by: Alex Reece 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c  Thu Apr 
27 21:45:50 2017(r317526)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c  Thu Apr 
27 22:00:03 2017(r317527)
@@ -533,7 +533,6 @@ metaslab_verify_space(metaslab_t *msp, u
 {
spa_t *spa = msp->ms_group->mg_vd->vdev_spa;
uint64_t allocated = 0;
-   uint64_t freed = 0;
uint64_t sm_free_space, msp_free_space;
 
ASSERT(MUTEX_HELD(>ms_lock));
@@ -563,10 +562,9 @@ metaslab_verify_space(metaslab_t *msp, u
allocated +=
range_tree_space(msp->ms_alloctree[(txg + t) & TXG_MASK]);
}
-   freed = range_tree_space(msp->ms_freetree[TXG_CLEAN(txg) & TXG_MASK]);
 
msp_free_space = range_tree_space(msp->ms_tree) + allocated +
-   msp->ms_deferspace + freed;
+   msp->ms_deferspace + range_tree_space(msp->ms_freedtree);
 
VERIFY3U(sm_free_space, ==, msp_free_space);
 }
@@ -1499,7 +1497,7 @@ metaslab_init(metaslab_group_t *mg, uint
 
/*
 * We create the main range tree here, but we don't create the
-* alloctree and freetree until metaslab_sync_done().  This serves
+* other range trees until metaslab_sync_done().  This serves
 * two purposes: it allows metaslab_sync_done() to detect the
 * addition of new space; and for debugging, it ensures that we'd
 * data fault on any attempt to use this metaslab before it's ready.
@@ -1557,10 +1555,11 @@ metaslab_fini(metaslab_t *msp)
 
metaslab_unload(msp);
range_tree_destroy(msp->ms_tree);
+   range_tree_destroy(msp->ms_freeingtree);
+   range_tree_destroy(msp->ms_freedtree);
 
for (int t = 0; t < TXG_SIZE; t++) {
range_tree_destroy(msp->ms_alloctree[t]);
-   range_tree_destroy(msp->ms_freetree[t]);
}
 
for (int t = 0; t < TXG_DEFER_SIZE; t++) {
@@ -2171,7 +2170,6 @@ static void
 metaslab_condense(metaslab_t *msp, uint64_t txg, dmu_tx_t *tx)
 {
spa_t *spa = msp->ms_group->mg_vd->vdev_spa;
-   range_tree_t *freetree = msp->ms_freetree[txg & TXG_MASK];
range_tree_t *condense_tree;
space_map_t *sm = msp->ms_sm;
 
@@ -2202,9 +2200,9 @@ metaslab_condense(metaslab_t *msp, uint6
/*
 * Remove what's been freed in this txg from the condense_tree.
 * Since we're in sync_pass 1, we know that all the frees from
-* this txg are in the freetree.
+* this txg are in the freeingtree.
 */
-   range_tree_walk(freetree, range_tree_remove, condense_tree);
+   range_tree_walk(msp->ms_freeingtree, range_tree_remove, condense_tree);
 
for (int t = 0; t < TXG_DEFER_SIZE; t++) {
range_tree_walk(msp->ms_defertree[t],
@@ -2260,9 +2258,6 @@ metaslab_sync(metaslab_t *msp, uint64_t 
spa_t *spa = vd->vdev_spa;
objset_t *mos = spa_meta_objset(spa);
range_tree_t *alloctree = msp->ms_alloctree[txg & TXG_MASK];
-   range_tree_t **freetree = >ms_freetree[txg & TXG_MASK];
-   range_tree_t **freed_tree =
-   >ms_freetree[TXG_CLEAN(txg) & TXG_MASK];
dmu_tx_t *tx;
uint64_t object = space_map_object(msp->ms_sm);
 
@@ -2271,14 +2266,14 @@ metaslab_sync(metaslab_t *msp, uint64_t 
/*
 * This metaslab has just been added so there's no work to do now.
 */
-   if (*freetree == NULL) {
+   if (msp->ms_freeingtree == NULL) {
ASSERT3P(alloctree, ==, NULL);
return;
}
 
ASSERT3P(alloctree, !=, NULL);
-   ASSERT3P(*freetree, !=, NULL);
-   ASSERT3P(*freed_tree, !=, NULL);
+   ASSERT3P(msp->ms_freeingtree, !=, NULL);
+   

svn commit: r317522 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2017-04-27 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Apr 27 21:11:57 2017
New Revision: 317522
URL: https://svnweb.freebsd.org/changeset/base/317522

Log:
  MFV 316897
  
  7586 remove #ifdef __lint hack from dmu.h
  
  illumos/illumos-gate@4ba5b9616327ef64e8abc737d29b3faabc6ae68c
  
https://github.com/illumos/illumos-gate/commit/4ba5b9616327ef64e8abc737d29b3faabc6ae68c
  
  https://www.illumos.org/issues/7586
The #ifdef __lint in dmu.h is ugly, and it would be nice not to duplicate 
it if
we add other inline functions into header files in ZFS, especially since it 
is
difficult to make any other solution work across all compilation targets. We
should switch to disabling the lint flags that are failing instead.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Pavel Zakharov 
  Approved by: Dan McDonald 
  Author: Dan Kimmel 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h   Thu Apr 
27 20:21:29 2017(r317521)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h   Thu Apr 
27 21:11:57 2017(r317522)
@@ -567,12 +567,7 @@ typedef struct dmu_buf_user {
  * NOTE: This function should only be called once on a given dmu_buf_user_t.
  *   To allow enforcement of this, dbu must already be zeroed on entry.
  */
-#ifdef __lint
-/* Very ugly, but it beats issuing suppression directives in many Makefiles. */
-extern void
-dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func,
-dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp);
-#else /* __lint */
+/*ARGSUSED*/
 inline void
 dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func_sync,
 dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp)
@@ -588,7 +583,6 @@ dmu_buf_init_user(dmu_buf_user_t *dbu, d
dbu->dbu_clear_on_evict_dbufp = clear_on_evict_dbufp;
 #endif
 }
-#endif /* __lint */
 
 /*
  * Attach user data to a dbuf and mark it for normal (when the dbuf's

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h   Thu Apr 
27 20:21:29 2017(r317521)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h   Thu Apr 
27 21:11:57 2017(r317522)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  * Copyright 2013 Saso Kiselkov. All rights reserved.
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -611,8 +612,6 @@ _NOTE(CONSTCOND) } while (0)
ASSERT(len < size); \
 }
 
-#include 
-
 #defineBP_GET_BUFC_TYPE(bp)
\
(((BP_GET_LEVEL(bp) > 0) || (DMU_OT_IS_METADATA(BP_GET_TYPE(bp ? \
ARC_BUFC_METADATA : ARC_BUFC_DATA)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317511 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-04-27 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Apr 27 16:38:28 2017
New Revision: 317511
URL: https://svnweb.freebsd.org/changeset/base/317511

Log:
  MFV 316896
  
  7580 ztest failure in dbuf_read_impl
  
  illumos/illumos-gate@1a01181fdc809f40c64d5c6881ae3e4521a9d9c7
  
https://github.com/illumos/illumos-gate/commit/1a01181fdc809f40c64d5c6881ae3e4521a9d9c7
  
  https://www.illumos.org/issues/7580
We need to prevent any reader whenever we're about the zero out all the
blkptrs. To do this we need to grab the dn_struct_rwlock as writer in
dbuf_write_children_ready and free_children just prior to calling bzero.
  
  Reviewed by: Pavel Zakharov 
  Reviewed by: Steve Gonczi 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: George Wilson 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Thu Apr 27 
16:32:42 2017(r317510)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Thu Apr 27 
16:38:28 2017(r317511)
@@ -3317,13 +3317,13 @@ dbuf_write_children_ready(zio_t *zio, ar
dmu_buf_impl_t *db = vdb;
dnode_t *dn;
blkptr_t *bp;
-   uint64_t i;
-   int epbs;
+   unsigned int epbs, i;
 
ASSERT3U(db->db_level, >, 0);
DB_DNODE_ENTER(db);
dn = DB_DNODE(db);
epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT;
+   ASSERT3U(epbs, <, 31);
 
/* Determine if all our children are holes */
for (i = 0, bp = db->db.db_data; i < 1 << epbs; i++, bp++) {
@@ -3336,8 +3336,14 @@ dbuf_write_children_ready(zio_t *zio, ar
 * we may get compressed away.
 */
if (i == 1 << epbs) {
-   /* didn't find any non-holes */
+   /*
+* We only found holes. Grab the rwlock to prevent
+* anybody from reading the blocks we're about to
+* zero out.
+*/
+   rw_enter(>dn_struct_rwlock, RW_WRITER);
bzero(db->db.db_data, db->db.db_size);
+   rw_exit(>dn_struct_rwlock);
}
DB_DNODE_EXIT(db);
 }

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.cThu Apr 
27 16:32:42 2017(r317510)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.cThu Apr 
27 16:38:28 2017(r317511)
@@ -236,8 +236,8 @@ free_children(dmu_buf_impl_t *db, uint64
dnode_t *dn;
blkptr_t *bp;
dmu_buf_impl_t *subdb;
-   uint64_t start, end, dbstart, dbend, i;
-   int epbs, shift;
+   uint64_t start, end, dbstart, dbend;
+   unsigned int epbs, shift, i;
 
/*
 * There is a small possibility that this block will not be cached:
@@ -254,6 +254,7 @@ free_children(dmu_buf_impl_t *db, uint64
DB_DNODE_ENTER(db);
dn = DB_DNODE(db);
epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT;
+   ASSERT3U(epbs, <, 31);
shift = (db->db_level - 1) * epbs;
dbstart = db->db_blkid << epbs;
start = blkid >> shift;
@@ -273,12 +274,12 @@ free_children(dmu_buf_impl_t *db, uint64
FREE_VERIFY(db, start, end, tx);
free_blocks(dn, bp, end-start+1, tx);
} else {
-   for (i = start; i <= end; i++, bp++) {
+   for (uint64_t id = start; id <= end; id++, bp++) {
if (BP_IS_HOLE(bp))
continue;
rw_enter(>dn_struct_rwlock, RW_READER);
VERIFY0(dbuf_hold_impl(dn, db->db_level - 1,
-   i, TRUE, FALSE, FTAG, ));
+   id, TRUE, FALSE, FTAG, ));
rw_exit(>dn_struct_rwlock);
ASSERT3P(bp, ==, subdb->db_blkptr);
 
@@ -293,8 +294,14 @@ free_children(dmu_buf_impl_t *db, uint64
break;
}
if (i == 1 << epbs) {
-   /* didn't find any non-holes */
+   /*
+* We only found holes. Grab the rwlock to prevent
+* anybody from reading the blocks we're about to
+* zero out.
+*/
+   rw_enter(>dn_struct_rwlock, RW_WRITER);
bzero(db->db.db_data, db->db.db_size);
+   rw_exit(>dn_struct_rwlock);
free_blocks(dn, db->db_blkptr, 1, tx);
  

svn commit: r317507 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-04-27 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Apr 27 15:10:45 2017
New Revision: 317507
URL: https://svnweb.freebsd.org/changeset/base/317507

Log:
  MFV 316895
  
  7606 dmu_objset_find_dp() takes a long time while importing pool
  
  illumos/illumos-gate@7588687e6ba67c47bf7c9805086dec4a97fcac7b
  
https://github.com/illumos/illumos-gate/commit/7588687e6ba67c47bf7c9805086dec4a97fcac7b
  
  https://www.illumos.org/issues/7606
When importing a pool with a large number of filesystems within the same
parent filesystem, we see that dmu_objset_find_dp() takes a long time.
It is called from 3 places: spa_check_logs(), spa_ld_claim_log_blocks(),
and spa_load_verify().
There are several ways to improve performance here:
1. We don't really need to do spa_check_logs() or
   spa_ld_claim_log_blocks() if the pool was closed cleanly.
2. spa_load_verify() uses dmu_objset_find_dp() to check that no
   datasets have too long of names.
3. dmu_objset_find_dp() is slow because it's doing
   zap_value_search() (which is O(N sibling datasets)) to determine
   the name of each dsl_dir when it's opened. In this case we
   actually know the name when we are opening it, so we can provide
   it and avoid the lookup.
This change implements fix #3 from the above list; i.e. make
dmu_objset_find_dp() provide the name of the dataset so that we don't
have to search for it.
  
  Reviewed by: Steve Gonczi 
  Reviewed by: George Wilson 
  Reviewed by: Prashanth Sreenivasa 
  Approved by: Gordon Ross 
  Author: Matthew Ahrens 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.cThu Apr 
27 15:03:24 2017(r317506)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.cThu Apr 
27 15:10:45 2017(r317507)
@@ -1705,6 +1705,7 @@ typedef struct dmu_objset_find_ctx {
taskq_t *dc_tq;
dsl_pool_t  *dc_dp;
uint64_tdc_ddobj;
+   char*dc_ddname; /* last component of ddobj's name */
int (*dc_func)(dsl_pool_t *, dsl_dataset_t *, void *);
void*dc_arg;
int dc_flags;
@@ -1716,7 +1717,6 @@ static void
 dmu_objset_find_dp_impl(dmu_objset_find_ctx_t *dcp)
 {
dsl_pool_t *dp = dcp->dc_dp;
-   dmu_objset_find_ctx_t *child_dcp;
dsl_dir_t *dd;
dsl_dataset_t *ds;
zap_cursor_t zc;
@@ -1728,7 +1728,12 @@ dmu_objset_find_dp_impl(dmu_objset_find_
if (*dcp->dc_error != 0)
goto out;
 
-   err = dsl_dir_hold_obj(dp, dcp->dc_ddobj, NULL, FTAG, );
+   /*
+* Note: passing the name (dc_ddname) here is optional, but it
+* improves performance because we don't need to call
+* zap_value_search() to determine the name.
+*/
+   err = dsl_dir_hold_obj(dp, dcp->dc_ddobj, dcp->dc_ddname, FTAG, );
if (err != 0)
goto out;
 
@@ -1753,9 +1758,11 @@ dmu_objset_find_dp_impl(dmu_objset_find_
sizeof (uint64_t));
ASSERT3U(attr->za_num_integers, ==, 1);
 
-   child_dcp = kmem_alloc(sizeof (*child_dcp), KM_SLEEP);
+   dmu_objset_find_ctx_t *child_dcp =
+   kmem_alloc(sizeof (*child_dcp), KM_SLEEP);
*child_dcp = *dcp;
child_dcp->dc_ddobj = attr->za_first_integer;
+   child_dcp->dc_ddname = spa_strdup(attr->za_name);
if (dcp->dc_tq != NULL)
(void) taskq_dispatch(dcp->dc_tq,
dmu_objset_find_dp_cb, child_dcp, TQ_SLEEP);
@@ -1798,16 +1805,25 @@ dmu_objset_find_dp_impl(dmu_objset_find_
}
}
 
-   dsl_dir_rele(dd, FTAG);
kmem_free(attr, sizeof (zap_attribute_t));
 
-   if (err != 0)
+   if (err != 0) {
+   dsl_dir_rele(dd, FTAG);
goto out;
+   }
 
/*
 * Apply to self.
 */
err = dsl_dataset_hold_obj(dp, thisobj, FTAG, );
+
+   /*
+* Note: we hold the dir while calling dsl_dataset_hold_obj() so
+* that the dir will remain cached, and we won't have to re-instantiate
+* it (which could be expensive due to finding its name via
+* zap_value_search()).
+*/
+   dsl_dir_rele(dd, FTAG);
if (err != 0)
goto out;
err = dcp->dc_func(dp, ds, dcp->dc_arg);
@@ -1822,6 +1838,8 @@ 

svn commit: r317414 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zstreamdump cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common s...

2017-04-25 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Apr 25 17:57:43 2017
New Revision: 317414
URL: https://svnweb.freebsd.org/changeset/base/317414

Log:
  MFV 316894
  
  7252 7628 compressed zfs send / receive
  
  illumos/illumos-gate@5602294fda888d923d57a78bafdaf48ae6223dea
  
https://github.com/illumos/illumos-gate/commit/5602294fda888d923d57a78bafdaf48ae6223dea
  
  https://www.illumos.org/issues/7252
This feature includes code to allow a system with compressed ARC enabled to
send data in its compressed form straight out of the ARC, and receive data 
in
its compressed form directly into the ARC.
  
  https://www.illumos.org/issues/7628
We should have longer, more readable versions of the ZFS send / recv 
options.
  
  7628 create long versions of ZFS send / receive options
  
  Reviewed by: George Wilson 
  Reviewed by: John Kennedy 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Sebastien Roy 
  Reviewed by: David Quigley 
  Reviewed by: Thomas Caputi 
  Approved by: Dan McDonald 
  Author: Dan Kimmel 

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
  head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Apr 25 17:46:44 2017
(r317413)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Apr 25 17:57:43 2017
(r317414)
@@ -180,12 +180,12 @@
 .Ar bookmark
 .Nm
 .Cm send
-.Op Fl DnPpRveL
+.Op Fl DLPRcenpv
 .Op Fl i Ar snapshot | Fl I Ar snapshot
 .Ar snapshot
 .Nm
 .Cm send
-.Op Fl eL
+.Op Fl Lce
 .Op Fl i Ar snapshot Ns | Ns bookmark
 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
 .Nm
@@ -2535,7 +2535,7 @@ feature.
 .It Xo
 .Nm
 .Cm send
-.Op Fl DnPpRveL
+.Op Fl DLPRcenpv
 .Op Fl i Ar snapshot | Fl I Ar snapshot
 .Ar snapshot
 .Xc
@@ -2580,7 +2580,7 @@ The incremental
 source may be specified as with the
 .Fl i
 option.
-.It Fl R
+.It Fl R, -replicate
 Generate a replication stream package, which will replicate the specified
 filesystem, and all descendent file systems, up to the named snapshot. When
 received, all properties, snapshots, descendent file systems, and clones are
@@ -2598,7 +2598,7 @@ is received. If the
 .Fl F
 flag is specified when this stream is received, snapshots and file systems that
 do not exist on the sending side are destroyed.
-.It Fl D
+.It Fl D, -dedup
 Generate a deduplicated stream. Blocks which would have been sent multiple
 times in the send stream will only be sent once.  The receiving system must
 also support this feature to receive a deduplicated stream.  This flag can
@@ -2607,7 +2607,7 @@ be used regardless of the dataset's
 property, but performance will be much better if the filesystem uses a
 dedup-capable checksum (eg.
 .Sy sha256 ) .
-.It Fl L
+.It Fl L, -large-block
 Generate a stream which may contain blocks larger than 128KB.
 This flag
 has no effect if the
@@ -2623,7 +2623,7 @@ See
 for details on ZFS feature 

svn commit: r317267 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs

2017-04-21 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Apr 21 19:53:52 2017
New Revision: 317267
URL: https://svnweb.freebsd.org/changeset/base/317267

Log:
  MFV 316891
  
  7386 zfs get does not work properly with bookmarks
  
  illumos/illumos-gate@edb901aab9c738b5eb15aa55933e82b0f2f9d9a2
  
https://github.com/illumos/illumos-gate/commit/edb901aab9c738b5eb15aa55933e82b0f2f9d9a2
  
  https://www.illumos.org/issues/7386
The zfs get command does not work with the bookmark parameter while it works
properly with both filesystem and snapshot:
# zfs get -t all -r creation rpool/test
NAME   PROPERTY  VALUE  SOURCE
rpool/test creation  Fri Sep 16 15:00 2016  -
rpool/test@snapcreation  Fri Sep 16 15:00 2016  -
rpool/test#bkmark  creation  Fri Sep 16 15:00 2016  -
# zfs get -t all -r creation rpool/test@snap
NAME PROPERTY  VALUE  SOURCE
rpool/test@snap  creation  Fri Sep 16 15:00 2016  -
# zfs get -t all -r creation rpool/test#bkmark
cannot open 'rpool/test#bkmark': invalid dataset name
#
The zfs get command should be modified to work properly with bookmarks too.
  
  Reviewed by: Simon Klinkert 
  Reviewed by: Paul Dagnelie 
  Approved by: Matthew Ahrens 
  Author: Marcel Telka 

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
  head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Apr 21 19:41:33 2017
(r317266)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Apr 21 19:53:52 2017
(r317267)
@@ -25,13 +25,13 @@
 .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
 .\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
 .\" Copyright (c) 2013, Steven Hartland 
-.\" Copyright (c) 2014 Nexenta Systems, Inc. All Rights Reserved.
+.\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved.
 .\" Copyright (c) 2014, Xin LI 
 .\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved.
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 31, 2016
+.Dd September 16, 2016
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -114,7 +114,7 @@
 .Op Fl t Ar type Ns Oo , Ns type Ns Oc Ns ...
 .Oo Fl s Ar property Oc Ns ...
 .Oo Fl S Ar property Oc Ns ...
-.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
+.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot | Ns Ar bookmark Ns ...
 .Nm
 .Cm set
 .Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns ...
@@ -2156,7 +2156,7 @@ section.
 .Op Fl t Ar type Ns Oo , Ns Ar type Oc Ns ...
 .Op Fl s Ar source Ns Oo , Ns Ar source Oc Ns ...
 .Ar all | property Ns Oo , Ns Ar property Oc Ns ...
-.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ...
+.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns | Ns Ar bookmark Ns ...
 .Xc
 .Pp
 Displays properties for the given datasets. If no datasets are specified, then

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cFri Apr 21 19:41:33 
2017(r317266)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cFri Apr 21 19:53:52 
2017(r317267)
@@ -243,7 +243,7 @@ get_usage(zfs_help_t idx)
"[-o \"all\" | field[,...]]\n"
"\t[-t type[,...]] [-s source[,...]]\n"
"\t<\"all\" | property[,...]> "
-   "[filesystem|volume|snapshot] ...\n"));
+   "[filesystem|volume|snapshot|bookmark] ...\n"));
case HELP_INHERIT:
return (gettext("\tinherit [-rS]  "
" ...\n"));
@@ -1622,7 +1622,7 @@ zfs_do_get(int argc, char **argv)
 {
zprop_get_cbdata_t cb = { 0 };
int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
-   int types = ZFS_TYPE_DATASET;
+   int types = ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK;
char *value, *fields;
int ret = 0;
int limit = 0;

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- 

svn commit: r317238 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-04-20 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Apr 21 00:24:59 2017
New Revision: 317238
URL: https://svnweb.freebsd.org/changeset/base/317238

Log:
  MFV 316871
  
  7490 real checksum errors are silenced when zinject is on
  
  illumos/illumos-gate@6cedfc397d92d64e442f0aae4445ac507beaf58f
  
https://github.com/illumos/illumos-gate/commit/6cedfc397d92d64e442f0aae4445ac507beaf58f
  
  https://www.illumos.org/issues/7490
When zinject is on, error codes from zfs_checksum_error() can be overwritten
due to an incorrect and overly-complex if condition.
  
  Reviewed by: George Wilson 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Pavel Zakharov 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c  Fri Apr 
21 00:17:54 2017(r317237)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c  Fri Apr 
21 00:24:59 2017(r317238)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright 2013 Saso Kiselkov. All rights reserved.
  */
@@ -392,12 +392,13 @@ zio_checksum_error(zio_t *zio, zio_bad_c
 
error = zio_checksum_error_impl(spa, bp, checksum, data, size,
offset, info);
-   if (error != 0 && zio_injection_enabled && !zio->io_error &&
-   (error = zio_handle_fault_injection(zio, ECKSUM)) != 0) {
 
-   info->zbc_injected = 1;
-   return (error);
+   if (zio_injection_enabled && error == 0 && zio->io_error == 0) {
+   error = zio_handle_fault_injection(zio, ECKSUM);
+   if (error != 0)
+   info->zbc_injected = 1;
}
+
return (error);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r317237 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-04-20 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Apr 21 00:17:54 2017
New Revision: 317237
URL: https://svnweb.freebsd.org/changeset/base/317237

Log:
  MFV 316870
  
  7448 ZFS doesn't notice when disk vdevs have no write cache
  
  illumos/illumos-gate@295438ba3230419314faaa889a2616f561658bd5
  
https://github.com/illumos/illumos-gate/commit/295438ba3230419314faaa889a2616f561658bd5
  
  https://www.illumos.org/issues/7448
 I built a SmartOS image with all the NVMe commits including 7372
 (support NVMe volatile write cache) and repeated my dd testing:
 > #!/bin/bash
 > for i in `seq 1 1000`; do
 > dd if=/dev/zero of=file00 bs=1M count=102400 oflag=sync &
 > dd if=/dev/zero of=file01 bs=1M count=102400 oflag=sync &
 > wait
 > rm file00 file01
 > done
 >
 Previously each dd command took ~145 seconds to finish, now it takes
 ~400 seconds.
 Eventually I figured out it is 7372 that causes unnecessary
 nvme_bd_sync() executions which wasted CPU cycles.
If a NVMe device doesn't support a write cache, the nvme_bd_sync function 
will
return ENOTSUP to indicate this to upper layers.
It seems this returned value is ignored by ZFS, and as such this bug is not
really specific to NVMe. In vdev_disk_io_start() ZFS sends the flush to the
disk driver (blkdev) with a callback to vdev_disk_ioctl_done(). As nvme 
filled
in the bd_sync_cache function pointer, blkdev will not return ENOTSUP, as 
the
nvme driver in general does support cache flush. Instead it will issue an
asynchronous flush to nvme and immediately return 0, and hence ZFS will not 
set
vdev_nowritecache here. The nvme driver will at some point process the cache
flush command, and if there is no write cache on the device it will return
ENOTSUP, which will be delivered to the vdev_disk_ioctl_done() callback. 
This
function will not check the error code and not set nowritecache.
The right place to check the error code from the cache flush is in
zio_vdev_io_assess(). This would catch both cases, synchronous and 
asynchronous
cache flushes. This would also be independent of the implementation detail 
that
some drivers can return ENOTSUP immediately.
  
  Reviewed by: Dan Fields 
  Reviewed by: Alek Pinchuk 
  Reviewed by: George Wilson 
  Approved by: Dan McDonald 
  Author: Hans Rosenfeld 
  Obtained from:Illumos

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Apr 
21 00:17:47 2017(r317236)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Apr 
21 00:17:54 2017(r317237)
@@ -21,7 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
  */
 
@@ -743,16 +743,6 @@ vdev_disk_io_start(zio_t *zio)
return;
}
 
-   if (error == ENOTSUP || error == ENOTTY) {
-   /*
-* If we get ENOTSUP or ENOTTY, we know that
-* no future attempts will ever succeed.
-* In this case we set a persistent bit so
-* that we don't bother with the ioctl in the
-* future.
-*/
-   vd->vdev_nowritecache = B_TRUE;
-   }
zio->io_error = error;
 
break;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Fri Apr 21 
00:17:47 2017(r317236)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Fri Apr 21 
00:17:54 2017(r317237)
@@ -3302,6 +3302,16 @@ zio_vdev_io_assess(zio_t *zio)
vd->vdev_cant_write = B_TRUE;
}
 
+   /*
+* If a cache flush returns ENOTSUP or ENOTTY, we know that no future
+* attempts will ever succeed. In this case we set a persistent bit so
+* that we don't bother with it in the 

svn commit: r317235 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-04-20 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Apr 21 00:12:47 2017
New Revision: 317235
URL: https://svnweb.freebsd.org/changeset/base/317235

Log:
  MFV 316868
  
  7430 Backfill metadnode more intelligently
  
  illumos/illumos-gate@af346df58864e8fe897b1ff1a3a4c12f9294391b
  
https://github.com/illumos/illumos-gate/commit/af346df58864e8fe897b1ff1a3a4c12f9294391b
  
  https://www.illumos.org/issues/7430
Description and patch from brought over from the following ZoL commit: 
https://
github.com/zfsonlinux/zfs/commit/68cbd56e182ab949f58d004778d463aeb3f595c6
Only attempt to backfill lower metadnode object numbers if at least
4096 objects have been freed since the last rescan, and at most once
per transaction group. This avoids a pathology in dmu_object_alloc()
that caused O(N^2) behavior for create-heavy workloads and
substantially improves object creation rates. As summarized by
@mahrens in #4636:
"Normally, the object allocator simply checks to see if the next
object is available. The slow calls happened when dmu_object_alloc()
checks to see if it can backfill lower object numbers. This happens
every time we move on to a new L1 indirect block (i.e. every 32 *
128 = 4096 objects). When re-checking lower object numbers, we use
the on-disk fill count (blkptr_t:blk_fill) to quickly skip over
indirect blocks that don?t have enough free dnodes (defined as an L2
with at least 393,216 of 524,288 dnodes free). Therefore, we may
find that a block of dnodes has a low (or zero) fill count, and yet
we can?t allocate any of its dnodes, because they've been allocated
in memory but not yet written to disk. In this case we have to hold
each of the dnodes and then notice that it has been allocated in
memory.
The end result is that allocating N objects in the same TXG can
require CPU usage proportional to N^2."
Add a tunable dmu_rescan_dnode_threshold to define the number of
objects that must be freed before a rescan is performed. Don't bother
to export this as a module option because testing doesn't show a
compelling reason to change it. The vast majority of the performance
gain comes from limit the rescan to at most once per TXG.
  
  Reviewed by: Alek Pinchuk 
  Reviewed by: Brian Behlendorf 
  Reviewed by: Matthew Ahrens 
  Approved by: Gordon Ross 
  Author: Ned Bass 
  
  Obtained from:Illumos

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.cFri Apr 
21 00:00:23 2017(r317234)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.cFri Apr 
21 00:12:47 2017(r317235)
@@ -36,20 +36,22 @@ dmu_object_alloc(objset_t *os, dmu_objec
 dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
 {
uint64_t object;
-   uint64_t L2_dnode_count = DNODES_PER_BLOCK <<
+   uint64_t L1_dnode_count = DNODES_PER_BLOCK <<
(DMU_META_DNODE(os)->dn_indblkshift - SPA_BLKPTRSHIFT);
dnode_t *dn = NULL;
-   int restarted = B_FALSE;
 
mutex_enter(>os_obj_lock);
for (;;) {
object = os->os_obj_next;
/*
-* Each time we polish off an L2 bp worth of dnodes
-* (2^13 objects), move to another L2 bp that's still
-* reasonably sparse (at most 1/4 full).  Look from the
-* beginning once, but after that keep looking from here.
-* If we can't find one, just keep going from here.
+* Each time we polish off a L1 bp worth of dnodes (2^12
+* objects), move to another L1 bp that's still reasonably
+* sparse (at most 1/4 full). Look from the beginning at most
+* once per txg, but after that keep looking from here.
+* os_scan_dnodes is set during txg sync if enough objects
+* have been freed since the previous rescan to justify
+* backfilling again. If we can't find a suitable block, just
+* keep going from here.
 *
 * Note that dmu_traverse depends on the behavior that we use
 * multiple blocks of the dnode object before going back to
@@ -57,12 +59,19 @@ dmu_object_alloc(objset_t *os, dmu_objec
 * that property or find another solution to the issues
  

svn commit: r316037 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-03-27 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 27 17:27:46 2017
New Revision: 316037
URL: https://svnweb.freebsd.org/changeset/base/316037

Log:
  MFV: 315989
  
  7603 xuio_stat_wbuf_* should be declared (void)
  
  illumos/illumos-gate@99aa8b55058e512798eafbd71f72f916bdc10181
  
https://github.com/illumos/illumos-gate/commit/99aa8b55058e512798eafbd71f72f916bdc10181
  
  https://www.illumos.org/issues/7603
  
The funcs are declared k style, where the args are not specified:
  
void xuio_stat_wbuf_copied();
They should be declared to take no arguments:
  
void xuio_stat_wbuf_copied(void);
Need to change both .c and .h.
  
  Author: Prashanth Sreenivasa 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Robert Mustacchi 
  Approved by: Richard Lowe 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Mon Mar 27 
17:24:40 2017(r316036)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Mon Mar 27 
17:27:46 2017(r316037)
@@ -1124,13 +1124,13 @@ xuio_stat_fini(void)
 }
 
 void
-xuio_stat_wbuf_copied()
+xuio_stat_wbuf_copied(void)
 {
XUIOSTAT_BUMP(xuiostat_wbuf_copied);
 }
 
 void
-xuio_stat_wbuf_nocopy()
+xuio_stat_wbuf_nocopy(void)
 {
XUIOSTAT_BUMP(xuiostat_wbuf_nocopy);
 }

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h   Mon Mar 
27 17:24:40 2017(r316036)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h   Mon Mar 
27 17:27:46 2017(r316037)
@@ -762,8 +762,8 @@ int dmu_xuio_add(struct xuio *uio, struc
 int dmu_xuio_cnt(struct xuio *uio);
 struct arc_buf *dmu_xuio_arcbuf(struct xuio *uio, int i);
 void dmu_xuio_clear(struct xuio *uio, int i);
-void xuio_stat_wbuf_copied();
-void xuio_stat_wbuf_nocopy();
+void xuio_stat_wbuf_copied(void);
+void xuio_stat_wbuf_nocopy(void);
 
 extern boolean_t zfs_prefetch_disable;
 extern int zfs_max_recordsize;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314280 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-02-25 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Feb 25 20:01:17 2017
New Revision: 314280
URL: https://svnweb.freebsd.org/changeset/base/314280

Log:
  MFV 314276
  
  7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL
  
  illumos/illumos-gate@1c9272b861cd640a8342f4407da026ed98615517
  
https://github.com/illumos/illumos-gate/commit/1c9272b861cd640a8342f4407da026ed98615517
  
  https://www.illumos.org/issues/7570
  
Based on the discovery that every unmap waits for the commit of the txn to 
the ZIL,
introducing a very high latency to unmap commands, this behavior was made 
into a
tunable zvol_unmap_sync_enabled and set to false. The net impact of this 
change is
that by default SCSI unmap commands will result in space being freed within 
the zvol
(today they are ignored and returned with good status). However, unlike the 
code
today, instead of 18+ms per unmap, they take about 30us.
  
With the testing done on NTFS against a Win2k12 target, the new behavior 
should work
seamlessly. Files on the zvol that have already been set with the zfree 
application
will continue to write 0's when deleted, and any new files created since 
zvol
creation will send unmap commands when deleted. This behavior exists today, 
but with
this change the unmap commands will be processed and result in reclaim of 
space.
  
  Author: Stephen Blinick 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matt Ahrens 
  Reviewed by: Steve Gonczi 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Saso Kiselkov 
  Reviewed by: Yuri Pankov 
  Approved by: Robert Mustacchi 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Sat Feb 25 
19:39:58 2017(r314279)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Sat Feb 25 
20:01:17 2017(r314280)
@@ -27,7 +27,7 @@
  * Portions Copyright 2010 Robert Milkowski
  *
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
- * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
@@ -202,11 +202,22 @@ int zvol_maxphys = DMU_MAX_ACCESS/2;
  * Toggle unmap functionality.
  */
 boolean_t zvol_unmap_enabled = B_TRUE;
+
+/*
+ * If true, unmaps requested as synchronous are executed synchronously,
+ * otherwise all unmaps are asynchronous.
+ */
+boolean_t zvol_unmap_sync_enabled = B_FALSE;
+
 #ifndef illumos
 SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_enabled, CTLFLAG_RWTUN,
 _unmap_enabled, 0,
 "Enable UNMAP functionality");
 
+SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_sync_enabled, CTLFLAG_RWTUN,
+_unmap_sync_enabled, 0,
+"UNMAPs requested as sync are executed synchronously");
+
 static d_open_tzvol_d_open;
 static d_close_t   zvol_d_close;
 static d_read_tzvol_read;
@@ -2268,26 +2279,21 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t 
 
zfs_range_unlock(rl);
 
-   if (error == 0) {
-   /*
-* If the write-cache is disabled or 'sync' property
-* is set to 'always' then treat this as a synchronous
-* operation (i.e. commit to zil).
-*/
-   if (!(zv->zv_flags & ZVOL_WCE) ||
-   (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS))
-   zil_commit(zv->zv_zilog, ZVOL_OBJ);
-
-   /*
-* If the caller really wants synchronous writes, and
-* can't wait for them, don't return until the write
-* is done.
-*/
-   if (df.df_flags & DF_WAIT_SYNC) {
-   txg_wait_synced(
-   dmu_objset_pool(zv->zv_objset), 0);
-   }
+   /*
+* If the write-cache is disabled, 'sync' property
+* is set to 'always', or if the caller is asking for
+* a synchronous free, commit this operation to the zil.
+* This will sync any previous uncommitted writes to the
+* zvol object.
+* Can be overridden by the zvol_unmap_sync_enabled tunable.
+*/
+   if ((error == 0) && zvol_unmap_sync_enabled &&
+   

svn commit: r314267 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-02-25 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Feb 25 14:45:54 2017
New Revision: 314267
URL: https://svnweb.freebsd.org/changeset/base/314267

Log:
  MFV 314243
  
  6676 Race between unique_insert() and unique_remove() causes ZFS fsid change
  
  illumos/illumos-gate@40510e8eba18690b9a9843b26393725eeb0f1dac
  
https://github.com/illumos/illumos-gate/commit/40510e8eba18690b9a9843b26393725eeb0f1dac
  
  https://www.illumos.org/issues/6676
  
The fsid of zfs filesystems might change after reboot or remount. The 
problem seems to
be caused by a race between unique_insert() and unique_remove(). The 
unique_remove()
is called from dsl_dataset_evict() which is now an asynchronous thread. In 
a case the
dsl_dataset_evict() thread is very slow and calls unique_remove() too late 
we will end
up with changed fsid on zfs mount.
  
This problem is very likely caused by #5056.
  
Steps to Reproduce
Note: I'm able to reproduce this always on a single core (virtual) machine. 
On multicore
machines it is not so easy to reproduce.
  
  # uname -a
  SunOS openindiana 5.11 illumos-633aa80 i86pc i386 i86pc Solaris
  # zfs create rpool/TEST
  # FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
  # echo $FS::print vfs_t vfs_fsid | mdb -k
  vfs_fsid = {
  vfs_fsid.val = [ 0x54d7028a, 0x70311508 ]
  }
  # zfs umount rpool/TEST
  # zfs mount rpool/TEST
  # FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
  # echo $FS::print vfs_t vfs_fsid | mdb -k
  vfs_fsid = {
  vfs_fsid.val = [ 0xd9454e49, 0x6b36d08 ]
  }
  #
  
Impact
The persistent fsid (filesystem id) is essential for proper NFS 
functionality.
If the fsid of a filesystem changes on remount (or after reboot) the NFS
clients might not be able to automatically recover from such event and the
manual remount of the NFS filesystems on every NFS client might be needed.
  
  Author: Josef 'Jeff' Sipek 
  Reviewed by: Saso Kiselkov 
  Reviewed by: Sanjay Nadkarni 
  Reviewed by: Dan Vatca 
  Reviewed by: Matthew Ahrens 
  Reviewed by: George Wilson 
  Reviewed by: Sebastien Roy 
  Approved by: Robert Mustacchi 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Feb 25 
14:41:06 2017(r314266)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Feb 25 
14:45:54 2017(r314267)
@@ -54,7 +54,9 @@ static void dbuf_write(dbuf_dirty_record
 
 #ifndef __lint
 extern inline void dmu_buf_init_user(dmu_buf_user_t *dbu,
-dmu_buf_evict_func_t *evict_func, dmu_buf_t **clear_on_evict_dbufp);
+dmu_buf_evict_func_t *evict_func_sync,
+dmu_buf_evict_func_t *evict_func_async,
+dmu_buf_t **clear_on_evict_dbufp);
 #endif /* ! __lint */
 
 /*
@@ -361,11 +363,24 @@ dbuf_evict_user(dmu_buf_impl_t *db)
 #endif
 
/*
-* Invoke the callback from a taskq to avoid lock order reversals
-* and limit stack depth.
-*/
-   taskq_dispatch_ent(dbu_evict_taskq, dbu->dbu_evict_func, dbu, 0,
-   >dbu_tqent);
+* There are two eviction callbacks - one that we call synchronously
+* and one that we invoke via a taskq.  The async one is useful for
+* avoiding lock order reversals and limiting stack depth.
+*
+* Note that if we have a sync callback but no async callback,
+* it's likely that the sync callback will free the structure
+* containing the dbu.  In that case we need to take care to not
+* dereference dbu after calling the sync evict func.
+*/
+   boolean_t has_async = (dbu->dbu_evict_func_async != NULL);
+
+   if (dbu->dbu_evict_func_sync != NULL)
+   dbu->dbu_evict_func_sync(dbu);
+
+   if (has_async) {
+   taskq_dispatch_ent(dbu_evict_taskq, dbu->dbu_evict_func_async,
+   dbu, 0, >dbu_tqent);
+   }
 }
 
 boolean_t

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c

svn commit: r313879 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-02-17 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Feb 17 17:52:12 2017
New Revision: 313879
URL: https://svnweb.freebsd.org/changeset/base/313879

Log:
  MVF: 313876
  
  7504 kmem_reap hangs spa_sync and administrative tasks
  
  illumos/illumos-gate@405a5a0f5c3ab36cb76559467d1a62ba648bd809
  
https://github.com/illumos/illumos-gate/commit/405a5a0f5c3ab36cb76559467d1a62ba648bd80
  
  https://www.illumos.org/issues/7504
  
We see long spa_sync(). We are waiting to hold dp_config_rwlock for writer. 
Some
other thread holds dp_config_rwlock for reader, then calls 
arc_get_data_buf(),
which finds that arc_is_overflowing()==B_TRUE. So it waits (while holding
dp_config_rwlock for reader) for arc_reclaim_thread to signal 
arc_reclaim_waiters_cv.
Before signaling, arc_reclaim_thread does arc_kmem_reap_now(), which takes 
~seconds.
  
  Author: Matthew Ahrens 
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Approved by: Dan McDonald 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Fri Feb 17 
15:40:24 2017(r313878)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Fri Feb 17 
17:52:12 2017(r313879)
@@ -4086,7 +4086,6 @@ arc_reclaim_thread(void *dummy __unused)
 
mutex_enter(_reclaim_lock);
while (!arc_reclaim_thread_exit) {
-   int64_t free_memory = arc_available_memory();
uint64_t evicted = 0;
 
/*
@@ -4105,6 +4104,14 @@ arc_reclaim_thread(void *dummy __unused)
 
mutex_exit(_reclaim_lock);
 
+   /*
+* We call arc_adjust() before (possibly) calling
+* arc_kmem_reap_now(), so that we can wake up
+* arc_get_data_buf() sooner.
+*/
+   evicted = arc_adjust();
+
+   int64_t free_memory = arc_available_memory();
if (free_memory < 0) {
 
arc_no_grow = B_TRUE;
@@ -4138,8 +4145,6 @@ arc_reclaim_thread(void *dummy __unused)
arc_no_grow = B_FALSE;
}
 
-   evicted = arc_adjust();
-
mutex_enter(_reclaim_lock);
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r313813 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-02-16 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Feb 16 19:00:09 2017
New Revision: 313813
URL: https://svnweb.freebsd.org/changeset/base/313813

Log:
  MFV 313786
  
  7500 Simplify dbuf_free_range by removing dn_unlisted_l0_blkid
  
  illumos/illumos-gate@653af1b809998570c7e89fe7a0d3f90992bf0216
  
https://github.com/illumos/illumos-gate/commit/653af1b809998570c7e89fe7a0d3f90992bf0216
  
  https://www.illumos.org/issues/7500
With the integration of:
  
  commit 0f6d88aded0d165f5954688a9b13bac76c38da84
  Author: Alex Reece 
  Date:   Sat Jul 26 13:40:04 2014 -0800
  4873 zvol unmap calls can take a very long time for larger datasets
  
the dnode's dn_bufs field was changed from a list to a tree. As a result,
the dn_unlisted_l0_blkid field is no longer necessary.
  
  Author: Stephen Blinick 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Dan Kimmel 
  Approved by: Gordon Ross 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Thu Feb 16 
17:08:43 2017(r313812)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Thu Feb 16 
19:00:09 2017(r313813)
@@ -49,12 +49,6 @@
 
 uint_t zfs_dbuf_evict_key;
 
-/*
- * Number of times that zfs_free_range() took the slow path while doing
- * a zfs receive.  A nonzero value indicates a potential performance problem.
- */
-uint64_t zfs_free_range_recv_miss;
-
 static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx);
 static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx);
 
@@ -1220,9 +1214,6 @@ dbuf_unoverride(dbuf_dirty_record_t *dr)
  * Evict (if its unreferenced) or clear (if its referenced) any level-0
  * data blocks in the free range, so that any future readers will find
  * empty blocks.
- *
- * This is a no-op if the dataset is in the middle of an incremental
- * receive; see comment below for details.
  */
 void
 dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid,
@@ -1232,10 +1223,9 @@ dbuf_free_range(dnode_t *dn, uint64_t st
dmu_buf_impl_t *db, *db_next;
uint64_t txg = tx->tx_txg;
avl_index_t where;
-   boolean_t freespill =
-   (start_blkid == DMU_SPILL_BLKID || end_blkid == DMU_SPILL_BLKID);
 
-   if (end_blkid > dn->dn_maxblkid && !freespill)
+   if (end_blkid > dn->dn_maxblkid &&
+   !(start_blkid == DMU_SPILL_BLKID || end_blkid == DMU_SPILL_BLKID))
end_blkid = dn->dn_maxblkid;
dprintf_dnode(dn, "start=%llu end=%llu\n", start_blkid, end_blkid);
 
@@ -1244,29 +1234,9 @@ dbuf_free_range(dnode_t *dn, uint64_t st
db_search.db_state = DB_SEARCH;
 
mutex_enter(>dn_dbufs_mtx);
-   if (start_blkid >= dn->dn_unlisted_l0_blkid && !freespill) {
-   /* There can't be any dbufs in this range; no need to search. */
-#ifdef DEBUG
-   db = avl_find(>dn_dbufs, _search, );
-   ASSERT3P(db, ==, NULL);
-   db = avl_nearest(>dn_dbufs, where, AVL_AFTER);
-   ASSERT(db == NULL || db->db_level > 0);
-#endif
-   mutex_exit(>dn_dbufs_mtx);
-   return;
-   } else if (dmu_objset_is_receiving(dn->dn_objset)) {
-   /*
-* If we are receiving, we expect there to be no dbufs in
-* the range to be freed, because receive modifies each
-* block at most once, and in offset order.  If this is
-* not the case, it can lead to performance problems,
-* so note that we unexpectedly took the slow path.
-*/
-   atomic_inc_64(_free_range_recv_miss);
-   }
-
db = avl_find(>dn_dbufs, _search, );
ASSERT3P(db, ==, NULL);
+
db = avl_nearest(>dn_dbufs, where, AVL_AFTER);
 
for (; db != NULL; db = db_next) {
@@ -2283,9 +2253,7 @@ dbuf_create(dnode_t *dn, uint8_t level, 
return (odb);
}
avl_add(>dn_dbufs, db);
-   if (db->db_level == 0 && db->db_blkid >=
-   dn->dn_unlisted_l0_blkid)
-   dn->dn_unlisted_l0_blkid = db->db_blkid + 1;
+
db->db_state = DB_UNCACHED;
mutex_exit(>dn_dbufs_mtx);
arc_space_consume(sizeof (dmu_buf_impl_t), ARC_SPACE_OTHER);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Thu Feb 16 

svn commit: r312535 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-01-20 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Jan 20 15:01:04 2017
New Revision: 312535
URL: https://svnweb.freebsd.org/changeset/base/312535

Log:
  MFV 312436
  
   6569 large file delete can starve out write ops
  
illumos/illumos-gate@ff5177ee8bf9a355131ce2cc61ae2da6a5a6fdd6

https://github.com/illumos/illumos-gate/commit/ff5177ee8bf9a355131ce2cc61ae2da6a5a6fdd6
  
https://www.illumos.org/issues/6569
  The core issue I've found is that there is no throttle for how many
  deletes get assigned to one TXG. As a results when deleting large files
  we end up filling consecutive TXGs with deletes/frees, then write
  throttling other (more important) ops.
  
  There is an easy test case for this problem. Try deleting several
  large files (at least 1/2 TB) while you do write ops on the same
  pool. What we've seen is performance of these write ops (let's
  call it sideload I/O) would drop to zero.
  
  More specifically the problem is that dmu_free_long_range_impl()
  can/will fill up all of the dirty data in the pool "instantly",
  before many of the sideload ops can get in. So sideload
  performance will be impacted until all the files are freed.
  
  The solution we have tested at Nexenta (with positive results)
  creates a relatively simple throttle for how many "free" ops we let
  into one TXG.
  
  However this solution exposes other problems that should also be
  addressed. If we are to slow down freeing of data that means one
  has to wait even longer (assuming vnode ref count of 1) to get shell
  back after an rm or for NFS thread to finish the free-ing op.
  To avoid this the proposed solution is to call zfs_inactive() async
  for "large" files. Async freeing then begs for the reclaimed space
  to be accounted for in the zpool's "freeing" prop.
  
  The other issue with having a longer delete is the inability to
  export/unmount for a longer period of time. The proposed solution
  is to interrupt freeing of blocks when a fs is unmounted.
  
Author: Alek Pinchuk 
Reviewed by: Matt Ahrens 
Reviewed by: Sanjay Nadkarni 
Reviewed by: Pavel Zakharov 
Approved by: Dan McDonald 
  
  Reviewed by:  avg
  Differential Revision:D9008

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Fri Jan 20 
14:59:56 2017(r312534)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Fri Jan 20 
15:01:04 2017(r312535)
@@ -60,6 +60,16 @@ SYSCTL_DECL(_vfs_zfs);
 SYSCTL_INT(_vfs_zfs, OID_AUTO, nopwrite_enabled, CTLFLAG_RDTUN,
 _nopwrite_enabled, 0, "Enable nopwrite feature");
 
+/*
+ * Tunable to control percentage of dirtied blocks from frees in one TXG.
+ * After this threshold is crossed, additional dirty blocks from frees
+ * wait until the next TXG.
+ * A value of zero will disable this throttle.
+ */
+uint32_t zfs_per_txg_dirty_frees_percent = 30;
+SYSCTL_INT(_vfs_zfs, OID_AUTO, per_txg_dirty_frees_percent, CTLFLAG_RWTUN,
+   _per_txg_dirty_frees_percent, 0, "Percentage of dirtied blocks from 
frees in one txg");
+
 const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = {
{   DMU_BSWAP_UINT8,TRUE,   "unallocated"   },
{   DMU_BSWAP_ZAP,  TRUE,   "object directory"  },
@@ -718,15 +728,25 @@ dmu_free_long_range_impl(objset_t *os, d
 {
uint64_t object_size = (dn->dn_maxblkid + 1) * dn->dn_datablksz;
int err;
+   uint64_t dirty_frees_threshold;
+   dsl_pool_t *dp = dmu_objset_pool(os);
 
if (offset >= object_size)
return (0);
 
+   if (zfs_per_txg_dirty_frees_percent <= 100)
+   dirty_frees_threshold =
+   zfs_per_txg_dirty_frees_percent * zfs_dirty_data_max / 100;
+   else
+   dirty_frees_threshold = zfs_dirty_data_max / 4;
+
if (length == DMU_OBJECT_END || offset + length > object_size)
length = object_size - offset;
 
while (length != 0) {
-   uint64_t chunk_end, chunk_begin;
+   uint64_t chunk_end, chunk_begin, chunk_len;
+   uint64_t long_free_dirty_all_txgs = 0;
+   dmu_tx_t *tx;
 
chunk_end = chunk_begin = offset + length;
 
@@ -737,9 +757,28 @@ dmu_free_long_range_impl(objset_t *os, d
ASSERT3U(chunk_begin, >=, offset);
ASSERT3U(chunk_begin, <=, 

svn commit: r311122 - head/sys/fs/nfsserver

2017-01-02 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Jan  2 19:18:56 2017
New Revision: 311122
URL: https://svnweb.freebsd.org/changeset/base/311122

Log:
  Workaround NFS bug with readdirplus when there are greater than 1 billion 
files in a filesystem.
  
  Reviewed by   kib
  MFC after:2 weeks
  Sponsored by: iXsystems
  Differential Revision:D9009

Modified:
  head/sys/fs/nfsserver/nfs_nfsdport.c

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==
--- head/sys/fs/nfsserver/nfs_nfsdport.cMon Jan  2 19:18:33 2017
(r311121)
+++ head/sys/fs/nfsserver/nfs_nfsdport.cMon Jan  2 19:18:56 2017
(r311122)
@@ -2018,25 +2018,17 @@ again:
}
 
/*
-* Check to see if entries in this directory can be safely acquired
-* via VFS_VGET() or if a switch to VOP_LOOKUP() is required.
-* ZFS snapshot directories need VOP_LOOKUP(), so that any
-* automount of the snapshot directory that is required will
-* be done.
-* This needs to be done here for NFSv4, since NFSv4 never does
-* a VFS_VGET() for "." or "..".
+* For now ZFS requires VOP_LOOKUP as a workaround.  Until ino_t is 
changed
+* to 64 bit type a ZFS filesystem with over 1 billion files in it
+* will suffer from 64bit -> 32bit truncation.
 */
-   if (is_zfs == 1) {
-   r = VFS_VGET(mp, at.na_fileid, LK_SHARED, );
-   if (r == EOPNOTSUPP) {
-   usevget = 0;
-   cn.cn_nameiop = LOOKUP;
-   cn.cn_lkflags = LK_SHARED | LK_RETRY;
-   cn.cn_cred = nd->nd_cred;
-   cn.cn_thread = p;
-   } else if (r == 0)
-   vput(nvp);
-   }
+   if (is_zfs == 1)
+   usevget = 0;
+
+   cn.cn_nameiop = LOOKUP;
+   cn.cn_lkflags = LK_SHARED | LK_RETRY;
+   cn.cn_cred = nd->nd_cred;
+   cn.cn_thread = p;
 
/*
 * Save this position, in case there is an error before one entry
@@ -2105,16 +2097,7 @@ again:
else
r = EOPNOTSUPP;
if (r == EOPNOTSUPP) {
-   if (usevget) {
-   usevget = 0;
-   cn.cn_nameiop = LOOKUP;
-   cn.cn_lkflags =
-   LK_SHARED |
-   LK_RETRY;
-   cn.cn_cred =
-   nd->nd_cred;
-   cn.cn_thread = p;
-   }
+   usevget = 0;
cn.cn_nameptr = dp->d_name;
cn.cn_namelen = nlen;
cn.cn_flags = ISLASTCN |
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r310847 - head/sys/netinet

2016-12-30 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Dec 30 18:46:21 2016
New Revision: 310847
URL: https://svnweb.freebsd.org/changeset/base/310847

Log:
  Harden CARP against network loops.
  
  If there is a loop in the network a CARP that is in MASTER state will see it's
  own broadcasts, which will then cause it to assume BACKUP state.  When it
  assumes BACKUP it will stop sending advertisements.  In that state it will no
  longer see advertisements and will assume MASTER...
  
  We can't catch all the cases where we are seeing our own CARP broadcast, but
  we can catch the obvious case.
  
  Submitted by: torek
  Obtained from:FreeNAS
  MFC after:2 weeks
  Sponsored by: iXsystems

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Fri Dec 30 18:23:58 2016(r310846)
+++ head/sys/netinet/ip_carp.c  Fri Dec 30 18:46:21 2016(r310847)
@@ -581,27 +581,90 @@ carp6_input(struct mbuf **mp, int *offp,
 }
 #endif /* INET6 */
 
+/*
+ * This routine should not be necessary at all, but some switches
+ * (VMWare ESX vswitches) can echo our own packets back at us,
+ * and we must ignore them or they will cause us to drop out of
+ * MASTER mode.
+ *
+ * We cannot catch all cases of network loops.  Instead, what we
+ * do here is catch any packet that arrives with a carp header
+ * with a VHID of 0, that comes from an address that is our own.
+ * These packets are by definition "from us" (even if they are from
+ * a misconfigured host that is pretending to be us).
+ *
+ * The VHID test is outside this mini-function.
+ */
+static int
+carp_source_is_self(struct mbuf *m, struct ifaddr *ifa, sa_family_t af)
+{
+   struct ip *ip4;
+   struct in_addr in4;
+   struct ip6_hdr *ip6;
+   struct in6_addr in6;
+
+   switch (af) {
+   case AF_INET:
+   ip4 = mtod(m, struct ip *);
+   in4 = ifatoia(ifa)->ia_addr.sin_addr;
+   return (in4.s_addr == ip4->ip_src.s_addr);
+
+   case AF_INET6:
+   ip6 = mtod(m, struct ip6_hdr *);
+   in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
+   return (memcmp(, >ip6_src, sizeof(in6)) == 0);
+
+   default:/* how did this happen? */
+   break;
+   }
+   return (0);
+}
+
 static void
 carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af)
 {
struct ifnet *ifp = m->m_pkthdr.rcvif;
-   struct ifaddr *ifa;
+   struct ifaddr *ifa, *match;
struct carp_softc *sc;
uint64_t tmp_counter;
struct timeval sc_tv, ch_tv;
+   int error;
 
-   /* verify that the VHID is valid on the receiving interface */
+   /*
+* Verify that the VHID is valid on the receiving interface.
+*
+* There should be just one match.  If there are none
+* the VHID is not valid and we drop the packet.  If
+* there are multiple VHID matches, take just the first
+* one, for compatibility with previous code.  While we're
+* scanning, check for obvious loops in the network topology
+* (these should never happen, and as noted above, we may
+* miss real loops; this is just a double-check).
+*/
IF_ADDR_RLOCK(ifp);
-   IFNET_FOREACH_IFA(ifp, ifa)
-   if (ifa->ifa_addr->sa_family == af &&
-   ifa->ifa_carp->sc_vhid == ch->carp_vhid) {
-   ifa_ref(ifa);
-   break;
-   }
+   error = 0;
+   match = NULL;
+   IFNET_FOREACH_IFA(ifp, ifa) {
+   if (match == NULL && ifa->ifa_carp != NULL &&
+   ifa->ifa_addr->sa_family == af &&
+   ifa->ifa_carp->sc_vhid == ch->carp_vhid)
+   match = ifa;
+   if (ch->carp_vhid == 0 && carp_source_is_self(m, ifa, af))
+   error = ELOOP;
+   }
+   ifa = error ? NULL : match;
+   if (ifa != NULL)
+   ifa_ref(ifa);
IF_ADDR_RUNLOCK(ifp);
 
if (ifa == NULL) {
-   CARPSTATS_INC(carps_badvhid);
+   if (error == ELOOP) {
+   CARP_DEBUG("dropping looped packet on interface %s\n",
+   ifp->if_xname);
+   CARPSTATS_INC(carps_badif); /* ??? */
+   } else {
+   CARPSTATS_INC(carps_badvhid);
+   }
m_freem(m);
return;
}
@@ -787,12 +850,41 @@ carp_send_ad_error(struct carp_softc *sc
}
 }
 
+/*
+ * Pick the best ifaddr on the given ifp for sending CARP
+ * advertisements.
+ *
+ * "Best" here is defined by ifa_preferred().  This function is much
+ * much like ifaof_ifpforaddr() except that we just use ifa_preferred().
+ *
+ * (This could be simplified to return the actual address, except that
+ * it has a different 

svn commit: r306219 - head/sys/dev/oce

2016-09-22 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Sep 22 22:51:11 2016
New Revision: 306219
URL: https://svnweb.freebsd.org/changeset/base/306219

Log:
  Update oce to version 11.0.50.0
  
  Submitted by: Venkat Duvvuru 

Added:
  head/sys/dev/oce/oce_user.h   (contents, props changed)
Modified:
  head/sys/dev/oce/oce_hw.c
  head/sys/dev/oce/oce_hw.h
  head/sys/dev/oce/oce_if.c
  head/sys/dev/oce/oce_if.h
  head/sys/dev/oce/oce_mbox.c
  head/sys/dev/oce/oce_queue.c
  head/sys/dev/oce/oce_sysctl.c

Modified: head/sys/dev/oce/oce_hw.c
==
--- head/sys/dev/oce/oce_hw.c   Thu Sep 22 21:34:35 2016(r306218)
+++ head/sys/dev/oce/oce_hw.c   Thu Sep 22 22:51:11 2016(r306219)
@@ -393,6 +393,11 @@ oce_create_nw_interface(POCE_SOFTC sc)
if (IS_SH(sc) || IS_XE201(sc))
capab_flags |= MBX_RX_IFACE_FLAGS_MULTICAST;
 
+if (sc->enable_hwlro) {
+capab_flags |= MBX_RX_IFACE_FLAGS_LRO;
+capab_en_flags |= MBX_RX_IFACE_FLAGS_LRO;
+}
+
/* enable capabilities controlled via driver startup parameters */
if (is_rss_enabled(sc))
capab_en_flags |= MBX_RX_IFACE_FLAGS_RSS;

Modified: head/sys/dev/oce/oce_hw.h
==
--- head/sys/dev/oce/oce_hw.h   Thu Sep 22 21:34:35 2016(r306218)
+++ head/sys/dev/oce/oce_hw.h   Thu Sep 22 22:51:11 2016(r306219)
@@ -111,6 +111,9 @@
 #definePD_MPU_MBOX_DB  0x0160
 #definePD_MQ_DB0x0140
 
+#define DB_OFFSET  0xc0
+#define DB_LRO_RQ_ID_MASK  0x7FF
+
 /* EQE completion types */
 #defineEQ_MINOR_CODE_COMPLETION0x00
 #defineEQ_MINOR_CODE_OTHER 0x01
@@ -180,6 +183,7 @@
 #define ASYNC_EVENT_GRP5   0x5
 #define ASYNC_EVENT_CODE_DEBUG 0x6
 #define ASYNC_EVENT_PVID_STATE 0x3
+#define ASYNC_EVENT_OS2BMC 0x5
 #define ASYNC_EVENT_DEBUG_QNQ  0x1
 #define ASYNC_EVENT_CODE_SLIPORT   0x11
 #define VLAN_VID_MASK  0x0FFF
@@ -722,6 +726,34 @@ struct oce_async_cqe_link_state {
} u0;
 };
 
+/* OS2BMC async event */
+struct oce_async_evt_grp5_os2bmc {
+   union {
+   struct {
+   uint32_t lrn_enable:1;
+   uint32_t lrn_disable:1;
+   uint32_t mgmt_enable:1;
+   uint32_t mgmt_disable:1;
+   uint32_t rsvd0:12;
+   uint32_t vlan_tag:16;
+   uint32_t arp_filter:1;
+   uint32_t dhcp_client_filt:1;
+   uint32_t dhcp_server_filt:1;
+   uint32_t net_bios_filt:1;
+   uint32_t rsvd1:3;
+   uint32_t bcast_filt:1;
+   uint32_t ipv6_nbr_filt:1;
+   uint32_t ipv6_ra_filt:1;
+   uint32_t ipv6_ras_filt:1;
+   uint32_t rsvd2[4];
+   uint32_t mcast_filt:1;
+   uint32_t rsvd3:16;
+   uint32_t evt_tag;
+   uint32_t dword3;
+   } s;
+   uint32_t dword[4];
+   } u;
+};
 
 /* PVID aync event */
 struct oce_async_event_grp5_pvid_state {
@@ -1396,7 +1428,7 @@ typedef union oce_cq_ctx_u {
uint32_t dw5rsvd3:1;
uint32_t eventable:1;
/* dw6 */
-   uint32_t eq_id:8;
+   uint32_t eq_id:16;
uint32_t dw6rsvd1:15;
uint32_t armed:1;
/* dw7 */
@@ -2403,8 +2435,8 @@ struct oce_nic_hdr_wqe {
uint32_t tcpcs:1;
uint32_t udpcs:1;
uint32_t ipcs:1;
-   uint32_t rsvd3:1;
-   uint32_t rsvd2:1;
+   uint32_t mgmt:1;
+   uint32_t lso6:1;
uint32_t forward:1;
uint32_t crc:1;
uint32_t event:1;
@@ -2426,8 +2458,8 @@ struct oce_nic_hdr_wqe {
uint32_t event:1;
uint32_t crc:1;
uint32_t forward:1;
-   uint32_t rsvd2:1;
-   uint32_t rsvd3:1;
+   uint32_t lso6:1;
+   uint32_t mgmt:1;
uint32_t ipcs:1;
uint32_t udpcs:1;
uint32_t tcpcs:1;
@@ -3010,6 +3042,53 @@ struct oce_rxf_stats_v0 {
uint32_t rsvd1[6];
 };
 
+struct oce_port_rxf_stats_v2 {
+uint32_t rsvd0[10];
+uint32_t roce_bytes_received_lsd;
+uint32_t roce_bytes_received_msd;
+uint32_t rsvd1[5];
+uint32_t 

Re: svn commit: r306149 - head/sys/dev/oce

2016-09-21 Thread Josh Paetzel
Thanks. I've investigated now. The disk filled up on the machine I ran make 
universe on which inexplicably caused it to report builds had succeeded. The 
vendor patch was clearly missing a header file and can't possibly build.


Thanks,

Josh Paetzel

> On Sep 21, 2016, at 7:25 PM, Conrad E. Meyer <c...@freebsd.org> wrote:
> 
> Author: cem
> Date: Thu Sep 22 00:25:23 2016
> New Revision: 306149
> URL: https://svnweb.freebsd.org/changeset/base/306149
> 
> Log:
>  Revert r306148 to fix build
> 
>  Requested by:jpaetzel
>  Reported by:Larry Rosenman , Jenkins
> 
> Modified:
>  head/sys/dev/oce/oce_hw.c
>  head/sys/dev/oce/oce_hw.h
>  head/sys/dev/oce/oce_if.c
>  head/sys/dev/oce/oce_if.h
>  head/sys/dev/oce/oce_mbox.c
>  head/sys/dev/oce/oce_queue.c
>  head/sys/dev/oce/oce_sysctl.c
> 
> Modified: head/sys/dev/oce/oce_hw.c
> ==
> --- head/sys/dev/oce/oce_hw.cWed Sep 21 22:53:16 2016(r306148)
> +++ head/sys/dev/oce/oce_hw.cThu Sep 22 00:25:23 2016(r306149)
> @@ -393,11 +393,6 @@ oce_create_nw_interface(POCE_SOFTC sc)
>if (IS_SH(sc) || IS_XE201(sc))
>capab_flags |= MBX_RX_IFACE_FLAGS_MULTICAST;
> 
> -if (sc->enable_hwlro) {
> -capab_flags |= MBX_RX_IFACE_FLAGS_LRO;
> -capab_en_flags |= MBX_RX_IFACE_FLAGS_LRO;
> -}
> -
>/* enable capabilities controlled via driver startup parameters */
>if (is_rss_enabled(sc))
>capab_en_flags |= MBX_RX_IFACE_FLAGS_RSS;
> 
> Modified: head/sys/dev/oce/oce_hw.h
> ==
> --- head/sys/dev/oce/oce_hw.hWed Sep 21 22:53:16 2016(r306148)
> +++ head/sys/dev/oce/oce_hw.hThu Sep 22 00:25:23 2016(r306149)
> @@ -111,9 +111,6 @@
> #definePD_MPU_MBOX_DB0x0160
> #definePD_MQ_DB0x0140
> 
> -#define DB_OFFSET0xc0
> -#define DB_LRO_RQ_ID_MASK0x7FF
> -
> /* EQE completion types */
> #defineEQ_MINOR_CODE_COMPLETION0x00
> #defineEQ_MINOR_CODE_OTHER0x01
> @@ -183,7 +180,6 @@
> #define ASYNC_EVENT_GRP50x5
> #define ASYNC_EVENT_CODE_DEBUG0x6
> #define ASYNC_EVENT_PVID_STATE0x3
> -#define ASYNC_EVENT_OS2BMC0x5
> #define ASYNC_EVENT_DEBUG_QNQ0x1
> #define ASYNC_EVENT_CODE_SLIPORT0x11
> #define VLAN_VID_MASK0x0FFF
> @@ -726,34 +722,6 @@ struct oce_async_cqe_link_state {
>} u0;
> };
> 
> -/* OS2BMC async event */
> -struct oce_async_evt_grp5_os2bmc {
> -union {
> -struct {
> -uint32_t lrn_enable:1;
> -uint32_t lrn_disable:1;
> -uint32_t mgmt_enable:1;
> -uint32_t mgmt_disable:1;
> -uint32_t rsvd0:12;
> -uint32_t vlan_tag:16;
> -uint32_t arp_filter:1;
> -uint32_t dhcp_client_filt:1;
> -uint32_t dhcp_server_filt:1;
> -uint32_t net_bios_filt:1;
> -uint32_t rsvd1:3;
> -uint32_t bcast_filt:1;
> -uint32_t ipv6_nbr_filt:1;
> -uint32_t ipv6_ra_filt:1;
> -uint32_t ipv6_ras_filt:1;
> -uint32_t rsvd2[4];
> -uint32_t mcast_filt:1;
> -uint32_t rsvd3:16;
> -uint32_t evt_tag;
> -uint32_t dword3;
> -} s;
> -uint32_t dword[4];
> -} u;
> -};
> 
> /* PVID aync event */
> struct oce_async_event_grp5_pvid_state {
> @@ -1428,7 +1396,7 @@ typedef union oce_cq_ctx_u {
>uint32_t dw5rsvd3:1;
>uint32_t eventable:1;
>/* dw6 */
> -uint32_t eq_id:16;
> +uint32_t eq_id:8;
>uint32_t dw6rsvd1:15;
>uint32_t armed:1;
>/* dw7 */
> @@ -2435,8 +2403,8 @@ struct oce_nic_hdr_wqe {
>uint32_t tcpcs:1;
>uint32_t udpcs:1;
>uint32_t ipcs:1;
> -uint32_t mgmt:1;
> -uint32_t lso6:1;
> +uint32_t rsvd3:1;
> +uint32_t rsvd2:1;
>uint32_t forward:1;
>uint32_t crc:1;
>uint32_t event:1;
> @@ -2458,8 +2426,8 @@ struct oce_nic_hdr_wqe {
>uint32_t event:1;
>uint32_t crc:1;
>uint32_t forward:1;
> -uint32_t lso6:1;
> -uint32_t mgmt:1;
> +uint32_t rsvd2:1;
> +uint32_t rsvd3:1;
>uint32_t ipcs:1;
>uint32_t udpcs:1;
>uint32_t tcpcs:1;
> @@ -3042,53 +3010,6 @@ struct oce_rxf_stats_v0 {
>uint32_t rsvd1[6];
>

Re: svn commit: r306148 - head/sys/dev/oce

2016-09-21 Thread Josh Paetzel
I clearly did not commit what I tested. Jenkins is sending breakages that have 
missing headers in oce.

It will be a few hours before I can look at this. Feel free to revert my commit.

Thanks,

Josh Paetzel

> On Sep 21, 2016, at 5:53 PM, Josh Paetzel <jpaet...@freebsd.org> wrote:
> 
> Author: jpaetzel
> Date: Wed Sep 21 22:53:16 2016
> New Revision: 306148
> URL: https://svnweb.freebsd.org/changeset/base/306148
> 
> Log:
>  Update oce driver to 11.0.50.0
> 
>  Submitted by:Venkat Duvvuru <venkatkumar.duvv...@broadcom.com>
> 
> Modified:
>  head/sys/dev/oce/oce_hw.c
>  head/sys/dev/oce/oce_hw.h
>  head/sys/dev/oce/oce_if.c
>  head/sys/dev/oce/oce_if.h
>  head/sys/dev/oce/oce_mbox.c
>  head/sys/dev/oce/oce_queue.c
>  head/sys/dev/oce/oce_sysctl.c
> 
> Modified: head/sys/dev/oce/oce_hw.c
> ==
> --- head/sys/dev/oce/oce_hw.cWed Sep 21 22:09:17 2016(r306147)
> +++ head/sys/dev/oce/oce_hw.cWed Sep 21 22:53:16 2016(r306148)
> @@ -393,6 +393,11 @@ oce_create_nw_interface(POCE_SOFTC sc)
>if (IS_SH(sc) || IS_XE201(sc))
>capab_flags |= MBX_RX_IFACE_FLAGS_MULTICAST;
> 
> +if (sc->enable_hwlro) {
> +capab_flags |= MBX_RX_IFACE_FLAGS_LRO;
> +capab_en_flags |= MBX_RX_IFACE_FLAGS_LRO;
> +}
> +
>/* enable capabilities controlled via driver startup parameters */
>if (is_rss_enabled(sc))
>capab_en_flags |= MBX_RX_IFACE_FLAGS_RSS;
> 
> Modified: head/sys/dev/oce/oce_hw.h
> ==
> --- head/sys/dev/oce/oce_hw.hWed Sep 21 22:09:17 2016(r306147)
> +++ head/sys/dev/oce/oce_hw.hWed Sep 21 22:53:16 2016(r306148)
> @@ -111,6 +111,9 @@
> #definePD_MPU_MBOX_DB0x0160
> #definePD_MQ_DB0x0140
> 
> +#define DB_OFFSET0xc0
> +#define DB_LRO_RQ_ID_MASK0x7FF
> +
> /* EQE completion types */
> #defineEQ_MINOR_CODE_COMPLETION0x00
> #defineEQ_MINOR_CODE_OTHER0x01
> @@ -180,6 +183,7 @@
> #define ASYNC_EVENT_GRP50x5
> #define ASYNC_EVENT_CODE_DEBUG0x6
> #define ASYNC_EVENT_PVID_STATE0x3
> +#define ASYNC_EVENT_OS2BMC0x5
> #define ASYNC_EVENT_DEBUG_QNQ0x1
> #define ASYNC_EVENT_CODE_SLIPORT0x11
> #define VLAN_VID_MASK0x0FFF
> @@ -722,6 +726,34 @@ struct oce_async_cqe_link_state {
>} u0;
> };
> 
> +/* OS2BMC async event */
> +struct oce_async_evt_grp5_os2bmc {
> +union {
> +struct {
> +uint32_t lrn_enable:1;
> +uint32_t lrn_disable:1;
> +uint32_t mgmt_enable:1;
> +uint32_t mgmt_disable:1;
> +uint32_t rsvd0:12;
> +uint32_t vlan_tag:16;
> +uint32_t arp_filter:1;
> +uint32_t dhcp_client_filt:1;
> +uint32_t dhcp_server_filt:1;
> +uint32_t net_bios_filt:1;
> +uint32_t rsvd1:3;
> +uint32_t bcast_filt:1;
> +uint32_t ipv6_nbr_filt:1;
> +uint32_t ipv6_ra_filt:1;
> +uint32_t ipv6_ras_filt:1;
> +uint32_t rsvd2[4];
> +uint32_t mcast_filt:1;
> +uint32_t rsvd3:16;
> +uint32_t evt_tag;
> +uint32_t dword3;
> +} s;
> +uint32_t dword[4];
> +} u;
> +};
> 
> /* PVID aync event */
> struct oce_async_event_grp5_pvid_state {
> @@ -1396,7 +1428,7 @@ typedef union oce_cq_ctx_u {
>uint32_t dw5rsvd3:1;
>uint32_t eventable:1;
>/* dw6 */
> -uint32_t eq_id:8;
> +uint32_t eq_id:16;
>uint32_t dw6rsvd1:15;
>uint32_t armed:1;
>/* dw7 */
> @@ -2403,8 +2435,8 @@ struct oce_nic_hdr_wqe {
>uint32_t tcpcs:1;
>uint32_t udpcs:1;
>uint32_t ipcs:1;
> -uint32_t rsvd3:1;
> -uint32_t rsvd2:1;
> +uint32_t mgmt:1;
> +uint32_t lso6:1;
>uint32_t forward:1;
>uint32_t crc:1;
>uint32_t event:1;
> @@ -2426,8 +2458,8 @@ struct oce_nic_hdr_wqe {
>uint32_t event:1;
>uint32_t crc:1;
>uint32_t forward:1;
> -uint32_t rsvd2:1;
> -uint32_t rsvd3:1;
> +uint32_t lso6:1;
> +uint32_t mgmt:1;
>uint32_t ipcs:1;
>uint32_t udpcs:1;
>uint32_t tcpcs:1;
> @@ -3010,6 +3042,53 @@ struct oce_rxf_stats_v0 {
>uint32_t rsvd1[6];
> };
> 
> +struct oce_port_rxf

svn commit: r306148 - head/sys/dev/oce

2016-09-21 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Sep 21 22:53:16 2016
New Revision: 306148
URL: https://svnweb.freebsd.org/changeset/base/306148

Log:
  Update oce driver to 11.0.50.0
  
  Submitted by: Venkat Duvvuru 

Modified:
  head/sys/dev/oce/oce_hw.c
  head/sys/dev/oce/oce_hw.h
  head/sys/dev/oce/oce_if.c
  head/sys/dev/oce/oce_if.h
  head/sys/dev/oce/oce_mbox.c
  head/sys/dev/oce/oce_queue.c
  head/sys/dev/oce/oce_sysctl.c

Modified: head/sys/dev/oce/oce_hw.c
==
--- head/sys/dev/oce/oce_hw.c   Wed Sep 21 22:09:17 2016(r306147)
+++ head/sys/dev/oce/oce_hw.c   Wed Sep 21 22:53:16 2016(r306148)
@@ -393,6 +393,11 @@ oce_create_nw_interface(POCE_SOFTC sc)
if (IS_SH(sc) || IS_XE201(sc))
capab_flags |= MBX_RX_IFACE_FLAGS_MULTICAST;
 
+if (sc->enable_hwlro) {
+capab_flags |= MBX_RX_IFACE_FLAGS_LRO;
+capab_en_flags |= MBX_RX_IFACE_FLAGS_LRO;
+}
+
/* enable capabilities controlled via driver startup parameters */
if (is_rss_enabled(sc))
capab_en_flags |= MBX_RX_IFACE_FLAGS_RSS;

Modified: head/sys/dev/oce/oce_hw.h
==
--- head/sys/dev/oce/oce_hw.h   Wed Sep 21 22:09:17 2016(r306147)
+++ head/sys/dev/oce/oce_hw.h   Wed Sep 21 22:53:16 2016(r306148)
@@ -111,6 +111,9 @@
 #definePD_MPU_MBOX_DB  0x0160
 #definePD_MQ_DB0x0140
 
+#define DB_OFFSET  0xc0
+#define DB_LRO_RQ_ID_MASK  0x7FF
+
 /* EQE completion types */
 #defineEQ_MINOR_CODE_COMPLETION0x00
 #defineEQ_MINOR_CODE_OTHER 0x01
@@ -180,6 +183,7 @@
 #define ASYNC_EVENT_GRP5   0x5
 #define ASYNC_EVENT_CODE_DEBUG 0x6
 #define ASYNC_EVENT_PVID_STATE 0x3
+#define ASYNC_EVENT_OS2BMC 0x5
 #define ASYNC_EVENT_DEBUG_QNQ  0x1
 #define ASYNC_EVENT_CODE_SLIPORT   0x11
 #define VLAN_VID_MASK  0x0FFF
@@ -722,6 +726,34 @@ struct oce_async_cqe_link_state {
} u0;
 };
 
+/* OS2BMC async event */
+struct oce_async_evt_grp5_os2bmc {
+   union {
+   struct {
+   uint32_t lrn_enable:1;
+   uint32_t lrn_disable:1;
+   uint32_t mgmt_enable:1;
+   uint32_t mgmt_disable:1;
+   uint32_t rsvd0:12;
+   uint32_t vlan_tag:16;
+   uint32_t arp_filter:1;
+   uint32_t dhcp_client_filt:1;
+   uint32_t dhcp_server_filt:1;
+   uint32_t net_bios_filt:1;
+   uint32_t rsvd1:3;
+   uint32_t bcast_filt:1;
+   uint32_t ipv6_nbr_filt:1;
+   uint32_t ipv6_ra_filt:1;
+   uint32_t ipv6_ras_filt:1;
+   uint32_t rsvd2[4];
+   uint32_t mcast_filt:1;
+   uint32_t rsvd3:16;
+   uint32_t evt_tag;
+   uint32_t dword3;
+   } s;
+   uint32_t dword[4];
+   } u;
+};
 
 /* PVID aync event */
 struct oce_async_event_grp5_pvid_state {
@@ -1396,7 +1428,7 @@ typedef union oce_cq_ctx_u {
uint32_t dw5rsvd3:1;
uint32_t eventable:1;
/* dw6 */
-   uint32_t eq_id:8;
+   uint32_t eq_id:16;
uint32_t dw6rsvd1:15;
uint32_t armed:1;
/* dw7 */
@@ -2403,8 +2435,8 @@ struct oce_nic_hdr_wqe {
uint32_t tcpcs:1;
uint32_t udpcs:1;
uint32_t ipcs:1;
-   uint32_t rsvd3:1;
-   uint32_t rsvd2:1;
+   uint32_t mgmt:1;
+   uint32_t lso6:1;
uint32_t forward:1;
uint32_t crc:1;
uint32_t event:1;
@@ -2426,8 +2458,8 @@ struct oce_nic_hdr_wqe {
uint32_t event:1;
uint32_t crc:1;
uint32_t forward:1;
-   uint32_t rsvd2:1;
-   uint32_t rsvd3:1;
+   uint32_t lso6:1;
+   uint32_t mgmt:1;
uint32_t ipcs:1;
uint32_t udpcs:1;
uint32_t tcpcs:1;
@@ -3010,6 +3042,53 @@ struct oce_rxf_stats_v0 {
uint32_t rsvd1[6];
 };
 
+struct oce_port_rxf_stats_v2 {
+uint32_t rsvd0[10];
+uint32_t roce_bytes_received_lsd;
+uint32_t roce_bytes_received_msd;
+uint32_t rsvd1[5];
+uint32_t roce_frames_received;
+uint32_t rx_crc_errors;
+

svn commit: r293305 - head/usr.sbin/mountd

2016-01-06 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Jan  7 05:34:39 2016
New Revision: 293305
URL: https://svnweb.freebsd.org/changeset/base/293305

Log:
  Allow /etc/exports to contain usernames/groups with spaces in them.
  
  If you are getting your users/groups from a directory service such
  as LDAP or AD it's possible for those usernames or groupnames to
  contain spaces.
  
  Submitted by: Sean E. Fagan
  Reviewed by:  rmacklem
  MFC after:1 week
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/mountd/exports.5
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/exports.5
==
--- head/usr.sbin/mountd/exports.5  Thu Jan  7 04:02:37 2016
(r293304)
+++ head/usr.sbin/mountd/exports.5  Thu Jan  7 05:34:39 2016
(r293305)
@@ -131,6 +131,7 @@ The credential includes all the groups t
 on the local machine (see
 .Xr id 1 ) .
 The user may be specified by name or number.
+The user string may be quoted, or use backslash escaping.
 .Pp
 .Sm off
 .Fl maproot Li = Sy user:group1:group2:...
@@ -140,6 +141,7 @@ to be used for remote access by root.
 The elements of the list may be either names or numbers.
 Note that user: should be used to distinguish a credential containing
 no groups from a complete credential for that user.
+The group names may be quoted, or use backslash escaping.
 .Pp
 .Sm off
 .Fl mapall Li = Sy user

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Thu Jan  7 04:02:37 2016
(r293304)
+++ head/usr.sbin/mountd/mountd.c   Thu Jan  7 05:34:39 2016
(r293305)
@@ -174,6 +174,7 @@ static int  check_options(struct dirlist 
 static int checkmask(struct sockaddr *sa);
 static int chk_host(struct dirlist *, struct sockaddr *, int *, int *,
int *, int **);
+static char*strsep_quote(char **stringp, const char *delim);
 static int create_service(struct netconfig *nconf);
 static voidcomplete_service(struct netconfig *nconf, char *port_str);
 static voidclearout_service(void);
@@ -278,6 +279,73 @@ static int debug = 0;
 #endif
 
 /*
+ * Similar to strsep(), but it allows for quoted strings
+ * and escaped characters.
+ *
+ * It returns the string (or NULL, if *stringp is NULL),
+ * which is a de-quoted version of the string if necessary.
+ *
+ * It modifies *stringp in place.
+ */
+static char *
+strsep_quote(char **stringp, const char *delim)
+{
+   char *srcptr, *dstptr, *retval;
+   char quot = 0;
+   
+   if (stringp == NULL || *stringp == NULL)
+   return (NULL);
+
+   srcptr = dstptr = retval = *stringp;
+
+   while (*srcptr) {
+   /*
+* We're looking for several edge cases here.
+* First:  if we're in quote state (quot != 0),
+* then we ignore the delim characters, but otherwise
+* process as normal, unless it is the quote character.
+* Second:  if the current character is a backslash,
+* we take the next character as-is, without checking
+* for delim, quote, or backslash.  Exception:  if the
+* next character is a NUL, that's the end of the string.
+* Third:  if the character is a quote character, we toggle
+* quote state.
+* Otherwise:  check the current character for NUL, or
+* being in delim, and end the string if either is true.
+*/
+   if (*srcptr == '\\') {
+   srcptr++;
+   /*
+* The edge case here is if the next character
+* is NUL, we want to stop processing.  But if
+* it's not NUL, then we simply want to copy it.
+*/
+   if (*srcptr) {
+   *dstptr++ = *srcptr++;
+   }
+   continue;
+   }
+   if (quot == 0 && (*srcptr == '\'' || *srcptr == '"')) {
+   quot = *srcptr++;
+   continue;
+   }
+   if (quot && *srcptr == quot) {
+   /* End of the quoted part */
+   quot = 0;
+   srcptr++;
+   continue;
+   }
+   if (!quot && strchr(delim, *srcptr))
+   break;
+   *dstptr++ = *srcptr++;
+   }
+
+   *dstptr = 0; /* Terminate the string */
+   *stringp = (*srcptr == '\0') ? NULL : srcptr + 1;
+   return (retval);
+}
+
+/*
  * Mountd server for NFS mount protocol as described in:
  * NFS: Network File System Protocol Specification, RFC1094, Appendix A
  * The optional arguments are the exports file name
@@ -2831,8 

svn commit: r293043 - in head: sys/kgssapi usr.sbin/gssd

2016-01-01 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Jan  1 17:06:16 2016
New Revision: 293043
URL: https://svnweb.freebsd.org/changeset/base/293043

Log:
  Unset the gss kernel state when gssd exits
  
  When gssd exits it leaves the kernel state set by
  gssd_syscall().  nfsd sees this and waits endlessly
  in an unkillable state for gssd to come back.  If you
  had acidentally started gssd then stopped it, then
  started nfsd you'd be in a bad way until you either
  restarted gssd or rebooted the system.  This change
  fixes that by setting the kernel state to "" when
  gssd exits.
  Reviewed by:  rmacklem
  MFC after:1 week
  Sponsored by: iXsystems

Modified:
  head/sys/kgssapi/gss_impl.c
  head/usr.sbin/gssd/gssd.c

Modified: head/sys/kgssapi/gss_impl.c
==
--- head/sys/kgssapi/gss_impl.c Fri Jan  1 15:48:48 2016(r293042)
+++ head/sys/kgssapi/gss_impl.c Fri Jan  1 17:06:16 2016(r293043)
@@ -105,14 +105,17 @@ sys_gssd_syscall(struct thread *td, stru
if (error)
return (error);
 
-sun.sun_family = AF_LOCAL;
-strcpy(sun.sun_path, path);
-sun.sun_len = SUN_LEN();
-
-nconf = getnetconfigent("local");
-cl = clnt_reconnect_create(nconf,
-   (struct sockaddr *) , GSSD, GSSDVERS,
-   RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+   if (path[0] != '\0') {
+   sun.sun_family = AF_LOCAL;
+   strcpy(sun.sun_path, path);
+   sun.sun_len = SUN_LEN();
+   
+   nconf = getnetconfigent("local");
+   cl = clnt_reconnect_create(nconf,
+   (struct sockaddr *) , GSSD, GSSDVERS,
+   RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+   } else
+   cl = NULL;
 
mtx_lock(_gssd_lock);
oldcl = kgss_gssd_handle;

Modified: head/usr.sbin/gssd/gssd.c
==
--- head/usr.sbin/gssd/gssd.c   Fri Jan  1 15:48:48 2016(r293042)
+++ head/usr.sbin/gssd/gssd.c   Fri Jan  1 17:06:16 2016(r293043)
@@ -254,6 +254,7 @@ main(int argc, char **argv)
 
gssd_syscall(_PATH_GSSDSOCK);
svc_run();
+   gssd_syscall("");
 
return (0);
 }
@@ -1285,6 +1286,7 @@ void gssd_terminate(int sig __unused)
if (hostbased_initiator_cred != 0)
unlink(GSSD_CREDENTIAL_CACHE_FILE);
 #endif
+   gssd_syscall("");
exit(0);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r290662 - head/sys/kern

2015-11-10 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Nov 10 14:14:32 2015
New Revision: 290662
URL: https://svnweb.freebsd.org/changeset/base/290662

Log:
  Fix a bug in the CPU % limiting code
  
  If you attempt to set a pcpu limit that is higher than
  110% using rctl (for instance, you want a jail to be
  able to use 2 cores on your system so you set pcpu to
  200%) the thing you are trying to limit becomes unthrottled.
  
  PR:   189870
  Submitted by: dustinw...@ebureau.com
  Reviewed by:  trasz
  MFC after:1 week

Modified:
  head/sys/kern/kern_racct.c

Modified: head/sys/kern/kern_racct.c
==
--- head/sys/kern/kern_racct.c  Tue Nov 10 13:47:28 2015(r290661)
+++ head/sys/kern/kern_racct.c  Tue Nov 10 14:14:32 2015(r290662)
@@ -517,16 +517,16 @@ racct_adjust_resource(struct racct *racc

/*
 * There are some cases where the racct %cpu resource would grow
-* beyond 100%.
-* For example in racct_proc_exit() we add the process %cpu usage
-* to the ucred racct containers.  If too many processes terminated
-* in a short time span, the ucred %cpu resource could grow too much.
-* Also, the 4BSD scheduler sometimes returns for a thread more than
-* 100% cpu usage.  So we set a boundary here to 100%.
+* beyond 100% per core.  For example in racct_proc_exit() we add
+* the process %cpu usage to the ucred racct containers.  If too
+* many processes terminated in a short time span, the ucred %cpu
+* resource could grow too much.  Also, the 4BSD scheduler sometimes
+* returns for a thread more than 100% cpu usage. So we set a sane
+* boundary here to 100% * the maxumum number of CPUs.
 */
if ((resource == RACCT_PCTCPU) &&
-   (racct->r_resources[RACCT_PCTCPU] > 100 * 100))
-   racct->r_resources[RACCT_PCTCPU] = 100 * 100;
+   (racct->r_resources[RACCT_PCTCPU] > 100 * 100 * 
(int64_t)MAXCPU))
+   racct->r_resources[RACCT_PCTCPU] = 100 * 100 * 
(int64_t)MAXCPU;
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r288272 - in head: sys/rpc/rpcsec_gss usr.sbin/gssd

2015-09-26 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Sep 26 16:30:16 2015
New Revision: 288272
URL: https://svnweb.freebsd.org/changeset/base/288272

Log:
  Increase group limit for kerberized NFSv4
  
  PR:   202659
  Submitted by: matthew.l.dai...@dartmouth.edu
  Reviewed by:  rmacklem dfr
  MFC after:1 week
  Sponsored by: iXsystems

Modified:
  head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
  head/usr.sbin/gssd/gssd.c

Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
==
--- head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cSat Sep 26 14:52:47 2015
(r288271)
+++ head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cSat Sep 26 16:30:16 2015
(r288272)
@@ -121,9 +121,6 @@ enum svc_rpc_gss_client_state {
 };
 
 #define SVC_RPC_GSS_SEQWINDOW  128
-#ifndef RPCAUTH_UNIXGIDS
-#define RPCAUTH_UNIXGIDS   16
-#endif
 
 struct svc_rpc_gss_clientid {
unsigned long   ci_hostid;
@@ -150,7 +147,7 @@ struct svc_rpc_gss_client {
int cl_rpcflavor;   /* RPC pseudo sec flavor */
bool_t  cl_done_callback; /* TRUE after call */
void*cl_cookie; /* user cookie from callback */
-   gid_t   cl_gid_storage[RPCAUTH_UNIXGIDS];
+   gid_t   cl_gid_storage[NGROUPS];
gss_OID cl_mech;/* mechanism */
gss_qop_t   cl_qop; /* quality of protection */
uint32_tcl_seqlast; /* sequence window origin */
@@ -776,7 +773,7 @@ svc_rpc_gss_build_ucred(struct svc_rpc_g
uc->gid = 65534;
uc->gidlist = client->cl_gid_storage;
 
-   numgroups = RPCAUTH_UNIXGIDS;
+   numgroups = NGROUPS;
maj_stat = gss_pname_to_unix_cred(_stat, name, client->cl_mech,
>uid, >gid, , >gidlist[0]);
if (GSS_ERROR(maj_stat))

Modified: head/usr.sbin/gssd/gssd.c
==
--- head/usr.sbin/gssd/gssd.c   Sat Sep 26 14:52:47 2015(r288271)
+++ head/usr.sbin/gssd/gssd.c   Sat Sep 26 16:30:16 2015(r288272)
@@ -751,8 +751,8 @@ gssd_pname_to_uid_1_svc(pname_to_uid_arg
buflen_hint = buflen;
}
if (pw) {
-   int len = NGRPS;
-   int groups[NGRPS];
+   int len = NGROUPS;
+   int groups[NGROUPS];
result->gid = pw->pw_gid;
getgrouplist(pw->pw_name, pw->pw_gid,
groups, );
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r288208 - head/usr.sbin/ctld

2015-09-24 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Sep 25 03:46:06 2015
New Revision: 288208
URL: https://svnweb.freebsd.org/changeset/base/288208

Log:
  Fix typo.
  
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/ctld/ctld.c

Modified: head/usr.sbin/ctld/ctld.c
==
--- head/usr.sbin/ctld/ctld.c   Fri Sep 25 02:52:54 2015(r288207)
+++ head/usr.sbin/ctld/ctld.c   Fri Sep 25 03:46:06 2015(r288208)
@@ -1149,7 +1149,7 @@ valid_iscsi_name(const char *name)
}
} else {
log_warnx("invalid target name \"%s\"; should start with "
-   "either \".iqn\", \"eui.\", or \"naa.\"",
+   "either \"iqn.\", \"eui.\", or \"naa.\"",
name);
}
return (true);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r281166 - head/etc/rc.d

2015-04-06 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Apr  6 19:23:45 2015
New Revision: 281166
URL: https://svnweb.freebsd.org/changeset/base/281166

Log:
  Typo fix in comment
  
  MFC after:3 days

Modified:
  head/etc/rc.d/pflog

Modified: head/etc/rc.d/pflog
==
--- head/etc/rc.d/pflog Mon Apr  6 19:08:44 2015(r281165)
+++ head/etc/rc.d/pflog Mon Apr  6 19:23:45 2015(r281166)
@@ -38,7 +38,7 @@ pflog_prestart()
return 1
fi
 
-   # -p flag requires striping pidfile's leading /var/run and trailing .pid
+   # -p flag requires stripping pidfile's leading /var/run and trailing 
.pid
pidfile=$(echo $pidfile | sed -e 's|/var/run/||' -e 's|.pid$||')
 
# prepare the command line for pflogd
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r281112 - head/etc/rc.d

2015-04-05 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Apr  5 17:09:58 2015
New Revision: 281112
URL: https://svnweb.freebsd.org/changeset/base/281112

Log:
  Bug fixes and feature adds
  
  - Remove extranious echo that breaks puppet
  - Handle restarts of multiple pflog devices correctly
  - Add the ability to perform actions on specific pflog devices.
  
  PR:   199150
  Submitted by: jason.unovi...@gmail.com
  MFC after:3 days

Modified:
  head/etc/rc.d/pflog

Modified: head/etc/rc.d/pflog
==
--- head/etc/rc.d/pflog Sun Apr  5 16:35:13 2015(r28)
+++ head/etc/rc.d/pflog Sun Apr  5 17:09:58 2015(r281112)
@@ -24,30 +24,30 @@ pflog_prestart()
 {
load_kld pflog || return 1
 
+   # create pflog_dev interface if needed
+   if ! ifconfig $pflog_dev  /dev/null 21; then
+   if ! ifconfig $pflog_dev create; then
+   warn could not create $pflog_dev.
+   return 1
+   fi
+   fi
+
# set pflog_dev interface to up state
if ! ifconfig $pflog_dev up; then
warn could not bring up $pflog_dev.
return 1
fi
 
+   # -p flag requires striping pidfile's leading /var/run and trailing .pid
+   pidfile=$(echo $pidfile | sed -e 's|/var/run/||' -e 's|.pid$||')
+
# prepare the command line for pflogd
-   rc_flags=-f $pflog_logfile -i $pflog_dev $rc_flags
+   rc_flags=-p $pidfile -f $pflog_logfile -i $pflog_dev $rc_flags
 
# report we're ready to run pflogd
return 0
 }
 
-pflog_poststart() {
-   # Allow child pflogd to settle
-   sleep 0.10
-   # More elegant(?) method for getting a unique pid
-   if [ -f /var/run/pflogd.pid ]; then
-   mv /var/run/pflogd.pid $pidfile
-   else
-   warn /var/run/pflogd.pid does not exist. Too fast.
-   fi
-}
-
 pflog_poststop()
 {
if ! ifconfig $pflog_dev down; then
@@ -70,29 +70,33 @@ pflog_resync()
 
 load_rc_config $name
 
-# Check if spawning multiple pflogd
-echo Starting pflogd: $pflog_instances
-if [ $pflog_instances ]  [ -n $pflog_instances ]; then
-   start_postcmd=pflog_poststart
+# Check if spawning multiple pflogd and told what to spawn
+if [ -n $2 ]; then
+   # Set required variables
+   eval pflog_dev=\$pflog_${2}_dev
+   eval pflog_logfile=\$pflog_${2}_logfile
+   eval pflog_flags=\$pflog_${2}_flags
+   # Check that required vars have non-zero length, warn if not.
+   if [ -z $pflog_dev ]; then
+   warn pflog_dev not set
+   continue
+   fi
+   if [ -z $pflog_logfile ]; then
+   warn pflog_logfile not set
+   continue
+   fi
+
+   # Provide a unique pidfile name for pflogd -p pidfile flag
+   pidfile=/var/run/pflogd.$2.pid
+
+   # Override service name and execute command
+   name=$pflog_dev
+   run_rc_command $1
+# Check if spawning multiple pflogd and not told what to spawn
+elif [ $pflog_instances ]  [ -n $pflog_instances ]; then
# Interate through requested instances.
for i in $pflog_instances; do
-   # Set required variables
-   eval pflog_dev=\$pflog_${i}_dev
-   eval pflog_logfile=\$pflog_${i}_logfile
-   eval pflog_flags=\$pflog_${i}_flags
-   # Check that required vars have non-zero length, warn if not.
-   if [ -z $pflog_dev ]; then
-   warn pflog_dev not set
-   continue
-   fi
-   if [ -z $pflog_logfile ]; then
-   warn pflog_logfile not set
-   continue
-   fi
-   # pflogd sets a pidfile, but the name is hardcoded. Concoct a
-   # unique pidfile name.
-   pidfile=/var/run/pflogd.$i.pid
-   run_rc_command $1
+   /etc/rc.d/pflog $1 $i
done
 else
# Typical case, spawn single instance only.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r281084 - head/usr.sbin/ctld

2015-04-04 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Apr  4 20:55:47 2015
New Revision: 281084
URL: https://svnweb.freebsd.org/changeset/base/281084

Log:
  Fix thinko/copypaste error.
  
  When checking the length of the mutual secret password the variable for
  the secret password was used by mistake.  This resulted in ctld never
  warning about the length of the mutual secret being wrong even if it was.
  
  MFC after:3 days
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/ctld/ctld.c

Modified: head/usr.sbin/ctld/ctld.c
==
--- head/usr.sbin/ctld/ctld.c   Sat Apr  4 20:30:20 2015(r281083)
+++ head/usr.sbin/ctld/ctld.c   Sat Apr  4 20:55:47 2015(r281084)
@@ -203,7 +203,7 @@ auth_check_secret_length(struct auth *au
}
 
if (auth-a_mutual_secret != NULL) {
-   len = strlen(auth-a_secret);
+   len = strlen(auth-a_mutual_secret);
if (len  16) {
if (auth-a_auth_group-ag_name != NULL)
log_warnx(mutual secret for user \%s\, 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273866 - head/sys/sys

2014-10-30 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Oct 30 16:26:17 2014
New Revision: 273866
URL: https://svnweb.freebsd.org/changeset/base/273866

Log:
  Plug memory ordering holes in buf_ring_enqueue. For at least some
  users this patch eliminates the races previously discussed on the
  mailing list.
  
  Submitted by: oleg
  Reviewed by:  kmacy
  MFC after:2 weeks
  Tested by:kmacy,rpaulo

Modified:
  head/sys/sys/buf_ring.h

Modified: head/sys/sys/buf_ring.h
==
--- head/sys/sys/buf_ring.h Thu Oct 30 15:52:01 2014(r273865)
+++ head/sys/sys/buf_ring.h Thu Oct 30 16:26:17 2014(r273866)
@@ -64,8 +64,7 @@ struct buf_ring {
 static __inline int
 buf_ring_enqueue(struct buf_ring *br, void *buf)
 {
-   uint32_t prod_head, prod_next;
-   uint32_t cons_tail;
+   uint32_t prod_head, prod_next, cons_tail;
 #ifdef DEBUG_BUFRING
int i;
for (i = br-br_cons_head; i != br-br_prod_head;
@@ -77,16 +76,20 @@ buf_ring_enqueue(struct buf_ring *br, vo
critical_enter();
do {
prod_head = br-br_prod_head;
+   prod_next = (prod_head + 1)  br-br_prod_mask;
cons_tail = br-br_cons_tail;
 
-   prod_next = (prod_head + 1)  br-br_prod_mask;
-   
if (prod_next == cons_tail) {
-   br-br_drops++;
-   critical_exit();
-   return (ENOBUFS);
+   rmb();
+   if (prod_head == br-br_prod_head 
+   cons_tail == br-br_cons_tail) {
+   br-br_drops++;
+   critical_exit();
+   return (ENOBUFS);
+   }
+   continue;
}
-   } while (!atomic_cmpset_int(br-br_prod_head, prod_head, prod_next));
+   } while (!atomic_cmpset_acq_int(br-br_prod_head, prod_head, 
prod_next));
 #ifdef DEBUG_BUFRING
if (br-br_ring[prod_head] != NULL)
panic(dangling value in enqueue);
@@ -94,19 +97,13 @@ buf_ring_enqueue(struct buf_ring *br, vo
br-br_ring[prod_head] = buf;
 
/*
-* The full memory barrier also avoids that br_prod_tail store
-* is reordered before the br_ring[prod_head] is full setup.
-*/
-   mb();
-
-   /*
 * If there are other enqueues in progress
 * that preceeded us, we need to wait for them
 * to complete 
 */   
while (br-br_prod_tail != prod_head)
cpu_spinwait();
-   br-br_prod_tail = prod_next;
+   atomic_store_rel_int(br-br_prod_tail, prod_next);
critical_exit();
return (0);
 }
@@ -119,37 +116,23 @@ static __inline void *
 buf_ring_dequeue_mc(struct buf_ring *br)
 {
uint32_t cons_head, cons_next;
-   uint32_t prod_tail;
void *buf;
-   int success;
 
critical_enter();
do {
cons_head = br-br_cons_head;
-   prod_tail = br-br_prod_tail;
-
cons_next = (cons_head + 1)  br-br_cons_mask;
-   
-   if (cons_head == prod_tail) {
+
+   if (cons_head == br-br_prod_tail) {
critical_exit();
return (NULL);
}
-   
-   success = atomic_cmpset_int(br-br_cons_head, cons_head,
-   cons_next);
-   } while (success == 0); 
+   } while (!atomic_cmpset_acq_int(br-br_cons_head, cons_head, 
cons_next));
 
buf = br-br_ring[cons_head];
 #ifdef DEBUG_BUFRING
br-br_ring[cons_head] = NULL;
 #endif
-
-   /*
-* The full memory barrier also avoids that br_ring[cons_read]
-* load is reordered after br_cons_tail is set.
-*/
-   mb();
-   
/*
 * If there are other dequeues in progress
 * that preceeded us, we need to wait for them
@@ -158,7 +141,7 @@ buf_ring_dequeue_mc(struct buf_ring *br)
while (br-br_cons_tail != cons_head)
cpu_spinwait();
 
-   br-br_cons_tail = cons_next;
+   atomic_store_rel_int(br-br_cons_tail, cons_next);
critical_exit();
 
return (buf);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273641 - in head/sys/cddl: compat/opensolaris/kern contrib/opensolaris/uts/common/fs contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/sys

2014-10-25 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Oct 25 17:42:44 2014
New Revision: 273641
URL: https://svnweb.freebsd.org/changeset/base/273641

Log:
  This change addresses 4 bugs in ZFS exposed by Richard Kojedzinszky's
  crash.sh script attached to FreeNAS bug 4109:
  https://bugs.freenas.org/issues/4109
  
  Three are in the snapshot layer:
  a) AVG explains in his notes: https://wiki.freebsd.org/AvgVfsSolarisVsFreeBSD
  
  VOP_INACTIVE must not do any destructive actions to a vnode
  and its filesystem node, nor invalidate them in any way.
  gfs_vop_inactive and zfsctl_snapshot_inactive did just that. In
  OpenSolaris VOP_INACTIVE is much closer to FreeBSD's VOP_RECLAIM.
  Rename  move them to gfs_vop_reclaim and zfsctl_snapshot_reclaim
  and merge in the requisite vnode_destroy from zfsctl_common_reclaim.
  
  b) gfs_lookup_dot and various zfsctl functions do not honor the
  FreeBSD VFS convention of only locking from the root downward. When
  looking up .. the convention is to drop the current leaf vnode lock before
  acquiring the directory vnode and then subsequently re-acquiring the lock on 
the
  leaf vnode. This fixes that in all the places that our exercised by crash.sh.
  
  c) The snapshot may already be unmounted when the directory vnode is 
reclaimed.
  Check for this case and return.
  
  One in the common layer:
  d) Callers of traverse expect the reference to the vnode passed in to be
  maintained. Don't release it.
  
  This last one may be an unclear contract. There may in fact be some callers 
that
  do expect the reference to be dropped on success in addition to callers that
  expect it to be released. In this case a further audit of the callers is 
needed
  and a consensus on the correct behavior.
  
  PR:   184677
  Submitted by: kmacy
  Reviewed by:  delphij, will, avg
  MFC after:2 weeks
  Sponsored by: iXsystems

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c  Sat Oct 25 
17:07:35 2014(r273640)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c  Sat Oct 25 
17:42:44 2014(r273641)
@@ -91,11 +91,11 @@ traverse(vnode_t **cvpp, int lktype)
error = vfs_busy(vfsp, 0);
/*
 * tvp is NULL for *cvpp vnode, which we can't unlock.
+* At least some callers expect the reference to be
+* maintained to the original *cvpp
 */
if (tvp != NULL)
vput(cvp);
-   else
-   vrele(cvp);
if (error)
return (error);
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Sat Oct 25 
17:07:35 2014(r273640)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Sat Oct 25 
17:42:44 2014(r273641)
@@ -90,7 +90,7 @@
  * gfs_dir_lookup()
  * gfs_dir_readdir()
  *
- * gfs_vop_inactive()
+ * gfs_vop_reclaim()
  * gfs_vop_lookup()
  * gfs_vop_readdir()
  * gfs_vop_map()
@@ -435,6 +435,8 @@ gfs_readdir_fini(gfs_readdir_state_t *st
 int
 gfs_lookup_dot(vnode_t **vpp, vnode_t *dvp, vnode_t *pvp, const char *nm)
 {
+   int ltype;
+
if (*nm == '\0' || strcmp(nm, .) == 0) {
VN_HOLD(dvp);
*vpp = dvp;
@@ -444,11 +446,15 @@ gfs_lookup_dot(vnode_t **vpp, vnode_t *d
ASSERT(dvp-v_flag  VROOT);
VN_HOLD(dvp);
*vpp = dvp;
+   ASSERT_VOP_ELOCKED(dvp, gfs_lookup_dot: non-locked 
dvp);
} else {
+   ltype = VOP_ISLOCKED(dvp);
+   VOP_UNLOCK(dvp, 0);
VN_HOLD(pvp);
*vpp = pvp;
+   vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+   vn_lock(dvp, ltype | LK_RETRY);
}
-   vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
return (0);
}
 
@@ -618,7 +624,7 @@ gfs_root_create_file(size_t size, vfs_t 
 /*
  * gfs_file_inactive()
  *
- * Called from the VOP_INACTIVE() routine.  If necessary, this routine will
+ * Called from the VOP_RECLAIM() routine.  If necessary, this routine will
  * remove the given vnode from the parent directory and clean up any references
  * in the VFS layer.
  *
@@ -1215,15 +1221,15 @@ gfs_vop_map(vnode_t *vp, offset_t off, s
 #endif /* sun */
 
 /*
- * gfs_vop_inactive: 

svn commit: r267833 - head/usr.sbin/ctld

2014-06-24 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Jun 24 19:12:55 2014
New Revision: 267833
URL: http://svnweb.freebsd.org/changeset/base/267833

Log:
  Fix issues in config parser relating to lun serial numbers.
  
  Without this fix some serial numbers needed to be quoted
  to avoid the config parser bailing out.
  
  Submitted by: delphij
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/ctld/parse.y
  head/usr.sbin/ctld/token.l

Modified: head/usr.sbin/ctld/parse.y
==
--- head/usr.sbin/ctld/parse.y  Tue Jun 24 19:05:47 2014(r267832)
+++ head/usr.sbin/ctld/parse.y  Tue Jun 24 19:12:55 2014(r267833)
@@ -659,6 +659,19 @@ lun_serial:SERIAL STR
}
lun_set_serial(lun, $2);
free($2);
+   } | SERIAL NUM
+   {
+   char *str = NULL;
+
+   if (lun-l_serial != NULL) {
+   log_warnx(serial for lun %d, target \%s\ 
+   specified more than once,
+   lun-l_lun, target-t_name);
+   return (1);
+   }
+   asprintf(str, %ju, $2);
+   lun_set_serial(lun, str);
+   free(str);
}
;
 

Modified: head/usr.sbin/ctld/token.l
==
--- head/usr.sbin/ctld/token.l  Tue Jun 24 19:05:47 2014(r267832)
+++ head/usr.sbin/ctld/token.l  Tue Jun 24 19:12:55 2014(r267833)
@@ -74,8 +74,9 @@ target{ return TARGET; }
 timeout{ return TIMEOUT; }
 [0-9]+[kKmMgGtTpPeE]?  { if (expand_number(yytext, yylval.num) == 0)
return NUM;
- else
-   return STR;
+ else {
+   yylval.str = strdup(yytext); return STR;
+ }
}
 \[^]+\  { yylval.str = strndup(yytext + 1,
strlen(yytext) - 2); return STR; }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r258080 - in head: etc/rc.d share/man/man5

2013-11-12 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Nov 13 03:50:31 2013
New Revision: 258080
URL: http://svnweb.freebsd.org/changeset/base/258080

Log:
  Add support for multiple instances of ftp-proxy
  and pflog devices.
  
  PR:   conf/158171
  Submitted by: Thomas Johnson t...@claimlynx.com

Modified:
  head/etc/rc.d/ftp-proxy
  head/etc/rc.d/pflog
  head/share/man/man5/rc.conf.5

Modified: head/etc/rc.d/ftp-proxy
==
--- head/etc/rc.d/ftp-proxy Wed Nov 13 01:51:40 2013(r258079)
+++ head/etc/rc.d/ftp-proxy Wed Nov 13 03:50:31 2013(r258080)
@@ -14,4 +14,62 @@ rcvar=ftpproxy_enable
 command=/usr/sbin/ftp-proxy
 
 load_rc_config $name
-run_rc_command $1
+
+#
+# manage_pid argument
+#  Create or remove a pidfile manually, for daemons that can't be bothered
+#  to do it themselves. Takes one argument, which is the argument provided
+#  to the rc script. The pidfile will be named /var/run/$name.pid,
+#  unless $pidfile is defined.
+#
+#  The method used to determine the pid is rather hacky; grep ps output to
+#  find '$procname|$command', then grep for ${name}_flags. If at all
+#  possible, use another method if at all possible, to avoid that dirty-
+#  code feeling.
+#
+manage_pid() {
+   local search_string ps_pid
+   case $1 in
+   *start)
+   cmd_string=`basename ${procname:-${command}}`
+   eval flag_string=\\$${name}_flags\
+   # Determine the pid.
+   ps_pid=`ps ax -o pid= -o command= | grep $cmd_string | 
grep -e $flag_string | grep -v grep | awk '{ print $1 }'`
+   # Write the pidfile depending on $pidfile status.
+   echo $ps_pid  ${pidfile:-/var/run/$name.pid}
+   ;;
+   stop)
+   rm $pidfile
+   ;;
+   esac
+}
+
+# Allow ftp-proxy to start up in two different ways. The typical behavior
+# is to start up one instance of ftp-proxy by setting ftpproxy_enable and
+# ftpproxy_flags. The alternate behavior allows multiple instances of ftp-
+# proxy to be started, allowing different types of proxy behavior. To use the
+# new behavior, a list of instances must be defined, and a list of flags for
+# each instance. For example, if we want to start two instances of ftp-proxy,
+# foo and bar, we would set the following vars.
+#  ftpproxy_enable=YES
+#  ftpproxy_instances=foo bar
+#  ftpproxy_foo=arguments for foo
+#  ftpproxy_bar=arguments for bar
+#
+# Starting more than one ftp-proxy?
+if [ $ftpproxy_instances ]  [ -n ${ftpproxy_instances} ]; then
+   # Iterate through instance list.
+   for i in $ftpproxy_instances; do
+   #eval ftpproxy_${i}_flags=\$ftpproxy_${i}
+   #eval name=ftpproxy_${i}
+   # Set flags for this instance.
+   eval ftpproxy_flags=\$ftpproxy_${i}
+   # Define a unique pid file name.
+   pidfile=/var/run/ftp-proxy.$i.pid
+   run_rc_command $1
+   manage_pid $1
+   done
+else
+   # Traditional single-instance behavior
+   run_rc_command $1
+fi

Modified: head/etc/rc.d/pflog
==
--- head/etc/rc.d/pflog Wed Nov 13 01:51:40 2013(r258079)
+++ head/etc/rc.d/pflog Wed Nov 13 03:50:31 2013(r258080)
@@ -24,25 +24,41 @@ pflog_prestart()
 {
load_kld pflog || return 1
 
-   # set pflog0 interface to up state
-   if ! ifconfig pflog0 up; then
-   warn 'could not bring up pflog0.'
+   # set pflog_dev interface to up state
+   if ! ifconfig $pflog_dev up; then
+   warn could not bring up $pflog_dev.
return 1
fi
 
# prepare the command line for pflogd
-   rc_flags=-f $pflog_logfile $rc_flags
+   rc_flags=-f $pflog_logfile -i $pflog_dev $rc_flags
 
# report we're ready to run pflogd
return 0
 }
 
+pflog_poststart() {
+   # Allow child pflogd to settle
+   sleep 0.10
+   # More elegant(?) method for getting a unique pid
+   if [ -f /var/run/pflogd.pid ]; then
+   mv /var/run/pflogd.pid $pidfile
+   else
+   warn /var/run/pflogd.pid does not exist. Too fast.
+   fi
+}
+
 pflog_poststop()
 {
-   if ! ifconfig pflog0 down; then
-   warn 'could not bring down pflog0.'
+   if ! ifconfig $pflog_dev down; then
+   warn could not bring down $pflog_dev.
return 1
fi
+
+   if [ $pflog_instances ]  [ -n $pflog_instances ]; then
+   rm $pidfile
+   fi
+
return 0
 }
 
@@ -53,4 +69,33 @@ pflog_resync()
 }
 
 load_rc_config $name
-run_rc_command $1
+
+# Check if spawning multiple pflogd
+echo Starting pflogd: $pflog_instances
+if [ $pflog_instances ]  

svn commit: r247705 - in head/usr.sbin/pc-sysinstall: backend examples

2013-03-03 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Mar  3 09:47:47 2013
New Revision: 247705
URL: http://svnweb.freebsd.org/changeset/base/247705

Log:
  Fix a bug extracting files from dist scheme
  
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh
  head/usr.sbin/pc-sysinstall/backend/functions-parse.sh
  head/usr.sbin/pc-sysinstall/backend/parseconfig.sh
  head/usr.sbin/pc-sysinstall/examples/README

Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh   Sun Mar 
 3 09:26:58 2013(r247704)
+++ head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh   Sun Mar 
 3 09:47:47 2013(r247705)
@@ -29,23 +29,60 @@
 
 . ${BACKEND}/functions-mountoptical.sh
 
+# Performs the extraction of data to disk from FreeBSD dist files
+start_extract_dist()
+{
+  if [ -z $1 ] ; then exit_err Called dist extraction with no directory 
set!; fi
+  if [ -z $INSFILE ]; then exit_err Called extraction with no install file 
set!; fi
+  local DDIR=$1
+
+  # Check if we are doing an upgrade, and if so use our exclude list
+  if [ ${INSTALLMODE} = upgrade ]; then
+   TAROPTS=-X ${PROGDIR}/conf/exclude-from-upgrade
+  else
+   TAROPTS=
+  fi
+
+  # Loop though and extract dist files
+  for di in $INSFILE
+  do
+  # Check the MANIFEST see if we have an archive size / count
+  if [ -e ${DDIR}/MANIFEST ]; then 
+ count=`grep ^${di}.txz ${DDIR}/MANIFEST | awk '{print $3}'`
+if [ ! -z $count ] ; then
+echo INSTALLCOUNT: $count
+fi
+  fi
+  echo_log pc-sysinstall: Starting Extraction (${di})
+  tar -xpv -C ${FSMNT} -f ${DDIR}/${di}.txz ${TAROPTS} 1 21
+  if [ $? -ne 0 ]; then
+exit_err ERROR: Failed extracting the dist file: $di
+  fi
+  done
+
+  # Check if this was a FTP download and clean it up now
+  if [ ${INSTALLMEDIUM} = ftp ]; then
+echo_log Cleaning up downloaded archives
+rm -rf ${DDIR}
+  fi
+
+  echo_log pc-sysinstall: Extraction Finished
+}
+
 # Performs the extraction of data to disk from a uzip or tar archive
 start_extract_uzip_tar()
 {
-  if [ -z $INSFILE ]
-  then
+  if [ -z $INSFILE ]; then
 exit_err ERROR: Called extraction with no install file set!
   fi
 
   # Check if we have a .count file, and echo it out for a front-end to use in 
progress bars
-  if [ -e ${INSFILE}.count ]
-  then
+  if [ -e ${INSFILE}.count ]; then
 echo INSTALLCOUNT: `cat ${INSFILE}.count`
   fi
 
   # Check if we are doing an upgrade, and if so use our exclude list
-  if [ ${INSTALLMODE} = upgrade ]
-  then
+  if [ ${INSTALLMODE} = upgrade ]; then
TAROPTS=-X ${PROGDIR}/conf/exclude-from-upgrade
   else
TAROPTS=
@@ -87,9 +124,8 @@ start_extract_uzip_tar()
   mdconfig -d -u ${MDDEVICE}
;;
 tar)
- tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} 1 21
-  if [ $? -ne 0 ]
-  then
+  tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} 1 21
+  if [ $? -ne 0 ]; then
 exit_err ERROR: Failed extracting the tar image
   fi
   ;;
@@ -176,6 +212,38 @@ start_extract_split()
   echo_log pc-sysinstall: Extraction Finished
 };
 
+# Function which will attempt to fetch the dist file(s) before we start
+fetch_dist_file()
+{
+  get_value_from_cfg ftpPath
+  if [ -z $VAL ]
+  then
+exit_err ERROR: Install medium was set to ftp, but no ftpPath was 
provided! 
+  fi
+
+  FTPPATH=${VAL}
+  
+  # Check if we have a /usr partition to save the download
+  if [ -d ${FSMNT}/usr ]
+  then
+DLDIR=${FSMNT}/usr/.fetch.$$
+  else
+DLDIR=${FSMNT}/.fetch.$$
+  fi
+  mkdir -p ${DLDIR}
+
+  # Do the fetch of the dist archive(s) now
+  for di in $INSFILE
+  do
+fetch_file ${FTPPATH}/${di}.txz ${DLDIR}/${di}.txz 1
+  done
+
+  # Check to see if there is a MANIFEST file for this install
+  fetch_file ${FTPPATH}/MANIFEST ${DLDIR}/MANIFEST 0
+
+  export DLDIR
+};
+
 # Function which will attempt to fetch the install file before we start
 # the install
 fetch_install_file()
@@ -390,6 +458,13 @@ init_extraction()
   case $PACKAGETYPE in
 uzip) INSFILE=${FBSD_UZIP_FILE} ;;
 tar) INSFILE=${FBSD_TAR_FILE} ;;
+dist) 
+ get_value_from_cfg_with_spaces distFiles
+ if [ -z $VAL ] ; then
+exit_err No dist files specified!
+ fi
+ INSFILE=${VAL} 
+ ;;
 split)
   INSDIR=${FBSD_BRANCH_DIR}
 
@@ -401,6 +476,13 @@ init_extraction()
   case $PACKAGETYPE in
 uzip) INSFILE=${UZIP_FILE} ;;
 tar) INSFILE=${TAR_FILE} ;;
+dist) 
+ get_value_from_cfg_with_spaces distFiles
+ if [ -z $VAL ] ; then
+exit_err No dist files specified!
+ fi
+ INSFILE=${VAL} 
+ ;;
   esac
 fi
 export INSFILE
@@ -417,22 +499,32 @@ init_extraction()

svn commit: r247734 - head/usr.sbin/pc-sysinstall/backend

2013-03-03 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Mar  3 23:01:46 2013
New Revision: 247734
URL: http://svnweb.freebsd.org/changeset/base/247734

Log:
  Improves and enhances using the installPackages= variable.
  Adds pkgExt= variable to set if pkgs are .tbz or .txz or other.
  Auto-detects if packages are PKGNG or old PKG format.
  Auto-bootstrap of PKGNG for the new installed environment.
  Fixes issues with installing packages from local media, such as DVD/USB.
  
  Switch to using a space-delimiter for installPackages, since a number
  of packages use a , in their version string.
  
  Fix pc-sysinstall to ignore install scripts, and not hang on
  user interaction prompts when installing pkgs.
  
  Add pkg2ng command as apart of pkgng bootstrap process.
  
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh
  head/usr.sbin/pc-sysinstall/backend/functions-packages.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-installpackages.shSun Mar 
 3 22:33:13 2013(r247733)
+++ head/usr.sbin/pc-sysinstall/backend/functions-installpackages.shSun Mar 
 3 23:01:46 2013(r247734)
@@ -76,50 +76,113 @@ fetch_package_dependencies()
 # Check for any packages specified, and begin loading them
 install_packages()
 {
+  echo Checking for packages to install...
+  sleep 2
+
   # First, lets check and see if we even have any packages to install
   get_value_from_cfg installPackages
-  if [ -n ${VAL} ]
-  then
-HERE=`pwd`
-rc_nohalt mkdir -p ${FSMNT}/${PKGTMPDIR}
-rc_nohalt cd ${FSMNT}/${PKGTMPDIR}
 
-if [ ! -f ${CONFDIR}/INDEX ]
+  # Nothing to do?
+  if [ -z ${VAL} ]; then return; fi
+
+  echo Installing packages...
+  sleep 3
+
+  local PKGPTH
+
+  HERE=`pwd`
+  rc_halt mkdir -p ${FSMNT}${PKGTMPDIR}
+
+  # Determine the directory we will install packages from
+  get_package_location
+  rc_halt cd ${PKGDLDIR}
+
+  # Set the location of the INDEXFILE
+  INDEXFILE=${TMPDIR}/INDEX
+
+  if [ ! -f ${INDEXFILE} ]; then
+get_package_index
+  fi
+
+  if [ ! -f ${TMPDIR}/INDEX.parsed -a $INSTALLMEDIUM = ftp ]; then
+parse_package_index
+  fi
+
+  # What extension are we using for pkgs?
+  PKGEXT=txz
+  get_value_from_cfg pkgExt
+  if [ -n ${VAL} ]; then 
+ strip_white_space ${VAL}
+ PKGEXT=$VAL
+  fi
+  export PKGEXT
+  
+  # We dont want to be bothered with scripts asking questions
+  PACKAGE_BUILDING=yes
+  export PACKAGE_BUILDING
+
+  # Lets start by cleaning up the string and getting it ready to parse
+  get_value_from_cfg_with_spaces installPackages
+  PACKAGES=${VAL}
+  echo_log Packages to install: `echo $PACKAGES | wc -w | awk '{print $1}'`
+  for i in $PACKAGES
+  do
+if ! get_package_name ${i}
 then
-  get_package_index
+  echo_log Unable to locate package ${i}
+  continue
+fi
+
+PKGNAME=${VAL}
+
+# Fetch package + deps, but skip if installing from local media
+if [ ${INSTALLMEDIUM} = ftp ] ; then
+  DEPFILE=${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps
+  rc_nohalt touch ${DEPFILE}
+  determine_package_dependencies ${PKGNAME} ${DEPFILE}
+  fetch_package_dependencies ${DEPFILE} ${FSMNT}/${PKGTMPDIR}
 fi
 
-if [ ! -f ${CONFDIR}/INDEX.parsed ]
+# Set package location
+case ${INSTALLMEDIUM} in
+  usb|dvd|local) PKGPTH=${PKGTMPDIR}/All/${PKGNAME} ;;
+  *) PKGPTH=${PKGTMPDIR}/${PKGNAME} ;;
+esac
+
+# See if we need to determine the package format we are working with
+if [ -z ${PKGINFO} ] ; then
+  tar tqf ${FSMNT}${PKGPTH} '+MANIFEST' /dev/null 2/dev/null   
+  if [ $? -ne 0 ] ; then
+PKGADD=pkg_add -C ${FSMNT} 
+PKGINFO=pkg_info 
+  else
+PKGADD=pkg -c ${FSMNT} add
+PKGINFO=pkg info
+bootstrap_pkgng
+  fi
+fi
+
+# If the package is not already installed, install it!
+if ! run_chroot_cmd ${PKGINFO} -e ${PKGNAME} /dev/null 2/dev/null
 then
-  parse_package_index
+  echo_log Installing package: ${PKGNAME}
+  rc_nohalt ${PKGADD} ${PKGPTH}
 fi
 
-# Lets start by cleaning up the string and getting it ready to parse
-strip_white_space ${VAL}
-PACKAGES=`echo ${VAL} | sed -e s|,| |g`
-for i in $PACKAGES
-do
-  if get_package_name ${i}
-  then
-PKGNAME=${VAL}
-DEPFILE=${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps
-
-rc_nohalt touch ${DEPFILE}
-determine_package_dependencies ${PKGNAME} ${DEPFILE}
-fetch_package_dependencies ${DEPFILE} ${FSMNT}/${PKGTMPDIR}
-
-# If the package is not already installed, install it!
-if ! run_chroot_cmd pkg_info -e ${PKGNAME}
-then
-  rc_nohalt pkg_add -C ${FSMNT} ${PKGTMPDIR}/${PKGNAME}.tbz
-fi
+if [ ${INSTALLMEDIUM} = ftp ] ; then
+  rc_nohalt rm ${DEPFILE}
+fi
 
-

svn commit: r247735 - in head/usr.sbin/pc-sysinstall: backend conf

2013-03-03 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Mar  3 23:07:27 2013
New Revision: 247735
URL: http://svnweb.freebsd.org/changeset/base/247735

Log:
  Use GNOP to force ZFS pools to 4k.
  
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh
  head/usr.sbin/pc-sysinstall/backend/functions.sh
  head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Sun Mar  3 
23:01:46 2013(r247734)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Sun Mar  3 
23:07:27 2013(r247735)
@@ -62,7 +62,18 @@ get_fs_line_xvars()
 echo $ZFSVARS | grep -qE 
^(disk|file|mirror|raidz(1|2|3)?|spare|log|cache): 2/dev/null
 if [ $? -eq 0 ] ; then
ZTYPE=`echo $ZFSVARS | cut -f1 -d:`
-   ZFSVARS=`echo $ZFSVARS | sed s|$ZTYPE: ||g | sed s|$ZTYPE:||g`
+   tmpVars=`echo $ZFSVARS | sed s|$ZTYPE: ||g | sed s|$ZTYPE:||g`
+   ZFSVARS=
+   # make sure we have a '/dev' in front of the extra devices
+   for i in $tmpVars
+   do
+  echo $i | grep -q '/dev/'
+  if [ $? -ne 0 ] ; then
+ ZFSVARS=$ZFSVARS /dev/${i}
+  else
+ ZFSVARS=$ZFSVARS $i
+  fi
+   done
 fi
 
 # Return the ZFS options

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Sun Mar  3 
23:01:46 2013(r247734)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Sun Mar  3 
23:07:27 2013(r247735)
@@ -33,6 +33,7 @@ is_disk()
   for _dsk in `sysctl -n kern.disks`
   do
 [ $_dsk = ${1} ]  return 0
+[ /dev/$_dsk = ${1} ]  return 0
   done
 
   return 1

Modified: head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh  Sun Mar  3 
23:01:46 2013(r247734)
+++ head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh  Sun Mar  3 
23:07:27 2013(r247735)
@@ -149,12 +149,12 @@ mount_all_filesystems()
   for PART in `ls ${PARTDIR}`
   do
 PARTDEV=`echo $PART | sed 's|-|/|g'` 
-if [ ! -e ${PARTDEV} ]
+PARTFS=`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`
+if [ ! -e ${PARTDEV} -a ${PARTFS} != ZFS ]
 then
   exit_err ERROR: The partition ${PARTDEV} does not exist. Failure in 
bsdlabel?
 fi 
 
-PARTFS=`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`
 PARTMNT=`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`
 PARTENC=`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`
 
@@ -186,12 +186,12 @@ mount_all_filesystems()
   for PART in `ls ${PARTDIR}`
   do
 PARTDEV=`echo $PART | sed 's|-|/|g'`
-if [ ! -e ${PARTDEV} ]
+PARTFS=`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`
+if [ ! -e ${PARTDEV} -a ${PARTFS} != ZFS ]
 then
   exit_err ERROR: The partition ${PARTDEV} does not exist. Failure in 
bsdlabel?
 fi 
  
-PARTFS=`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`
 PARTMNT=`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`
 PARTENC=`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`
 

Modified: head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh  Sun Mar  3 
23:01:46 2013(r247734)
+++ head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh  Sun Mar  3 
23:07:27 2013(r247735)
@@ -60,18 +60,56 @@ setup_zfs_filesystem()
 fi
   done 
 
-
   # Check if we have some custom zpool arguments and use them if so
   if [ ! -z ${ZPOOLOPTS} ] ; then
-rc_halt zpool create -m none -f ${ZPOOLNAME} ${ZPOOLOPTS}
+# Sort through devices and run gnop on them
+local gnopDev=
+local newOpts=
+for i in $ZPOOLOPTS
+do
+   echo $i | grep -q '/dev/'
+   if [ $? -eq 0 ] ; then
+  rc_halt gnop create -S 4096 ${i}
+  gnopDev=$gnopDev $i
+  newOpts=$newOpts ${i}.nop
+   else
+  newOpts=$newOpts $i
+   fi
+done
+
+echo_log Creating zpool ${ZPOOLNAME} with $newOpts
+rc_halt zpool create -m none -f ${ZPOOLNAME} ${newOpts}
+
+# Export the pool
+rc_halt zpool export ${ZPOOLNAME}
+
+# Destroy the gnop devices
+for i in $gnopDev
+do
+   rc_halt gnop destroy ${i}.nop
+done
+
+# And lastly re-import the pool
+rc_halt zpool import ${ZPOOLNAME}
   else
+# Lets do our pseudo-4k drive
+rc_halt gnop create -S 4096 ${PART}${EXT}
+
 # No 

svn commit: r246799 - head/sys/dev/oce

2013-02-14 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Feb 14 17:34:17 2013
New Revision: 246799
URL: http://svnweb.freebsd.org/changeset/base/246799

Log:
  Resolve issue that caused WITNESS to report LORs.
  
  PR:   kern/171838
  Submitted by: Venkat Duvvuru venkatduvvuru...@gmail.com
  MFC after:2 weeks

Modified:
  head/sys/dev/oce/oce_if.c
  head/sys/dev/oce/oce_if.h

Modified: head/sys/dev/oce/oce_if.c
==
--- head/sys/dev/oce/oce_if.c   Thu Feb 14 15:43:37 2013(r246798)
+++ head/sys/dev/oce/oce_if.c   Thu Feb 14 17:34:17 2013(r246799)
@@ -1817,6 +1817,9 @@ oce_local_timer(void *arg)
 }
 
 
+/* NOTE : This should only be called holding
+ *DEVICE_LOCK.
+*/
 static void
 oce_if_deactivate(POCE_SOFTC sc)
 {
@@ -1846,11 +1849,17 @@ oce_if_deactivate(POCE_SOFTC sc)
/* Stop intrs and finish any bottom halves pending */
oce_hw_intr_disable(sc);
 
+/* Since taskqueue_drain takes a Giant Lock, We should not acquire
+   any other lock. So unlock device lock and require after
+   completing taskqueue_drain.
+*/
+UNLOCK(sc-dev_lock);
for (i = 0; i  sc-intr_count; i++) {
if (sc-intrs[i].tq != NULL) {
taskqueue_drain(sc-intrs[i].tq, sc-intrs[i].task);
}
}
+LOCK(sc-dev_lock);
 
/* Delete RX queue in card with flush param */
oce_stop_rx(sc);

Modified: head/sys/dev/oce/oce_if.h
==
--- head/sys/dev/oce/oce_if.h   Thu Feb 14 15:43:37 2013(r246798)
+++ head/sys/dev/oce/oce_if.h   Thu Feb 14 17:34:17 2013(r246799)
@@ -493,7 +493,7 @@ struct oce_lock {
 #define LOCK_CREATE(lock, desc){ \
strncpy((lock)-name, (desc), MAX_LOCK_DESC_LEN); \
(lock)-name[MAX_LOCK_DESC_LEN] = '\0'; \
-   mtx_init((lock)-mutex, (lock)-name, MTX_NETWORK_LOCK, MTX_DEF); \
+   mtx_init((lock)-mutex, (lock)-name, NULL, MTX_DEF); \
 }
 #define LOCK_DESTROY(lock) \
if (mtx_initialized((lock)-mutex))\
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r240165 - head/usr.sbin/pc-sysinstall/backend

2012-09-06 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Sep  6 14:59:53 2012
New Revision: 240165
URL: http://svn.freebsd.org/changeset/base/240165

Log:
  Add TRIM support, enabled by default.
  Fix a bug installing components from a localPath.
  Allow autosizing of any partition, not just the last partition.
  Adjust how ZFS is laid out to work with Boot Environments.
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  MFC after:3 days

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
  head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu Sep  6 
13:54:01 2012(r240164)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu Sep  6 
14:59:53 2012(r240165)
@@ -164,6 +164,38 @@ gen_glabel_name()
   export VAL=${NAME}${NUM} 
 };
 
+# Function to determine the size we can safely use when 0 is specified
+get_autosize()
+{
+  # Disk tag to look for
+  dTag=$1
+
+  # Total MB Avail
+  get_disk_mediasize_mb $2
+  local _aSize=$VAL
+
+  while read line
+  do
+# Check for data on this slice
+echo $line | grep -q ^${_dTag}-part= 2/dev/null
+if [ $? -ne 0 ] ; then continue ; fi
+
+get_value_from_string ${line}
+STRING=$VAL
+
+# Get the size of this partition
+SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2` 
+if [ $SIZE -eq 0 ] ; then continue ; fi
+_aSize=`expr $_aSize - $SIZE`
+  done ${CFGF}
+
+  # Pad the size a bit
+  _aSize=`expr $_aSize - 2`
+
+  VAL=$_aSize
+  export VAL
+};
+
 # Function to setup partitions using gpart
 setup_gpart_partitions()
 {
@@ -173,6 +205,7 @@ setup_gpart_partitions()
   local _sNum=$4
   local _pType=$5
   FOUNDPARTS=1
+  USEDAUTOSIZE=0
 
   # Lets read in the config file now and setup our partitions
   if [ ${_pType} = gpt ] ; then
@@ -245,7 +278,15 @@ setup_gpart_partitions()
 
   if [ $SIZE = 0 ]
   then
-SOUT=
+   if [ $USEDAUTOSIZE -eq 1 ] ; then
+  exit_err ERROR: You can not have two partitions with a size of 0 
specified!
+   fi
+case ${_pType} in
+ gpt|apm) get_autosize ${_dTag} $_pDisk ;;
+   *) get_autosize ${_dTag} $_wSlice ;;
+esac
+SOUT=-s ${VAL}M
+   USEDAUTOSIZE=1
   else
 SOUT=-s ${SIZE}M
   fi

Modified: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-cleanup.shThu Sep  6 
13:54:01 2012(r240164)
+++ head/usr.sbin/pc-sysinstall/backend/functions-cleanup.shThu Sep  6 
14:59:53 2012(r240165)
@@ -49,7 +49,7 @@ zfs_cleanup_unmount()
   # Creating a dedicated /boot partition
   cat ${FSMNT}/boot/loader.conf 2/dev/null | grep -q 
vfs.root.mountfrom= 2/dev/null
   if [ $? -ne 0 ] ; then
-echo vfs.root.mountfrom=\zfs:${ZPOOLNAME}\  
${FSMNT}/boot/loader.conf
+echo vfs.root.mountfrom=\zfs:${ZPOOLNAME}/ROOT/default\  
${FSMNT}/boot/loader.conf
   fi
   export FOUNDZFSROOT=${ZPOOLNAME}
 fi
@@ -195,8 +195,8 @@ setup_fstab()
 if [ $? -eq 0 ] ; then
   if [ ${PARTFS} = ZFS ] ; then
 ROOTFSTYPE=zfs
-XPOOLNAME=$(get_zpool_name ${PARTDEV})
-ROOTFS=${ZPOOLNAME}
+ZPOOLNAME=$(get_zpool_name ${PARTDEV})
+ROOTFS=${ZPOOLNAME}/ROOT/default
   else
 ROOTFS=${DEVICE}
 ROOTFSTYPE=ufs

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Thu Sep  6 
13:54:01 2012(r240164)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Thu Sep  6 
14:59:53 2012(r240165)
@@ -224,6 +224,15 @@ get_disk_mediasize()
   export VAL=${mediasize}
 };
 
+# Function which returns a target disks mediasize in megabytes
+get_disk_mediasize_mb()
+{
+  mediasize=`diskinfo -v ${1} | grep # mediasize in bytes | tr -s ' ' | cut 
-f 2`
+  mediasize=`expr $mediasize / 1024`
+  mediasize=`expr $mediasize / 1024`
+  export VAL=${mediasize}
+};
+
 # Function to delete all gparts before starting an install
 delete_all_gpart()
 {

Modified: head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh  Thu Sep 
 6 13:54:01 2012(r240164)
+++ 

svn commit: r236330 - head/usr.sbin/pc-sysinstall/backend

2012-05-30 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 30 20:44:04 2012
New Revision: 236330
URL: http://svn.freebsd.org/changeset/base/236330

Log:
  Fix French Canadian console keyboard layout
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  MFC after:3 days
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-localize.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-localize.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-localize.sh   Wed May 30 
20:13:49 2012(r236329)
+++ head/usr.sbin/pc-sysinstall/backend/functions-localize.sh   Wed May 30 
20:44:04 2012(r236330)
@@ -168,6 +168,7 @@ localize_key_layout()
   # Set the keylayout in rc.conf
   case ${KEYLAYOUT} in
 am) KEYLAYOUT_CONSOLE=hy.armscii-8 ;;
+ca) KEYLAYOUT_CONSOLE=fr_CA.acc.iso ;;
 ch) KEYLAYOUT_CONSOLE=swissgerman.iso ;;
 cz) KEYLAYOUT_CONSOLE=cz.iso2 ;;
 de) KEYLAYOUT_CONSOLE=german.iso ;;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r236331 - head/usr.sbin/pc-sysinstall/backend

2012-05-30 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 30 20:49:28 2012
New Revision: 236331
URL: http://svn.freebsd.org/changeset/base/236331

Log:
  Fix detecting available zpool names.
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  MFC after:3 days
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions.shWed May 30 20:44:04 
2012(r236330)
+++ head/usr.sbin/pc-sysinstall/backend/functions.shWed May 30 20:49:28 
2012(r236331)
@@ -277,7 +277,7 @@ get_zpool_name()
 while :
 do
   NEWNAME=${BASENAME}${NUM}
-  zpool import | grep -qw ${NEWNAME}  break
+  zpool import | grep -qw ${NEWNAME} || break
   NUM=$((NUM+1))
 done
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r236333 - in head/usr.sbin/pkg_install: add lib

2012-05-30 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 30 21:01:06 2012
New Revision: 236333
URL: http://svn.freebsd.org/changeset/base/236333

Log:
  Let pkg_add use the ENV variable PACKAGESUFFIX. This
  can be used to override the default .tbz package extension to
  .txz .tgz or .tar
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  Sponsored by: iXsystems
  MFC after:3 days

Modified:
  head/usr.sbin/pkg_install/add/main.c
  head/usr.sbin/pkg_install/add/perform.c
  head/usr.sbin/pkg_install/add/pkg_add.1
  head/usr.sbin/pkg_install/lib/file.c
  head/usr.sbin/pkg_install/lib/url.c

Modified: head/usr.sbin/pkg_install/add/main.c
==
--- head/usr.sbin/pkg_install/add/main.cWed May 30 20:56:07 2012
(r236332)
+++ head/usr.sbin/pkg_install/add/main.cWed May 30 21:01:06 2012
(r236333)
@@ -234,10 +234,17 @@ main(int argc, char **argv)
remotepkg = temppackageroot;
if (!((ptr = strrchr(remotepkg, '.'))  ptr[1] == 't' 
(ptr[2] == 'b' || ptr[2] == 'g' || ptr[2] == 'x') 
-   ptr[3] == 'z'  !ptr[4]))
-   if (strlcat(remotepkg, .tbz,
-   sizeof(temppackageroot)) = sizeof(temppackageroot))
-   errx(1, package name too long);
+   ptr[3] == 'z'  !ptr[4])) {
+   if (getenv(PACKAGESUFFIX)) {
+  if (strlcat(remotepkg, getenv(PACKAGESUFFIX),
+  sizeof(temppackageroot)) = sizeof(temppackageroot))
+  errx(1, package name too long);
+   } else {
+  if (strlcat(remotepkg, .tbz,
+  sizeof(temppackageroot)) = sizeof(temppackageroot))
+  errx(1, package name too long);
+   }
+   }
}
if (!strcmp(*argv, -))/* stdin? */
pkgs[ch] = (char *)-;

Modified: head/usr.sbin/pkg_install/add/perform.c
==
--- head/usr.sbin/pkg_install/add/perform.c Wed May 30 20:56:07 2012
(r236332)
+++ head/usr.sbin/pkg_install/add/perform.c Wed May 30 21:01:06 2012
(r236333)
@@ -307,8 +307,12 @@ pkg_do(char *pkg)
*sep = '\0';
strlcat(subpkg, /All/, sizeof subpkg);
strlcat(subpkg, p-name, sizeof subpkg);
-   if ((ext = strrchr(pkg, '.')) == NULL)
-   ext = .tbz;
+   if ((ext = strrchr(pkg, '.')) == NULL) {
+   if (getenv(PACKAGESUFFIX))
+ ext = getenv(PACKAGESUFFIX);
+   else
+ ext = .tbz;
+   }
strlcat(subpkg, ext, sizeof subpkg);
pkg_do(subpkg);
}
@@ -345,8 +349,13 @@ pkg_do(char *pkg)
const char *ext;
 
ext = strrchr(pkg_fullname, '.');
-   if (ext == NULL)
-   ext = .tbz;
+   if (ext == NULL) {
+   if (getenv(PACKAGESUFFIX)) {
+ ext = getenv(PACKAGESUFFIX);
+   } else {
+ ext = .tbz;
+   }
+   }
snprintf(path, FILENAME_MAX, %s/%s%s, getenv(_TOP), 
p-name, ext);
if (fexists(path))
cp = path;

Modified: head/usr.sbin/pkg_install/add/pkg_add.1
==
--- head/usr.sbin/pkg_install/add/pkg_add.1 Wed May 30 20:56:07 2012
(r236332)
+++ head/usr.sbin/pkg_install/add/pkg_add.1 Wed May 30 21:01:06 2012
(r236333)
@@ -553,6 +553,11 @@ The environment variable
 specifies an alternative location to save downloaded packages to when
 .Fl K
 option is used.
+.Pp
+The environment variable
+.Ev PACKAGESUFFIX
+specifies an alternative file extension to use when fetching remote
+packages. Default is .tbz
 .Sh FILES
 .Bl -tag -width /var/db/pkg -compact
 .It Pa /var/tmp

Modified: head/usr.sbin/pkg_install/lib/file.c
==
--- head/usr.sbin/pkg_install/lib/file.cWed May 30 20:56:07 2012
(r236332)
+++ head/usr.sbin/pkg_install/lib/file.cWed May 30 21:01:06 2012
(r236333)
@@ -140,7 +140,7 @@ fileFindByPath(const char *base, const c
 {
 static char tmp[FILENAME_MAX];
 char *cp;
-const char *suffixes[] = {.tbz, .tgz, .tar, NULL};
+const char *suffixes[] = {.tbz, .tgz, .tar, .txz, NULL};
 int i;
 
 if (fexists(fname)  isfile(fname)) {

Modified: head/usr.sbin/pkg_install/lib/url.c

svn commit: r236336 - head/usr.sbin/pkg_install/lib

2012-05-30 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 30 21:28:37 2012
New Revision: 236336
URL: http://svn.freebsd.org/changeset/base/236336

Log:
  Bump PKG_INSTALL_VERSION which should've been done in r236233
  
  MFC after:3 days
  Pointed out by:   bapt

Modified:
  head/usr.sbin/pkg_install/lib/lib.h

Modified: head/usr.sbin/pkg_install/lib/lib.h
==
--- head/usr.sbin/pkg_install/lib/lib.h Wed May 30 21:04:14 2012
(r236335)
+++ head/usr.sbin/pkg_install/lib/lib.h Wed May 30 21:28:37 2012
(r236336)
@@ -99,7 +99,7 @@
  * Version of the package tools - increase whenever you make a change
  * in the code that is not cosmetic only.
  */
-#define PKG_INSTALL_VERSION20100403
+#define PKG_INSTALL_VERSION20120530
 
 #define PKG_WRAPCONF_FNAME /var/db/pkg_install.conf
 #define main(argc, argv)   real_main(argc, argv)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r235915 - head/usr.bin

2012-05-24 Thread Josh Paetzel
Author: jpaetzel
Date: Thu May 24 16:11:51 2012
New Revision: 235915
URL: http://svn.freebsd.org/changeset/base/235915

Log:
  Hook up mkulzma to the build.
  
  MFC after:3 days

Modified:
  head/usr.bin/Makefile

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Thu May 24 16:11:13 2012(r235914)
+++ head/usr.bin/Makefile   Thu May 24 16:11:51 2012(r235915)
@@ -105,6 +105,7 @@ SUBDIR= alias \
mkfifo \
mklocale \
mktemp \
+   mkulzma \
mkuzip \
mt \
ncal \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r235452 - head/usr.sbin/pc-sysinstall/backend

2012-05-14 Thread Josh Paetzel
Author: jpaetzel
Date: Mon May 14 18:03:59 2012
New Revision: 235452
URL: http://svn.freebsd.org/changeset/base/235452

Log:
  Set the MBR partition to active when doing a full disk MBR.
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  Sponsored by: iXsystems
  MFC after:3 days

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon May 14 
17:00:32 2012(r235451)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon May 14 
18:03:59 2012(r235452)
@@ -689,6 +689,9 @@ init_mbr_full_disk()
   echo_log Cleaning up ${_intDISK}s1
   rc_halt dd if=/dev/zero of=${_intDISK}s1 count=1024
   
+  # Make the partition active
+  rc_halt gpart set -a active -i 1 ${_intDISK}
+
   if [ $_intBOOT = bsd ] ; then
 echo_log Stamping boot0 on ${_intDISK}
 rc_halt gpart bootcode -b /boot/boot0 ${_intDISK}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r235453 - head/usr.sbin/pc-sysinstall/backend

2012-05-14 Thread Josh Paetzel
Author: jpaetzel
Date: Mon May 14 18:06:51 2012
New Revision: 235453
URL: http://svn.freebsd.org/changeset/base/235453

Log:
  Style fixes.
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  MFC after:3 days
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions.shMon May 14 18:03:59 
2012(r235452)
+++ head/usr.sbin/pc-sysinstall/backend/functions.shMon May 14 18:06:51 
2012(r235453)
@@ -208,15 +208,11 @@ fetch_file()
   FETCHOUTFILE=$2
   EXITFAILED=$3
 
-  SIZEFILE=${TMPDIR}/.fetchSize
   EXITFILE=${TMPDIR}/.fetchExit
 
-  rm ${SIZEFILE} 2/dev/null /dev/null
   rm ${FETCHOUTFILE} 2/dev/null /dev/null
 
-  fetch -s ${FETCHFILE} ${SIZEFILE}
-  SIZE=`cat ${SIZEFILE}`
-  SIZE=$((SIZE/1024))
+  SIZE=$(( `fetch -s ${FETCHFILE}` / 1024 ))
   echo FETCH: ${FETCHFILE}
   echo FETCH: ${FETCHOUTFILE} ${LOGOUT}
 
@@ -278,12 +274,10 @@ get_zpool_name()
 NUM=`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'`
 
 # Is it used in another zpool?
-while
-z=1
+while :
 do
   NEWNAME=${BASENAME}${NUM}
-  zpool import | grep -q ${NEWNAME}
-  if [ $? -ne 0 ] ; then break ; fi
+  zpool import | grep -qw ${NEWNAME}  break
   NUM=$((NUM+1))
 done
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r235005 - head/usr.sbin/pc-sysinstall/backend

2012-05-04 Thread Josh Paetzel
Author: jpaetzel
Date: Fri May  4 15:31:35 2012
New Revision: 235005
URL: http://svn.freebsd.org/changeset/base/235005

Log:
  Use a unique zpool name during install, in the case of having another
  PC-BSD / FreeBSD zpool on the system for another install.
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  MFC after:3 days
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions.shFri May  4 15:27:18 
2012(r235004)
+++ head/usr.sbin/pc-sysinstall/backend/functions.shFri May  4 15:31:35 
2012(r235005)
@@ -216,7 +216,7 @@ fetch_file()
 
   fetch -s ${FETCHFILE} ${SIZEFILE}
   SIZE=`cat ${SIZEFILE}`
-  SIZE=`expr ${SIZE} / 1024`
+  SIZE=$((SIZE/1024))
   echo FETCH: ${FETCHFILE}
   echo FETCH: ${FETCHOUTFILE} ${LOGOUT}
 
@@ -276,11 +276,22 @@ get_zpool_name()
   else
 # Need to generate a zpool name for this device
 NUM=`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'`
-NEWNAME=${BASENAME}${NUM}
+
+# Is it used in another zpool?
+while
+z=1
+do
+  NEWNAME=${BASENAME}${NUM}
+  zpool import | grep -q ${NEWNAME}
+  if [ $? -ne 0 ] ; then break ; fi
+  NUM=$((NUM+1))
+done
+
+# Now save the new tank name
 mkdir -p ${TMPDIR}/.zpools/`dirname $DEVICE`
 echo $NEWNAME ${TMPDIR}/.zpools/${DEVICE} 
 echo ${NEWNAME}
-return
+return 0
   fi
 };
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r235006 - head/usr.sbin/pc-sysinstall/backend

2012-05-04 Thread Josh Paetzel
Author: jpaetzel
Date: Fri May  4 15:36:51 2012
New Revision: 235006
URL: http://svn.freebsd.org/changeset/base/235006

Log:
  Add powerpc / powerpc64 support to pc-sysinstall. This patch will
  autodetect if on powerpc and use the APM gpart GEOM class
  automaticaly.  At this time support for full disk installation is
  the only supported scheme.
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  MFC after:3 days
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Fri May  4 
15:31:35 2012(r235005)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Fri May  4 
15:36:51 2012(r235006)
@@ -177,6 +177,8 @@ setup_gpart_partitions()
   # Lets read in the config file now and setup our partitions
   if [ ${_pType} = gpt ] ; then
 CURPART=2
+  elif [ ${_pType} = apm ] ; then
+CURPART=3
   else
 PARTLETTER=a
 CURPART=1
@@ -255,6 +257,9 @@ setup_gpart_partitions()
 if [ ${CURPART} = 2 -a $_pType = gpt ] ; then
   export FOUNDROOT=0
 fi
+if [ ${CURPART} = 3 -a $_pType = apm ] ; then
+  export FOUNDROOT=0
+fi
 if [ ${CURPART} = 1 -a $_pType = mbr ] ; then
   export FOUNDROOT=0
 fi
@@ -269,6 +274,9 @@ setup_gpart_partitions()
 if [ ${CURPART} != 2 -a ${_pType} = gpt ] ; then
 exit_err /boot partition must be first partition
 fi
+if [ ${CURPART} != 3 -a ${_pType} = apm ] ; then
+exit_err /boot partition must be first partition
+fi
 if [ ${CURPART} != 1 -a ${_pType} = mbr ] ; then
 exit_err /boot partition must be first partition
 fi
@@ -288,6 +296,8 @@ setup_gpart_partitions()
   # Get any extra options for this fs / line
   if [ ${_pType} = gpt ] ; then
 get_fs_line_xvars ${_pDisk}p${CURPART} ${STRING}
+  elif [ ${_pType} = apm ] ; then
+get_fs_line_xvars ${_pDisk}s${CURPART} ${STRING}
   else
 get_fs_line_xvars ${_wSlice}${PARTLETTER} ${STRING}
   fi
@@ -298,6 +308,8 @@ setup_gpart_partitions()
   if [ $? -eq 0 -a $FS = ZFS ] ; then
 if [ ${_pType} = gpt -o ${_pType} = gptslice ] ; then
  XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS 
${_pDisk}p${CURPART})
+elif [ ${_pType} = apm ] ; then
+ XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS 
${_pDisk}s${CURPART})
 else
  XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS 
${_wSlice}${PARTLETTER})
 fi
@@ -323,6 +335,9 @@ setup_gpart_partitions()
   elif [ ${_pType} = gptslice ]; then
 sleep 2
 rc_halt gpart add ${SOUT} -t ${PARTYPE} ${_wSlice}
+  elif [ ${_pType} = apm ]; then
+sleep 2
+rc_halt gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}
   else
 sleep 2
 rc_halt gpart add ${SOUT} -t ${PARTYPE} -i ${CURPART} ${_wSlice}
@@ -352,6 +367,18 @@ setup_gpart_partitions()
 if [ -n ${ENCPASS} ] ; then
   echo ${ENCPASS} ${PARTDIR}-enc/${_dFile}p${CURPART}-encpass
 fi
+  elif [ ${_pType} = apm ] ; then
+   _dFile=`echo $_pDisk | sed 's|/|-|g'`
+echo ${FS}#${MNT}#${ENC}#${PLABEL}#GPT#${XTRAOPTS} 
${PARTDIR}/${_dFile}s${CURPART}
+
+# Clear out any headers
+sleep 2
+dd if=/dev/zero of=${_pDisk}s${CURPART} count=2048 2/dev/null
+
+# If we have a enc password, save it as well
+if [ -n ${ENCPASS} ] ; then
+  echo ${ENCPASS} ${PARTDIR}-enc/${_dFile}s${CURPART}-encpass
+fi
   else
# MBR Partition or GPT slice
_dFile=`echo $_wSlice | sed 's|/|-|g'`
@@ -368,9 +395,10 @@ setup_gpart_partitions()
 
 
   # Increment our parts counter
-  if [ $_pType = gpt ] ; then 
+  if [ $_pType = gpt -o $_pType = apm ] ; then 
   CURPART=$((CURPART+1))
-# If this is a gpt partition, we can continue and skip the MBR part 
letter stuff
+# If this is a gpt/apm partition, 
+# we can continue and skip the MBR part letter stuff
 continue
   else
   CURPART=$((CURPART+1))
@@ -437,6 +465,9 @@ populate_disk_label()
   if [ $type = mbr ] ; then
 wrkslice=${diskid}s${slicenum}
   fi
+  if [ $type = apm ] ; then
+wrkslice=${diskid}s${slicenum}
+  fi
   if [ $type = gpt -o $type = gptslice ] ; then
 wrkslice=${diskid}p${slicenum}
   fi
@@ -474,6 +505,9 @@ setup_disk_label()
 if [ $type = gpt -a ! -e ${disk}p${pnum} ] ; then
   exit_err ERROR: The partition ${i} doesn't exist! gpart failure!
 fi
+if [ $type = apm -a ! -e ${disk}s${pnum} ] ; then
+  exit_err ERROR: The partition ${i} doesn't exist! gpart failure!
+fi
 if 

svn commit: r235008 - head/usr.sbin/pc-sysinstall/backend

2012-05-04 Thread Josh Paetzel
Author: jpaetzel
Date: Fri May  4 15:39:41 2012
New Revision: 235008
URL: http://svn.freebsd.org/changeset/base/235008

Log:
  Add bootcamp bootloader stamp
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  MFC after:3 days
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Fri May  4 
15:38:47 2012(r235007)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Fri May  4 
15:39:41 2012(r235008)
@@ -766,6 +766,10 @@ run_gpart_gpt_part()
   # Init the MBR partition
   rc_halt gpart create -s BSD ${DISK}p${slicenum}
 
+  # Stamp the bootloader
+  sleep 4
+  rc_halt gpart bootcode -b /boot/boot ${DISK}p${slicenum}
+
   # Set the slice to the format we'll be using for gpart later
   slice=`echo ${1}:${3}:gptslice | sed 's|/|-|g'`
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r234985 - head/usr.sbin/pc-sysinstall/backend

2012-05-03 Thread Josh Paetzel
Author: jpaetzel
Date: Thu May  3 21:15:47 2012
New Revision: 234985
URL: http://svn.freebsd.org/changeset/base/234985

Log:
  Fix parsing values which contain multiple = signs.
  
  Submitted by: glarkin
  MFC after:3 days
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-parse.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-parse.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-parse.sh  Thu May  3 
21:03:21 2012(r234984)
+++ head/usr.sbin/pc-sysinstall/backend/functions-parse.sh  Thu May  3 
21:15:47 2012(r234985)
@@ -33,7 +33,7 @@ get_value_from_string()
 {
   if [ -n ${1} ]
   then
-export VAL=`echo ${1} | cut -d '=' -f 2-15`
+export VAL=`echo ${1} | cut -d '=' -f 2-`
   else
 echo Error: Did we forgot to supply a string to parse?
 exit 1
@@ -45,7 +45,7 @@ get_value_from_cfg_with_spaces()
 {
   if [ -n ${1} ]
   then
-export VAL=`grep ^${1}= ${CFGF} | head -n 1 | cut -d '=' -f 2-15`
+export VAL=`grep ^${1}= ${CFGF} | head -n 1 | cut -d '=' -f 2-`
   else
 exit_err Error: Did we forgot to supply a setting to grab?
   fi
@@ -57,7 +57,7 @@ get_value_from_cfg()
 {
   if [ -n ${1} ]
   then
-export VAL=`grep ^${1}= ${CFGF} | head -n 1 | cut -d '=' -f 2-15 | tr -d 
' '`
+export VAL=`grep ^${1}= ${CFGF} | head -n 1 | cut -d '=' -f 2- | tr -d ' 
'`
   else
 exit_err Error: Did we forgot to supply a setting to grab?
   fi
@@ -71,7 +71,7 @@ if_check_value_exists()
   then
 # Get the first occurrence of the setting from the config, strip out 
whitespace
 
-VAL=`grep ^${1} ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '`
+VAL=`grep ^${1} ${CFGF} | head -n 1 | cut -d '=' -f 2- | tr -d ' '`
 if [ -z ${VAL} ]
 then
   # This value doesn't exist, lets return
@@ -104,7 +104,7 @@ check_value()
   if [ -n ${1} -a -n ${2} ]
   then
 # Get the first occurrence of the setting from the config, strip out 
whitespace
-VAL=`grep ^${1} ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '`
+VAL=`grep ^${1} ${CFGF} | head -n 1 | cut -d '=' -f 2- | tr -d ' '`
 VALID=1
 for i in ${2}
 do
@@ -133,7 +133,7 @@ file_sanity_check()
   grep -q ^${i}= $CFGF 2/dev/null
   if [ $? -eq 0 ]
   then
-LN=`grep ^${i}= ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '`
+LN=`grep ^${i}= ${CFGF} | head -n 1 | cut -d '=' -f 2- | tr -d ' '`
 if [ -z ${LN} ]
 then
   echo Error: Config fails sanity test! ${i}= is empty
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r234987 - head/usr.sbin/pc-sysinstall/backend

2012-05-03 Thread Josh Paetzel
Author: jpaetzel
Date: Thu May  3 21:21:45 2012
New Revision: 234987
URL: http://svn.freebsd.org/changeset/base/234987

Log:
  Add the ability to configure multiple interfaces.
  
  Submitted by: glarkin
  Obtained from:PC-BSD
  MFC after:3 days

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-networking.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-networking.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-networking.sh Thu May  3 
21:16:53 2012(r234986)
+++ head/usr.sbin/pc-sysinstall/backend/functions-networking.sh Thu May  3 
21:21:45 2012(r234987)
@@ -192,7 +192,7 @@ save_manual_nic()
   # Get the target nic
   NIC=$1
 
-  get_value_from_cfg netSaveIP
+  get_value_from_cfg netSaveIP_${NIC}
   NETIP=${VAL}
  
   if [ $NETIP = DHCP ]
@@ -212,7 +212,7 @@ save_manual_nic()
 IFARGS=inet ${NETIP}
 
 # Check if we have a netmask to set
-get_value_from_cfg netSaveMask
+get_value_from_cfg netSaveMask_${NIC}
 NETMASK=${VAL}
 if [ -n ${NETMASK} ]
 then
@@ -220,7 +220,7 @@ save_manual_nic()
 fi
   fi
 
-  get_value_from_cfg netSaveIPv6
+  get_value_from_cfg netSaveIPv6_${NIC}
   NETIP6=${VAL}
   if [ -n ${NETIP6} ]
   then
@@ -239,6 +239,12 @@ save_manual_nic()
 echo ifconfig_${NIC}_ipv6=\${IF6ARGS}\ ${FSMNT}/etc/rc.conf
   fi
 
+};
+
+# Function which saves a manual gateway router setup to the installed system
+save_manual_router()
+{
+
   # Check if we have a default router to set
   get_value_from_cfg netSaveDefaultRouter
   NETROUTE=${VAL}
@@ -253,19 +259,30 @@ save_manual_nic()
 echo ipv6_defaultrouter=\${NETROUTE}\ ${FSMNT}/etc/rc.conf
   fi
 
+};
+
+save_manual_nameserver()
+{
   # Check if we have a nameserver to enable
   :  ${FSMNT}/etc/resolv.conf
-  get_value_from_cfg netSaveNameServer
-  NAMESERVER=${VAL}
-  if [ -n ${NAMESERVER} ]
-  then
-echo nameserver ${NAMESERVER} ${FSMNT}/etc/resolv.conf
-  fi
-  get_value_from_cfg netSaveIPv6NameServer
-  NAMESERVER=${VAL}
-  if [ -n ${NAMESERVER} ]
-  then
-echo nameserver ${NAMESERVER} ${FSMNT}/etc/resolv.conf
+  get_value_from_cfg_with_spaces netSaveNameServer
+  NAMESERVERLIST=${VAL}
+  if [ ! -z ${NAMESERVERLIST} ]
+  then
+for NAMESERVER in ${NAMESERVERLIST}
+do
+  echo nameserver ${NAMESERVER} ${FSMNT}/etc/resolv.conf
+done
+  fi
+
+  get_value_from_cfg_with_spaces netSaveIPv6NameServer
+  NAMESERVERLIST=${VAL}
+  if [ ! -z ${NAMESERVERLIST} ]
+  then
+for NAMESERVER in ${NAMESERVERLIST}
+do
+  echo nameserver ${NAMESERVER} ${FSMNT}/etc/resolv.conf
+done
   fi
 
 };
@@ -454,25 +471,30 @@ save_networking_install()
 {
 
   # Check if we have any networking requested to save
-  get_value_from_cfg netSaveDev
+  get_value_from_cfg_with_spaces netSaveDev
   if [ -z ${VAL} ]
   then
 return 0
   fi
 
-  NETDEV=${VAL}
-  if [ $NETDEV = AUTO-DHCP ]
+  NETDEVLIST=${VAL}
+  if [ $NETDEVLIST = AUTO-DHCP ]
   then
 save_auto_dhcp
-  elif [ $NETDEV = IPv6-SLAAC ]
+  elif [ $NETDEVLIST = IPv6-SLAAC ]
   then
 save_auto_slaac
-  elif [ $NETDEV = AUTO-DHCP-SLAAC ]
+  elif [ $NETDEVLIST = AUTO-DHCP-SLAAC ]
   then
 save_auto_dhcp
 save_auto_slaac
   else
-save_manual_nic ${NETDEV}
+for NETDEV in ${NETDEVLIST}
+do
+  save_manual_nic ${NETDEV}
+done
+save_manual_router
+save_manual_nameserver
   fi
 
 };
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r234990 - head/usr.sbin/pc-sysinstall/backend

2012-05-03 Thread Josh Paetzel
Author: jpaetzel
Date: Thu May  3 21:53:25 2012
New Revision: 234990
URL: http://svn.freebsd.org/changeset/base/234990

Log:
  Fix some issues creating zpool mirror / raidz1(2)(3) devices.
  Fix issues stamping boot on other ZFS drives, now you can boot after removing
  mirror drive.
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  MFC after:3 days
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu May  3 
21:44:01 2012(r234989)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu May  3 
21:53:25 2012(r234990)
@@ -50,41 +50,39 @@ get_fs_line_xvars()
   ACTIVEDEV=${1}
   LINE=${2}
 
-  echo $LINE | cut -d ' ' -f 4 | grep -q ' (' 2/dev/null
+  echo $LINE | cut -d ' ' -f 4 | grep -q '(' 2/dev/null
+  if [ $? -ne 0 ] ; then return ; fi
+
+  # See if we are looking for ZFS specific options
+  echo $LINE | grep -q '^ZFS' 2/dev/null
   if [ $? -eq 0 ] ; then
+ZTYPE=NONE
+ZFSVARS=`echo $LINE | cut -d ' ' -f 4-20 |cut -d '(' -f 2- | cut -d ')' 
-f 1 | xargs`
 
-# See if we are looking for ZFS specific options
-echo $LINE | grep -q '^ZFS' 2/dev/null
+echo $ZFSVARS | grep -qE 
^(disk|file|mirror|raidz(1|2|3)?|spare|log|cache): 2/dev/null
 if [ $? -eq 0 ] ; then
-  ZTYPE=NONE
-  ZFSVARS=`echo $LINE | cut -d ' ' -f 4 |cut -d '(' -f 2- | cut -d ')' -f 
1 | xargs`
-
-  echo $ZFSVARS | grep -qE 
^(disk|file|mirror|raidz(1|2|3)?|spare|log|cache): 2/dev/null
- if [ $? -eq 0 ] ; then
ZTYPE=`echo $ZFSVARS | cut -f1 -d:`
ZFSVARS=`echo $ZFSVARS | sed s|$ZTYPE: ||g | sed s|$ZTYPE:||g`
- fi
-
-  # Return the ZFS options
-  if [ ${ZTYPE} = NONE ] ; then
-VAR=${ACTIVEDEV} ${ZFSVARS}
-  else
-VAR=${ZTYPE} ${ACTIVEDEV} ${ZFSVARS}
-  fi
-  export VAR
-  return
-fi # End of ZFS block
+fi
 
-# See if we are looking for UFS specific newfs options
-echo $LINE | grep -q '^UFS' 2/dev/null
-if [ $? -eq 0 ] ; then
-  FSVARS=`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`
-  VAR=${FSVARS}
-  export VAR
-  return
+# Return the ZFS options
+if [ ${ZTYPE} = NONE ] ; then
+  VAR=${ACTIVEDEV} ${ZFSVARS}
+else
+  VAR=${ZTYPE} ${ACTIVEDEV} ${ZFSVARS}
 fi
+export VAR
+return
+  fi # End of ZFS block
 
-  fi # End of xtra-options block
+  # See if we are looking for UFS specific newfs options
+  echo $LINE | grep -q '^UFS' 2/dev/null
+  if [ $? -eq 0 ] ; then
+FSVARS=`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`
+VAR=${FSVARS}
+export VAR
+return
+  fi
 
   # If we got here, set VAR to empty and export
   export VAR=
@@ -96,8 +94,10 @@ setup_zfs_mirror_parts()
 {
   _nZFS=
 
+  ZTYPE=`echo ${1} | awk '{print $1}'`
+
   # Using mirroring, setup boot partitions on each disk
-  _mirrline=`echo ${1} | sed 's|mirror ||g'`
+  _mirrline=`echo ${1} | sed 's|mirror ||g' | sed 's|raidz1 ||g' | sed 
's|raidz2 ||g' | sed 's|raidz3 ||g' | sed 's|raidz ||g'`
   for _zvars in $_mirrline
   do
 echo Looping through _zvars: $_zvars ${LOGOUT}
@@ -107,15 +107,16 @@ setup_zfs_mirror_parts()
 
 is_disk $_zvars /dev/null 2/dev/null
 if [ $? -eq 0 ] ; then
-  echo Setting up ZFS mirror disk $_zvars ${LOGOUT}
+  echo Setting up ZFS disk $_zvars ${LOGOUT}
   init_gpt_full_disk $_zvars /dev/null 2/dev/null
-  rc_halt gpart add -t freebsd-zfs ${_zvars} /dev/null 2/dev/null
+  rc_halt gpart add -a 4k -t freebsd-zfs ${_zvars} /dev/null 2/dev/null
+  rc_halt gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 
${_zvars} /dev/null 2/dev/null
   _nZFS=$_nZFS ${_zvars}p2   
 else
   _nZFS=$_nZFS ${_zvars} 
 fi 
   done
-  echo mirror $2 `echo $_nZFS | tr -s ' '`
+  echo $ZTYPE $2 `echo $_nZFS | tr -s ' '`
 } ;
 
 # Function which creates a unique label name for the specified mount
@@ -290,15 +291,15 @@ setup_gpart_partitions()
   else
 get_fs_line_xvars ${_wSlice}${PARTLETTER} ${STRING}
   fi
-  XTRAOPTS=${VAR}
+  XTRAOPTS=$VAR
 
   # Check if using zfs mirror
-  echo ${XTRAOPTS} | grep -q mirror 2/dev/null
+  echo ${XTRAOPTS} | grep -q -e mirror -e raidz
   if [ $? -eq 0 -a $FS = ZFS ] ; then
 if [ ${_pType} = gpt -o ${_pType} = gptslice ] ; then
  XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS 
${_pDisk}p${CURPART})
 else
- XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS ${_wSlice})
+ XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS 
${_wSlice}${PARTLETTER})
 fi
   fi
 

Modified: head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh

svn commit: r234425 - in head: sbin/iscontrol sys/modules/iscsi/initiator

2012-04-18 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Apr 18 16:47:57 2012
New Revision: 234425
URL: http://svn.freebsd.org/changeset/base/234425

Log:
  Unbreak tinderbox.
  
  Fix FreeBSD paradigms in the upstream code.
  
  PR:   bin/166933
  Submitted by: Garrett Cooper yaneg...@gmail.com

Modified:
  head/sbin/iscontrol/Makefile
  head/sbin/iscontrol/iscontrol.c
  head/sys/modules/iscsi/initiator/Makefile

Modified: head/sbin/iscontrol/Makefile
==
--- head/sbin/iscontrol/MakefileWed Apr 18 16:29:55 2012
(r234424)
+++ head/sbin/iscontrol/MakefileWed Apr 18 16:47:57 2012
(r234425)
@@ -7,8 +7,7 @@ LDADD= -lcam -lmd
 S= ${.CURDIR}/../../sys
 
 WARNS?=3
-CFLAGS += -I$S
-CFLAGS += -g -DDEBUG
+CFLAGS+=   -I$S
 
 MAN= iscsi.conf.5 iscontrol.8
 

Modified: head/sbin/iscontrol/iscontrol.c
==
--- head/sbin/iscontrol/iscontrol.c Wed Apr 18 16:29:55 2012
(r234424)
+++ head/sbin/iscontrol/iscontrol.c Wed Apr 18 16:47:57 2012
(r234425)
@@ -44,13 +44,15 @@ __FBSDID($FreeBSD$);
 #include arpa/inet.h
 #include sys/ioctl.h
 #include netdb.h
-#include stdlib.h
-#include unistd.h
-#include stdio.h
-#include string.h
+#include err.h
 #include errno.h
 #include fcntl.h
+#include libgen.h
+#include stdio.h
+#include stdlib.h
+#include string.h
 #include time.h
+#include unistd.h
 #include camlib.h
 
 #include dev/iscsi/initiator/iscsi.h
@@ -111,6 +113,13 @@ isc_opt_t opvals = {
  .immediateData= TRUE,
 };
 
+static void
+usage(const char *pname)
+{
+   fprintf(stderr, usage: %s  USAGE \n, pname);
+   exit(1);
+}
+
 int
 lookup(token_t *tbl, char *m)
 {
@@ -135,8 +144,8 @@ main(int cc, char **vv)
  iscsidev = /dev/ISCSIDEV;
  fd = NULL;
  pname = vv[0];
- if((p = strrchr(pname, '/')) != NULL)
- pname = p + 1;
+ if ((pname = basename(pname)) == NULL)
+ err(1, basename);
 
  kw = ta = 0;
  disco = 0;
@@ -145,17 +154,21 @@ main(int cc, char **vv)
   | check for driver  controller version match
   */
  n = 0;
- if(sysctlbyname(net.iscsi_initiator.driver_version, 0, n, 0, 0) != 0)
- perror(sysctlbyname);
- v = malloc(n+1);
- if(sysctlbyname(net.iscsi_initiator.driver_version, v, n, 0, 0) != 0)
- perror(sysctlbyname);
-
- if(strncmp(version, v, 3)) {
- fprintf(stderr, versions missmatch\n);
- exit(1);
+#define VERSION_OID_S  net.iscsi_initiator.driver_version
+ if (sysctlbyname(VERSION_OID_S, 0, n, 0, 0) != 0) {
+ if (errno == ENOENT)
+   errx(1, sysctlbyname(\ VERSION_OID_S \) 
+   failed; is the iscsi driver loaded?);
+ err(1, sysctlbyname(\ VERSION_OID_S \));
  }
+ v = malloc(n+1);
+ if (v == NULL)
+ err(1, malloc);
+ if (sysctlbyname(VERSION_OID_S, v, n, 0, 0) != 0)
+ err(1, sysctlbyname);
 
+ if (strncmp(version, v, 3) != 0)
+ errx(1, versions mismatch);
 
  while((ch = getopt(cc, vv, OPTIONS)) != -1) {
  switch(ch) {
@@ -164,10 +177,8 @@ main(int cc, char **vv)
   break;
  case 'c':
   fd = fopen(optarg, r);
-  if(fd == NULL) {
-   perror(optarg);
-   exit(1);
-  }
+  if (fd == NULL)
+   err(1, fopen(\%s\), optarg);
   break;
  case 'd':
   disco = 1;
@@ -182,9 +193,7 @@ main(int cc, char **vv)
   pidfile = optarg;
   break;
  default:
- badu:
-  fprintf(stderr, Usage: %s %s\n, pname, USAGE);
-  exit(1);
+  usage(pname);
  }
  }
  if(fd == NULL)
@@ -205,8 +214,8 @@ main(int cc, char **vv)
  op-targetAddress = ta;
 
  if(op-targetAddress == NULL) {
- fprintf(stderr, No target!\n);
- goto badu;
+ warnx(no target specified!);
+ usage(pname);
  }
  q = op-targetAddress;
  if(*q == '['  (q = strchr(q, ']')) != NULL) {
@@ -224,7 +233,7 @@ main(int cc, char **vv)
  op-targetPortalGroupTag = atoi(p);
  }
  if(op-initiatorName == 0) {
- char  hostname[256];
+ char  hostname[MAXHOSTNAMELEN];
 
  if(op-iqn) {
   if(gethostname(hostname, sizeof(hostname)) == 0)

Modified: head/sys/modules/iscsi/initiator/Makefile
==
--- head/sys/modules/iscsi/initiator/Makefile   Wed Apr 18 16:29:55 2012
(r234424)
+++ head/sys/modules/iscsi/initiator/Makefile   Wed Apr 18 16:47:57 2012
(r234425)
@@ -10,7 +10,9 @@ SRCS+= iscsi.c isc_cam.c isc_soc.c isc_s
 SRCS+= opt_cam.h opt_iscsi_initiator.h
 SRCS+= bus_if.h device_if.h
 #CFLAGS+= -DNO_USE_MBUF
+CFLAGS+= -DISCSI_INITIATOR_DEBUG=2
 #CFLAGS+= 

svn commit: r234233 - in head: sbin/iscontrol share/man/man4 sys/dev/iscsi/initiator sys/modules/iscsi/initiator

2012-04-13 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Apr 13 18:21:56 2012
New Revision: 234233
URL: http://svn.freebsd.org/changeset/base/234233

Log:
  Update to version 2.3.1.0
  
  Obtained from:Daniel Braniss da...@cs.huji.ac.il

Modified:
  head/sbin/iscontrol/Makefile
  head/sbin/iscontrol/iscontrol.8
  head/sbin/iscontrol/iscontrol.c
  head/sbin/iscontrol/iscsi.conf.5
  head/share/man/man4/iscsi_initiator.4
  head/sys/dev/iscsi/initiator/isc_subr.c
  head/sys/dev/iscsi/initiator/iscsi.c
  head/sys/dev/iscsi/initiator/iscsi_subr.c
  head/sys/dev/iscsi/initiator/iscsivar.h
  head/sys/modules/iscsi/initiator/Makefile

Modified: head/sbin/iscontrol/Makefile
==
--- head/sbin/iscontrol/MakefileFri Apr 13 18:01:53 2012
(r234232)
+++ head/sbin/iscontrol/MakefileFri Apr 13 18:21:56 2012
(r234233)
@@ -8,7 +8,7 @@ S= ${.CURDIR}/../../sys
 
 WARNS?=3
 CFLAGS += -I$S
-#CFLAGS += -g -DDEBUG
+CFLAGS += -g -DDEBUG
 
 MAN= iscsi.conf.5 iscontrol.8
 

Modified: head/sbin/iscontrol/iscontrol.8
==
--- head/sbin/iscontrol/iscontrol.8 Fri Apr 13 18:01:53 2012
(r234232)
+++ head/sbin/iscontrol/iscontrol.8 Fri Apr 13 18:21:56 2012
(r234233)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 22, 2007
+.Dd August 9, 2010
 .Dt ISCONTROL 8
 .Os
 .Sh NAME

Modified: head/sbin/iscontrol/iscontrol.c
==
--- head/sbin/iscontrol/iscontrol.c Fri Apr 13 18:01:53 2012
(r234232)
+++ head/sbin/iscontrol/iscontrol.c Fri Apr 13 18:21:56 2012
(r234233)
@@ -56,6 +56,8 @@ __FBSDID($FreeBSD$);
 #include dev/iscsi/initiator/iscsi.h
 #include iscontrol.h
 
+static char version[] = 2.3.1; // keep in sync with iscsi_initiator
+
 #define USAGE [-v] [-d] [-c config] [-n name] [-t target] [-p pidfile]
 #define OPTIONSvdc:t:n:p:
 
@@ -124,9 +126,10 @@ int
 main(int cc, char **vv)
 {
  int   ch, disco;
- char  *pname, *pidfile, *p, *q, *ta, *kw;
+ char  *pname, *pidfile, *p, *q, *ta, *kw, *v;
  isc_opt_t *op;
  FILE  *fd;
+ size_tn;
 
  op = opvals;
  iscsidev = /dev/ISCSIDEV;
@@ -138,6 +141,21 @@ main(int cc, char **vv)
  kw = ta = 0;
  disco = 0;
  pidfile = NULL;
+ /*
+  | check for driver  controller version match
+  */
+ n = 0;
+ if(sysctlbyname(net.iscsi_initiator.driver_version, 0, n, 0, 0) != 0)
+ perror(sysctlbyname);
+ v = malloc(n+1);
+ if(sysctlbyname(net.iscsi_initiator.driver_version, v, n, 0, 0) != 0)
+ perror(sysctlbyname);
+
+ if(strncmp(version, v, 3)) {
+ fprintf(stderr, versions missmatch\n);
+ exit(1);
+ }
+
 
  while((ch = getopt(cc, vv, OPTIONS)) != -1) {
  switch(ch) {

Modified: head/sbin/iscontrol/iscsi.conf.5
==
--- head/sbin/iscontrol/iscsi.conf.5Fri Apr 13 18:01:53 2012
(r234232)
+++ head/sbin/iscontrol/iscsi.conf.5Fri Apr 13 18:21:56 2012
(r234233)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 25, 2012
+.Dd June 5, 2007
 .Dt ISCSI.CONF 5
 .Os
 .Sh NAME

Modified: head/share/man/man4/iscsi_initiator.4
==
--- head/share/man/man4/iscsi_initiator.4   Fri Apr 13 18:01:53 2012
(r234232)
+++ head/share/man/man4/iscsi_initiator.4   Fri Apr 13 18:21:56 2012
(r234233)
@@ -1,4 +1,4 @@
-.\ Copyright (c) 2007 Daniel Braniss da...@cs.huji.ac.il
+.\ Copyright (c) 2007-2010 Daniel Braniss da...@cs.huji.ac.il
 .\ All rights reserved.
 .\
 .\ Redistribution and use in source and binary forms, with or without
@@ -24,9 +24,9 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd May 9, 2010
-.Dt ISCSI_INITIATOR 4
+.Dd August 3, 2010
 .Os
+.Dt ISCSI_INITIATOR 4
 .Sh NAME
 .Nm iscsi_initiator
 .Nd kernel driver for the iSCSI protocol
@@ -48,38 +48,36 @@ iscsi_initiator_load=YES
 The
 .Nm
 implements the kernel side of the Internet SCSI (iSCSI) network
-protocol standard.
-The userland companion is
+protocol standard, the user land companion is
 .Xr iscontrol 8 ,
 and permits access to remote
 .Em virtual
 SCSI devices via
 .Xr cam 4 .
 .Sh SYSCTL VARIABLES
-.Bl -tag -width net.iscsi.n.targedaddress
+.Bl -tag -width .Va net.iscsi.n.targeaddress
 .It Va debug.iscsi_initiator
 set the debug-level, 0 means no debugging, 9 for maximum.
 .It Va net.iscsi.isid
 the initiator part of the Session Identifier.
-.El
-.Pp
-The following are informative only:
-.Bl -tag -width net.iscsi.n.targedaddress
+.It Va kern.cam.cam_srch_hi=1
+allow search above LUN 7 for SCSI3 and greater devices.
+.It the following are informative only:
 .It Va net.iscsi.driver_version
 the current version of the driver.
 .It Va net.iscsi.sessions
 the number 

svn commit: r233186 - head/usr.sbin/pc-sysinstall/backend-query

2012-03-19 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 19 16:13:14 2012
New Revision: 233186
URL: http://svn.freebsd.org/changeset/base/233186

Log:
  An intel RAID can have any arbitrary name.

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Mon Mar 19 
15:50:14 2012(r233185)
+++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Mon Mar 19 
16:13:14 2012(r233186)
@@ -63,10 +63,7 @@ if [ -d /dev/raid ] ; then
   cd /dev/raid
   for i in `ls`
   do
-case ${i} in
-  r0|r1|r2|r3|r4|r5) SYSDISK=${SYSDISK} ${i} ;;
-  *) ;;
-esac
+  SYSDISK=${SYSDISK} ${i}
   done
 fi
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r233131 - head/usr.sbin/pc-sysinstall/backend-query

2012-03-18 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Mar 18 21:19:21 2012
New Revision: 233131
URL: http://svn.freebsd.org/changeset/base/233131

Log:
  Redirect camcontrol stderr to /dev/null.

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Sun Mar 18 
20:34:01 2012(r233130)
+++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Sun Mar 18 
21:19:21 2012(r233131)
@@ -86,7 +86,7 @@ do
   fi
 
   # Try and find some identification information with camcontrol or atacontrol
-  NEWLINE=$(camcontrol identify $DEV | sed -ne 's/^device model *//p')
+  NEWLINE=$(camcontrol identify $DEV 2/dev/null | sed -ne 's/^device model 
*//p')
   if [ -z $NEWLINE ]; then
# Now try atacontrol
NEWLINE=$(atacontrol list 2/dev/null | sed -n s|^.*$DEV 
\(.*\).*|\1|p)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232880 - head/usr.sbin/pc-sysinstall/backend

2012-03-12 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 12 18:50:37 2012
New Revision: 232880
URL: http://svn.freebsd.org/changeset/base/232880

Log:
  Fix a bug running the autoinstall functionality.
  
  Submitted by: kris
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend/startautoinstall.sh

Modified: head/usr.sbin/pc-sysinstall/backend/startautoinstall.sh
==
--- head/usr.sbin/pc-sysinstall/backend/startautoinstall.sh Mon Mar 12 
18:44:30 2012(r232879)
+++ head/usr.sbin/pc-sysinstall/backend/startautoinstall.sh Mon Mar 12 
18:50:37 2012(r232880)
@@ -114,7 +114,7 @@ then
 esac
   fi
 
-  ${PROGDIR}/pc-sysinstall -c ${INSTALL_CFG}
+  pc-sysinstall -c ${INSTALL_CFG}
   if [ $? -eq 0 ]
   then
 if [ -n $SHUTDOWN_CMD ]
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232889 - in head/usr.sbin/pc-sysinstall: backend backend-partmanager

2012-03-12 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 12 20:41:36 2012
New Revision: 232889
URL: http://svn.freebsd.org/changeset/base/232889

Log:
  Make sure when creating new MBR partition it is set to active by default.
  
  Submitted by: kris
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
==
--- head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh  Mon Mar 
12 20:33:20 2012(r232888)
+++ head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh  Mon Mar 
12 20:41:36 2012(r232889)
@@ -86,7 +86,12 @@ fi
 # If this is an empty disk, see if we need to create a new scheme for it
 gpart show ${DISK} /dev/null 2/dev/null
 if [ $? -eq 0 -a ${SLICENUM} = 1 ] ; then
- gpart create -s ${TYPE} ${DISK}
+  if [ ${TYPE} = mbr -o ${TYPE} = MBR ] ; then 
+flags=-s ${TYPE} -f active
+  else
+flags=-s ${TYPE}
+  fi
+  gpart create ${flags} ${DISK}
 fi
 
 # If we have a starting block, use it

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon Mar 12 
20:33:20 2012(r232888)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon Mar 12 
20:41:36 2012(r232889)
@@ -641,7 +641,7 @@ init_mbr_full_disk()
   sleep 2
 
   echo_log Running gpart on ${_intDISK}
-  rc_halt gpart create -s mbr ${_intDISK}
+  rc_halt gpart create -s mbr -f active ${_intDISK}
 
   # Lets figure out disk size in blocks
   # Get the cyl of this disk
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232890 - head/usr.sbin/pc-sysinstall/backend

2012-03-12 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 12 20:44:44 2012
New Revision: 232890
URL: http://svn.freebsd.org/changeset/base/232890

Log:
  Fix a couple of bugs saving network config.
  Don't duplicate wlans_ lines.
  Enable ipv6 on wireless devices correctly.
  
  Submitted by: kris
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-networking.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-networking.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-networking.sh Mon Mar 12 
20:41:36 2012(r232889)
+++ head/usr.sbin/pc-sysinstall/backend/functions-networking.sh Mon Mar 12 
20:44:44 2012(r232890)
@@ -104,7 +104,10 @@ enable_dhcp_all()
   then
 # We have a wifi device, setup a wlan* entry for it
 WLAN=wlan${WLANCOUNT}
-echo wlans_${NIC}=\${WLAN}\ ${FSMNT}/etc/rc.conf
+   cat ${FSMNT}/etc/rc.conf | grep -q wlans_${NIC}=
+   if [ $? -ne 0 ] ; then
+  echo wlans_${NIC}=\${WLAN}\ ${FSMNT}/etc/rc.conf
+   fi
 echo ifconfig_${WLAN}=\DHCP\ ${FSMNT}/etc/rc.conf
 CNIC=${WLAN}
 WLANCOUNT=$((WLANCOUNT+1))
@@ -138,7 +141,7 @@ enable_slaac_all()
 do
   NIC=`echo $line | cut -d ':' -f 1`
   DESC=`echo $line | cut -d ':' -f 2`
-  echo_log Setting $NIC to acceptign RAs on the system.
+  echo_log Setting $NIC to accepting RAs on the system.
   check_is_wifi ${NIC}
   if [ $? -eq 0 ]
   then
@@ -146,9 +149,12 @@ enable_slaac_all()
 # Given we cannot have DHCP and SLAAC the same time currently
# it's save to just duplicate.
 WLAN=wlan${WLANCOUNT}
-echo wlans_${NIC}=\${WLAN}\ ${FSMNT}/etc/rc.conf
+   cat ${FSMNT}/etc/rc.conf | grep -q wlans_${NIC}=
+   if [ $? -ne 0 ] ; then
+  echo wlans_${NIC}=\${WLAN}\ ${FSMNT}/etc/rc.conf
+   fi
#echo ifconfig_${NIC}=\up\ ${FSMNT}/etc/rc.conf
-echo ifconfig_${WLAN}=\inet6 accept_rtadv\ ${FSMNT}/etc/rc.conf
+echo ifconfig_${WLAN}_ipv6=\inet6 accept_rtadv\ 
${FSMNT}/etc/rc.conf
 CNIC=${WLAN}
 WLANCOUNT=$((WLANCOUNT+1))
   else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232895 - head/usr.sbin/pc-sysinstall/backend-query

2012-03-12 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 12 21:24:40 2012
New Revision: 232895
URL: http://svn.freebsd.org/changeset/base/232895

Log:
  Check for intel RAID devices
  
  Submitted by: kris
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Mon Mar 12 
21:07:22 2012(r232894)
+++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Mon Mar 12 
21:24:40 2012(r232895)
@@ -58,6 +58,18 @@ then
   fi
 fi
 
+# Add any RAID devices
+if [ -d /dev/raid ] ; then
+  cd /dev/raid
+  for i in `ls`
+  do
+case ${i} in
+  r0|r1|r2|r3|r4|r5) SYSDISK=${SYSDISK} ${i} ;;
+  *) ;;
+esac
+  done
+fi
+
 # Now loop through these devices, and list the disk drives
 for i in ${SYSDISK}
 do
@@ -77,7 +89,7 @@ do
   NEWLINE=$(camcontrol identify $DEV | sed -ne 's/^device model *//p')
   if [ -z $NEWLINE ]; then
# Now try atacontrol
-   NEWLINE=$(atacontrol list | sed -n s|^.*$DEV \(.*\).*|\1|p)
+   NEWLINE=$(atacontrol list 2/dev/null | sed -n s|^.*$DEV 
\(.*\).*|\1|p)

if [ -z $NEWLINE ]; then
NEWLINE= Unknown Device
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232898 - head/usr.sbin/pc-sysinstall/backend

2012-03-12 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 12 21:28:54 2012
New Revision: 232898
URL: http://svn.freebsd.org/changeset/base/232898

Log:
  Improve ZFS exporting functionality, only export pools which are on a
  specific device we happen to be writing to. This fixes an issue when
  running pc-sysinstall on a running system which needs ZFS and the main
  disk gets exported.
  
  Submitted by: kris
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon Mar 12 
21:26:09 2012(r232897)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon Mar 12 
21:28:54 2012(r232898)
@@ -224,16 +224,6 @@ get_disk_mediasize()
   export VAL=${mediasize}
 };
 
-# Function which exports all zpools, making them safe to overwrite potentially
-export_all_zpools()
-{
-  # Export any zpools
-  for i in `zpool list -H -o name`
-  do
-zpool export -f ${i}
-  done
-};
-
 # Function to delete all gparts before starting an install
 delete_all_gpart()
 {
@@ -268,10 +258,15 @@ delete_all_gpart()
 # Function to export all zpools before starting an install
 stop_all_zfs()
 {
-  # Export all zpools again, so that we can overwrite these partitions 
potentially
+  local DISK=`echo ${1} | sed 's|/dev/||g'`
+
+  # Export any zpools using this device so we can overwrite
   for i in `zpool list -H -o name`
   do
-zpool export -f ${i}
+ztst=`zpool status ${i} | grep ONLINE | awk '{print $1}' | grep -q 
${DISK}`
+if [ $ztst = $DISK ] ; then
+  zpool export -f ${i}
+fi
   done
 };
 
@@ -324,9 +319,6 @@ setup_disk_slice()
   disknum=0
   gmnum=0
 
-  # Make sure all zpools are exported
-  export_all_zpools
-
   # We are ready to start setting up the disks, lets read the config and do 
the actions
   while read line
   do
@@ -354,7 +346,7 @@ setup_disk_slice()
   stop_all_geli ${DISK}
 
   # Make sure we don't have any zpools loaded
-  stop_all_zfs
+  stop_all_zfs ${DISK}
 
  fi
 
@@ -375,6 +367,16 @@ setup_disk_slice()
   then
 exit_err ERROR: The mirror disk ${MIRRORDISK} does not exist!
   fi
+
+  # Make sure we stop any gmirrors on this mirror disk
+  stop_all_gmirror ${MIRRORDISK}
+
+  # Make sure we stop any geli stuff on this mirror disk
+  stop_all_geli ${MIRRORDISK}
+
+  # Make sure we don't have any zpools mirror loaded
+  stop_all_zfs ${MIRRORDISK}
+
 fi
 
 # Lets see if we have been given a mirror balance choice
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r232899 - head/usr.sbin/pc-sysinstall/backend

2012-03-12 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 12 21:32:43 2012
New Revision: 232899
URL: http://svn.freebsd.org/changeset/base/232899

Log:
  Add the ability to use a varity of ZFS dataset options.
  While here fix a bug causing zpools with /tmp mount-points to fail
  
  Submitted by: kris
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh
  head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh
  head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Mon Mar 12 
21:28:54 2012(r232898)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Mon Mar 12 
21:32:43 2012(r232899)
@@ -50,14 +50,14 @@ get_fs_line_xvars()
   ACTIVEDEV=${1}
   LINE=${2}
 
-  echo $LINE | grep -q ' (' 2/dev/null
+  echo $LINE | cut -d ' ' -f 4 | grep -q ' (' 2/dev/null
   if [ $? -eq 0 ] ; then
 
 # See if we are looking for ZFS specific options
 echo $LINE | grep -q '^ZFS' 2/dev/null
 if [ $? -eq 0 ] ; then
   ZTYPE=NONE
-  ZFSVARS=`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`
+  ZFSVARS=`echo $LINE | cut -d ' ' -f 4 |cut -d '(' -f 2- | cut -d ')' -f 
1 | xargs`
 
   echo $ZFSVARS | grep -qE 
^(disk|file|mirror|raidz(1|2|3)?|spare|log|cache): 2/dev/null
  if [ $? -eq 0 ] ; then
@@ -126,9 +126,9 @@ gen_glabel_name()
   NUM=0
   MAXNUM=20
 
-  # Check if we are doing /, and rename it
-  if [ $MOUNT = / ]
-  then
+  if [ $TYPE = ZFS ] ; then
+NAME=zpool
+  elif [ $MOUNT = / ] ; then
 NAME=rootfs
   else
 # If doing a swap partition, also rename it
@@ -341,7 +341,7 @@ setup_gpart_partitions()
   # Save this data to our partition config dir
   if [ ${_pType} = gpt ] ; then
_dFile=`echo $_pDisk | sed 's|/|-|g'`
-echo ${FS}:${MNT}:${ENC}:${PLABEL}:GPT:${XTRAOPTS} 
${PARTDIR}/${_dFile}p${CURPART}
+echo ${FS}#${MNT}#${ENC}#${PLABEL}#GPT#${XTRAOPTS} 
${PARTDIR}/${_dFile}p${CURPART}
 
 # Clear out any headers
 sleep 2
@@ -354,7 +354,7 @@ setup_gpart_partitions()
   else
# MBR Partition or GPT slice
_dFile=`echo $_wSlice | sed 's|/|-|g'`
-echo ${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE} 
${PARTDIR}/${_dFile}${PARTLETTER}
+echo ${FS}#${MNT}#${ENC}#${PLABEL}#MBR#${XTRAOPTS}#${IMAGE} 
${PARTDIR}/${_dFile}${PARTLETTER}
 # Clear out any headers
 sleep 2
 dd if=/dev/zero of=${_wSlice}${PARTLETTER} count=2048 2/dev/null
@@ -409,7 +409,7 @@ setup_gpart_partitions()
   fi
 
   # Found our flag to commit this label setup, check that we found at 
least 1 partition
-  if [ ${CURPART} = 2 ] ; then
+  if [ ${CURPART} = 1 ] ; then
 exit_err ERROR: commitDiskLabel was called without any partition 
entries for it!
   fi
 

Modified: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-cleanup.shMon Mar 12 
21:28:54 2012(r232898)
+++ head/usr.sbin/pc-sysinstall/backend/functions-cleanup.shMon Mar 12 
21:32:43 2012(r232899)
@@ -34,8 +34,8 @@ zfs_cleanup_unmount()
   for PART in `ls ${PARTDIR}`
   do
 PARTDEV=`echo $PART | sed 's|-|/|g'`
-PARTFS=`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`
-PARTMNT=`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`
+PARTFS=`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`
+PARTMNT=`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`
 ZPOOLNAME=$(get_zpool_name ${PARTDEV})
 
 if [ $PARTFS = ZFS ]
@@ -84,9 +84,9 @@ zfs_cleanup_unmount()
   for PART in `ls ${PARTDIR}`
   do
 PARTDEV=`echo $PART | sed 's|-|/|g'`
-PARTFS=`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`
-PARTMNT=`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`
-PARTENC=`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`
+PARTFS=`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`
+PARTMNT=`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`
+PARTENC=`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`
 ZPOOLNAME=$(get_zpool_name ${PARTDEV})
 
 if [ $PARTFS = ZFS ]
@@ -101,17 +101,20 @@ zfs_cleanup_unmount()
   # Check if we have multiple zfs mounts specified
   for ZMNT in `echo ${PARTMNT} | sed 's|,| |g'`
   do
+   ZMNT=`echo $ZMNT | cut -d '(' -f 1`
 PARTMNTREV=${ZMNT} ${PARTMNTREV}
   done
 
   for ZMNT in ${PARTMNTREV}
   do
-if [ ${ZMNT} != / ]
-then
-  rc_halt zfs set mountpoint=${ZMNT} ${ZPOOLNAME}${ZMNT}
+if [ ${ZMNT} = / ] ; then continue ; fi
+# Some ZFS like /swap aren't mounted, and dont need unmounting
+mount | grep -q ${FSMNT}${ZMNT}
+   

svn commit: r232901 - head/usr.sbin/pc-sysinstall/backend

2012-03-12 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 12 21:41:29 2012
New Revision: 232901
URL: http://svn.freebsd.org/changeset/base/232901

Log:
  Use gpart -a flag to 4k alignment.
  
  Submitted by: kris
  Obtained from:PC-BSD

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Mon Mar 12 
21:34:10 2012(r232900)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Mon Mar 12 
21:41:29 2012(r232901)
@@ -314,7 +314,7 @@ setup_gpart_partitions()
if [ $CURPART = 2 ] ; then
  # If this is GPT, make sure first partition is aligned to 4k
   sleep 2
-  rc_halt gpart add -b 2016 ${SOUT} -t ${PARTYPE} ${_pDisk}
+  rc_halt gpart add -a 4k ${SOUT} -t ${PARTYPE} ${_pDisk}
else
   sleep 2
   rc_halt gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon Mar 12 
21:34:10 2012(r232900)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon Mar 12 
21:41:29 2012(r232901)
@@ -645,33 +645,9 @@ init_mbr_full_disk()
   echo_log Running gpart on ${_intDISK}
   rc_halt gpart create -s mbr -f active ${_intDISK}
 
-  # Lets figure out disk size in blocks
-  # Get the cyl of this disk
-  get_disk_cyl ${_intDISK}
-  cyl=${VAL}
-
-  # Get the heads of this disk
-  get_disk_heads ${_intDISK}
-  head=${VAL}
-
-  # Get the tracks/sectors of this disk
-  get_disk_sectors ${_intDISK}
-  sec=${VAL}
-
-  # Multiply them all together to get our total blocks
-  totalblocks=`expr ${cyl} \* ${head} 2/dev/null`
-  totalblocks=`expr ${totalblocks} \* ${sec} 2/dev/null`
-  if [ -z ${totalblocks} ]
-  then
-totalblocks=`gpart show ${_intDISK}|tail -2|head -1|awk '{ print $2 }'`
-  fi
-
-  # Now set the ending block to the total disk block size
-  sizeblock=`expr ${totalblocks} - ${startblock}`
-
   # Install new partition setup
   echo_log Running gpart add on ${_intDISK}
-  rc_halt gpart add -b ${startblock} -s ${sizeblock} -t freebsd -i 1 
${_intDISK}
+  rc_halt gpart add -a 4k -t freebsd -i 1 ${_intDISK}
   sleep 2
   
   echo_log Cleaning up ${_intDISK}s1
@@ -847,44 +823,9 @@ run_gpart_free()
 rc_halt gpart create -s mbr ${DISK}
   fi
 
-  # Lets get the starting block first
-  if [ ${slicenum} = 1 ]
-  then
- startblock=63
-  else
- # Lets figure out where the prior slice ends
- checkslice=$((slicenum-1))
-
- # Get starting block of this slice
- sblk=`gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | sed '/^$/d' 
| grep  ${checkslice}  | cut -d ' ' -f 2`
- blksize=`gpart show ${DISK} | grep -v ${DISK} | tr -s '\t' ' ' | sed 
'/^$/d' | grep  ${checkslice}  | cut -d ' ' -f 3`
- startblock=$((sblk+blksiz))
-  fi
-
-  # No slice after the new slice, lets figure out the free space remaining and 
use it
-  # Get the cyl of this disk
-  get_disk_cyl ${DISK}
-  cyl=${VAL}
-
-  # Get the heads of this disk
-  get_disk_heads ${DISK}
-  head=${VAL}
-
-  # Get the tracks/sectors of this disk
-  get_disk_sectors ${DISK}
-  sec=${VAL}
-
-  # Multiply them all together to get our total blocks
-  totalblocks=$((cyl*head))
-  totalblocks=$((totalblocks*sec))
-
-
-  # Now set the ending block to the total disk block size
-  sizeblock=$((totalblocks-startblock))
-
   # Install new partition setup
   echo_log Running gpart on ${DISK}
-  rc_halt gpart add -b ${startblock} -s ${sizeblock} -t freebsd -i 
${slicenum} ${DISK}
+  rc_halt gpart add -a 4k -t freebsd -i ${slicenum} ${DISK}
   sleep 2
   
   echo_log Cleaning up $slice
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r231999 - head/sys/conf

2012-02-22 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Feb 22 15:05:19 2012
New Revision: 231999
URL: http://svn.freebsd.org/changeset/base/231999

Log:
  Fix various typos and normalize spelling.
  
  Approved by:  kib (mentor)

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Wed Feb 22 13:01:17 2012(r231998)
+++ head/sys/conf/NOTES Wed Feb 22 15:05:19 2012(r231999)
@@ -219,19 +219,19 @@ options   MAXCPU=32
 
 # ADAPTIVE_MUTEXES changes the behavior of blocking mutexes to spin
 # if the thread that currently owns the mutex is executing on another
-# CPU.  This behaviour is enabled by default, so this option can be used
+# CPU.  This behavior is enabled by default, so this option can be used
 # to disable it.
 optionsNO_ADAPTIVE_MUTEXES
 
 # ADAPTIVE_RWLOCKS changes the behavior of reader/writer locks to spin
 # if the thread that currently owns the rwlock is executing on another
-# CPU.  This behaviour is enabled by default, so this option can be used
+# CPU.  This behavior is enabled by default, so this option can be used
 # to disable it.
 optionsNO_ADAPTIVE_RWLOCKS
 
 # ADAPTIVE_SX changes the behavior of sx locks to spin if the thread that
 # currently owns the sx lock is executing on another CPU.
-# This behaviour is enabled by default, so this option can be used to
+# This behavior is enabled by default, so this option can be used to
 # disable it.
 optionsNO_ADAPTIVE_SX
 
@@ -437,7 +437,7 @@ options KTRACE_REQUEST_POOL=101
 # initial value of the ktr_mask variable which determines at runtime
 # what events to trace.  KTR_CPUMASK determines which CPU's log
 # events, with bit X corresponding to CPU X.  The layout of the string
-# passed as KTR_CPUMASK must match a serie of bitmasks each of them
+# passed as KTR_CPUMASK must match a series of bitmasks each of them
 # separated by the ,  characters (ie:
 # KTR_CPUMASK=(0xAF, 0x)).  KTR_VERBOSE enables
 # dumping of KTR events to the console by default.  This functionality
@@ -602,7 +602,7 @@ options FLOWTABLE
 optionsSCTP
 # There are bunches of options:
 # this one turns on all sorts of
-# nastly printing that you can
+# nastily printing that you can
 # do. It's all controlled by a
 # bit mask (settable by socket opt and
 # by sysctl). Including will not cause
@@ -1269,7 +1269,7 @@ hint.sa.1.target=6
 # The sg driver provides a passthrough API that is compatible with the
 # Linux SG driver.  It will work in conjunction with the COMPAT_LINUX
 # option to run linux SG apps.  It can also stand on its own and provide
-# source level API compatiblity for porting apps to FreeBSD.
+# source level API compatibility for porting apps to FreeBSD.
 #
 # Target Mode support is provided here but also requires that a SIM
 # (SCSI Host Adapter Driver) provide support as well.
@@ -1434,7 +1434,7 @@ options   SC_NORM_REV_ATTR=(FG_YELLOW|BG_
 optionsSC_KERNEL_CONS_ATTR=(FG_RED|BG_BLACK)
 optionsSC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)
 
-# The following options will let you change the default behaviour of
+# The following options will let you change the default behavior of
 # cut-n-paste feature
 optionsSC_CUT_SPACES2TABS  # convert leading spaces into tabs
 optionsSC_CUT_SEPCHARS=\x09\ # set of characters that delimit words
@@ -1835,7 +1835,7 @@ hint.uart.0.baud=115200
 #  specifically, the 0x20 flag can also be set (see above).
 #  Currently, at most one unit can have console support; the
 #  first one (in config file order) with this flag set is
-#  preferred.  Setting this flag for sio0 gives the old behaviour.
+#  preferred.  Setting this flag for sio0 gives the old behavior.
 #  0x80use this port for serial line gdb support in ddb.  Also known
 #  as debug port.
 #
@@ -2335,7 +2335,7 @@ hint.gusc.0.flags=0x13
 #  sanity checking and possible increase of
 #  verbosity.
 #
-# SND_DIAGNOSTIC   Simmilar in a spirit of INVARIANTS/DIAGNOSTIC,
+# SND_DIAGNOSTIC   Similar in a spirit of INVARIANTS/DIAGNOSTIC,
 #  zero tolerance against inconsistencies.
 #
 # SND_FEEDER_MULTIFORMAT   By default, only 16/32 bit feeders are compiled
@@ -2418,7 +2418,7 @@ devicecmx
 # options  BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC
 # Specifies the default video capture mode.
 # This is required for Dual Crystal (2835Mhz) boards where PAL is used
-# to prevent hangs during initialisation, e.g. VideoLogic Captivator PCI.
+# to prevent hangs during initialization, e.g. VideoLogic Captivator PCI.
 #
 # options  BKTR_USE_PLL
 # This is required for PAL or SECAM boards with a 28Mhz crystal and no 35Mhz
@@ -2428,7 +2428,7 @@ devicecmx
 # This enables IOCTLs which give user level 

svn commit: r227390 - head/share/misc

2011-11-09 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Nov  9 15:21:48 2011
New Revision: 227390
URL: http://svn.freebsd.org/changeset/base/227390

Log:
  Add myself.
  
  Approved by:  kib (mentor)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Wed Nov  9 14:37:47 2011
(r227389)
+++ head/share/misc/committers-src.dot  Wed Nov  9 15:21:48 2011
(r227390)
@@ -167,6 +167,7 @@ jls [label=Jordan Sissel\njls@FreeBSD.o
 joerg [label=Joerg Wunsch\njo...@freebsd.org\n1993/11/14]
 jon [label=Jonathan Chen\n...@freebsd.org\n2000/10/17]
 jonathan [label=Jonathan Anderson\njonat...@freebsd.org\n2010/10/07]
+jpaetzel [label=Josh Paetzel\njpaet...@freebsd.org\n2011/01/21]
 julian [label=Julian Elischer\njul...@freebsd.org\n1993/??/??]
 kaiw [label=Kai Wang\nk...@freebsd.org\n2007/09/26]
 kan [label=Alexander Kabaev\n...@freebsd.org\n2002/07/21]
@@ -443,6 +444,7 @@ kan - kib
 
 kib - ae
 kib - dchagin
+kib - jpaetzel
 kib - lulf
 kib - melifaro
 kib - pho
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r227368 - head/usr.sbin/pc-sysinstall/backend

2011-11-08 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Nov  8 23:44:26 2011
New Revision: 227368
URL: http://svn.freebsd.org/changeset/base/227368

Log:
  Welcome the initial patches for OSX bootcamp support!!!
  This should let you select the ada0p3 hybrid MBR/GPT partition, and do an 
installation to it.
  
  Approved by:  kib (mentor)
  Obtained from:k...@pcbsd.org
  MFC after:3 days

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  head/usr.sbin/pc-sysinstall/backend/parseconfig.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Tue Nov  8 
23:19:22 2011(r227367)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Tue Nov  8 
23:44:26 2011(r227368)
@@ -179,7 +179,9 @@ setup_gpart_partitions()
   else
 PARTLETTER=a
 CURPART=1
-rc_halt gpart create -s BSD ${_wSlice}
+if [ ${_pType} = mbr ] ; then
+  rc_halt gpart create -s BSD ${_wSlice}
+fi
   fi
 
   while read line
@@ -255,6 +257,9 @@ setup_gpart_partitions()
 if [ ${CURPART} = 1 -a $_pType = mbr ] ; then
   export FOUNDROOT=0
 fi
+if [ ${CURPART} = 1 -a $_pType = gptslice ] ; then
+  export FOUNDROOT=0
+fi
   fi
 
   check_for_mount ${MNT} /boot
@@ -266,6 +271,9 @@ setup_gpart_partitions()
 if [ ${CURPART} != 1 -a ${_pType} = mbr ] ; then
 exit_err /boot partition must be first partition
 fi
+if [ ${CURPART} != 1 -a ${_pType} = gptslice ] ; then
+exit_err /boot partition must be first partition
+fi
 
 if [ ${FS} != UFS -a ${FS} != UFS+S -a ${FS} != UFS+J -a 
${FS} != UFS+SUJ ] ; then
   exit_err /boot partition must be formatted with UFS
@@ -287,7 +295,7 @@ setup_gpart_partitions()
   # Check if using zfs mirror
   echo ${XTRAOPTS} | grep -q mirror 2/dev/null
   if [ $? -eq 0 -a $FS = ZFS ] ; then
-if [ ${_pType} = gpt ] ; then
+if [ ${_pType} = gpt -o ${_pType} = gptslice ] ; then
  XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS 
${_pDisk}p${CURPART})
 else
  XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS ${_wSlice})
@@ -305,11 +313,17 @@ setup_gpart_partitions()
   if [ ${_pType} = gpt ] ; then
if [ $CURPART = 2 ] ; then
  # If this is GPT, make sure first partition is aligned to 4k
+  sleep 2
   rc_halt gpart add -b 2016 ${SOUT} -t ${PARTYPE} ${_pDisk}
else
+  sleep 2
   rc_halt gpart add ${SOUT} -t ${PARTYPE} ${_pDisk}
fi
+  elif [ ${_pType} = gptslice ]; then
+sleep 2
+rc_halt gpart add ${SOUT} -t ${PARTYPE} ${_wSlice}
   else
+sleep 2
 rc_halt gpart add ${SOUT} -t ${PARTYPE} -i ${CURPART} ${_wSlice}
   fi
 
@@ -338,7 +352,7 @@ setup_gpart_partitions()
   echo ${ENCPASS} ${PARTDIR}-enc/${_dFile}p${CURPART}-encpass
 fi
   else
-   # MBR Partition
+   # MBR Partition or GPT slice
_dFile=`echo $_wSlice | sed 's|/|-|g'`
 echo ${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE} 
${PARTDIR}/${_dFile}${PARTLETTER}
 # Clear out any headers
@@ -422,7 +436,7 @@ populate_disk_label()
   if [ $type = mbr ] ; then
 wrkslice=${diskid}s${slicenum}
   fi
-  if [ $type = gpt ] ; then
+  if [ $type = gpt -o $type = gptslice ] ; then
 wrkslice=${diskid}p${slicenum}
   fi
 
@@ -459,6 +473,9 @@ setup_disk_label()
 if [ $type = gpt -a ! -e ${disk}p${pnum} ] ; then
   exit_err ERROR: The partition ${i} doesn't exist! gpart failure!
 fi
+if [ $type = gptslice -a ! -e ${disk}p${pnum} ] ; then
+  exit_err ERROR: The partition ${i} doesn't exist! gpart failure!
+fi
   done
 
   # Setup some files which we'll be referring to

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Tue Nov  8 
23:19:22 2011(r227367)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Tue Nov  8 
23:44:26 2011(r227368)
@@ -496,6 +496,13 @@ setup_disk_slice()
 run_gpart_slice ${DISK} ${BMANAGER} ${s}
 ;;
 
+  
p1|p2|p3|p4|p5|p6|p7|p8|p9|p10|p11|p12|p13|p14|p15|p16|p17|p18|p19|p20)
+tmpSLICE=${DISK}${PTYPE} 
+# Get the number of the gpt partition we are working on
+s=`echo ${PTYPE} | awk '{print substr($0,length,1)}'` 
+run_gpart_gpt_part ${DISK} ${BMANAGER} ${s}
+;;
+
   free)
 tmpSLICE=${DISK}s${LASTSLICE}
 run_gpart_free ${DISK} ${LASTSLICE} ${BMANAGER}
@@ -704,6 +711,58 @@ run_gpart_full()
   fi
 };
 
+# Function which runs gpart on a 

svn commit: r225657 - in head/usr.sbin/pc-sysinstall: backend backend-partmanager examples

2011-09-18 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Sep 19 05:12:53 2011
New Revision: 225657
URL: http://svn.freebsd.org/changeset/base/225657

Log:
  Fix a logic bug in pc-sysinstall creating partitions.
  Improve exit when an error occurs.
  Fix parsing to grab values which contain extra '=' signs.
  Fix a bug setting the timezone properly.
  Fix a usage bug when setting up with gmirror.
  Allow a uzip file from local media to be used.
  Allow specifying flags for newfs when using UFS as the file system.
  Run custom commands after doing final cleanup / fstab generation
  and such. Also fix using relative path for config file.
  
  Approved by:  re (bz)

Modified:
  head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh
  head/usr.sbin/pc-sysinstall/backend/functions-localize.sh
  head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh
  head/usr.sbin/pc-sysinstall/backend/functions-parse.sh
  head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh
  head/usr.sbin/pc-sysinstall/backend/functions.sh
  head/usr.sbin/pc-sysinstall/backend/parseconfig.sh
  head/usr.sbin/pc-sysinstall/examples/README

Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
==
--- head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh  Mon Sep 
19 04:08:52 2011(r225656)
+++ head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh  Mon Sep 
19 05:12:53 2011(r225657)
@@ -90,7 +90,7 @@ if [ $? -eq 0 -a ${SLICENUM} = 1 ] ;
 fi
 
 # If we have a starting block, use it
-if [ -z $STARTBLOCK ] ; then
+if [ -n $STARTBLOCK ] ; then
   sBLOCK=-b $STARTBLOCK
 fi
 

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Mon Sep 19 
04:08:52 2011(r225656)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Mon Sep 19 
05:12:53 2011(r225657)
@@ -45,7 +45,6 @@ check_for_enc_pass()
 };
 
 # On check on the disk-label line if we have any extra vars for this device
-# Only enabled for ZFS devices now, may add other xtra options in future for 
other FS's
 get_fs_line_xvars()
 {
   ACTIVEDEV=${1}
@@ -76,6 +75,15 @@ get_fs_line_xvars()
   return
 fi # End of ZFS block
 
+# See if we are looking for UFS specific newfs options
+echo $LINE | grep -q '^UFS' 2/dev/null
+if [ $? -eq 0 ] ; then
+  FSVARS=`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`
+  VAR=${FSVARS}
+  export VAR
+  return
+fi
+
   fi # End of xtra-options block
 
   # If we got here, set VAR to empty and export
@@ -278,7 +286,7 @@ setup_gpart_partitions()
 
   # Check if using zfs mirror
   echo ${XTRAOPTS} | grep -q mirror 2/dev/null
-  if [ $? -eq 0 ] ; then
+  if [ $? -eq 0 -a $FS = ZFS ] ; then
 if [ ${_pType} = gpt ] ; then
  XTRAOPTS=$(setup_zfs_mirror_parts $XTRAOPTS 
${_pDisk}p${CURPART})
 else

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon Sep 19 
04:08:52 2011(r225656)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Mon Sep 19 
05:12:53 2011(r225657)
@@ -554,7 +554,7 @@ init_gmirror()
 local _mDisk=$3
 
 # Create this mirror device
-rc_halt gmirror label -vb ${_mBal} gm${_mNum} /dev/${_mDisk}
+rc_halt gmirror label -vb ${_mBal} gm${_mNum} ${_mDisk}
 
 sleep 3
 

Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh   Mon Sep 
19 04:08:52 2011(r225656)
+++ head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh   Mon Sep 
19 05:12:53 2011(r225657)
@@ -55,6 +55,10 @@ start_extract_uzip_tar()
 
   case ${PACKAGETYPE} in
 uzip)
+  if ! kldstat -v | grep -q geom_uzip ; then
+   exit_err Kernel module geom_uzip not loaded
+  fi
+
  # Start by mounting the uzip image
   MDDEVICE=`mdconfig -a -t vnode -o readonly -f ${INSFILE}`
   mkdir -p ${FSMNT}.uzip
@@ -435,6 +439,16 @@ init_extraction()
 
 rsync) start_rsync_copy ;;
 image) start_image_install ;;
+local)
+  get_value_from_cfg localPath
+  if [ -z $VAL ]
+  then
+exit_err Install medium was set to local, but no localPath was 
provided!
+  fi
+  LOCALPATH=$VAL
+  INSFILE=${LOCALPATH}/${INSFILE} ; export INSFILE
+  start_extract_uzip_tar
+  ;;
 *) exit_err ERROR: Unknown 

svn commit: r223117 - head/etc/periodic/daily

2011-06-15 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Jun 15 19:33:02 2011
New Revision: 223117
URL: http://svn.freebsd.org/changeset/base/223117

Log:
  Eliminate extraneous pipelines and tr calls.
  
  Approved by:  kib (mentor)
  MFC after:3 days

Modified:
  head/etc/periodic/daily/800.scrub-zfs

Modified: head/etc/periodic/daily/800.scrub-zfs
==
--- head/etc/periodic/daily/800.scrub-zfs   Wed Jun 15 19:15:50 2011
(r223116)
+++ head/etc/periodic/daily/800.scrub-zfs   Wed Jun 15 19:33:02 2011
(r223117)
@@ -46,7 +46,7 @@ case $daily_scrub_zfs_enable in
esac
 
# determine how many days shall be between scrubs
-   eval _pool_threshold=\${daily_scrub_zfs_$(echo ${pool}|tr -s 
- _|tr -s . _|tr -s : _)_threshold}
+   eval _pool_threshold=\${daily_scrub_zfs_$(echo ${pool}|tr  
.:- _)_threshold}
if [ -z ${_pool_threshold} ];then
_pool_threshold=${daily_scrub_zfs_default_threshold}
fi
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r223056 - head/etc/periodic/daily

2011-06-13 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Jun 13 19:45:01 2011
New Revision: 223056
URL: http://svn.freebsd.org/changeset/base/223056

Log:
  Convert the allowed characters '-', '.', and ':' in a ZFS pool name to _
  to avoid causing errors in the shell script.
  
  Submitted by: William Grzybowski willia...@gmail.com
  Approved by:  kib (mentor)
  MFC after:7 days
  Sponsored by: iXsystems

Modified:
  head/etc/periodic/daily/800.scrub-zfs

Modified: head/etc/periodic/daily/800.scrub-zfs
==
--- head/etc/periodic/daily/800.scrub-zfs   Mon Jun 13 19:40:09 2011
(r223055)
+++ head/etc/periodic/daily/800.scrub-zfs   Mon Jun 13 19:45:01 2011
(r223056)
@@ -46,7 +46,7 @@ case $daily_scrub_zfs_enable in
esac
 
# determine how many days shall be between scrubs
-   eval _pool_threshold=\${daily_scrub_zfs_${pool}_threshold}
+   eval _pool_threshold=\${daily_scrub_zfs_$(echo ${pool}|tr -s 
- _|tr -s . _|tr -s : _)_threshold}
if [ -z ${_pool_threshold} ];then
_pool_threshold=${daily_scrub_zfs_default_threshold}
fi
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r222078 - head/usr.sbin/pc-sysinstall/backend

2011-05-18 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 18 20:29:07 2011
New Revision: 222078
URL: http://svn.freebsd.org/changeset/base/222078

Log:
  Extracting optional components requires mounting devfs
  
  Submitted by: Kris Moore k...@pcbsd.org
  Approved by:  kib (mentor)
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh  Wed May 
18 19:49:39 2011(r222077)
+++ head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh  Wed May 
18 20:29:07 2011(r222078)
@@ -120,9 +120,11 @@ COMPTMPDIR=\${COMPTMPDIR}\
 export COMPTMPDIR
 CFILE=\${CFILE}\
 export CFILE
+mount -t devfs devfs /dev
 
 sh ${COMPTMPDIR}/install.sh
 
+umount /dev
  ${FSMNT}/.componentwrapper.sh
   chmod 755 ${FSMNT}/.componentwrapper.sh

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r222079 - head/usr.sbin/pc-sysinstall/backend

2011-05-18 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 18 20:38:28 2011
New Revision: 222079
URL: http://svn.freebsd.org/changeset/base/222079

Log:
  Wipeout the end of disks, home to things like gmirror metadata, backup GPT 
tables,
  and other potential evil.
  
  Submitted by: Kris Moore k...@pcbsd.org
  Approved by:  kib (mentor)
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Wed May 18 
20:29:07 2011(r222078)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Wed May 18 
20:38:28 2011(r222079)
@@ -582,17 +582,9 @@ stop_gjournal()
 # Function to wipe the potential backup gpt table from a disk
 clear_backup_gpt_table()
 {
-  # Get the disk block size
-  local dSize=`gpart show $1 | grep $1 | tr -s ' ' | cut -d ' ' -f 3`
-
-  # Make sure this is a valid number
-  is_num ${dSize} /dev/null 2/dev/null
-  [ $? -ne 0 ]  return
-
-  # Die backup label, DIE
   echo_log Clearing gpt backup table location on disk
-  rc_nohalt dd if=/dev/zero of=${1} bs=512 seek=${dSize}
-
+  rc_nohalt dd if=/dev/zero of=${1} bs=1m count=1
+  rc_nohalt dd if=/dev/zero of=${1} bs=1m oseek=`diskinfo ${1} | awk '{print 
int($3 / (1024*1024)) - 4;}'`
 } ;
 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r220909 - in head/usr.sbin/pc-sysinstall: backend backend-query

2011-04-21 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Apr 21 06:25:12 2011
New Revision: 220909
URL: http://svn.freebsd.org/changeset/base/220909

Log:
  - Allows using full device name paths, such as /dev/ad0 or /dev/mirror/gm0 in 
config files
  - Fixes some issues creating gmirror devices, including on GPT partitions
  - Bugfixes for ZFS mirroring
  - Enhanced GELI to work with a passphrase only, or key-file only
  - Bugfix to prevent crashing of PC-BSD Live media when checking for upgrade 
partitions
  
  Submitted by: Kris Moore kmo...@freebsd.org
  Approved by:  kib (mentor)
  Sponsored by: iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh
  head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh
  head/usr.sbin/pc-sysinstall/backend/functions.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh   Thu Apr 
21 03:59:37 2011(r220908)
+++ head/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh   Thu Apr 
21 06:25:12 2011(r220909)
@@ -37,16 +37,22 @@ FSMNT=/mnt
 # Get the freebsd version on this partition
 get_fbsd_ver()
 {
-
-  VER=`file ${FSMNT}/bin/sh | grep 'for FreeBSD' | sed 's|for FreeBSD |;|g' | 
cut -d ';' -f 2 | cut -d ',' -f 1`
-  if [ $? = 0 ] ; then
-file ${FSMNT}/bin/sh | grep '32-bit' /dev/null 2/dev/null
-if [ ${?} = 0 ] ; then
-  echo ${1}: FreeBSD ${VER} (32bit)
-else
-  echo ${1}: FreeBSD ${VER} (64bit)
+  sFiles=/bin/sh /boot/kernel/kernel
+  for file in $sFiles
+  do
+ if [ ! -e ${FSMNT}/$file ] ; then continue ; fi
+
+ VER=`file ${FSMNT}/$file | grep 'for FreeBSD' | sed 's|for FreeBSD |;|g' 
| cut -d ';' -f 2 | cut -d ',' -f 1`
+if [ $? = 0 ] ; then
+  file ${FSMNT}/$file | grep '32-bit' /dev/null 2/dev/null
+  if [ ${?} = 0 ] ; then
+echo ${1}: FreeBSD ${VER} (32bit)
+  else
+echo ${1}: FreeBSD ${VER} (64bit)
+  fi
 fi
-  fi
+break
+  done
 
 }
 
@@ -86,25 +92,8 @@ do
   fi
 
   mount -o ro ${_dsk} ${FSMNT} ${LOGOUT} 2${LOGOUT}
-  if [ ${?} = 0 -a -e ${FSMNT}/bin/sh ] ; then
+  if [ $? -eq 0 ] ; then
 get_fbsd_ver `echo ${_dsk} | sed 's|/dev/||g'`
 umount -f ${FSMNT} /dev/null 2/dev/null
   fi
 done
-
-# Now search for any ZFS root partitions
-zpool import -o altroot=${FSMNT} -a
-
-# Unmount any auto-mounted stuff
-umount_all_dir ${FSMNT}
-
-# Get pools
-_zps=`zpool list | grep -v 'NAME' | cut -d ' ' -f 1`
-for _zpools in ${_zps}
-do
-  mount -o ro -t zfs ${_zpools} ${FSMNT} ${LOGOUT} 2${LOGOUT}
-  if [ ${?} = 0 -a -e ${FSMNT}/bin/sh ] ; then
-get_fbsd_ver ${_zpools}
-umount -f ${FSMNT} /dev/null 2/dev/null
-  fi
-done

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu Apr 21 
03:59:37 2011(r220908)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu Apr 21 
06:25:12 2011(r220909)
@@ -101,7 +101,6 @@ setup_zfs_mirror_parts()
 if [ $? -eq 0 ] ; then
   echo Setting up ZFS mirror disk $_zvars ${LOGOUT}
   init_gpt_full_disk $_zvars /dev/null 2/dev/null
-  rc_halt gpart bootcode -p /boot/gptzfsboot -i 1 ${_zvars} /dev/null 
2/dev/null
   rc_halt gpart add -t freebsd-zfs ${_zvars} /dev/null 2/dev/null
   _nZFS=$_nZFS ${_zvars}p2   
 else
@@ -319,7 +318,8 @@ setup_gpart_partitions()
 
   # Save this data to our partition config dir
   if [ ${_pType} = gpt ] ; then
-echo ${FS}:${MNT}:${ENC}:${PLABEL}:GPT:${XTRAOPTS} 
${PARTDIR}/${_pDisk}p${CURPART}
+   _dFile=`echo $_pDisk | sed 's|/|-|g'`
+echo ${FS}:${MNT}:${ENC}:${PLABEL}:GPT:${XTRAOPTS} 
${PARTDIR}/${_dFile}p${CURPART}
 
 # Clear out any headers
 sleep 2
@@ -327,18 +327,19 @@ setup_gpart_partitions()
 
 # If we have a enc password, save it as well
 if [ -n ${ENCPASS} ] ; then
-  echo ${ENCPASS} ${PARTDIR}-enc/${_pDisk}p${CURPART}-encpass
+  echo ${ENCPASS} ${PARTDIR}-enc/${_dFile}p${CURPART}-encpass
 fi
   else
# MBR Partition
-echo ${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE} 
${PARTDIR}/${_wSlice}${PARTLETTER}
+   _dFile=`echo $_wSlice | sed 's|/|-|g'`
+echo ${FS}:${MNT}:${ENC}:${PLABEL}:MBR:${XTRAOPTS}:${IMAGE} 
${PARTDIR}/${_dFile}${PARTLETTER}
 # Clear out any headers
 sleep 2
 dd if=/dev/zero of=${_wSlice}${PARTLETTER} count=2048 2/dev/null
 
 # If we have a enc 

svn commit: r220161 - head/usr.sbin/pc-sysinstall/backend

2011-03-30 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Mar 30 17:33:52 2011
New Revision: 220161
URL: http://svn.freebsd.org/changeset/base/220161

Log:
  Fix syntax error from previous commit.
  
  Approved by:  kib (mentor)

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Wed Mar 30 
14:48:49 2011(r220160)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Wed Mar 30 
17:33:52 2011(r220161)
@@ -421,7 +421,7 @@ setup_disk_slice()
 
 # Check if we have an image file defined
 echo $line | grep -q ^image= 2/dev/null
-if [ $? eq 0 ] ; then
+if [ $? -eq 0 ] ; then
   # Found an image= entry, lets read / set it
   get_value_from_string ${line}
   strip_white_space $VAL
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r220162 - head/usr.sbin/pc-sysinstall/backend-partmanager

2011-03-30 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Mar 30 17:37:04 2011
New Revision: 220162
URL: http://svn.freebsd.org/changeset/base/220162

Log:
  Check in two missing files missed in cleanup.
  Change expr to $(())
  Switch test from $? = 0 to $? -eq 0
  
  Approved by:  kib (mentor)

Modified:
  head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
  head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh

Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
==
--- head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh  Wed Mar 
30 17:33:52 2011(r220161)
+++ head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh  Wed Mar 
30 17:37:04 2011(r220162)
@@ -85,7 +85,7 @@ fi
 
 # If this is an empty disk, see if we need to create a new scheme for it
 gpart show ${DISK} /dev/null 2/dev/null
-if [ $? != 0 -a ${SLICENUM} = 1 ] ; then
+if [ $? -eq 0 -a ${SLICENUM} = 1 ] ; then
  gpart create -s ${TYPE} ${DISK}
 fi
 

Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh
==
--- head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh  Wed Mar 
30 17:33:52 2011(r220161)
+++ head/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh  Wed Mar 
30 17:37:04 2011(r220162)
@@ -57,10 +57,10 @@ PARTINDEX=
 while 
 z=1
 do
-  CHARS=`expr $CHARS - 1`
+  CHARS=$((CHARS-1))
   LAST_CHAR=`echo ${PARTITION} | cut -c $CHARS`
-  echo ${LAST_CHAR} | grep ^[0-9]$ /dev/null 2/dev/null
-  if [ $? = 0 ] ; then
+  echo ${LAST_CHAR} | grep -q ^[0-9]$ 2/dev/null
+  if [ $? -eq 0 ] ; then
 PARTINDEX=${LAST_CHAR}${PARTINDEX}
   else
 break
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r220057 - head/usr.sbin/pc-sysinstall/backend

2011-03-27 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Mar 27 14:20:47 2011
New Revision: 220057
URL: http://svn.freebsd.org/changeset/base/220057

Log:
  Increase size of boot partition to give breathing room in the future.
  
  Approved by:  kib (mentor)

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Sun Mar 27 
13:55:35 2011(r220056)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Sun Mar 27 
14:20:47 2011(r220057)
@@ -596,7 +596,7 @@ init_gpt_full_disk()
 
   echo_log Running gpart on ${_intDISK}
   rc_halt gpart create -s GPT ${_intDISK}
-  rc_halt gpart add -b 34 -s 64 -t freebsd-boot ${_intDISK}
+  rc_halt gpart add -b 34 -s 128 -t freebsd-boot ${_intDISK}
   
   echo_log Stamping boot sector on ${_intDISK}
   rc_halt gpart bootcode -b /boot/pmbr ${_intDISK}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r220059 - head/usr.sbin/pc-sysinstall/backend

2011-03-27 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Mar 27 16:57:54 2011
New Revision: 220059
URL: http://svn.freebsd.org/changeset/base/220059

Log:
  Fix a syntax error in a little-used function.
  Replace expr with $(())
  Replace grep  /dev/null with grep -q
  Replace $? = 0 with $? -eq 0 in tests
  Consolidate export statements with variable assignment
  Replace tests for ! -z with -n
  
  Approved by:  kib (mentor)

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh
  head/usr.sbin/pc-sysinstall/backend/functions-ftp.sh
  head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
  head/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh
  head/usr.sbin/pc-sysinstall/backend/functions-localize.sh
  head/usr.sbin/pc-sysinstall/backend/functions-mountoptical.sh
  head/usr.sbin/pc-sysinstall/backend/functions-networking.sh
  head/usr.sbin/pc-sysinstall/backend/functions-packages.sh
  head/usr.sbin/pc-sysinstall/backend/functions-parse.sh
  head/usr.sbin/pc-sysinstall/backend/functions-runcommands.sh
  head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh
  head/usr.sbin/pc-sysinstall/backend/functions-upgrade.sh
  head/usr.sbin/pc-sysinstall/backend/functions-users.sh
  head/usr.sbin/pc-sysinstall/backend/functions.sh
  head/usr.sbin/pc-sysinstall/backend/parseconfig.sh
  head/usr.sbin/pc-sysinstall/backend/startautoinstall.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Sun Mar 27 
16:18:51 2011(r220058)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Sun Mar 27 
16:57:54 2011(r220059)
@@ -33,14 +33,14 @@ check_for_enc_pass()
   CURLINE=${1}
  
   get_next_cfg_line ${CFGF} ${CURLINE} 
-  echo ${VAL} | grep ^encpass= /dev/null 2/dev/null
-  if [ $? = 0 ] ; then
+  echo ${VAL} | grep -q ^encpass= 2/dev/null
+  if [ $? -eq 0 ] ; then
 # Found a password, return it
 get_value_from_string ${VAL}
 return
   fi
 
-  VAL= ; export VAL
+  export VAL=
   return
 };
 
@@ -51,17 +51,17 @@ get_fs_line_xvars()
   ACTIVEDEV=${1}
   LINE=${2}
 
-  echo $LINE | grep ' (' /dev/null 2/dev/null
-  if [ $? = 0 ] ; then
+  echo $LINE | grep -q ' (' 2/dev/null
+  if [ $? -eq 0 ] ; then
 
 # See if we are looking for ZFS specific options
-echo $LINE | grep '^ZFS' /dev/null 2/dev/null
-if [ $? = 0 ] ; then
+echo $LINE | grep -q '^ZFS' 2/dev/null
+if [ $? -eq 0 ] ; then
   ZTYPE=NONE
   ZFSVARS=`echo $LINE | cut -d '(' -f 2- | cut -d ')' -f 1 | xargs`
 
-  echo $ZFSVARS | grep -E 
^(disk|file|mirror|raidz(1|2)?|spare|log|cache): /dev/null 2/dev/null
- if [ $? = 0 ] ; then
+  echo $ZFSVARS | grep -qE 
^(disk|file|mirror|raidz(1|2)?|spare|log|cache): 2/dev/null
+ if [ $? -eq 0 ] ; then
ZTYPE=`echo $ZFSVARS | cut -f1 -d:`
ZFSVARS=`echo $ZFSVARS | sed s|$ZTYPE: ||g | sed s|$ZTYPE:||g`
  fi
@@ -79,8 +79,7 @@ get_fs_line_xvars()
   fi # End of xtra-options block
 
   # If we got here, set VAR to empty and export
-  VAR=
-  export VAR
+  export VAR=
   return
 };
 
@@ -94,12 +93,12 @@ setup_zfs_mirror_parts()
   for _zvars in $_mirrline
   do
 echo Looping through _zvars: $_zvars ${LOGOUT}
-echo $_zvars | grep ${2} /dev/null 2/dev/null
-if [ $? = 0 ] ; then continue ; fi
+echo $_zvars | grep -q ${2} 2/dev/null
+if [ $? -eq 0 ] ; then continue ; fi
 if [ -z $_zvars ] ; then continue ; fi
 
 is_disk $_zvars /dev/null 2/dev/null
-if [ $? = 0 ] ; then
+if [ $? -eq 0 ] ; then
   echo Setting up ZFS mirror disk $_zvars ${LOGOUT}
   init_gpt_full_disk $_zvars /dev/null 2/dev/null
   rc_halt gpart bootcode -p /boot/gptzfsboot -i 1 ${_zvars} /dev/null 
2/dev/null
@@ -138,12 +137,12 @@ gen_glabel_name()
   while
   Z=1
   do
-glabel status | grep ${NAME}${NUM} /dev/null 2/dev/null
-if [ $? != 0 ]
+glabel status | grep -q ${NAME}${NUM} 2/dev/null
+if [ $? -ne 0 ]
 then
   break
 else
-  NUM=`expr ${NUM} + 1`
+NUM=$((NUM+1))
 fi
 
 if [ $NUM -gt $MAXNUM ]
@@ -154,8 +153,7 @@ gen_glabel_name()
   done 

 
-  VAL=${NAME}${NUM} 
-  export VAL
+  export VAL=${NAME}${NUM} 
 };
 
 # Function to setup partitions using gpart
@@ -180,8 +178,8 @@ setup_gpart_partitions()
   while read line
   do
 # Check for data on this slice
-echo $line | grep ^${_dTag}-part= /dev/null 2/dev/null
-if [ $? = 0 ]
+echo $line | grep -q ^${_dTag}-part= 2/dev/null
+if [ $? -eq 0 ]
 then
   FOUNDPARTS=0
   # Found a slice- entry, lets get the slice info
@@ -194,8 +192,8 @@ setup_gpart_partitions()
   MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 3` 
 
   # Check 

svn commit: r218975 - head/usr.sbin/pc-sysinstall/backend-query

2011-02-23 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Feb 23 17:52:26 2011
New Revision: 218975
URL: http://svn.freebsd.org/changeset/base/218975

Log:
  Alter comment to reflect change in code.
  Try atacontrol if camcontrol fails.
  
  Approved by:  kib (mentor, implicit)

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Wed Feb 23 
17:17:05 2011(r218974)
+++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Wed Feb 23 
17:52:26 2011(r218975)
@@ -73,10 +73,15 @@ do
 esac
   fi
 
-  # Check the dmesg output for some more info about this device
-  NEWLINE=$(camcontrol identify $DEV | grep device model | tr -s ' ' | sed 
's |device model ||g')
+  # Try and find some identification information with camcontrol or atacontrol
+  NEWLINE=$(camcontrol identify $DEV | sed -ne 's/^device model *//p')
   if [ -z $NEWLINE ]; then
-NEWLINE= Unknown Device
+   # Now try atacontrol
+   NEWLINE=$(atacontrol list | sed -n s|^.*$DEV \(.*\).*|\1|p)
+   
+   if [ -z $NEWLINE ]; then
+   NEWLINE= Unknown Device
+   fi
   fi
 
   if [ -n ${FLAGS_MD} ]  echo ${DEV} | grep -E '^md[0-9]+' /dev/null 
2/dev/null
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r218959 - head/usr.sbin/pc-sysinstall/backend-query

2011-02-22 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Feb 22 19:18:56 2011
New Revision: 218959
URL: http://svn.freebsd.org/changeset/base/218959

Log:
  Better method for grabbing disk name, dmesg may produce mangled output.
  
  Approved by:  kib (mentor, implicit)

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Tue Feb 22 
19:05:42 2011(r218958)
+++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Tue Feb 22 
19:18:56 2011(r218959)
@@ -74,7 +74,7 @@ do
   fi
 
   # Check the dmesg output for some more info about this device
-  NEWLINE=$(dmesg | sed -n s/^$DEV: .*\(.*\).*$/ \1/p | head -n 1)
+  NEWLINE=$(camcontrol identify $DEV | grep device model | tr -s ' ' | sed 
's |device model ||g')
   if [ -z $NEWLINE ]; then
 NEWLINE= Unknown Device
   fi
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r218960 - head/usr.sbin/pc-sysinstall/backend

2011-02-22 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Feb 22 19:37:12 2011
New Revision: 218960
URL: http://svn.freebsd.org/changeset/base/218960

Log:
  Added patch-functions-upgrade which should fix some kernel panics
  doing upgrades and uninstalling linux compat ports.
  
  Submitted by: Joerg-Christian Boehme jo...@chaosdorf.de
  Approved by:  kib (mentor, implicit)

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-upgrade.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-upgrade.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-upgrade.shTue Feb 22 
19:18:56 2011(r218959)
+++ head/usr.sbin/pc-sysinstall/backend/functions-upgrade.shTue Feb 22 
19:37:12 2011(r218960)
@@ -58,7 +58,7 @@ mount_target_slice()
   zfs mount -a
 
   # Mount all the fstab goodies on disk
-  chroot ${FSMNT} /sbin/mount -a ${LOGOUT} 2${LOGOUT}
+  chroot ${FSMNT} /sbin/mount -a -t nolinprocfs ${LOGOUT} 2${LOGOUT
   chroot ${FSMNT} umount /proc /dev/null 2/dev/null 
   chroot ${FSMNT} umount /compat/linux/proc  /dev/null 2/dev/null
 
@@ -79,7 +79,7 @@ mount_target_slice()
   if [ $INSTALLTYPE != FreeBSD ]
   then
 echo_log Removing old packages, this may take a while... Please wait...
-echo '#/bin/sh
+echo '#!/bin/sh
 for i in `pkg_info -E \*`
 do
   echo Uninstalling package: ${i}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r218800 - in head/usr.sbin/pc-sysinstall: backend-partmanager pc-sysinstall

2011-02-18 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Feb 18 15:00:25 2011
New Revision: 218800
URL: http://svn.freebsd.org/changeset/base/218800

Log:
  Add support to pc-sysinstall's create-part feature, to create non MBR type 
partitions,
  such as GPT and others.
  
  PR:   bin/154684
  Submitted by: kmoore
  Approved by:  kib (mentor, implicit)

Modified:
  head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
  head/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh

Modified: head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh
==
--- head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh  Fri Feb 
18 14:54:34 2011(r218799)
+++ head/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh  Fri Feb 
18 15:00:25 2011(r218800)
@@ -25,7 +25,7 @@
 #
 # $FreeBSD$
 
-# Query a disk for partitions and display them
+# Create partitions on a target disk
 #
 
 . ${PROGDIR}/backend/functions.sh
@@ -47,46 +47,52 @@ fi
 
 DISK=${1}
 MB=${2}
+TYPE=${3}
+STARTBLOCK=${4}
 
 TOTALBLOCKS=`expr $MB \* 2048`
 
+# If no TYPE specified, default to MBR
+if [ -z $TYPE ] ; then TYPE=mbr ; fi
 
-# Lets figure out what number this slice will be
-LASTSLICE=`fdisk -s /dev/${DISK} 2/dev/null | grep -v ${DISK} | grep ':' | 
tail -n 1 | cut -d ':' -f 1 | tr -s '\t' ' ' | tr -d ' '`
+# Sanity check the gpart type
+case $TYPE in
+   apm|APM) ;;
+   bsd|BSD) ;;
+   ebr|EBR) ;;
+  pc98|pc98) ;;
+   gpt|GPT) ;;
+   mbr|MBR) ;;
+vtoc8|VTOC8) ;;
+   *) echo Error: Unknown gpart type: $TYPE ; exit 1 ;;
+esac
+
+# Lets figure out what number this partition will be
+LASTSLICE=`gpart show $DISK | grep -v -e $DISK -e '\- free \-' -e '^$' | awk 
'END {print $3}'`
 if [ -z ${LASTSLICE} ] ; then
   LASTSLICE=1
 else
   LASTSLICE=`expr $LASTSLICE + 1`
 fi
 
-if [ ${LASTSLICE} -gt 4 ] ; then
-  echo Error: FreeBSD MBR setups can only have a max of 4 slices
-  exit 1
-fi
-
-
 SLICENUM=${LASTSLICE}
 
-# Lets get the starting block
-if [ ${SLICENUM} = 1 ] ; then
-  STARTBLOCK=63
-else
-  # Lets figure out where the prior slice ends
-  checkslice=`expr ${SLICENUM} - 1`
-
-  # Get starting block of this slice
-  fdisk -s /dev/${DISK} | grep -v ${DISK}: | grep ${checkslice}: | tr -s  
 ${TMPDIR}/pfdisk
-  pstartblock=`cat ${TMPDIR}/pfdisk | cut -d ' ' -f 3`
-  psize=`cat ${TMPDIR}/pfdisk | cut -d ' ' -f 4`
-  STARTBLOCK=`expr ${pstartblock} + ${psize}`
+# Set a 4k Aligned start block if none specified
+if [ ${SLICENUM} = 1 -a -z $STARTBLOCK ] ; then
+  STARTBLOCK=2016
 fi
 
 
-# If this is an empty disk, see if we need to create a new MBR scheme for it
+# If this is an empty disk, see if we need to create a new scheme for it
 gpart show ${DISK} /dev/null 2/dev/null
 if [ $? != 0 -a ${SLICENUM} = 1 ] ; then
- gpart create -s mbr ${DISK}
+ gpart create -s ${TYPE} ${DISK}
+fi
+
+# If we have a starting block, use it
+if [ -z $STARTBLOCK ] ; then
+  sBLOCK=-b $STARTBLOCK
 fi
 
-gpart add -b ${STARTBLOCK} -s ${TOTALBLOCKS} -t freebsd -i ${SLICENUM} ${DISK}
+gpart add ${sBLOCK} -s ${TOTALBLOCKS} -t freebsd -i ${SLICENUM} ${DISK}
 exit $?

Modified: head/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh
==
--- head/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh  Fri Feb 18 
14:54:34 2011(r218799)
+++ head/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh  Fri Feb 18 
15:00:25 2011(r218800)
@@ -125,7 +125,7 @@ case $1 in
   ;;
 
   # The user is wanting to create a new partition
-  create-part) ${PARTMANAGERDIR}/create-part.sh ${2} ${3}
+  create-part) ${PARTMANAGERDIR}/create-part.sh ${2} ${3} ${4} ${5}
   ;;
 
   # The user is wanting to delete an existing partition
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r218801 - head/usr.sbin/pc-sysinstall/backend

2011-02-18 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Feb 18 15:06:35 2011
New Revision: 218801
URL: http://svn.freebsd.org/changeset/base/218801

Log:
  Improve pc-sysinstall's localization options to include support for GDM  KDM
  desktop login managers.
  
  PR:   bin/154686
  Submitted by: kmoore
  Approved by:  kib (mentor, implicit)

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-localize.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-localize.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-localize.sh   Fri Feb 18 
15:00:25 2011(r218800)
+++ head/usr.sbin/pc-sysinstall/backend/functions-localize.sh   Fri Feb 18 
15:06:35 2011(r218801)
@@ -38,25 +38,46 @@ localize_freebsd()
   rm ${FSMNT}/etc/login.conf.bak
 };
 
+localize_x_desktops() {
 
-# Function which localizes a PC-BSD install
-localize_pcbsd()
-{
-  #Change the skel files
+  # Check for and customize KDE lang
   ##
-  sed -i.bak s/Country=us/Country=${COUNTRY}/g 
${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals
-  sed -i.bak s/Country=us/Country=${COUNTRY}/g 
${FSMNT}/root/.kde4/share/config/kdeglobals
-  sed -i.bak s/Language=en_US/Language=${SETLANG}:${LOCALE}/g 
${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals
-  sed -i.bak s/Language=en_US/Language=${SETLANG}:${LOCALE}/g 
${FSMNT}/root/.kde4/share/config/kdeglobals
 
-  #Change KDM Langs
+  # Check if we can localize KDE via skel
+  if [ -e ${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals ] ; then
+sed -i '' s/Country=us/Country=${COUNTRY}/g 
${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals
+sed -i '' s/Country=us/Country=${COUNTRY}/g 
${FSMNT}/root/.kde4/share/config/kdeglobals
+sed -i '' s/Language=en_US/Language=${SETLANG}:${LOCALE}/g 
${FSMNT}/usr/share/skel/.kde4/share/config/kdeglobals
+  fi
+
+  # Check if we have a KDE root config
+  if [ -e ${FSMNT}/root/.kde4/share/config/kdeglobals ] ; then
+sed -i '' s/Language=en_US/Language=${SETLANG}:${LOCALE}/g 
${FSMNT}/root/.kde4/share/config/kdeglobals
+  fi
+
+  # Check for KDM
+  if [ -e ${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc ] ; then
+sed -i '' s/Language=en_US/Language=${LOCALE}.UTF-8/g 
${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc
+  fi
+
+  # Check for and customize GNOME / GDM lang
   ##
-  sed -i.bak s/Language=en_US/Language=${LOCALE}.UTF-8/g 
${FSMNT}/usr/local/kde4/share/config/kdm/kdmrc
 
+  # See if GDM is enabled and customize its lang
+  cat ${FSMNT}/etc/rc.conf 2/dev/null | grep gdm_enable=\YES\ /dev/null 
2/dev/null
+  if [ $? = 0 ] ; then
+echo gdm_lang=\${LOCALE}.UTF-8\  ${FSMNT}/etc/rc.conf
+  fi
+
+};
+
+# Function which localizes a PC-BSD install
+localize_pcbsd()
+{
   # Check if we have a localized splash screen and copy it
-  if [ -e ${FSMNT}/usr/PCBSD/splash-screens/loading-screen-${SETLANG}.pcx ]
+  if [ -e 
${FSMNT}/usr/local/share/pcbsd/splash-screens/loading-screen-${SETLANG}.pcx ]
   then
-cp ${FSMNT}/usr/PCBSD/splash-screens/loading-screen-${SETLANG}.pcx 
${FSMNT}/boot/loading-screen.pcx
+cp 
${FSMNT}/usr/local/share/pcbsd/splash-screens/loading-screen-${SETLANG}.pcx 
${FSMNT}/boot/loading-screen.pcx
   fi
 
 };
@@ -117,12 +138,14 @@ localize_x_keyboard()
 cp ${FSMNT}/usr/share/skel/.xprofile ${FSMNT}/root/.xprofile
 
 # Save it for KDM
-echo setxkbmap ${SETXKBMAP} 
${FSMNT}/usr/local/kde4/share/config/kdm/Xsetup
+if [ -e ${FSMNT}/usr/local/kde4/share/config/kdm/Xsetup ] ; then
+  echo setxkbmap ${SETXKBMAP} 
${FSMNT}/usr/local/kde4/share/config/kdm/Xsetup
+fi
   fi
  
-
-   # Create the kxkbrc configuration using these options
-  echo [Layout]
+  # Create the kxkbrc configuration using these options
+  if [ -d ${FSMNT}/usr/share/skel/.kde4/share/config ] ; then
+echo [Layout]
 DisplayNames=${KXLAYOUT}${COUNTRY}
 IndicatorOnly=false
 LayoutList=${KXLAYOUT}${KXVAR}${COUNTRY}
@@ -133,6 +156,7 @@ ShowFlag=true
 ShowSingle=false
 SwitchMode=WinClass
 Use=true  ${FSMNT}/usr/share/skel/.kde4/share/config/kxkbrc
+  fi
 
 };
 
@@ -454,7 +478,12 @@ run_localize()
   then
 localize_pcbsd $VAL
   fi
+
+  # Localize FreeBSD
   localize_freebsd $VAL
+
+  # Localize any X pkgs
+  localize_x_desktops $VAL
 fi
 
 # Check if we need to do any keylayouts
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r218802 - head/usr.sbin/pc-sysinstall/backend-query

2011-02-18 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Feb 18 15:13:07 2011
New Revision: 218802
URL: http://svn.freebsd.org/changeset/base/218802

Log:
  Sort available keyboard layouts to a more sane default.
  
  PR:   bin/154687
  Submitted by: kmoore
  Approved by:  kib (mentor, implicit)

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh  Fri Feb 
18 15:06:35 2011(r218801)
+++ head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh  Fri Feb 
18 15:13:07 2011(r218802)
@@ -26,6 +26,12 @@
 # $FreeBSD$
 
 FOUND=0
+TMPLIST=/tmp/.xkeyList.$$
+XLST=/usr/local/share/X11/xkb/rules/xorg.lst
+
+if [ ! -e ${XLST} ] ; then
+  exit 1
+fi
 
 # Lets parse the xorg.list file, and see what layouts are supported
 while read line
@@ -36,9 +42,9 @@ do
 echo $line | grep '! ' /dev/null 2/dev/null
 if [ $? = 0 ]
 then
-  exit 0
+   break
 else 
-  echo $line
+  echo $line  ${TMPLIST}
 fi 
   fi 
 
@@ -51,6 +57,13 @@ do
 fi 
   fi
 
-done  /usr/local/share/X11/xkb/rules/xorg.lst
+done  $XLST
+
+# Display the output, with us English as the first entry
+echo us   U.S. English
+sort -b -d +1 $TMPLIST
+
+# Delete the tmp file
+rm $TMPLIST
 
 exit 0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r218803 - head/usr.sbin/pc-sysinstall/backend-query

2011-02-18 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Feb 18 15:52:57 2011
New Revision: 218803
URL: http://svn.freebsd.org/changeset/base/218803

Log:
  Remove US as the default layout in backend, let front-ends decide that
  
  Submitted by: kmoore
  Approved by:  kib (mentor, implicit)

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh  Fri Feb 
18 15:13:07 2011(r218802)
+++ head/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh  Fri Feb 
18 15:52:57 2011(r218803)
@@ -59,8 +59,6 @@ do
 
 done  $XLST
 
-# Display the output, with us English as the first entry
-echo us   U.S. English
 sort -b -d +1 $TMPLIST
 
 # Delete the tmp file
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r218776 - in head/usr.sbin/pc-sysinstall: backend conf examples

2011-02-17 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Feb 17 16:33:41 2011
New Revision: 218776
URL: http://svn.freebsd.org/changeset/base/218776

Log:
  Add Extract Only functionality to pc-sysinstall.  This allows disk setup to
  be done manually, pc-sysinstall is pointed to a mount-point for installation.
  
  PR:   bin/154685
  Submitted by: kmoore
  Approved by:  kib (mentor)

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions.sh
  head/usr.sbin/pc-sysinstall/backend/parseconfig.sh
  head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf
  head/usr.sbin/pc-sysinstall/examples/README

Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions.shThu Feb 17 16:21:26 
2011(r218775)
+++ head/usr.sbin/pc-sysinstall/backend/functions.shThu Feb 17 16:33:41 
2011(r218776)
@@ -409,6 +409,7 @@ write_image()
   fi
 };
 
+# Setup and install on a new disk / partition
 install_fresh()
 {
   # Lets start setting up the disk slices now
@@ -458,6 +459,39 @@ install_fresh()
   echo_log Installation finished!
 };
 
+# Extract the system to a pre-mounted directory
+install_extractonly()
+{
+  # We are ready to begin extraction, lets start now
+  init_extraction 
+
+  # Check if we have any optional modules to load 
+  install_components
+
+  # Check if we have any packages to install
+  install_packages
+
+  # Do any localization in configuration
+  run_localize
+
+  # Save any networking config on the installed system
+  save_networking_install
+
+  # Now add any users
+  setup_users
+
+  # Now run any commands specified
+  run_commands
+  
+  # Set a hostname on the install system
+  setup_hostname
+  
+  # Set the root_pw if it is specified
+  set_root_pw
+
+  echo_log Installation finished!
+};
+
 install_image()
 {
   # We are ready to begin extraction, lets start now
@@ -478,7 +512,7 @@ install_upgrade()
   # Do any localization in configuration
   run_localize
 
-  # ow run any commands specified
+  # Now run any commands specified
   run_commands
   
   # Merge any old configuration files

Modified: head/usr.sbin/pc-sysinstall/backend/parseconfig.sh
==
--- head/usr.sbin/pc-sysinstall/backend/parseconfig.sh  Thu Feb 17 16:21:26 
2011(r218775)
+++ head/usr.sbin/pc-sysinstall/backend/parseconfig.sh  Thu Feb 17 16:33:41 
2011(r218776)
@@ -67,11 +67,10 @@ fi
 export CFGF
 
 # Start by doing a sanity check, which will catch any obvious mistakes in the 
config
-file_sanity_check installMode disk0 installType installMedium packageType
+file_sanity_check installMode installType installMedium packageType
 
 # We passed the Sanity check, lets grab some of the universal config settings 
and store them
-check_value installMode fresh upgrade
-check_value bootManager bsd none
+check_value installMode fresh upgrade extract
 check_value installType PCBSD FreeBSD
 check_value installMedium dvd usb ftp rsync image
 check_value packageType uzip tar rsync split
@@ -108,6 +107,16 @@ case ${INSTALLMODE} in
 fi
 ;;
 
+  extract)
+# Extracting only, make sure we have a valid target directory
+get_value_from_cfg installLocation
+FSMNT=${VAL} ; export FSMNT
+if [ -z $FSMNT ] ; then exit_err Missing installLocation= ; fi
+if [ ! -d $FSMNT ] ; then exit_err No such directory: $FSMNT ; fi
+
+install_extractonly
+;;
+
   upgrade)
 install_upgrade
 ;;

Modified: head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf
==
--- head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf Thu Feb 17 16:21:26 
2011(r218775)
+++ head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf Thu Feb 17 16:33:41 
2011(r218776)
@@ -36,8 +36,8 @@ RSYNCTRIES=3
 export RSYNCTRIES
 
 # Set our mount-points
-CDMNT=/cdmnt-install
-FSMNT=/mnt
+CDMNT=${CDMNT-/cdmnt-install}
+FSMNT=${FSMNT-/mnt}
 UZIP_DIR=/usr
 BOOT_PART_MOUNT=/boot-mount
 export FSMNT CDMNT UZIP_DIR BOOT_PART_MOUNT

Modified: head/usr.sbin/pc-sysinstall/examples/README
==
--- head/usr.sbin/pc-sysinstall/examples/README Thu Feb 17 16:21:26 2011
(r218775)
+++ head/usr.sbin/pc-sysinstall/examples/README Thu Feb 17 16:33:41 2011
(r218776)
@@ -12,9 +12,9 @@ installed system
 When hostname= is not present, pc-sysinstall will auto-generate
 a hostname such as freebsd- or pcbsd-
 
-# installMode=(fresh or upgrade)
+# installMode=(fresh/upgrade/extract)
 
-Set the type of install we are doing, fresh or upgrade.
+Set the type of install we are doing.
 
 Fresh installs will format and mount the target disks before
 extracting the install images to the system. Using this mode
@@ -27,6 +27,19 @@ The conf/exclude-from-upgrade file can b
 additional files to exclude from 

svn commit: r218523 - head/share/man/man4

2011-02-10 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Feb 10 15:41:32 2011
New Revision: 218523
URL: http://svn.freebsd.org/changeset/base/218523

Log:
  Netgear renamed the WG311 to the WG311v1 after they released a second
  version of it.  There is also a WG311v3 which uses a chipset covered by
  malo(4). Along the way add the WG311T to the list which is also an
  atheros chipset.
  
  PR:   docs/154589
  Approved by:  kib (mentor)
  MFC after:3 days

Modified:
  head/share/man/man4/ath_hal.4

Modified: head/share/man/man4/ath_hal.4
==
--- head/share/man/man4/ath_hal.4   Thu Feb 10 15:07:17 2011
(r218522)
+++ head/share/man/man4/ath_hal.4   Thu Feb 10 15:41:32 2011
(r218523)
@@ -109,7 +109,9 @@ module:
 .It Netgear WAG311AR5212  PCI a/b/g
 .It Netgear WAB501AR5211  CardBus a/b
 .It Netgear WAG511AR5212  CardBus a/b/g
-.It Netgear WG311 AR5212  PCI b/g
+.It Netgear WG311 (aka WG311v1)   AR5212  PCI b/g
+.It Netgear WG311v2   AR5212  PCI b/g
+.It Netgear WG311TAR5212  PCI b/g
 .It Netgear WG511TAR5212  CardBus b/g
 .It Orinoco 8480  AR5212  CardBus a/b/g
 .It Orinoco 8470WDAR5212  CardBus a/b/g
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r217822 - head/etc/periodic/daily

2011-01-25 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Jan 25 13:41:48 2011
New Revision: 217822
URL: http://svn.freebsd.org/changeset/base/217822

Log:
  Fix logic error introduced in previous commit.
  Along the way make some efficiency improvements.
  
  Submitted by: jilles
  Approved by:  kib (mentor)
  MFC after:3 days

Modified:
  head/etc/periodic/daily/800.scrub-zfs

Modified: head/etc/periodic/daily/800.scrub-zfs
==
--- head/etc/periodic/daily/800.scrub-zfs   Tue Jan 25 11:04:16 2011
(r217821)
+++ head/etc/periodic/daily/800.scrub-zfs   Tue Jan 25 13:41:48 2011
(r217822)
@@ -5,6 +5,10 @@
 
 # If there is a global system configuration file, suck it in.
 #
+
+newline=
+ # A single newline
+
 if [ -r /etc/defaults/periodic.conf ]
 then
 . /etc/defaults/periodic.conf
@@ -24,17 +28,19 @@ case $daily_scrub_zfs_enable in
 
for pool in ${daily_scrub_zfs_pools}; do
# sanity check
-   _status=$(zpool list ${pool} | sed -n -e '$p')
+   _status=$(zpool list ${pool} 2 /dev/null)
if [ $? -ne 0 ]; then
echoWARNING: pool '${pool}' specified in
echo 
'/etc/periodic.conf:daily_scrub_zfs_pools'
echo does not exist
continue
fi
-   if echo ${_status} | grep -q FAULTED; then
+   _status=${_status##*$newline}
+   case ${_status} in
+   *FAULTED*)
echo Skipping faulted pool: ${pool}
-   continue
-   fi
+   continue ;;
+   esac
 
# successful only if there is at least one pool to scrub
rc=0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


  1   2   >