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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r338939 - stable/11/sys/dev/oce

2018-09-25 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Sep 25 23:59:45 2018
New Revision: 338939
URL: https://svnweb.freebsd.org/changeset/base/338939

Log:
  MFC r333146:
  
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:
  stable/11/sys/dev/oce/oce_if.h
  stable/11/sys/dev/oce/oce_mbox.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/oce/oce_if.h
==
--- stable/11/sys/dev/oce/oce_if.h  Tue Sep 25 23:48:43 2018
(r338938)
+++ stable/11/sys/dev/oce/oce_if.h  Tue Sep 25 23:59:45 2018
(r338939)
@@ -1014,6 +1014,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: stable/11/sys/dev/oce/oce_mbox.c
==
--- stable/11/sys/dev/oce/oce_mbox.cTue Sep 25 23:48:43 2018
(r338938)
+++ stable/11/sys/dev/oce/oce_mbox.cTue Sep 25 23:59:45 2018
(r338939)
@@ -41,6 +41,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
@@ -54,26 +82,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(&sc->bsmbx, struct oce_bmbx);
-   mbx = &mb->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 *)&mbx->payload;
-   mbx_common_req_hdr_init(&fwcmd->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(&sc->bsmbx, struct oce_bmbx);
+   mbx = &mb->mbx;
+   bzero(mbx, sizeof(struct oce_mbx));
+
+   fwcmd = (struct ioctl_common_function_reset *)&mbx->payload;
+   mbx_common_req_hdr_init(&fwcmd->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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r338938 - stable/11/sys/dev/oce

2018-09-25 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Sep 25 23:48:43 2018
New Revision: 338938
URL: https://svnweb.freebsd.org/changeset/base/338938

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

Added:
  stable/11/sys/dev/oce/oce_user.h
 - copied unchanged from r306219, head/sys/dev/oce/oce_user.h
Modified:
  stable/11/sys/dev/oce/oce_hw.c
  stable/11/sys/dev/oce/oce_hw.h
  stable/11/sys/dev/oce/oce_if.c
  stable/11/sys/dev/oce/oce_if.h
  stable/11/sys/dev/oce/oce_mbox.c
  stable/11/sys/dev/oce/oce_queue.c
  stable/11/sys/dev/oce/oce_sysctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/oce/oce_hw.c
==
--- stable/11/sys/dev/oce/oce_hw.c  Tue Sep 25 23:33:30 2018
(r338937)
+++ stable/11/sys/dev/oce/oce_hw.c  Tue Sep 25 23:48:43 2018
(r338938)
@@ -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: stable/11/sys/dev/oce/oce_hw.h
==
--- stable/11/sys/dev/oce/oce_hw.h  Tue Sep 25 23:33:30 2018
(r338937)
+++ stable/11/sys/dev/oce/oce_hw.h  Tue Sep 25 23:48:43 2018
(r338938)
@@ -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_

svn commit: r338937 - in stable/11/sys: net net80211

2018-09-25 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Sep 25 23:33:30 2018
New Revision: 338937
URL: https://svnweb.freebsd.org/changeset/base/338937

Log:
  MFC r303811:
  
Extract out the various local definitions of ETHER_IS_BROADCAST() and
turn them into a shared definition.
  
Set M_MCAST/M_BCAST appropriately upon packet reception in net80211, just
before they are delivered up to the ethernet stack.
  
Submitted by:   rstone

Modified:
  stable/11/sys/net/ethernet.h
  stable/11/sys/net/if_ethersubr.c
  stable/11/sys/net/if_gif.c
  stable/11/sys/net80211/ieee80211_input.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/ethernet.h
==
--- stable/11/sys/net/ethernet.hTue Sep 25 22:21:36 2018
(r338936)
+++ stable/11/sys/net/ethernet.hTue Sep 25 23:33:30 2018
(r338937)
@@ -71,6 +71,9 @@ struct ether_addr {
 } __packed;
 
 #defineETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address 
mcast/bcast? */
+#defineETHER_IS_BROADCAST(addr) \
+   (((addr)[0] & (addr)[1] & (addr)[2] & \
+ (addr)[3] & (addr)[4] & (addr)[5]) == 0xff)
 
 /*
  * 802.1q Virtual LAN header.

Modified: stable/11/sys/net/if_ethersubr.c
==
--- stable/11/sys/net/if_ethersubr.cTue Sep 25 22:21:36 2018
(r338936)
+++ stable/11/sys/net/if_ethersubr.cTue Sep 25 23:33:30 2018
(r338937)
@@ -118,8 +118,6 @@ static  void ether_reassign(struct ifnet *, struct vnet
 #endif
 static int ether_requestencap(struct ifnet *, struct if_encap_req *);
 
-#defineETHER_IS_BROADCAST(addr) \
-   (bcmp(etherbroadcastaddr, (addr), ETHER_ADDR_LEN) == 0)
 
 #define senderr(e) do { error = (e); goto bad;} while (0)
 

Modified: stable/11/sys/net/if_gif.c
==
--- stable/11/sys/net/if_gif.c  Tue Sep 25 22:21:36 2018(r338936)
+++ stable/11/sys/net/if_gif.c  Tue Sep 25 23:33:30 2018(r338937)
@@ -166,14 +166,6 @@ SYSCTL_INT(_net_link_gif, OID_AUTO, parallel_tunnels,
 CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(parallel_tunnels), 0,
 "Allow parallel tunnels?");
 
-/* copy from src/sys/net/if_ethersubr.c */
-static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] =
-   { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-#ifndef ETHER_IS_BROADCAST
-#define ETHER_IS_BROADCAST(addr) \
-   (bcmp(etherbroadcastaddr, (addr), ETHER_ADDR_LEN) == 0)
-#endif
-
 static int
 gif_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {

Modified: stable/11/sys/net80211/ieee80211_input.c
==
--- stable/11/sys/net80211/ieee80211_input.cTue Sep 25 22:21:36 2018
(r338936)
+++ stable/11/sys/net80211/ieee80211_input.cTue Sep 25 23:33:30 2018
(r338937)
@@ -283,7 +283,10 @@ ieee80211_deliver_data(struct ieee80211vap *vap,
IEEE80211_NODE_STAT(ni, rx_data);
IEEE80211_NODE_STAT_ADD(ni, rx_bytes, m->m_pkthdr.len);
if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
-   m->m_flags |= M_MCAST;  /* XXX M_BCAST? */
+   if (ETHER_IS_BROADCAST(eh->ether_dhost))
+   m->m_flags |= M_BCAST;
+   else
+   m->m_flags |= M_MCAST;
IEEE80211_NODE_STAT(ni, rx_mcast);
} else
IEEE80211_NODE_STAT(ni, rx_ucast);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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(&sc->bsmbx, struct oce_bmbx);
-   mbx = &mb->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 *)&mbx->payload;
-   mbx_common_req_hdr_init(&fwcmd->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(&sc->bsmbx, struct oce_bmbx);
+   mbx = &mb->mbx;
+   bzero(mbx, sizeof(struct oce_mbx));
+
+   fwcmd = (struct ioctl_common_function_reset *)&mbx->payload;
+   mbx_common_req_hdr_init(&fwcmd->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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r323770 - in stable/11/sys: amd64/conf arm64/conf i386/conf powerpc/conf riscv/conf sparc64/conf

2017-09-20 Thread Josh Paetzel
On Wed, Sep 20, 2017, at 01:25 PM, Gleb Smirnoff wrote:
> On Wed, Sep 20, 2017 at 05:21:45PM +, Alexey Dokuchaev wrote:
> A> On Wed, Sep 20, 2017 at 08:58:59AM -0500, Josh Paetzel wrote:
> A> > On Wed, Sep 20, 2017, at 02:41 AM, Ngie Cooper (yaneurabeya) wrote:
> A> > > > On Sep 19, 2017, at 09:51, Josh Paetzel 
> wrote:
> A> > > > New Revision: 323770
> A> > > > URL: https://svnweb.freebsd.org/changeset/base/323770
> A> > > > 
> A> > > > Log:
> A> > > >  MFC: 323068
> A> > > > 
> A> > > >Allow kldload tcpmd5
> A> > > 
> A> > > Wasn't this reverted on ^/head ?
> A> > 
> A> > Not this one.  What was reverted on HEAD was the removal of options
> A> > IPSEC from GENERIC.
> A> > 
> A> > The endgoal is options IPSEC and options IPSEC_SUPPORT in GENERIC,
> which
> A> > will allow someone running GENERIC to kldload tcpmd5.
> A> 
> A> I'll shamelessly steal this thread to ask somewhat related question
> that
> A> was bothering me since the original botched commit: what is the reason
> A> behind IPSEC_SUPPORT option?  If it does not cost anything, why not
> just
> A> optimize it away; if it does imply something more, can you shed some
> A> light on why is it needed (and/or might not be)?  Thanks,
> 
> The reason is to make loadable ipsec.ko. I actually don't understand
> why do we still have IPSEC in GENERIC once it is loadable. Doesn't it
> still have performance impact?
> 
> -- 
> Gleb Smirnoff

options IPSEC no longer has a performance impact. gnn@ fixed that.

Why IPSEC_SUPPORT can't just get folded in with IPSEC I can't answer.  I
looked briefly at the code but that didn't tell me anything useful.

-- 

Thanks,

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


Re: svn commit: r323770 - in stable/11/sys: amd64/conf arm64/conf i386/conf powerpc/conf riscv/conf sparc64/conf

2017-09-20 Thread Josh Paetzel


On Wed, Sep 20, 2017, at 02:41 AM, Ngie Cooper (yaneurabeya) wrote:
> 
> > On Sep 19, 2017, at 09:51, Josh Paetzel  wrote:
> > 
> > Author: jpaetzel
> > Date: Tue Sep 19 16:51:51 2017
> > New Revision: 323770
> > URL: https://svnweb.freebsd.org/changeset/base/323770
> > 
> > Log:
> >  MFC: 323068
> > 
> >Allow kldload tcpmd5
> 
> Wasn’t this reverted on ^/head ?
> Thanks,
> -Ngie
> Email had 1 attachment:
> + signature.asc
>   1k (application/pgp-signature)


Not this one.  What was reverted on HEAD was the removal of options
IPSEC from GENERIC.

The endgoal is options IPSEC and options IPSEC_SUPPORT in GENERIC, which
will allow someone running GENERIC to kldload tcpmd5

I think it's clear that removing options IPSEC from GENERIC was the
wrong way to go. (There was consensus on the phabricator review, not so
much once it was committed.)

-- 

Thanks,

Josh Paetzel
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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 # Be

svn commit: r323770 - in stable/11/sys: amd64/conf arm64/conf i386/conf powerpc/conf riscv/conf sparc64/conf

2017-09-19 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Sep 19 16:51:51 2017
New Revision: 323770
URL: https://svnweb.freebsd.org/changeset/base/323770

Log:
  MFC: 323068
  
Allow kldload tcpmd5
  
  PR:   220170

Modified:
  stable/11/sys/amd64/conf/GENERIC
  stable/11/sys/arm64/conf/GENERIC
  stable/11/sys/i386/conf/GENERIC
  stable/11/sys/powerpc/conf/GENERIC
  stable/11/sys/riscv/conf/GENERIC
  stable/11/sys/sparc64/conf/GENERIC
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/conf/GENERIC
==
--- stable/11/sys/amd64/conf/GENERICTue Sep 19 16:49:45 2017
(r323769)
+++ stable/11/sys/amd64/conf/GENERICTue Sep 19 16:51:51 2017
(r323770)
@@ -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
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem

Modified: stable/11/sys/arm64/conf/GENERIC
==
--- stable/11/sys/arm64/conf/GENERICTue Sep 19 16:49:45 2017
(r323769)
+++ stable/11/sys/arm64/conf/GENERICTue Sep 19 16:51:51 2017
(r323770)
@@ -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
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem

Modified: stable/11/sys/i386/conf/GENERIC
==
--- stable/11/sys/i386/conf/GENERIC Tue Sep 19 16:49:45 2017
(r323769)
+++ stable/11/sys/i386/conf/GENERIC Tue Sep 19 16:51:51 2017
(r323770)
@@ -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_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem

Modified: stable/11/sys/powerpc/conf/GENERIC
==
--- stable/11/sys/powerpc/conf/GENERIC  Tue Sep 19 16:49:45 2017
(r323769)
+++ stable/11/sys/powerpc/conf/GENERIC  Tue Sep 19 16:51:51 2017
(r323770)
@@ -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
 optionsSCTP#Stream Control Transmission Protocol
 optionsFFS #Berkeley Fast Filesystem
 optionsSOFTUPDATES #Enable FFS soft updates support

Modified: stable/11/sys/riscv/conf/GENERIC
==
--- stable/11/sys/riscv/conf/GENERICTue Sep 19 16:49:45 2017
(r323769)
+++ stable/11/sys/riscv/conf/GENERICTue Sep 19 16:51:51 2017
(r323770)
@@ -32,6 +32,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
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem

Modified: stable/11/sys/sparc64/conf/GENERIC
==
--- stable/11/sys/sparc64/conf/GENERIC  Tue Sep 19 16:49:45 2017
(r323769)
+++ stable/11/sys/sparc64/conf/GEN

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   

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

2017-09-01 Thread Josh Paetzel
Ok, I'm going to revert it for now.  There was a mistake in the commit,
the commit message was wrong, and it sounds like we need more consensus.


On Fri, Sep 1, 2017, at 11:54 AM, Ian Lepore wrote:
> On Fri, 2017-09-01 at 09:06 -0700, Conrad Meyer wrote:
> > Wait, why?  The PR doesn't explain it any better than this commit
> > message.
> > 
> > On Fri, Sep 1, 2017 at 8:54 AM, Josh Paetzel 
> > wrote:
> > > 
> > > 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
> 
> The differential revision (which should be cited using the complete url
> in the commit) seems to indicate that it's because it can be kldloaded.
> 
> This change misses the armv6 platform, where the option appears in
> std.armv6, which gets included in GENERIC (and all other armv6
> configs).
> 
> This change seems to warrant an entry in UPDATING, because it's going
> to catch a lot of people by surprise.  Even people with custom kernels,
> if they follow the advice of the handbook and "include GENERIC" then
> override things.
> 
> -- Ian
> _______
> svn-src-all@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


-- 

Thanks,

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

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

2017-09-01 Thread Josh Paetzel
Yeah, the commit message is horrible.  I apologize.

The phabricator is a little better but you have to read and parse the
whole thing.

Then end result of this change is you can kldload ipsec AND tcpmd5,
however ipsec support won't be in GENERIC.

(which is the consensus from the phab)

On Fri, Sep 1, 2017, at 11:06 AM, Conrad Meyer wrote:
> Wait, why?  The PR doesn't explain it any better than this commit
> message.
> 
> On Fri, Sep 1, 2017 at 8:54 AM, Josh Paetzel 
> wrote:
> > 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
> ___
> svn-src-all@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


-- 

Thanks,

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


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   

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

2017-08-31 Thread Josh Paetzel


On Thu, Aug 31, 2017, at 04:25 PM, Andrey V. Elsukov wrote:
> On 31.08.2017 23:16, Josh Paetzel wrote:
> > 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
> 
> JFYI, there is related review: https://reviews.freebsd.org/D11806
> 
> -- 
> WBR, Andrey V. Elsukov
> 
> Email had 1 attachment:
> + signature.asc
>   1k (application/pgp-signature)

Thanks for pointing that out.  I'm going to go ahead and remove IPSEC
and site the review then as well as long as Xin is ok with that.

Xin,

Any objections?  There was a bug but the review wasn't linked so I had
no idea it was in process.

-- 

Thanks,

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


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# In

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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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 = &format_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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r319992 - stable/10/contrib/smbfs/lib/smb

2017-06-15 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Jun 15 23:14:04 2017
New Revision: 319992
URL: https://svnweb.freebsd.org/changeset/base/319992

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

Modified:
  stable/10/contrib/smbfs/lib/smb/subr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/smbfs/lib/smb/subr.c
==
--- stable/10/contrib/smbfs/lib/smb/subr.c  Thu Jun 15 21:34:43 2017
(r319991)
+++ stable/10/contrib/smbfs/lib/smb/subr.c  Thu Jun 15 23:14:04 2017
(r319992)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r319980 - stable/11/contrib/smbfs/lib/smb

2017-06-15 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Jun 15 16:12:45 2017
New Revision: 319980
URL: https://svnweb.freebsd.org/changeset/base/319980

Log:
  MFC 319670
  
  Fix SMBFS when saved passwords are greater than 18 character
  
  PR:   132302
  Submitted by: dhorn2...@gmail.com g...@unixarea.de
  Approved by:  re (gjb)

Modified:
  stable/11/contrib/smbfs/lib/smb/subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/smbfs/lib/smb/subr.c
==
--- stable/11/contrib/smbfs/lib/smb/subr.c  Thu Jun 15 15:50:49 2017
(r319979)
+++ stable/11/contrib/smbfs/lib/smb/subr.c  Thu Jun 15 16:12:45 2017
(r319980)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318806 - stable/10/sys/dev/tws

2017-05-24 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 24 20:13:49 2017
New Revision: 318806
URL: https://svnweb.freebsd.org/changeset/base/318806

Log:
  MFC 318401
  
  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

Modified:
  stable/10/sys/dev/tws/tws.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/tws/tws.h
==
--- stable/10/sys/dev/tws/tws.h Wed May 24 20:10:38 2017(r318805)
+++ stable/10/sys/dev/tws/tws.h Wed May 24 20:13:49 2017(r318806)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318805 - stable/11/sys/dev/tws

2017-05-24 Thread Josh Paetzel
Author: jpaetzel
Date: Wed May 24 20:10:38 2017
New Revision: 318805
URL: https://svnweb.freebsd.org/changeset/base/318805

Log:
  MFC 318401
  
  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

Modified:
  stable/11/sys/dev/tws/tws.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/tws/tws.h
==
--- stable/11/sys/dev/tws/tws.h Wed May 24 20:01:12 2017(r318804)
+++ stable/11/sys/dev/tws/tws.h Wed May 24 20:10:38 2017(r318805)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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->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  /* 4k */
+/*
+ * If we ever increase this value beyond 20, we need to revisit all log

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->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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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(&msp->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 = &msp->ms_freetree[txg & TXG_MASK];
-   range_tree_t **freed_tree =
-   &msp->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);
+   ASSERT3P(msp->ms_freedtree, !=, NULL);
 
/*
 * Normally, we don't wa

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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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->dn_struct_rwlock, RW_WRITER);
bzero(db->db.db_data, db->db.db_size);
+   rw_exit(&dn->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->dn_struct_rwlock, RW_READER);
VERIFY0(dbuf_hold_impl(dn, db->db_level - 1,
-   i, TRUE, FALSE, FTAG, &subdb));
+   id, TRUE, FALSE, FTAG, &subdb));
rw_exit(&dn->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->dn_struct_rwlock, RW_WRITER);
bzero(db->db.db_data, db->db.db_size);
+   rw_exit(&dn->dn_struct_rwlock);
free_blocks(dn, db->db_blkptr, 1, tx);
} else {
/*
___
svn

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, &dd);
+   /*
+* 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, &dd);
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, &ds);
+
+   /*
+* 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 @@ out:
mutex_exit(dcp->dc_error_lock);
}
 
+   if (dcp->dc_ddname != NULL)
+  

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 flags and the
 .Sy large_blocks
 feature.
-.It Fl e
+.It Fl e, -embed
 Generate a more compact stream by using WRITE_EMBEDDED records for blocks
 which are stored more compactly on disk by the
 .Sy embedded_data
@@ -2646,11 +2646,25 @@ S

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
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cFri Apr 
21 19:41:33 2017(r317266)
+++ head/cddl/contrib/opensolaris/lib/libzfs/comm

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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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 future.
+*/
+   if ((zio->io_error == ENOTSUP || zio->io_error == ENOTTY) &&
+   zio->io_type == ZIO_TYPE

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->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
 * described in traverse_visitbp.
 */
-   if (P2PHASE(ob

svn commit: r316752 - vendor/illumos/dist/man/man1m

2017-04-12 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Apr 13 05:55:36 2017
New Revision: 316752
URL: https://svnweb.freebsd.org/changeset/base/316752

Log:
  5409 Remove shareiscsi description and example from zfs(1M)
  
  illumos/illumos-gate@b3cff10cdd26674d8dc66e0b349fd185df709fad
  
https://github.com/illumos/illumos-gate/commit/b3cff10cdd26674d8dc66e0b349fd185df709fad
  
  https://www.illumos.org/issues/5409
  
  Reviewed by: Matthew Ahrens 
  Approved by: Gordon Ross 

Modified:
  vendor/illumos/dist/man/man1m/zfs.1m

Modified: vendor/illumos/dist/man/man1m/zfs.1m
==
--- vendor/illumos/dist/man/man1m/zfs.1mThu Apr 13 05:47:52 2017
(r316751)
+++ vendor/illumos/dist/man/man1m/zfs.1mThu Apr 13 05:55:36 2017
(r316752)
@@ -1,4 +1,3 @@
-'\" t
 .\"
 .\" CDDL HEADER START
 .\"
@@ -26,647 +25,574 @@
 .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
 .\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
 .\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
-.\" Copyright 2014 Nexenta Systems, Inc.  All Rights Reserved.
+.\" Copyright 2015 Nexenta Systems, Inc.  All Rights Reserved.
 .\"
-.TH ZFS 1M "November 11, 2014"
-.SH NAME
-zfs \- configures ZFS file systems
-.SH SYNOPSIS
-.LP
-.nf
-\fBzfs\fR [\fB-?\fR]
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBcreate\fR [\fB-p\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR]... 
\fIfilesystem\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBcreate\fR [\fB-ps\fR] [\fB-b\fR \fIblocksize\fR] [\fB-o\fR 
\fIproperty\fR=\fIvalue\fR]... \fB-V\fR \fIsize\fR \fIvolume\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBdestroy\fR [\fB-fnpRrv\fR] \fIfilesystem\fR|\fIvolume\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBdestroy\fR [\fB-dnpRrv\fR] 
\fIfilesystem\fR|\fIvolume\fR@\fIsnap\fR[%\fIsnap\fR][,\fIsnap\fR[%\fIsnap\fR]]...
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBdestroy\fR \fIfilesystem\fR|\fIvolume\fR#\fIbookmark\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBsnapshot\fR [\fB-r\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR]...
-  \fIfilesystem@snapname\fR|\fIvolume@snapname\fR...
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBrollback\fR [\fB-rRf\fR] \fIsnapshot\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBclone\fR [\fB-p\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR]... 
\fIsnapshot\fR \fIfilesystem\fR|\fIvolume\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBpromote\fR \fIclone-filesystem\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBrename\fR [\fB-f\fR] \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR
- \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBrename\fR [\fB-fp\fR] \fIfilesystem\fR|\fIvolume\fR 
\fIfilesystem\fR|\fIvolume\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBrename\fR \fB-r\fR \fIsnapshot\fR \fIsnapshot\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-Hp\fR][\fB-o\fR 
\fIproperty\fR[,\fIproperty\fR]...] [\fB-t\fR \fItype\fR[,\fItype\fR]...]
- [\fB-s\fR \fIproperty\fR]... [\fB-S\fR \fIproperty\fR]... 
[\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR]...
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBset\fR \fIproperty\fR=\fIvalue\fR... 
\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR...
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBget\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-Hp\fR][\fB-o\fR 
\fIfield\fR[,\fIfield\fR]...] [\fB-t\fR \fItype\fR[,\fItype\fR]...]
-[\fB-s\fR \fIsource\fR[,\fIsource\fR]...] \fBall\fR | 
\fIproperty\fR[,\fIproperty\fR]...
-\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR...
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBinherit\fR [\fB-rS\fR] \fIproperty\fR 
\fIfilesystem\fR|\fIvolume|snapshot\fR...
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBupgrade\fR [\fB-v\fR]
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBupgrade\fR [\fB-r\fR] [\fB-V\fR \fIversion\fR] \fB-a\fR | 
\fIfilesystem\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBuserspace\fR [\fB-Hinp\fR] [\fB-o\fR 
\fIfield\fR[,\fIfield\fR]...] [\fB-s\fR \fIfield\fR]...
-[\fB-S\fR \fIfield\fR]... [\fB-t\fR \fItype\fR[,\fItype\fR]...] 
\fIfilesystem\fR|\fIsnapshot\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBgroupspace\fR [\fB-Hinp\fR] [\fB-o\fR 
\fIfield\fR[,\fIfield\fR]...] [\fB-s\fR \fIfield\fR]...
-[\fB-S\fR \fIfield\fR]... [\fB-t\fR \fItype\fR[,\fItype\fR]...] 
\fIfilesystem\fR|\fIsnapshot\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBmount\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBmount\fR [\fB-vO\fR] [\fB-o \fIoptions\fR\fR] \fB-a\fR | 
\fIfilesystem\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBunmount\fR [\fB-f\fR] \fB-a\fR | \fIfilesystem\fR|\fImountpoint\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBshare\fR \fB-a\fR | \fIfilesystem\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBunshare\fR \fB-a\fR \fIfilesystem\fR|\fImountpoint\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBbookmark\fR \fIsnapshot\fR \fIbookmark\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBsend\fR [\fB-DnPpRveL\fR] [\fB-\fR[\fBiI\fR] \fIsnapshot\fR] 
\fIsnapshot\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBsend\fR [\fB-eL\fR] [\fB-i \fIsnapshot\fR|\fIbookmark\fR]\fR 
\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBreceive\fR [\fB-vnFu\fR] 
\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR
-.fi
-
-.LP
-.nf
-\fBzfs\fR \fBreceive\fR [\fB-vnFu\fR] [\fB-d\fR|\f

svn commit: r316751 - vendor/illumos/dist/man/man1m

2017-04-12 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Apr 13 05:47:52 2017
New Revision: 316751
URL: https://svnweb.freebsd.org/changeset/base/316751

Log:
  5661 ZFS: "compression = on" should use lz4 if feature is enabled
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Josef 'Jeff' Sipek 
  Reviewed by: Xin LI 
  Approved by: Robert Mustacchi 
  Author: Justin T. Gibbs 
  
  illumos/illumos-gate@db1741f555ec79def5e9846e6bfd132248514ff

Modified:
  vendor/illumos/dist/man/man1m/zfs.1m

Modified: vendor/illumos/dist/man/man1m/zfs.1m
==
--- vendor/illumos/dist/man/man1m/zfs.1mThu Apr 13 04:10:27 2017
(r316750)
+++ vendor/illumos/dist/man/man1m/zfs.1mThu Apr 13 05:47:52 2017
(r316751)
@@ -987,20 +987,25 @@ Changing this property affects only newl
 .sp
 .ne 2
 .na
-\fB\fBcompression\fR=\fBon\fR | \fBoff\fR | \fBlzjb\fR | \fBgzip\fR |
-\fBgzip-\fR\fIN\fR | \fBzle\fR\fR | \fBlz4\fR
+\fB\fBcompression\fR=\fBon\fR | \fBoff\fR | \fBlzjb\fR | \fBlz4\fR |
+\fBgzip\fR | \fBgzip-\fR\fIN\fR | \fBzle\fR\fR
 .ad
 .sp .6
 .RS 4n
-Controls the compression algorithm used for this dataset. The \fBlzjb\fR
-compression algorithm is optimized for performance while providing decent data
-compression. Setting compression to \fBon\fR uses the \fBlzjb\fR compression
-algorithm. The \fBgzip\fR compression algorithm uses the same compression as
-the \fBgzip\fR(1) command. You can specify the \fBgzip\fR level by using the
-value \fBgzip-\fR\fIN\fR where \fIN\fR is an integer from 1 (fastest) to 9
-(best compression ratio). Currently, \fBgzip\fR is equivalent to \fBgzip-6\fR
-(which is also the default for \fBgzip\fR(1)). The \fBzle\fR compression
-algorithm compresses runs of zeros.
+Controls the compression algorithm used for this dataset.
+.sp
+Setting compression to \fBon\fR indicates that the current default
+compression algorithm should be used.  The default balances compression
+and decompression speed, with compression ratio and is expected to
+work well on a wide variety of workloads.  Unlike all other settings for
+this property, \fBon\fR does not select a fixed compression type.  As
+new compression algorithms are added to ZFS and enabled on a pool, the
+default compression algorithm may change.  The current default compression
+algorthm is either \fBlzjb\fR or, if the \fBlz4_compress\fR feature is
+enabled, \fBlz4\fR.
+.sp
+The \fBlzjb\fR compression algorithm is optimized for performance while
+providing decent data compression.
 .sp
 The \fBlz4\fR compression algorithm is a high-performance replacement
 for the \fBlzjb\fR algorithm. It features significantly faster
@@ -1010,6 +1015,13 @@ the \fBlz4_compress\fR feature set to \f
 \fBzpool-features\fR(5) for details on ZFS feature flags and the
 \fBlz4_compress\fR feature.
 .sp
+The \fBgzip\fR compression algorithm uses the same compression as
+the \fBgzip\fR(1) command. You can specify the \fBgzip\fR level by using the
+value \fBgzip-\fR\fIN\fR where \fIN\fR is an integer from 1 (fastest) to 9
+(best compression ratio). Currently, \fBgzip\fR is equivalent to \fBgzip-6\fR
+(which is also the default for \fBgzip\fR(1)). The \fBzle\fR compression
+algorithm compresses runs of zeros.
+.sp
 This property can also be referred to by its shortened column name
 \fBcompress\fR. Changing this property affects only newly-written data.
 .RE
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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&r 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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315989 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2017-03-26 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Mar 26 16:49:20 2017
New Revision: 315989
URL: https://svnweb.freebsd.org/changeset/base/315989

Log:
  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&r 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:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Sun Mar 26 16:46:39 
2017(r315988)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Sun Mar 26 16:49:20 
2017(r315989)
@@ -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: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Sun Mar 26 16:46:39 
2017(r315988)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Sun Mar 26 16:49:20 
2017(r315989)
@@ -753,8 +753,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315291 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2017-03-14 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Mar 15 04:18:40 2017
New Revision: 315291
URL: https://svnweb.freebsd.org/changeset/base/315291

Log:
  7303 dynamic metaslab selection
  
  illumos/illumos-gate@8363e80ae72609660f6090766ca8c2c18aa53f0c
  
https://github.com/illumos/illumos-gate/commit/8363e80ae72609660f6090766ca8c2c18aa53f0
  
  https://www.illumos.org/issues/7303
  
This change introduces a new weighting algorithm to improve metaslab 
selection.
The new weighting algorithm relies on the SPACEMAP_HISTOGRAM feature. As a 
result,
the metaslab weight now encodes the type of weighting algorithm used
(size-based vs segment-based).
  
This also introduce a new allocation tracing facility and two new dcmds to 
help
debug allocation problems. Each zio now contains a zio_alloc_list_t 
structure
that is populated as the zio goes through the allocations stage. Here's an
example of how to use the tracing facility:
  
  > c5ec000::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
MSIDDVAASIZE  WEIGHT RESULT   VDEV
   -  0  400   0NOT_ALLOCATABLE   ztest.0a
   -  0  400   0NOT_ALLOCATABLE   ztest.0a
   -  0  400   0 ENOSPC   ztest.0a
   -  0  200   0NOT_ALLOCATABLE   ztest.0a
   -  0  200   0NOT_ALLOCATABLE   ztest.0a
   -  0  200   0 ENOSPC   ztest.0a
   1  0  400  1 x 8M17b1a00   ztest.0a
  
  > 1ff2400::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
MSIDDVAASIZE  WEIGHT RESULT   VDEV
   -  0  200   0NOT_ALLOCATABLE   mirror-2
   -  0  200   0NOT_ALLOCATABLE   mirror-0
   1  0  200  1 x 4M112ae00   mirror-1
   -  1  200   0NOT_ALLOCATABLE   mirror-2
   -  1  200   0NOT_ALLOCATABLE   mirror-0
   1  1  200  1 x 4M112b000   mirror-1
   -  2  200   0NOT_ALLOCATABLE   mirror-2
  
If the metaslab is using segment-based weighting then the WEIGHT column will
display the number of segments available in the bucket where the allocation
attempt was made.
  
  Author: George Wilson 
  Reviewed by: Alex Reece 
  Reviewed by: Chris Siden 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Prakash Surya 
  Reviewed by: Don Brady 
  Approved by: Richard Lowe 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_debug.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.cWed Mar 15 
04:16:08 2017(r315290)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.cWed Mar 15 
04:18:40 2017(r315291)
@@ -38,18 +38,13 @@
 #defineGANG_ALLOCATION(flags) \
((flags) & (METASLAB_GANG_CHILD | METASLAB_GANG_HEADER))
 
-#defineMETASLAB_WEIGHT_PRIMARY (1ULL << 63)
-#defineMETASLAB_WEIGHT_SECONDARY   (1ULL << 62)
-#defineMETASLAB_ACTIVE_MASK\
-   (METASLAB_WEIGHT_PRIMARY | METASLAB_WEIGHT_SECONDARY)
-
 uint64_t metaslab_aliquot = 512ULL << 10;
 uint64_t metaslab_gang_bang = SPA_MAXBLOCKSIZE + 1;/* force gang blocks */
 
 /*
  * The in-core space map representation is more compact than its on-disk form.
  * The zfs_condense_pct determines how much more compact the in-core
- * space_map representation must be before we compact it on-disk.
+ * space map representation must be before we compact it on-disk.
  * Values should be greater than or equal to 100.
  */
 int zfs_condense_pct = 200;
@@ -122,7 +117,7 @@ uint64_t metaslab_df_alloc_threshold = S
 /*
  * The minimum free space, in percent, which must be available
  * in a space map to continue allocations in a first-fit fashion.
- * Once the space_map's free space drops below this level we dynamically
+ * Once the space map's free space drops below this level we dynamically
  * switch to using best-fit allocations.
  */
 int metaslab_df_free_pct = 4;
@@ -170,7 +165,38 @@ boolean_t metaslab_lba_weighting_enabled
  */
 boolean_t 

svn commit: r315290 - in vendor/illumos/dist: cmd/zdb cmd/ztest lib/libzpool/common lib/libzpool/common/sys

2017-03-14 Thread Josh Paetzel
Author: jpaetzel
Date: Wed Mar 15 04:16:08 2017
New Revision: 315290
URL: https://svnweb.freebsd.org/changeset/base/315290

Log:
  7303 dynamic metaslab selection
  
  illumos/illumos-gate@8363e80ae72609660f6090766ca8c2c18aa53f0c
  
https://github.com/illumos/illumos-gate/commit/8363e80ae72609660f6090766ca8c2c18aa53f0
  
  https://www.illumos.org/issues/7303
  
This change introduces a new weighting algorithm to improve metaslab 
selection.
The new weighting algorithm relies on the SPACEMAP_HISTOGRAM feature. As a 
result,
the metaslab weight now encodes the type of weighting algorithm used
(size-based vs segment-based).
  
This also introduce a new allocation tracing facility and two new dcmds to 
help
debug allocation problems. Each zio now contains a zio_alloc_list_t 
structure
that is populated as the zio goes through the allocations stage. Here's an
example of how to use the tracing facility:
  
  > c5ec000::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
MSIDDVAASIZE  WEIGHT RESULT   VDEV
   -  0  400   0NOT_ALLOCATABLE   ztest.0a
   -  0  400   0NOT_ALLOCATABLE   ztest.0a
   -  0  400   0 ENOSPC   ztest.0a
   -  0  200   0NOT_ALLOCATABLE   ztest.0a
   -  0  200   0NOT_ALLOCATABLE   ztest.0a
   -  0  200   0 ENOSPC   ztest.0a
   1  0  400  1 x 8M17b1a00   ztest.0a
  
  > 1ff2400::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
MSIDDVAASIZE  WEIGHT RESULT   VDEV
   -  0  200   0NOT_ALLOCATABLE   mirror-2
   -  0  200   0NOT_ALLOCATABLE   mirror-0
   1  0  200  1 x 4M112ae00   mirror-1
   -  1  200   0NOT_ALLOCATABLE   mirror-2
   -  1  200   0NOT_ALLOCATABLE   mirror-0
   1  1  200  1 x 4M112b000   mirror-1
   -  2  200   0NOT_ALLOCATABLE   mirror-2
  
If the metaslab is using segment-based weighting then the WEIGHT column will
display the number of segments available in the bucket where the allocation
attempt was made.
  
  Author: George Wilson 
  Reviewed by: Alex Reece 
  Reviewed by: Chris Siden 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Prakash Surya 
  Reviewed by: Don Brady 
  Approved by: Richard Lowe 

Modified:
  vendor/illumos/dist/cmd/zdb/zdb.c
  vendor/illumos/dist/cmd/ztest/ztest.c
  vendor/illumos/dist/lib/libzpool/common/kernel.c
  vendor/illumos/dist/lib/libzpool/common/sys/zfs_context.h

Modified: vendor/illumos/dist/cmd/zdb/zdb.c
==
--- vendor/illumos/dist/cmd/zdb/zdb.c   Wed Mar 15 00:29:27 2017
(r315289)
+++ vendor/illumos/dist/cmd/zdb/zdb.c   Wed Mar 15 04:16:08 2017
(r315290)
@@ -2562,10 +2562,21 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 
if (!dump_opt['L']) {
vdev_t *rvd = spa->spa_root_vdev;
+
+   /*
+* We are going to be changing the meaning of the metaslab's
+* ms_tree.  Ensure that the allocator doesn't try to
+* use the tree.
+*/
+   spa->spa_normal_class->mc_ops = &zdb_metaslab_ops;
+   spa->spa_log_class->mc_ops = &zdb_metaslab_ops;
+
for (uint64_t c = 0; c < rvd->vdev_children; c++) {
vdev_t *vd = rvd->vdev_child[c];
+   metaslab_group_t *mg = vd->vdev_mg;
for (uint64_t m = 0; m < vd->vdev_ms_count; m++) {
metaslab_t *msp = vd->vdev_ms[m];
+   ASSERT3P(msp->ms_group, ==, mg);
mutex_enter(&msp->ms_lock);
metaslab_unload(msp);
 
@@ -2586,8 +2597,6 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
(longlong_t)m,
(longlong_t)vd->vdev_ms_count);
 
-   msp->ms_ops = &zdb_metaslab_ops;
-
/*
 * We don't want to spend the CPU
 * manipulating the size-ordered
@@ -2597,7 +2606,10 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
msp->ms_tree->rt_ops = NULL;
VERIFY0(space_map_load(msp->ms_sm,
msp->ms_tree, SM_ALL

svn commit: r314874 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-03-07 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Mar  7 18:31:03 2017
New Revision: 314874
URL: https://svnweb.freebsd.org/changeset/base/314874

Log:
  MFC 313879
  
  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:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Tue Mar 
 7 18:27:35 2017(r314873)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Tue Mar 
 7 18:31:03 2017(r314874)
@@ -4084,7 +4084,6 @@ arc_reclaim_thread(void *dummy __unused)
 
mutex_enter(&arc_reclaim_lock);
while (!arc_reclaim_thread_exit) {
-   int64_t free_memory = arc_available_memory();
uint64_t evicted = 0;
 
/*
@@ -4103,6 +4102,14 @@ arc_reclaim_thread(void *dummy __unused)
 
mutex_exit(&arc_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;
@@ -4136,8 +4143,6 @@ arc_reclaim_thread(void *dummy __unused)
arc_no_grow = B_FALSE;
}
 
-   evicted = arc_adjust();
-
mutex_enter(&arc_reclaim_lock);
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314873 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-03-07 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Mar  7 18:27:35 2017
New Revision: 314873
URL: https://svnweb.freebsd.org/changeset/base/314873

Log:
  MFC 313879
  
  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:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Tue Mar 
 7 17:53:53 2017(r314872)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Tue Mar 
 7 18:27:35 2017(r314873)
@@ -4086,7 +4086,6 @@ arc_reclaim_thread(void *dummy __unused)
 
mutex_enter(&arc_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(&arc_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(&arc_reclaim_lock);
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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,
 &zvol_unmap_enabled, 0,
 "Enable UNMAP functionality");
 
+SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_sync_enabled, CTLFLAG_RWTUN,
+&zvol_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 &&
+   (!(zv->zv_flags & ZVOL_WCE) ||
+   (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS) ||
+   (df.df_flags & DF_WAIT_SYNC))) {
+   zil_commit(zv->zv_

svn commit: r314276 - vendor-sys/illumos/dist/uts/common/fs/zfs

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

Log:
  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:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.cSat Feb 25 18:14:32 
2017(r314275)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.cSat Feb 25 19:16:20 
2017(r314276)
@@ -24,7 +24,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]
  */
@@ -148,6 +148,12 @@ int zvol_maxphys = DMU_MAX_ACCESS/2;
  */
 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;
+
 extern int zfs_set_prop_nvlist(const char *, zprop_source_t,
 nvlist_t *, nvlist_t *);
 static int zvol_remove_zv(zvol_state_t *);
@@ -1811,26 +1817,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 &&
+   (!(zv->zv_flags & ZVOL_WCE) ||
+   (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS) ||
+   (df.df_flags & DF_WAIT_SYNC))) {
+   zil_commit(zv->zv_zilog, ZVOL_OBJ);
}
+
return (error);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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->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->dbu_tqent);
+   }
 }
 
 boolean_t

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Sat Feb 25 
14:41:06 2017(r314266)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/

svn commit: r314243 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2017-02-24 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Feb 25 03:34:22 2017
New Revision: 314243
URL: https://svnweb.freebsd.org/changeset/base/314243

Log:
  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:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dir.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sa.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zap_impl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cSat Feb 25 03:33:09 
2017(r314242)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cSat Feb 25 03:34:22 
2017(r314243)
@@ -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->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->dbu_tqent);
+   }
 }
 
 boolean_t

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c   Sat Feb 25 03:33:09 
2017(r314242)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c   Sat Feb 25 03:34:22 
2017(r314243)
@@ -1009,7 +1009,7 @@ dnode_special_open(objset_t *os, dnode_p
 }
 
 static void
-dnode_buf_pageout(void *dbu)
+dnode_buf_evict_async(void *dbu)
 {
dnode_children_t *childr

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(&arc_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(&arc_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(&arc_reclaim_lock);
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313876 - vendor-sys/illumos/dist/uts/common/fs/zfs

2017-02-17 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Feb 17 15:00:13 2017
New Revision: 313876
URL: https://svnweb.freebsd.org/changeset/base/313876

Log:
  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:
  vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Fri Feb 17 14:55:59 
2017(r313875)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Fri Feb 17 15:00:13 
2017(r313876)
@@ -3748,7 +3748,6 @@ arc_reclaim_thread(void)
 
mutex_enter(&arc_reclaim_lock);
while (!arc_reclaim_thread_exit) {
-   int64_t free_memory = arc_available_memory();
uint64_t evicted = 0;
 
/*
@@ -3767,6 +3766,14 @@ arc_reclaim_thread(void)
 
mutex_exit(&arc_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;
@@ -3800,8 +3807,6 @@ arc_reclaim_thread(void)
arc_no_grow = B_FALSE;
}
 
-   evicted = arc_adjust();
-
mutex_enter(&arc_reclaim_lock);
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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->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->dn_dbufs, &db_search, &where);
-   ASSERT3P(db, ==, NULL);
-   db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER);
-   ASSERT(db == NULL || db->db_level > 0);
-#endif
-   mutex_exit(&dn->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(&zfs_free_range_recv_miss);
-   }
-
db = avl_find(&dn->dn_dbufs, &db_search, &where);
ASSERT3P(db, ==, NULL);
+
db = avl_nearest(&dn->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->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->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 
17:08:43 2017(r313812)
+++ head/sys/cddl/contrib/opensol

svn commit: r313786 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2017-02-15 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Feb 16 01:44:56 2017
New Revision: 313786
URL: https://svnweb.freebsd.org/changeset/base/313786

Log:
  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:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cWed Feb 15 23:49:28 
2017(r313785)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.cThu Feb 16 01:44:56 
2017(r313786)
@@ -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->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->dn_dbufs, &db_search, &where);
-   ASSERT3P(db, ==, NULL);
-   db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER);
-   ASSERT(db == NULL || db->db_level > 0);
-#endif
-   mutex_exit(&dn->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(&zfs_free_range_recv_miss);
-   }
-
db = avl_find(&dn->dn_dbufs, &db_search, &where);
ASSERT3P(db, ==, NULL);
+
db = avl_nearest(&dn->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->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->dn_dbufs_mtx);
arc_space_consume(sizeof (dmu_buf_impl_t), ARC_SPACE_OTHER);

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c   Wed Feb 15 23:49:28 
2017(r313785)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c   Thu Feb 16 01:44:56 
2017(r313786)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights res

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,
 &zfs_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,
+   &zfs_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, <=, chunk_end);
 
-   dmu_tx_t *tx = dmu_tx_create(os);
-   dmu_tx_hold_free(tx, dn->dn

svn commit: r312445 - stable/11/sys/netinet

2017-01-19 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Jan 20 00:17:53 2017
New Revision: 312445
URL: https://svnweb.freebsd.org/changeset/base/312445

Log:
  Revert MFC of 310847 and 310864
  
  Requested by glebius who had questions about the original
  head commit that I didn't see.

Modified:
  stable/11/sys/netinet/ip_carp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/ip_carp.c
==
--- stable/11/sys/netinet/ip_carp.c Fri Jan 20 00:15:11 2017
(r312444)
+++ stable/11/sys/netinet/ip_carp.c Fri Jan 20 00:17:53 2017
(r312445)
@@ -581,96 +581,27 @@ 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)
-{
-#ifdef INET
-   struct ip *ip4;
-   struct in_addr in4;
-#endif
-#ifdef INET6
-   struct ip6_hdr *ip6;
-   struct in6_addr in6;
-#endif
-
-   switch (af) {
-#ifdef INET
-   case AF_INET:
-   ip4 = mtod(m, struct ip *);
-   in4 = ifatoia(ifa)->ia_addr.sin_addr;
-   return (in4.s_addr == ip4->ip_src.s_addr);
-#endif
-#ifdef INET6
-   case AF_INET6:
-   ip6 = mtod(m, struct ip6_hdr *);
-   in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
-   return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0);
-#endif
-   default:
-   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, *match;
+   struct ifaddr *ifa;
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.
-*
-* 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).
-*/
+   /* verify that the VHID is valid on the receiving interface */
IF_ADDR_RLOCK(ifp);
-   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);
+   IFNET_FOREACH_IFA(ifp, ifa)
+   if (ifa->ifa_addr->sa_family == af &&
+   ifa->ifa_carp->sc_vhid == ch->carp_vhid) {
+   ifa_ref(ifa);
+   break;
+   }
IF_ADDR_RUNLOCK(ifp);
 
if (ifa == NULL) {
-   if (error == ELOOP) {
-   CARP_DEBUG("dropping looped packet on interface %s\n",
-   ifp->if_xname);
-   CARPSTATS_INC(carps_badif); /* ??? */
-   } else {
-   CARPSTATS_INC(carps_badvhid);
-   }
+   CARPSTATS_INC(carps_badvhid);
m_freem(m);
return;
}
@@ -856,41 +787,12 @@ 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 format in AF_INET and AF_INET6.)
- */
-static struct ifaddr *
-carp_best_ifa(int af, struct ifnet *ifp)
-{
-   struct ifaddr *ifa, *best;
-
-   if (af >= AF_MAX)
-   return (NULL);
-   best = NULL;
-   IF_ADDR_RLOCK(ifp);
-   TAILQ_FOREACH(ifa, &ifp->if_addrhea

svn commit: r312444 - stable/10/sys/netinet

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

Log:
  Revert MFC of 310847 and 310864
  
  Requested by glebius who had questions about the original
  head commit that I didn't see.

Modified:
  stable/10/sys/netinet/ip_carp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/ip_carp.c
==
--- stable/10/sys/netinet/ip_carp.c Fri Jan 20 00:02:11 2017
(r312443)
+++ stable/10/sys/netinet/ip_carp.c Fri Jan 20 00:15:11 2017
(r312444)
@@ -573,96 +573,27 @@ 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)
-{
-#ifdef INET
-   struct ip *ip4;
-   struct in_addr in4;
-#endif
-#ifdef INET6
-   struct ip6_hdr *ip6;
-   struct in6_addr in6;
-#endif
-
-   switch (af) {
-#ifdef INET
-   case AF_INET:
-   ip4 = mtod(m, struct ip *);
-   in4 = ifatoia(ifa)->ia_addr.sin_addr;
-   return (in4.s_addr == ip4->ip_src.s_addr);
-#endif
-#ifdef INET6
-   case AF_INET6:
-   ip6 = mtod(m, struct ip6_hdr *);
-   in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
-   return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0);
-#endif
-   default:
-   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, *match;
+   struct ifaddr *ifa;
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.
-*
-* 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).
-*/
+   /* verify that the VHID is valid on the receiving interface */
IF_ADDR_RLOCK(ifp);
-   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);
+   IFNET_FOREACH_IFA(ifp, ifa)
+   if (ifa->ifa_addr->sa_family == af &&
+   ifa->ifa_carp->sc_vhid == ch->carp_vhid) {
+   ifa_ref(ifa);
+   break;
+   }
IF_ADDR_RUNLOCK(ifp);
 
if (ifa == NULL) {
-   if (error == ELOOP) {
-   CARP_DEBUG("dropping looped packet on interface %s\n",
-   ifp->if_xname);
-   CARPSTATS_INC(carps_badif); /* ??? */
-   } else {
-   CARPSTATS_INC(carps_badvhid);
-   }
+   CARPSTATS_INC(carps_badvhid);
m_freem(m);
return;
}
@@ -858,41 +789,12 @@ 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 format in AF_INET and AF_INET6.)
- */
-static struct ifaddr *
-carp_best_ifa(int af, struct ifnet *ifp)
-{
-   struct ifaddr *ifa, *best;
-
-   if (af >= AF_MAX)
-   return (NULL);
-   best = NULL;
-   IF_ADDR_RLOCK(ifp);
-   TAILQ_FOREACH(ifa, &ifp->if_addrhea

svn commit: r312440 - stable/10/sys/netinet

2017-01-19 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Jan 19 23:42:26 2017
New Revision: 312440
URL: https://svnweb.freebsd.org/changeset/base/312440

Log:
  MFC 310847 310864
  
  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.
  
  Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6
  structs under the INET6 #ifdef. Similarly (even though it doesn't seem
  to affect the build), conditionalize all IPv4 structs under the INET
  #ifdef
  
  This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have not
  verified other MACHINE/TARGET pairs (e.g. armv6/arm).
  
  Submitted by: torek
  Obtained from:FreeNAS
  Pointyhat fix:ngie

Modified:
  stable/10/sys/netinet/ip_carp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/ip_carp.c
==
--- stable/10/sys/netinet/ip_carp.c Thu Jan 19 23:38:31 2017
(r312439)
+++ stable/10/sys/netinet/ip_carp.c Thu Jan 19 23:42:26 2017
(r312440)
@@ -573,27 +573,96 @@ 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)
+{
+#ifdef INET
+   struct ip *ip4;
+   struct in_addr in4;
+#endif
+#ifdef INET6
+   struct ip6_hdr *ip6;
+   struct in6_addr in6;
+#endif
+
+   switch (af) {
+#ifdef INET
+   case AF_INET:
+   ip4 = mtod(m, struct ip *);
+   in4 = ifatoia(ifa)->ia_addr.sin_addr;
+   return (in4.s_addr == ip4->ip_src.s_addr);
+#endif
+#ifdef INET6
+   case AF_INET6:
+   ip6 = mtod(m, struct ip6_hdr *);
+   in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
+   return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0);
+#endif
+   default:
+   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_b

svn commit: r312439 - stable/11/sys/netinet

2017-01-19 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Jan 19 23:38:31 2017
New Revision: 312439
URL: https://svnweb.freebsd.org/changeset/base/312439

Log:
  MFC 310847 310864
  
  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.
  
  Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6
  structs under the INET6 #ifdef. Similarly (even though it doesn't seem
  to affect the build), conditionalize all IPv4 structs under the INET
  #ifdef
  
  This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have not
  verified other MACHINE/TARGET pairs (e.g. armv6/arm).
  
  Submitted by: torek
  Obtained from:FreeNAS
  Pointyhat fix:ngie

Modified:
  stable/11/sys/netinet/ip_carp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/ip_carp.c
==
--- stable/11/sys/netinet/ip_carp.c Thu Jan 19 22:07:21 2017
(r312438)
+++ stable/11/sys/netinet/ip_carp.c Thu Jan 19 23:38:31 2017
(r312439)
@@ -581,27 +581,96 @@ 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)
+{
+#ifdef INET
+   struct ip *ip4;
+   struct in_addr in4;
+#endif
+#ifdef INET6
+   struct ip6_hdr *ip6;
+   struct in6_addr in6;
+#endif
+
+   switch (af) {
+#ifdef INET
+   case AF_INET:
+   ip4 = mtod(m, struct ip *);
+   in4 = ifatoia(ifa)->ia_addr.sin_addr;
+   return (in4.s_addr == ip4->ip_src.s_addr);
+#endif
+#ifdef INET6
+   case AF_INET6:
+   ip6 = mtod(m, struct ip6_hdr *);
+   in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
+   return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0);
+#endif
+   default:
+   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_b

svn commit: r312436 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2017-01-19 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Jan 19 20:44:29 2017
New Revision: 312436
URL: https://svnweb.freebsd.org/changeset/base/312436

Log:
  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 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Thu Jan 19 20:03:26 
2017(r312435)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Thu Jan 19 20:44:29 
2017(r312436)
@@ -56,6 +56,14 @@
  */
 int zfs_nopwrite_enabled = 1;
 
+/*
+ * 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;
+
 const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = {
{   DMU_BSWAP_UINT8,TRUE,   "unallocated"   },
{   DMU_BSWAP_ZAP,  TRUE,   "object directory"  },
@@ -717,15 +725,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;
 
if (dmu_objset_zfs_unmounting(dn->dn_objset))
return (SET_ERROR(EINTR));
@@ -739,9 +757,28 @@ dmu_free_long_range_impl(objset_t *os, d
ASSERT3U(chunk_begin, >=, offset);
ASSERT3U(chunk_begin, <=, chunk_end);
 
-   dmu_tx_t *tx = dmu_tx_create(os);
-   dmu_tx_hold_free(tx, dn->dn_object,
-   chunk_begin, chunk_end - chunk_begin);
+   chunk_len = chunk_end - chunk_begin;
+
+   mutex_enter(&dp->dp_lock);
+   for (int t = 0; t < TXG_SIZE; t++) {
+   long_free_dirty_all_txgs +=
+   dp->dp_long_free_dirty_pertxg[t];
+   }
+   mutex_exit(&dp->dp_lock);
+
+   /*
+* To avoid filling up a TXG with just frees wait for
+* the next T

svn commit: r312421 - stable/10/sys/fs/nfsserver

2017-01-19 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Jan 19 17:58:08 2017
New Revision: 312421
URL: https://svnweb.freebsd.org/changeset/base/312421

Log:
  MFC 311122
  
  Workaround NFS bug with readdirplus when there are greater than 1 billion 
files in a filesystem.
  
  Reviewed by:  kib

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Thu Jan 19 17:49:47 2017
(r312420)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Thu Jan 19 17:58:08 2017
(r312421)
@@ -2013,25 +2013,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, &nvp);
-   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
@@ -2100,16 +2092,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312420 - stable/11/sys/fs/nfsserver

2017-01-19 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Jan 19 17:49:47 2017
New Revision: 312420
URL: https://svnweb.freebsd.org/changeset/base/312420

Log:
  MFC 311122
  
  Workaround NFS bug with readdirplus when there are greater than 1 billion 
files in a filesystem.
  
  Reviewed by:  kib

Modified:
  stable/11/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdport.c   Thu Jan 19 17:09:11 2017
(r312419)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdport.c   Thu Jan 19 17:49:47 2017
(r312420)
@@ -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, &nvp);
-   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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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, &nvp);
-   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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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(&in6, &ip6->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 d

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 roce_frames_received;
+uint

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  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  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 
> 
> 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_stats_v2 {
> +uint32_t rsvd0[10];
> +uint32_t roce

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;
+uint32_t rx_alignment_symbol_errors;

svn commit: r294124 - stable/10/usr.sbin/mountd

2016-01-15 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Jan 16 01:40:46 2016
New Revision: 294124
URL: https://svnweb.freebsd.org/changeset/base/294124

Log:
  MFC 293305
  
  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
  Sponsored by: iXsystems

Modified:
  stable/10/usr.sbin/mountd/exports.5
  stable/10/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/mountd/exports.5
==
--- stable/10/usr.sbin/mountd/exports.5 Sat Jan 16 01:37:17 2016
(r294123)
+++ stable/10/usr.sbin/mountd/exports.5 Sat Jan 16 01:40:46 2016
(r294124)
@@ -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: stable/10/usr.sbin/mountd/mountd.c
==
--- stable/10/usr.sbin/mountd/mountd.c  Sat Jan 16 01:37:17 2016
(r294123)
+++ stable/10/usr.sbin/mountd/mountd.c  Sat Jan 16 01:40:46 2016
(r294124)
@@ -174,6 +174,7 @@ int check_options(struct dirlist *);
 intcheckmask(struct sockaddr *sa);
 intchk_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 @@ 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 ar

svn commit: r293446 - in stable/10: sys/kgssapi usr.sbin/gssd

2016-01-08 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Jan  8 23:58:32 2016
New Revision: 293446
URL: https://svnweb.freebsd.org/changeset/base/293446

Log:
  MFC 293043
  
  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.

Modified:
  stable/10/sys/kgssapi/gss_impl.c
  stable/10/usr.sbin/gssd/gssd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kgssapi/gss_impl.c
==
--- stable/10/sys/kgssapi/gss_impl.cFri Jan  8 22:59:49 2016
(r293445)
+++ stable/10/sys/kgssapi/gss_impl.cFri Jan  8 23:58:32 2016
(r293446)
@@ -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(&sun);
-
-nconf = getnetconfigent("local");
-cl = clnt_reconnect_create(nconf,
-   (struct sockaddr *) &sun, 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(&sun);
+   
+   nconf = getnetconfigent("local");
+   cl = clnt_reconnect_create(nconf,
+   (struct sockaddr *) &sun, GSSD, GSSDVERS,
+   RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+   } else
+   cl = NULL;
 
mtx_lock(&kgss_gssd_lock);
oldcl = kgss_gssd_handle;

Modified: stable/10/usr.sbin/gssd/gssd.c
==
--- stable/10/usr.sbin/gssd/gssd.c  Fri Jan  8 22:59:49 2016
(r293445)
+++ stable/10/usr.sbin/gssd/gssd.c  Fri Jan  8 23:58:32 2016
(r293446)
@@ -253,6 +253,7 @@ main(int argc, char **argv)
 
gssd_syscall(_PATH_GSSDSOCK);
svc_run();
+   gssd_syscall("");
 
return (0);
 }
@@ -1284,6 +1285,7 @@ void gssd_terminate(int sig __unused)
if (hostbased_initiator_cred != 0)
unlink(GSSD_CREDENTIAL_CACHE_FILE);
 #endif
+   gssd_syscall("");
exit(0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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 +2899,

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(&sun);
-
-nconf = getnetconfigent("local");
-cl = clnt_reconnect_create(nconf,
-   (struct sockaddr *) &sun, 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(&sun);
+   
+   nconf = getnetconfigent("local");
+   cl = clnt_reconnect_create(nconf,
+   (struct sockaddr *) &sun, GSSD, GSSDVERS,
+   RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+   } else
+   cl = NULL;
 
mtx_lock(&kgss_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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291100 - stable/10/sys/kern

2015-11-20 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Nov 20 15:13:49 2015
New Revision: 291100
URL: https://svnweb.freebsd.org/changeset/base/291100

Log:
  MFC 290662
  
  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

Modified:
  stable/10/sys/kern/kern_racct.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_racct.c
==
--- stable/10/sys/kern/kern_racct.c Fri Nov 20 14:20:24 2015
(r291099)
+++ stable/10/sys/kern/kern_racct.c Fri Nov 20 15:13:49 2015
(r291100)
@@ -519,16 +519,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r288827 - in stable/10: sys/rpc/rpcsec_gss usr.sbin/gssd

2015-10-05 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Oct  5 17:15:04 2015
New Revision: 288827
URL: https://svnweb.freebsd.org/changeset/base/288827

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

Modified:
  stable/10/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
  stable/10/usr.sbin/gssd/gssd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
==
--- stable/10/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c   Mon Oct  5 14:57:45 
2015(r288826)
+++ stable/10/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c   Mon Oct  5 17:15:04 
2015(r288827)
@@ -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(&min_stat, name, client->cl_mech,
&uc->uid, &uc->gid, &numgroups, &uc->gidlist[0]);
if (GSS_ERROR(maj_stat))

Modified: stable/10/usr.sbin/gssd/gssd.c
==
--- stable/10/usr.sbin/gssd/gssd.c  Mon Oct  5 14:57:45 2015
(r288826)
+++ stable/10/usr.sbin/gssd/gssd.c  Mon Oct  5 17:15:04 2015
(r288827)
@@ -750,8 +750,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, &len);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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(&min_stat, name, client->cl_mech,
&uc->uid, &uc->gid, &numgroups, &uc->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, &len);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r288209 - stable/10/usr.sbin/ctld

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

Log:
  MFC 288208
  
  Fix typo.
  
  Sponsored by: iXsystems

Modified:
  stable/10/usr.sbin/ctld/ctld.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/ctld.c
==
--- stable/10/usr.sbin/ctld/ctld.c  Fri Sep 25 03:46:06 2015
(r288208)
+++ stable/10/usr.sbin/ctld/ctld.c  Fri Sep 25 03:54:10 2015
(r288209)
@@ -1132,7 +1132,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r285717 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-07-20 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Jul 20 14:38:40 2015
New Revision: 285717
URL: https://svnweb.freebsd.org/changeset/base/285717

Log:
  MFC 278040:
  
  Prevent inlining txg_quiesce
  
  This allows dtrace to monitor the calls to txg_quiesce which can be
  really helpful.
  
  Also standardize __noinline order for arc_kmem_reap_now.
  
  Sponsored by: Multiplay
  
  Approved by:  re

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

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Mon Jul 
20 13:46:22 2015(r285716)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Mon Jul 
20 14:38:40 2015(r285717)
@@ -2645,7 +2645,7 @@ extern kmem_cache_t   *zio_buf_cache[];
 extern kmem_cache_t*zio_data_buf_cache[];
 extern kmem_cache_t*range_seg_cache;
 
-static void __noinline
+static __noinline void
 arc_kmem_reap_now(arc_reclaim_strategy_t strat)
 {
size_t  i;

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c  Mon Jul 
20 13:46:22 2015(r285716)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c  Mon Jul 
20 14:38:40 2015(r285717)
@@ -354,7 +354,7 @@ txg_rele_to_sync(txg_handle_t *th)
  * On return, the transaction group has reached a stable state in which it can
  * then be passed off to the syncing context.
  */
-static void
+static __noinline void
 txg_quiesce(dsl_pool_t *dp, uint64_t txg)
 {
tx_state_t *tx = &dp->dp_tx;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r281446 - stable/10/etc/rc.d

2015-04-11 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Apr 12 01:14:43 2015
New Revision: 281446
URL: https://svnweb.freebsd.org/changeset/base/281446

Log:
  MFC 281112, 281166
  
  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.
  
  Typo Fix.
  
  PR:   199150

Modified:
  stable/10/etc/rc.d/pflog
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/pflog
==
--- stable/10/etc/rc.d/pflogSun Apr 12 00:02:32 2015(r281445)
+++ stable/10/etc/rc.d/pflogSun Apr 12 01:14:43 2015(r281446)
@@ -24,30 +24,30 @@ pflog_prestart()
 {
load_kld pflog || return 1
 
+   # create pflog_dev interface if needed
+   if ! ifconfig $pflog_dev > /dev/null 2>&1; 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 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
-   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  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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r281187 - stable/10/usr.sbin/ctld

2015-04-06 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Apr  7 04:21:36 2015
New Revision: 281187
URL: https://svnweb.freebsd.org/changeset/base/281187

Log:
  MFC 281084
  
  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.
  
  Sponsored by: iXsystems

Modified:
  stable/10/usr.sbin/ctld/ctld.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/ctld.c
==
--- stable/10/usr.sbin/ctld/ctld.c  Tue Apr  7 02:55:22 2015
(r281186)
+++ stable/10/usr.sbin/ctld/ctld.c  Tue Apr  7 04:21:36 2015
(r281187)
@@ -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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-04-05 Thread Josh Paetzel

> 
> Is a character device created for pflog?
> 

No.

> > +
> ># 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$||')
> > +
> 
> Could this use pgrep with a custom pidfile?
> 

Maybe?  But as far as I understand it no.  pgrep returns a pid.  Not
following how that would help in selecting the correct pidfile, but
maybe I'm missing something here.  Perhaps a more concrete example would
enlighten me.

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


-- 

Thanks,

Josh Paetzel
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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 2>&1; 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  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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r274646 - stable/10/sys/sys

2014-11-17 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Nov 18 07:16:03 2014
New Revision: 274646
URL: https://svnweb.freebsd.org/changeset/base/274646

Log:
  MFC 273866
  
  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:
  stable/10/sys/sys/buf_ring.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/buf_ring.h
==
--- stable/10/sys/sys/buf_ring.hTue Nov 18 07:03:10 2014
(r274645)
+++ stable/10/sys/sys/buf_ring.hTue Nov 18 07:16:03 2014
(r274646)
@@ -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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r274327 - in stable/10: etc/rc.d share/man/man5

2014-11-09 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Nov  9 20:08:43 2014
New Revision: 274327
URL: https://svnweb.freebsd.org/changeset/base/274327

Log:
  MFC: 258080
  
  Add support for multiple instances of ftp-proxy
  and pflog devices.
  
  PR: conf/158171
  Submitted by:   Thomas Johnson 

Modified:
  stable/10/etc/rc.d/ftp-proxy
  stable/10/etc/rc.d/pflog
  stable/10/share/man/man5/rc.conf.5
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/ftp-proxy
==
--- stable/10/etc/rc.d/ftp-proxySun Nov  9 20:04:29 2014
(r274326)
+++ stable/10/etc/rc.d/ftp-proxySun Nov  9 20:08:43 2014
(r274327)
@@ -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=""
+#  ftpproxy_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: stable/10/etc/rc.d/pflog
==
--- stable/10/etc/rc.d/pflogSun Nov  9 20:04:29 2014(r274326)
+++ stable/10/etc/rc.d/pflogSun Nov  9 20:08:43 2014(r274327)
@@ -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_confi

svn commit: r274326 - in stable/10/sys/cddl: compat/opensolaris/kern contrib/opensolaris/uts/common/fs contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/sys

2014-11-09 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Nov  9 20:04:29 2014
New Revision: 274326
URL: https://svnweb.freebsd.org/changeset/base/274326

Log:
  MFC: 273641
  
  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
  Sponsored by: iXsystems

Modified:
  stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
==
--- stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sun Nov 
 9 20:04:12 2014(r274325)
+++ stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sun Nov 
 9 20:04:29 2014(r274326)
@@ -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: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c  Sun Nov  9 
20:04:12 2014(r274325)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c  Sun Nov  9 
20:04:29 2014(r274326)
@@ -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,1

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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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: VO

svn commit: r267962 - stable/10/usr.sbin/ctld

2014-06-27 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Jun 27 17:10:28 2014
New Revision: 267962
URL: http://svnweb.freebsd.org/changeset/base/267962

Log:
  MFC: 267833
  
  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:
  stable/10/usr.sbin/ctld/parse.y
  stable/10/usr.sbin/ctld/token.l
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/parse.y
==
--- stable/10/usr.sbin/ctld/parse.y Fri Jun 27 16:33:43 2014
(r267961)
+++ stable/10/usr.sbin/ctld/parse.y Fri Jun 27 17:10:28 2014
(r267962)
@@ -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: stable/10/usr.sbin/ctld/token.l
==
--- stable/10/usr.sbin/ctld/token.l Fri Jun 27 16:33:43 2014
(r267961)
+++ stable/10/usr.sbin/ctld/token.l Fri Jun 27 17:10:28 2014
(r267962)
@@ -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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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 

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=""
+#  ftpproxy_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: r249490 - in stable/9: sbin/iscontrol sys/dev/iscsi/initiator

2013-04-14 Thread Josh Paetzel
Author: jpaetzel
Date: Sun Apr 14 22:38:28 2013
New Revision: 249490
URL: http://svnweb.freebsd.org/changeset/base/249490

Log:
  MFC 234223:
  
  Update to version 2.3.1.0
  
  MFC 234284, 234425, 234481:
  
  Unbreak the build caused by 234233
  
  PR:   kern/157770
  Obtained from:Daniel Braniss 

Modified:
  stable/9/sbin/iscontrol/Makefile
  stable/9/sbin/iscontrol/iscontrol.8
  stable/9/sbin/iscontrol/iscontrol.c
  stable/9/sbin/iscontrol/iscsi.conf.5
  stable/9/sys/dev/iscsi/initiator/isc_subr.c
  stable/9/sys/dev/iscsi/initiator/iscsi.c
  stable/9/sys/dev/iscsi/initiator/iscsi_subr.c
  stable/9/sys/dev/iscsi/initiator/iscsivar.h
Directory Properties:
  stable/9/sbin/iscontrol/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sbin/iscontrol/Makefile
==
--- stable/9/sbin/iscontrol/MakefileSun Apr 14 21:11:19 2013
(r249489)
+++ stable/9/sbin/iscontrol/MakefileSun Apr 14 22:38:28 2013
(r249490)
@@ -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: stable/9/sbin/iscontrol/iscontrol.8
==
--- stable/9/sbin/iscontrol/iscontrol.8 Sun Apr 14 21:11:19 2013
(r249489)
+++ stable/9/sbin/iscontrol/iscontrol.8 Sun Apr 14 22:38:28 2013
(r249490)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 22, 2007
+.Dd August 9, 2010
 .Dt ISCONTROL 8
 .Os
 .Sh NAME

Modified: stable/9/sbin/iscontrol/iscontrol.c
==
--- stable/9/sbin/iscontrol/iscontrol.c Sun Apr 14 21:11:19 2013
(r249489)
+++ stable/9/sbin/iscontrol/iscontrol.c Sun Apr 14 22:38:28 2013
(r249490)
@@ -44,18 +44,22 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
+#include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
 
 #include 
 #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 OPTIONS"vdc:t:n:p:"
 
@@ -109,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)
 {
@@ -124,20 +135,40 @@ 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;
  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;
  pidfile = NULL;
+ /*
+  | check for driver & controller version match
+  */
+ n = 0;
+#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) {
@@ -146,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;
@@ -164,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)
@@ -187,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 = strc

svn commit: r248147 - stable/8/usr.sbin/pkg_install/add

2013-03-11 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 11 07:10:15 2013
New Revision: 248147
URL: http://svnweb.freebsd.org/changeset/base/248147

Log:
  Add the packages directory that will be used for the upcoming
  8.4 release
  
  Approved by:  re (implicit)

Modified:
  stable/8/usr.sbin/pkg_install/add/main.c

Modified: stable/8/usr.sbin/pkg_install/add/main.c
==
--- stable/8/usr.sbin/pkg_install/add/main.cMon Mar 11 06:54:58 2013
(r248146)
+++ stable/8/usr.sbin/pkg_install/add/main.cMon Mar 11 07:10:15 2013
(r248147)
@@ -88,6 +88,7 @@ struct {
{ 801000, 801499, "/packages-8.1-release" },
{ 802000, 802499, "/packages-8.2-release" },
{ 803000, 803499, "/packages-8.3-release" },
+   { 804000, 804499, "/packages-8.4-release" },
{ 90, 900499, "/packages-9.0-release" },
{ 901000, 901499, "/packages-9.1-release" },
{ 30, 399000, "/packages-3-stable" },
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248075 - svnadmin/conf

2013-03-08 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Mar  8 21:44:42 2013
New Revision: 248075
URL: http://svnweb.freebsd.org/changeset/base/248075

Log:
  Enter code freeze for the 8.4 release cycle by turning on approval
  checking for stable/8.
  
  Approved by:  core (implicit)

Modified:
  svnadmin/conf/approvers

Modified: svnadmin/conf/approvers
==
--- svnadmin/conf/approvers Fri Mar  8 21:07:31 2013(r248074)
+++ svnadmin/conf/approvers Fri Mar  8 21:44:42 2013(r248075)
@@ -18,7 +18,7 @@
 #
 #^head/re
 #^stable/9/re
-#^stable/8/re
+^stable/8/ re
 #^stable/7/re
 ^releng/9.[0-1]/   (security-officer|so)
 ^releng/8.[0-3]/   (security-officer|so)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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
+

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}/${PK

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 2>&1
+  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 2>&1
-  if [ $? -ne 0 ]
-  then
+  tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} >&1 2>&1
+  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}"

svn commit: r247572 - stable/9/sys/dev/oce

2013-03-01 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Mar  1 20:33:35 2013
New Revision: 247572
URL: http://svnweb.freebsd.org/changeset/base/247572

Log:
  MFC 246799:
  
  Resolve issue that caused WITNESS to report LORs.

Modified:
  stable/9/sys/dev/oce/oce_if.c
  stable/9/sys/dev/oce/oce_if.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/oce/oce_if.c
==
--- stable/9/sys/dev/oce/oce_if.c   Fri Mar  1 20:16:06 2013
(r247571)
+++ stable/9/sys/dev/oce/oce_if.c   Fri Mar  1 20:33:35 2013
(r247572)
@@ -1856,6 +1856,9 @@ oce_local_timer(void *arg)
 }
 
 
+/* NOTE : This should only be called holding
+ *DEVICE_LOCK.
+*/
 static void
 oce_if_deactivate(POCE_SOFTC sc)
 {
@@ -1885,11 +1888,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: stable/9/sys/dev/oce/oce_if.h
==
--- stable/9/sys/dev/oce/oce_if.h   Fri Mar  1 20:16:06 2013
(r247571)
+++ stable/9/sys/dev/oce/oce_if.h   Fri Mar  1 20:33:35 2013
(r247572)
@@ -491,7 +491,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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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 
  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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


  1   2   >