svn commit: r348600 - stable/12/sys/contrib/ipfilter/netinet

2019-06-03 Thread Cy Schubert
Author: cy
Date: Tue Jun  4 03:04:30 2019
New Revision: 348600
URL: https://svnweb.freebsd.org/changeset/base/348600

Log:
  MFC r348320:
  
  Contuation of r343701, removal of irrelevant #ifdefs.

Modified:
  stable/12/sys/contrib/ipfilter/netinet/ip_frag.c
  stable/12/sys/contrib/ipfilter/netinet/ip_proxy.h
  stable/12/sys/contrib/ipfilter/netinet/ip_rules.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/ip_frag.c
==
--- stable/12/sys/contrib/ipfilter/netinet/ip_frag.cTue Jun  4 02:37:11 
2019(r348599)
+++ stable/12/sys/contrib/ipfilter/netinet/ip_frag.cTue Jun  4 03:04:30 
2019(r348600)
@@ -34,11 +34,11 @@
 #include 
 #if defined(_KERNEL)
 # include 
-# if !defined(__SVR4) && !defined(__svr4__)
+# if !defined(__SVR4)
 #  include 
 # endif
 #endif
-#if !defined(__SVR4) && !defined(__svr4__)
+#if !defined(__SVR4)
 # if defined(_KERNEL)
 #  include 
 # endif

Modified: stable/12/sys/contrib/ipfilter/netinet/ip_proxy.h
==
--- stable/12/sys/contrib/ipfilter/netinet/ip_proxy.h   Tue Jun  4 02:37:11 
2019(r348599)
+++ stable/12/sys/contrib/ipfilter/netinet/ip_proxy.h   Tue Jun  4 03:04:30 
2019(r348600)
@@ -13,14 +13,14 @@
 #define__IP_PROXY_H__
 
 #ifndefSOLARIS
-# if defined(sun) && (defined(__svr4__) || defined(__SVR4))
+# if defined(sun) && defined(__SVR4))
 #  define  SOLARIS 1
 # else
 #  define  SOLARIS 0
 # endif
 #endif
 
-#if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
+#if defined(__STDC__) || defined(__GNUC__)
 #defineSIOCPROXY   _IOWR('r', 64, struct ap_control)
 #else
 #defineSIOCPROXY   _IOWR(r, 64, struct ap_control)

Modified: stable/12/sys/contrib/ipfilter/netinet/ip_rules.c
==
--- stable/12/sys/contrib/ipfilter/netinet/ip_rules.c   Tue Jun  4 02:37:11 
2019(r348599)
+++ stable/12/sys/contrib/ipfilter/netinet/ip_rules.c   Tue Jun  4 03:04:30 
2019(r348600)
@@ -12,22 +12,18 @@
 #include 
 #include 
 #include 
-#if defined(__FreeBSD_version) && (__FreeBSD_version >= 4)
+#if defined(__FreeBSD_version)
 # if defined(_KERNEL)
 #  include 
 # else
 #  include 
 # endif
-#endif
-#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 39900)
 #else
-# if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__sgi)
-#  include 
-# endif
+# include 
 #endif
 #include 
 #include 
-#if !defined(__SVR4) && !defined(__svr4__) && !defined(__hpux)
+#if !defined(__SVR4)
 # include 
 #endif
 #if defined(__FreeBSD__)
___
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: r348599 - in head/sys/dev/virtio: . balloon block console network random scsi

2019-06-03 Thread Conrad Meyer
Author: cem
Date: Tue Jun  4 02:37:11 2019
New Revision: 348599
URL: https://svnweb.freebsd.org/changeset/base/348599

Log:
  virtio(4): Add PNP match metadata for virtio devices
  
  Register MODULE_PNP_INFO for virtio devices using the newbus PNP information
  provided by the previous commit.  Matching can be quite simple; existing
  probe routines only matched on bus (implicit) and device_type.  The same
  matching criteria are retained exactly, but is now also available to
  devmatch(8).
  
  Reviewed by:  bryanv, markj; imp (earlier version)
  Differential Revision:https://reviews.freebsd.org/D20407

Modified:
  head/sys/dev/virtio/balloon/virtio_balloon.c
  head/sys/dev/virtio/block/virtio_blk.c
  head/sys/dev/virtio/console/virtio_console.c
  head/sys/dev/virtio/network/if_vtnet.c
  head/sys/dev/virtio/random/virtio_random.c
  head/sys/dev/virtio/scsi/virtio_scsi.c
  head/sys/dev/virtio/virtio.h

Modified: head/sys/dev/virtio/balloon/virtio_balloon.c
==
--- head/sys/dev/virtio/balloon/virtio_balloon.cTue Jun  4 02:34:59 
2019(r348598)
+++ head/sys/dev/virtio/balloon/virtio_balloon.cTue Jun  4 02:37:11 
2019(r348599)
@@ -158,16 +158,14 @@ DRIVER_MODULE(virtio_balloon, virtio_pci, vtballoon_dr
 MODULE_VERSION(virtio_balloon, 1);
 MODULE_DEPEND(virtio_balloon, virtio, 1, 1, 1);
 
+VIRTIO_SIMPLE_PNPTABLE(virtio_balloon, VIRTIO_ID_BALLOON,
+"VirtIO Balloon Adapter");
+VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_balloon);
+
 static int
 vtballoon_probe(device_t dev)
 {
-
-   if (virtio_get_device_type(dev) != VIRTIO_ID_BALLOON)
-   return (ENXIO);
-
-   device_set_desc(dev, "VirtIO Balloon Adapter");
-
-   return (BUS_PROBE_DEFAULT);
+   return (VIRTIO_SIMPLE_PROBE(dev, virtio_balloon));
 }
 
 static int

Modified: head/sys/dev/virtio/block/virtio_blk.c
==
--- head/sys/dev/virtio/block/virtio_blk.c  Tue Jun  4 02:34:59 2019
(r348598)
+++ head/sys/dev/virtio/block/virtio_blk.c  Tue Jun  4 02:37:11 2019
(r348599)
@@ -261,6 +261,10 @@ DRIVER_MODULE(virtio_blk, virtio_pci, vtblk_driver, vt
 MODULE_VERSION(virtio_blk, 1);
 MODULE_DEPEND(virtio_blk, virtio, 1, 1, 1);
 
+VIRTIO_SIMPLE_PNPTABLE(virtio_blk, VIRTIO_ID_BLOCK, "VirtIO Block Adapter");
+VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_blk);
+VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_blk);
+
 static int
 vtblk_modevent(module_t mod, int type, void *unused)
 {
@@ -285,13 +289,7 @@ vtblk_modevent(module_t mod, int type, void *unused)
 static int
 vtblk_probe(device_t dev)
 {
-
-   if (virtio_get_device_type(dev) != VIRTIO_ID_BLOCK)
-   return (ENXIO);
-
-   device_set_desc(dev, "VirtIO Block Adapter");
-
-   return (BUS_PROBE_DEFAULT);
+   return (VIRTIO_SIMPLE_PROBE(dev, virtio_blk));
 }
 
 static int

Modified: head/sys/dev/virtio/console/virtio_console.c
==
--- head/sys/dev/virtio/console/virtio_console.cTue Jun  4 02:34:59 
2019(r348598)
+++ head/sys/dev/virtio/console/virtio_console.cTue Jun  4 02:37:11 
2019(r348599)
@@ -261,6 +261,10 @@ DRIVER_MODULE(virtio_console, virtio_pci, vtcon_driver
 MODULE_VERSION(virtio_console, 1);
 MODULE_DEPEND(virtio_console, virtio, 1, 1, 1);
 
+VIRTIO_SIMPLE_PNPTABLE(virtio_console, VIRTIO_ID_CONSOLE,
+"VirtIO Console Adapter");
+VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_console);
+
 static int
 vtcon_modevent(module_t mod, int type, void *unused)
 {
@@ -305,13 +309,7 @@ vtcon_drain_all(void)
 static int
 vtcon_probe(device_t dev)
 {
-
-   if (virtio_get_device_type(dev) != VIRTIO_ID_CONSOLE)
-   return (ENXIO);
-
-   device_set_desc(dev, "VirtIO Console Adapter");
-
-   return (BUS_PROBE_DEFAULT);
+   return (VIRTIO_SIMPLE_PROBE(dev, virtio_console));
 }
 
 static int

Modified: head/sys/dev/virtio/network/if_vtnet.c
==
--- head/sys/dev/virtio/network/if_vtnet.c  Tue Jun  4 02:34:59 2019
(r348598)
+++ head/sys/dev/virtio/network/if_vtnet.c  Tue Jun  4 02:37:11 2019
(r348599)
@@ -325,6 +325,10 @@ MODULE_DEPEND(vtnet, virtio, 1, 1, 1);
 MODULE_DEPEND(vtnet, netmap, 1, 1, 1);
 #endif /* DEV_NETMAP */
 
+VIRTIO_SIMPLE_PNPTABLE(vtnet, VIRTIO_ID_NETWORK, "VirtIO Networking Adapter");
+VIRTIO_SIMPLE_PNPINFO(virtio_mmio, vtnet);
+VIRTIO_SIMPLE_PNPINFO(virtio_pci, vtnet);
+
 static int
 vtnet_modevent(module_t mod, int type, void *unused)
 {
@@ -361,13 +365,7 @@ vtnet_modevent(module_t mod, int type, void *unused)
 static int
 vtnet_probe(device_t dev)
 {
-
-   if (virtio_get_device_type(dev) != VIRTIO_ID_NETWORK)
-   return (ENXIO);
-
-   device_set_desc(dev, "VirtIO Networking Adapter");
-
-   return 

svn commit: r348598 - in head/sys/dev/virtio: . mmio pci

2019-06-03 Thread Conrad Meyer
Author: cem
Date: Tue Jun  4 02:34:59 2019
New Revision: 348598
URL: https://svnweb.freebsd.org/changeset/base/348598

Log:
  virtio(4): Expose PNP metadata through newbus
  
  Expose the same fields and widths from both vtio buses, even though they
  don't quite line up; several virtio drivers can attach to both buses,
  and sharing a PNP info table for both seems more convenient.
  
  In practice, I doubt any virtio driver really needs to match on anything
  other than bus and device_type (eliminating the unused entries for
  vtmmio), and also in practice device_type is << 2^16 (so far, values
  range from 1 to 20).  So it might be fine to only expose a 16-bit
  device_type for PNP purposes.  On the other hand, I don't see much harm
  in overkill here.
  
  Reviewed by:  bryanv, markj (earlier version)
  Differential Revision:https://reviews.freebsd.org/D20406

Modified:
  head/sys/dev/virtio/mmio/virtio_mmio.c
  head/sys/dev/virtio/pci/virtio_pci.c
  head/sys/dev/virtio/virtio.c
  head/sys/dev/virtio/virtio.h

Modified: head/sys/dev/virtio/mmio/virtio_mmio.c
==
--- head/sys/dev/virtio/mmio/virtio_mmio.c  Tue Jun  4 01:00:30 2019
(r348597)
+++ head/sys/dev/virtio/mmio/virtio_mmio.c  Tue Jun  4 02:34:59 2019
(r348598)
@@ -145,6 +145,7 @@ static device_method_t vtmmio_methods[] = {
/* Bus interface. */
DEVMETHOD(bus_driver_added,   vtmmio_driver_added),
DEVMETHOD(bus_child_detached, vtmmio_child_detached),
+   DEVMETHOD(bus_child_pnpinfo_str,  virtio_child_pnpinfo_str),
DEVMETHOD(bus_read_ivar,  vtmmio_read_ivar),
DEVMETHOD(bus_write_ivar, vtmmio_write_ivar),
 
@@ -331,6 +332,14 @@ vtmmio_read_ivar(device_t dev, device_t child, int ind
break;
case VIRTIO_IVAR_VENDOR:
*result = vtmmio_read_config_4(sc, VIRTIO_MMIO_VENDOR_ID);
+   break;
+   case VIRTIO_IVAR_SUBVENDOR:
+   case VIRTIO_IVAR_DEVICE:
+   /*
+* Dummy value for fields not present in this bus.  Used by
+* bus-agnostic virtio_child_pnpinfo_str.
+*/
+   *result = 0;
break;
default:
return (ENOENT);

Modified: head/sys/dev/virtio/pci/virtio_pci.c
==
--- head/sys/dev/virtio/pci/virtio_pci.cTue Jun  4 01:00:30 2019
(r348597)
+++ head/sys/dev/virtio/pci/virtio_pci.cTue Jun  4 02:34:59 2019
(r348598)
@@ -200,6 +200,7 @@ static device_method_t vtpci_methods[] = {
/* Bus interface. */
DEVMETHOD(bus_driver_added,   vtpci_driver_added),
DEVMETHOD(bus_child_detached, vtpci_child_detached),
+   DEVMETHOD(bus_child_pnpinfo_str,  virtio_child_pnpinfo_str),
DEVMETHOD(bus_read_ivar,  vtpci_read_ivar),
DEVMETHOD(bus_write_ivar, vtpci_write_ivar),
 

Modified: head/sys/dev/virtio/virtio.c
==
--- head/sys/dev/virtio/virtio.cTue Jun  4 01:00:30 2019
(r348597)
+++ head/sys/dev/virtio/virtio.cTue Jun  4 02:34:59 2019
(r348598)
@@ -263,6 +263,30 @@ virtio_write_device_config(device_t dev, bus_size_t of
offset, dst, len);
 }
 
+int
+virtio_child_pnpinfo_str(device_t busdev __unused, device_t child, char *buf,
+size_t buflen)
+{
+
+   /*
+* All of these PCI fields will be only 16 bits, but on the vtmmio bus
+* the corresponding fields (only "vendor" and "device_type") are 32
+* bits.  Many virtio drivers can attach below either bus.
+* Gratuitously expand these two fields to 32-bits to allow sharing PNP
+* match table data between the mostly-similar buses.
+*
+* Subdevice and device_type are redundant in both buses, so I don't
+* see a lot of PNP utility in exposing the same value under a
+* different name.
+*/
+   snprintf(buf, buflen, "vendor=0x%08x device=0x%04x subvendor=0x%04x "
+   "device_type=0x%08x", (unsigned)virtio_get_vendor(child),
+   (unsigned)virtio_get_device(child),
+   (unsigned)virtio_get_subvendor(child),
+   (unsigned)virtio_get_device_type(child));
+   return (0);
+}
+
 static int
 virtio_modevent(module_t mod, int type, void *unused)
 {

Modified: head/sys/dev/virtio/virtio.h
==
--- head/sys/dev/virtio/virtio.hTue Jun  4 01:00:30 2019
(r348597)
+++ head/sys/dev/virtio/virtio.hTue Jun  4 02:34:59 2019
(r348598)
@@ -81,6 +81,8 @@ void   virtio_stop(device_t dev);
 int virtio_config_generation(device_t 

svn commit: r348597 - stable/12/sys/fs/pseudofs

2019-06-03 Thread Johannes Lundberg
Author: johalun
Date: Tue Jun  4 01:00:30 2019
New Revision: 348597
URL: https://svnweb.freebsd.org/changeset/base/348597

Log:
  MFC r348338:
  pseudofs: Ignore unsupported commands in vop_setattr.
  
  Users of pseudofs (e.g. lindebugfs), should be able to receive
  input from command line via commands like "echo 1 > /path/to/file".
  Currently this fails because sh tries to truncate the file first and
  vop_setattr returns not supported error for this. This patch simply
  ignores the error and returns 0 instead.
  
  Reviewed by:  imp (mentor), asomers
  Approved by:  imp (mentor), asomers
  Differential Revision: D20451

Modified:
  stable/12/sys/fs/pseudofs/pseudofs_vnops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/pseudofs/pseudofs_vnops.c
==
--- stable/12/sys/fs/pseudofs/pseudofs_vnops.c  Tue Jun  4 00:42:51 2019
(r348596)
+++ stable/12/sys/fs/pseudofs/pseudofs_vnops.c  Tue Jun  4 01:00:30 2019
(r348597)
@@ -967,7 +967,8 @@ pfs_setattr(struct vop_setattr_args *va)
PFS_TRACE(("%s", pn->pn_name));
pfs_assert_not_owned(pn);
 
-   PFS_RETURN (EOPNOTSUPP);
+   /* Silently ignore unchangeable attributes. */
+   PFS_RETURN (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: r348596 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/ztest

2019-06-03 Thread Alexander Motin
Author: mav
Date: Tue Jun  4 00:42:51 2019
New Revision: 348596
URL: https://svnweb.freebsd.org/changeset/base/348596

Log:
  9689 zfs range lock code should not be zpl-specific
  
  illumos/illumos-gate@7931524763ef94dc16989451206563d03bb4
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_rlock.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_znode.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_rlock.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/cmd/ztest/ztest.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Tue Jun  4 00:01:37 
2019(r348595)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Tue Jun  4 00:42:51 
2019(r348596)
@@ -75,6 +75,7 @@ struct nvlist;
 struct arc_buf;
 struct zio_prop;
 struct sa_handle;
+struct locked_range;
 
 typedef struct objset objset_t;
 typedef struct dmu_tx dmu_tx_t;
@@ -941,7 +942,7 @@ typedef struct zgd {
struct lwb  *zgd_lwb;
struct blkptr   *zgd_bp;
dmu_buf_t   *zgd_db;
-   struct rl   *zgd_rl;
+   struct locked_range *zgd_lr;
void*zgd_private;
 } zgd_t;
 

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_rlock.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_rlock.h   Tue Jun  4 
00:01:37 2019(r348595)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_rlock.h   Tue Jun  4 
00:42:51 2019(r348596)
@@ -22,6 +22,9 @@
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ * Copyright (c) 2018 by Delphix. All rights reserved.
+ */
 
 #ifndef_SYS_FS_ZFS_RLOCK_H
 #define_SYS_FS_ZFS_RLOCK_H
@@ -30,54 +33,44 @@
 extern "C" {
 #endif
 
-#ifdef _KERNEL
-
-#include 
-
 typedef enum {
RL_READER,
RL_WRITER,
RL_APPEND
-} rl_type_t;
+} rangelock_type_t;
 
-typedef struct rl {
-   znode_t *r_zp;  /* znode this lock applies to */
-   avl_node_t r_node;  /* avl node link */
-   uint64_t r_off; /* file range offset */
-   uint64_t r_len; /* file range length */
-   uint_t r_cnt;   /* range reference count in tree */
-   rl_type_t r_type;   /* range type */
-   kcondvar_t r_wr_cv; /* cv for waiting writers */
-   kcondvar_t r_rd_cv; /* cv for waiting readers */
-   uint8_t r_proxy;/* acting for original range */
-   uint8_t r_write_wanted; /* writer wants to lock this range */
-   uint8_t r_read_wanted;  /* reader wants to lock this range */
-} rl_t;
+struct locked_range;
 
-/*
- * Lock a range (offset, length) as either shared (RL_READER)
- * or exclusive (RL_WRITER or RL_APPEND).  RL_APPEND is a special type that
- * is converted to RL_WRITER that specified to lock from the start of the
- * end of file.  Returns the range lock structure.
- */
-rl_t *zfs_range_lock(znode_t *zp, uint64_t off, uint64_t len, rl_type_t type);
+typedef void (rangelock_cb_t)(struct locked_range *, void *);
 
-/* Unlock range and destroy range lock structure. */
-void zfs_range_unlock(rl_t *rl);
+typedef struct rangelock {
+   avl_tree_t rl_tree; /* contains locked_range_t */
+   kmutex_t rl_lock;
+   rangelock_cb_t *rl_cb;
+   void *rl_arg;
+} rangelock_t;
 
-/*
- * Reduce range locked as RW_WRITER from whole file to specified range.
- * Asserts the whole file was previously locked.
- */
-void zfs_range_reduce(rl_t *rl, uint64_t off, uint64_t len);
+typedef struct locked_range {
+   rangelock_t *lr_rangelock; /* rangelock that this lock applies to */
+   avl_node_t lr_node; /* avl node link */
+   uint64_t lr_offset; /* file range offset */
+   uint64_t lr_length; /* file range length */
+   uint_t lr_count;/* range reference count in tree */
+   rangelock_type_t lr_type; /* range type */
+   kcondvar_t lr_write_cv; /* cv for waiting writers */
+   kcondvar_t lr_read_cv;  /* cv for waiting readers */
+   uint8_t lr_proxy;   /* acting for original range */
+   uint8_t lr_write_wanted; /* writer wants to lock this range */
+   uint8_t lr_read_wanted; /* reader wants to lock this range */
+} locked_range_t;
 
-/*
- * AVL comparison function used to order range locks
- * Locks are ordered on the start offset of the range.
- */
-int zfs_range_compare(const void *arg1, const void *arg2);

svn commit: r348596 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/ztest

2019-06-03 Thread Alexander Motin
Author: mav
Date: Tue Jun  4 00:42:51 2019
New Revision: 348596
URL: https://svnweb.freebsd.org/changeset/base/348596

Log:
  9689 zfs range lock code should not be zpl-specific
  
  illumos/illumos-gate@7931524763ef94dc16989451206563d03bb4
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  vendor/illumos/dist/cmd/ztest/ztest.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_rlock.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_znode.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_rlock.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c

Modified: vendor/illumos/dist/cmd/ztest/ztest.c
==
--- vendor/illumos/dist/cmd/ztest/ztest.c   Tue Jun  4 00:01:37 2019
(r348595)
+++ vendor/illumos/dist/cmd/ztest/ztest.c   Tue Jun  4 00:42:51 2019
(r348596)
@@ -237,7 +237,9 @@ typedef struct bufwad {
 } bufwad_t;
 
 /*
- * XXX -- fix zfs range locks to be generic so we can use them here.
+ * It would be better to use a rangelock_t per object.  Unfortunately
+ * the rangelock_t is not a drop-in replacement for rl_t, because we
+ * still need to map from object ID to rangelock_t.
  */
 typedef enum {
RL_READER,
@@ -1845,12 +1847,12 @@ static void
 ztest_get_done(zgd_t *zgd, int error)
 {
ztest_ds_t *zd = zgd->zgd_private;
-   uint64_t object = zgd->zgd_rl->rl_object;
+   uint64_t object = ((rl_t *)zgd->zgd_lr)->rl_object;
 
if (zgd->zgd_db)
dmu_buf_rele(zgd->zgd_db, zgd);
 
-   ztest_range_unlock(zgd->zgd_rl);
+   ztest_range_unlock((rl_t *)zgd->zgd_lr);
ztest_object_unlock(zd, object);
 
umem_free(zgd, sizeof (*zgd));
@@ -1900,8 +1902,8 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, s
zgd->zgd_private = zd;
 
if (buf != NULL) {  /* immediate write */
-   zgd->zgd_rl = ztest_range_lock(zd, object, offset, size,
-   RL_READER);
+   zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd,
+   object, offset, size, RL_READER);
 
error = dmu_read(os, object, offset, size, buf,
DMU_READ_NO_PREFETCH);
@@ -1915,8 +1917,8 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, s
offset = 0;
}
 
-   zgd->zgd_rl = ztest_range_lock(zd, object, offset, size,
-   RL_READER);
+   zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd,
+   object, offset, size, RL_READER);
 
error = dmu_buf_hold(os, object, offset, zgd, ,
DMU_READ_NO_PREFETCH);
___
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: r348595 - head/sys/dev/virtio/random

2019-06-03 Thread Conrad Meyer
Author: cem
Date: Tue Jun  4 00:01:37 2019
New Revision: 348595
URL: https://svnweb.freebsd.org/changeset/base/348595

Log:
  virtio_random(4): Fix random(4) integration
  
  random(4) masks unregistered entropy sources.  Prior to this revision,
  virtio_random(4) did not correctly register a random_source and did not
  function as a source of entropy.
  
  Random source registration for loadable pure sources requires registering a
  poll callback, which is invoked periodically by random(4)'s harvestq
  kthread.  The periodic poll makes virtio_random(4)'s periodic entropy
  collection redundant, so this revision removes the callout.
  
  The current random source API is somewhat limiting, so simply fail to attach
  any virtio_random devices if one is already registered as a source.  This
  scenario is expected to be uncommon.
  
  While here, handle the possibility of short reads from the hypervisor random
  device gracefully / correctly.  It is not clear why a hypervisor would
  return a short read or if it is allowed by spec, but we may as well handle
  it.
  
  Reviewed by:  bryanv (earlier version), markm
  Security: yes (note: many other "pure" random sources remain broken)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20419

Modified:
  head/sys/dev/virtio/random/virtio_random.c

Modified: head/sys/dev/virtio/random/virtio_random.c
==
--- head/sys/dev/virtio/random/virtio_random.c  Mon Jun  3 23:57:29 2019
(r348594)
+++ head/sys/dev/virtio/random/virtio_random.c  Tue Jun  4 00:01:37 2019
(r348595)
@@ -33,21 +33,24 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 
 struct vtrnd_softc {
uint64_t vtrnd_features;
-   struct callout   vtrnd_callout;
struct virtqueue*vtrnd_vq;
 };
 
@@ -59,8 +62,8 @@ static intvtrnd_detach(device_t);
 
 static voidvtrnd_negotiate_features(device_t);
 static int vtrnd_alloc_virtqueue(device_t);
-static voidvtrnd_harvest(struct vtrnd_softc *);
-static voidvtrnd_timer(void *);
+static int vtrnd_harvest(struct vtrnd_softc *, void *, size_t *);
+static unsignedvtrnd_read(void *, unsigned);
 
 #define VTRND_FEATURES 0
 
@@ -68,6 +71,15 @@ static struct virtio_feature_desc vtrnd_feature_desc[]
{ 0, NULL }
 };
 
+static struct random_source random_vtrnd = {
+   .rs_ident = "VirtIO Entropy Adapter",
+   .rs_source = RANDOM_PURE_VIRTIO,
+   .rs_read = vtrnd_read,
+};
+
+/* Kludge for API limitations of random(4). */
+static _Atomic(struct vtrnd_softc *) g_vtrnd_softc;
+
 static device_method_t vtrnd_methods[] = {
/* Device methods. */
DEVMETHOD(device_probe, vtrnd_probe),
@@ -125,13 +137,11 @@ vtrnd_probe(device_t dev)
 static int
 vtrnd_attach(device_t dev)
 {
-   struct vtrnd_softc *sc;
+   struct vtrnd_softc *sc, *exp;
int error;
 
sc = device_get_softc(dev);
 
-   callout_init(>vtrnd_callout, 1);
-
virtio_set_feature_desc(dev, vtrnd_feature_desc);
vtrnd_negotiate_features(dev);
 
@@ -141,7 +151,13 @@ vtrnd_attach(device_t dev)
goto fail;
}
 
-   callout_reset(>vtrnd_callout, 5 * hz, vtrnd_timer, sc);
+   exp = NULL;
+   if (!atomic_compare_exchange_strong_explicit(_vtrnd_softc, , sc,
+   memory_order_release, memory_order_acquire)) {
+   error = EEXIST;
+   goto fail;
+   }
+   random_source_register(_vtrnd);
 
 fail:
if (error)
@@ -156,9 +172,20 @@ vtrnd_detach(device_t dev)
struct vtrnd_softc *sc;
 
sc = device_get_softc(dev);
+   KASSERT(
+   atomic_load_explicit(_vtrnd_softc, memory_order_acquire) == sc,
+   ("only one global instance at a time"));
 
-   callout_drain(>vtrnd_callout);
+   random_source_deregister(_vtrnd);
+   atomic_store_explicit(_vtrnd_softc, NULL, memory_order_release);
 
+   /*
+* Unfortunately, deregister does not guarantee our source callback
+* will not be invoked after it returns.  Use a kludge to prevent some,
+* but not all, possible races.
+*/
+   tsleep_sbt(_vtrnd_softc, 0, "vtrnddet", mstosbt(50), 0, C_HARDCLOCK);
+
return (0);
 }
 
@@ -185,44 +212,64 @@ vtrnd_alloc_virtqueue(device_t dev)
return (virtio_alloc_virtqueues(dev, 0, 1, _info));
 }
 
-static void
-vtrnd_harvest(struct vtrnd_softc *sc)
+static int
+vtrnd_harvest(struct vtrnd_softc *sc, void *buf, size_t *sz)
 {
struct sglist_seg segs[1];
struct sglist sg;
struct virtqueue *vq;
-   uint32_t value;
+   uint32_t value[HARVESTSIZE] __aligned(sizeof(uint32_t) * HARVESTSIZE);
+   uint32_t rdlen;
int error;
 

svn commit: r348594 - head/share/man/man9

2019-06-03 Thread Conrad Meyer
Author: cem
Date: Mon Jun  3 23:57:29 2019
New Revision: 348594
URL: https://svnweb.freebsd.org/changeset/base/348594

Log:
  style.9: Codify tolerance for eliding blank lines
  
  Consensus seems to be that eliding blank lines for functions with no local
  variables is acceptable.  Codify that explicitly in the style document.
  
  Reported by:  jhb
  Reviewed by:  delphij, imp, vangyzen (earlier version); rgrimes
  With feedback from:   kib
  Differential Revision:https://reviews.freebsd.org/D20448

Modified:
  head/share/man/man9/style.9

Modified: head/share/man/man9/style.9
==
--- head/share/man/man9/style.9 Mon Jun  3 23:24:07 2019(r348593)
+++ head/share/man/man9/style.9 Mon Jun  3 23:57:29 2019(r348594)
@@ -26,7 +26,7 @@
 .\"From: @(#)style 1.14 (Berkeley) 4/28/95
 .\" $FreeBSD$
 .\"
-.Dd May 28, 2019
+.Dd June 3, 2019
 .Dt STYLE 9
 .Os
 .Sh NAME
@@ -779,8 +779,19 @@ vaf(const char *fmt, ...)
 static void
 usage(void)
 {
-   /* Insert an empty line if the function has no local variables. */
+   /* Optional blank line goes here. */
 .Ed
+.Pp
+Optionally, insert a blank line at the beginning of functions with no local
+variables.
+Older versions of this
+.Nm
+document required the blank line convention, so it is widely used in existing
+code.
+.Pp
+Do not insert a blank line at the beginning of functions with local variables.
+Instead, these should have local variable declarations first, followed by one
+blank line, followed by the first statement.
 .Pp
 Use
 .Xr printf 3 ,
___
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: r348592 - head/usr.sbin/bhyve

2019-06-03 Thread John Baldwin
Author: jhb
Date: Mon Jun  3 23:17:35 2019
New Revision: 348592
URL: https://svnweb.freebsd.org/changeset/base/348592

Log:
  Emulate the AMD MSR_LS_CFG MSR used for various Ryzen errata.
  
  Writes are ignored and reads always return zero.
  
  Submitted by: José Albornoz  (write-only version)
  Reviewed by:  Patrick Mooney, cem
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D19506

Modified:
  head/usr.sbin/bhyve/xmsr.c

Modified: head/usr.sbin/bhyve/xmsr.c
==
--- head/usr.sbin/bhyve/xmsr.c  Mon Jun  3 23:07:46 2019(r348591)
+++ head/usr.sbin/bhyve/xmsr.c  Mon Jun  3 23:17:35 2019(r348592)
@@ -72,6 +72,7 @@ emulate_wrmsr(struct vmctx *ctx, int vcpu, uint32_t nu
return (0);
 
case MSR_NB_CFG1:
+   case MSR_LS_CFG:
case MSR_IC_CFG:
return (0); /* Ignore writes */
 
@@ -141,6 +142,7 @@ emulate_rdmsr(struct vmctx *ctx, int vcpu, uint32_t nu
break;
 
case MSR_NB_CFG1:
+   case MSR_LS_CFG:
case MSR_IC_CFG:
/*
 * The reset value is processor family dependent so
___
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: r348591 - head/usr.sbin/mountd

2019-06-03 Thread Rick Macklem
Author: rmacklem
Date: Mon Jun  3 23:07:46 2019
New Revision: 348591
URL: https://svnweb.freebsd.org/changeset/base/348591

Log:
  r348590 had mention of "-I" in a comment that no longer applied to the patch.
  
  Take "-I" out of the comment line, since the patch no longer uses the "-I"
  option.
  
  MFC after:1 month

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

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Mon Jun  3 22:58:51 2019
(r348590)
+++ head/usr.sbin/mountd/mountd.c   Mon Jun  3 23:07:46 2019
(r348591)
@@ -1716,7 +1716,7 @@ get_exportlist_one(int passno)
 */
if (v4root_phase > 0 && v4root_phase <= 2) {
/*
-* These structures are used for the "-I" reload,
+* These structures are used for the reload,
 * so save them for that case.  Otherwise, just
 * free them up now.
 */
___
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: r348590 - head/usr.sbin/mountd

2019-06-03 Thread Rick Macklem
Author: rmacklem
Date: Mon Jun  3 22:58:51 2019
New Revision: 348590
URL: https://svnweb.freebsd.org/changeset/base/348590

Log:
  Modify mountd so that it incrementally updates the kernel exports upon a 
reload.
  
  Without this patch, mountd would delete/load all exports from the exports
  file(s) when it receives a SIGHUP. This works fine for small exports file(s),
  but can take several seconds to do when there are large numbers (1+) of
  exported file systems. Most of this time is spent doing the system calls
  that delete/export each of these file systems. When the "-S" option
  has been specified (the default these days), the nfsd threads are suspended
  for several seconds while the reload is done.
  
  This patch changes mountd so that it only does system calls for file systems
  where the exports have been changed/added/deleted as compared to the exports
  done for the previous load/reload of the exports file(s).
  Basically, when SIGHUP is posted to mountd, it saves the exportlist structures
  from the previous load and creates a new set of structures from the current
  exports file(s). Then it compares the current with the previous and only does
  system calls for cases that have been changed/added/deleted.
  The nfsd threads do not need to be suspended until the comparison step is
  being done. This results in a suspension period of milliseconds for a server
  with 1+ exported file systems.
  
  There is some code using a LOGDEBUG() macro that allow runtime debugging
  output via syslog(LOG_DEBUG,...) that can be enabled by creating a file
  called /var/log/mountd.debug. This code is expected to be replaced with
  code that uses dtrace by cy@ in the near future, once issues w.r.t. dtrace
  in stable/12 have been resolved.
  
  The patch should not change the usage of the exports file(s), but improves
  the performance of reloading large exports file(s) where there are only a
  small number of changes done to the file(s).
  
  Tested by:p...@lysator.liu.se
  PR:   237860
  Reviewed by:  kib
  MFC after:1 month
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D20487

Modified:
  head/usr.sbin/mountd/mountd.c
  head/usr.sbin/mountd/pathnames.h

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Mon Jun  3 21:40:42 2019
(r348589)
+++ head/usr.sbin/mountd/mountd.c   Mon Jun  3 22:58:51 2019
(r348590)
@@ -120,6 +120,8 @@ struct exportlist {
fsid_t  ex_fs;
char*ex_fsdir;
char*ex_indexfile;
+   struct xucred   ex_defanon;
+   int ex_defexflags;
int ex_numsecflavors;
int ex_secflavors[MAXSECFLAVORS];
int ex_defnumsecflavors;
@@ -129,6 +131,9 @@ struct exportlist {
 };
 /* ex_flag bits */
 #defineEX_LINKED   0x1
+#defineEX_DONE 0x2
+#defineEX_DEFSET   0x4
+#defineEX_PUBLICFH 0x8
 
 SLIST_HEAD(exportlisthead, exportlist);
 
@@ -147,6 +152,9 @@ struct grouplist {
int gr_type;
union grouptypes gr_ptr;
struct grouplist *gr_next;
+   struct xucred gr_anon;
+   int gr_exflags;
+   int gr_flag;
int gr_numsecflavors;
int gr_secflavors[MAXSECFLAVORS];
 };
@@ -157,6 +165,9 @@ struct grouplist {
 #defineGT_DEFAULT  0x3
 #define GT_IGNORE  0x5
 
+/* Group flags */
+#defineGR_FND  0x1
+
 struct hostlist {
int  ht_flag;   /* Uses DP_xx bits */
struct grouplist *ht_grp;
@@ -176,7 +187,8 @@ struct fhreturn {
 /* Global defs */
 static char*add_expdir(struct dirlist **, char *, int);
 static voidadd_dlist(struct dirlist **, struct dirlist *,
-   struct grouplist *, int, struct exportlist *);
+   struct grouplist *, int, struct exportlist *,
+   struct xucred *, int);
 static voidadd_mlist(char *, char *);
 static int check_dirpath(char *);
 static int check_options(struct dirlist *);
@@ -189,8 +201,9 @@ static void complete_service(struct netconfig *nconf, 
 static voidclearout_service(void);
 static voiddel_mlist(char *hostp, char *dirp);
 static struct dirlist  *dirp_search(struct dirlist *, char *);
+static int do_export_mount(struct exportlist *, struct statfs *);
 static int do_mount(struct exportlist *, struct grouplist *, int,
-   struct xucred *, char *, int, struct statfs *);
+   struct xucred *, char *, int, struct statfs *, int, int *);
 static int do_opt(char **, char **, struct exportlist *,
struct grouplist *, int *, int *, struct xucred *);
 static struct exportlist   *ex_search(fsid_t *, struct exportlisthead *);
@@ -199,10 +212,16 @@ static void   free_dir(struct dirlist *);
 

svn commit: r348589 - head/etc

2019-06-03 Thread Maxim Sobolev
Author: sobomax
Date: Mon Jun  3 21:40:42 2019
New Revision: 348589
URL: https://svnweb.freebsd.org/changeset/base/348589

Log:
  Put back MTREE_CMD here for now. Doh, not my day, perhaps.
  
  Reported by:  markj, mav

Modified:
  head/etc/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Mon Jun  3 21:04:23 2019(r348588)
+++ head/etc/Makefile   Mon Jun  3 21:40:42 2019(r348589)
@@ -93,6 +93,8 @@ distribution:
 .endif
 .endif
 
+MTREE_CMD?=mtree
+
 MTREES=mtree/BSD.root.dist /   \
mtree/BSD.var.dist  /var\
mtree/BSD.usr.dist  /usr\
___
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: r348532 - in head: . etc

2019-06-03 Thread Mark Johnston
On Mon, Jun 03, 2019 at 03:12:45PM +, Maxim Sobolev wrote:
> Author: sobomax
> Date: Mon Jun  3 15:12:44 2019
> New Revision: 348532
> URL: https://svnweb.freebsd.org/changeset/base/348532
> 
> Log:
>   Leave mtree hardcoded for now. Reverting partially 348521 and also
>   the followup stopgap change, because I don't think it's a correct. I still
>   need to figure out where to stick it in. In cannot be in Makefile.inc1
>   and it cannot be in etc/Makefile from the looks of it to avoid
>   chicken-and-egg problem.
> 
> Modified:
>   head/Makefile.inc1
>   head/etc/Makefile
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Mon Jun  3 15:10:37 2019(r348531)
> +++ head/Makefile.inc1Mon Jun  3 15:12:44 2019(r348532)
> @@ -888,7 +888,7 @@ INSTALLFLAGS+=-h sha256
>  .endif
>  .if defined(DB_FROM_SRC) || defined(NO_ROOT)
>  IMAKE_INSTALL=   INSTALL="${INSTALL} ${INSTALLFLAGS}"
> -IMAKE_MTREE= MTREE_CMD="${MTREE} ${MTREEFLAGS}"
> +IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
>  .endif
>  
>  DESTDIR_MTREEFLAGS=  -deU
> 
> Modified: head/etc/Makefile
> ==
> --- head/etc/Makefile Mon Jun  3 15:10:37 2019(r348531)
> +++ head/etc/Makefile Mon Jun  3 15:12:44 2019(r348532)
> @@ -93,8 +93,6 @@ distribution:
>  .endif
>  .endif
>  
> -MTREE_CMD?=  mtree
> -

I don't see how this can be right.  Nothing sets MTREE_CMD if
!defined(DB_FROM_SRC) && !defined(NO_ROOT), so now a regular
installworld fails for me:

--  
  
 >>> Making hierarchy   
 >>>
 >>> 
--  
  
cd /usr/home/markj/src/freebsd-dev; make -f Makefile.inc1  LOCAL_MTREE= 
hierarchy   
  
[...]
-deU -i -f /usr/home/markj/src/freebsd-dev/etc/mtree/BSD.root.dist -p / 
  
/tmp/install.ClQih1mt/sh: -deU: not found   
  
*** Error code 127
___
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: r348588 - in stable/11: sbin/geom/class/eli sys/geom/eli tests/sys/geom/class/eli

2019-06-03 Thread John Baldwin
Author: jhb
Date: Mon Jun  3 21:04:23 2019
New Revision: 348588
URL: https://svnweb.freebsd.org/changeset/base/348588

Log:
  MFC 348206,348231,348454: GELI crypto deprecation warnings.
  
  348206:
  Add deprecation warnings for weaker algorithms to geli(4).
  
  - Triple DES has been formally deprecated in Kerberos (RFC 8429)
and is soon to be deprecated in IPsec (RFC 8221).
  - Blowfish is deprecated.  FreeBSD doesn't support its successor
(Twofish).
  - MD5 is generally considered a weak digest that has known attacks.
  
  geli refuses to create new volumes using these algorithms via 'geli
  init'.  It also warns when attaching to existing volumes or creating
  temporary volumes via 'geli onetime' .  The plan is to fully remove
  support for these algorithms in FreeBSD 13.
  
  Note that none of these algorithms have ever been the default
  algorithm used by geli(8).  Users would have had to explicitly select
  these algorithms when creating volumes in the past.
  
  348231:
  Correct the argument passed to g_eli_algo2str()
  
  348454:
  Remove tests for the deprecated algorithms in r348206
  
  The tests are failing because the return value and output have changed, but
  before test code structure adjusted, removing these test cases help people
  be able to focus on more important cases.
  
  Approved by:  re (gjb)
  Relnotes: yes

Modified:
  stable/11/sbin/geom/class/eli/geli.8
  stable/11/sbin/geom/class/eli/geom_eli.c
  stable/11/sys/geom/eli/g_eli.c
  stable/11/tests/sys/geom/class/eli/conf.sh
  stable/11/tests/sys/geom/class/eli/init_test.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/geom/class/eli/geli.8
==
--- stable/11/sbin/geom/class/eli/geli.8Mon Jun  3 21:03:28 2019
(r348587)
+++ stable/11/sbin/geom/class/eli/geli.8Mon Jun  3 21:04:23 2019
(r348588)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 9, 2018
+.Dd May 23, 2019
 .Dt GELI 8
 .Os
 .Sh NAME
@@ -856,6 +856,18 @@ specified in
 .El
 .Sh EXIT STATUS
 Exit status is 0 on success, and 1 if the command fails.
+.Sh DEPRECATION NOTICE
+Support for the
+.Nm Blowfish-CBC
+and
+.Nm 3DES-CBC
+cryptographic algorithms and
+.Nm HMAC/MD5
+authentication algorithm will be removed in
+.Fx 13.0 .
+New volumes cannot be created using these algorithms.
+Existing volumes should be migrated to a new volume that uses
+non-deprecated algorithms.
 .Sh EXAMPLES
 Initialize a provider which is going to be encrypted with a
 passphrase and random data from a file on the user's pen drive.
@@ -1089,7 +1101,7 @@ utility appeared in
 .Fx 6.0 .
 Support for the
 .Nm Camellia
-block cipher is implemented by Yoshisato Yanagisawa in
+block cipher was implemented by Yoshisato Yanagisawa in
 .Fx 7.0 .
 .Pp
 Highest

Modified: stable/11/sbin/geom/class/eli/geom_eli.c
==
--- stable/11/sbin/geom/class/eli/geom_eli.cMon Jun  3 21:03:28 2019
(r348587)
+++ stable/11/sbin/geom/class/eli/geom_eli.cMon Jun  3 21:04:23 2019
(r348588)
@@ -781,6 +781,22 @@ eli_init(struct gctl_req *req)
return;
}
}
+   if (md.md_flags & G_ELI_FLAG_AUTH) {
+   switch (md.md_aalgo) {
+   case CRYPTO_MD5_HMAC:
+   gctl_error(req,
+   "The %s authentication algorithm is deprecated.",
+   g_eli_algo2str(md.md_aalgo));
+   return;
+   }
+   }
+   switch (md.md_ealgo) {
+   case CRYPTO_3DES_CBC:
+   case CRYPTO_BLF_CBC:
+   gctl_error(req, "The %s encryption algorithm is deprecated.",
+   g_eli_algo2str(md.md_ealgo));
+   return;
+   }
val = gctl_get_intmax(req, "keylen");
md.md_keylen = val;
md.md_keylen = g_eli_keylen(md.md_ealgo, md.md_keylen);

Modified: stable/11/sys/geom/eli/g_eli.c
==
--- stable/11/sys/geom/eli/g_eli.c  Mon Jun  3 21:03:28 2019
(r348587)
+++ stable/11/sys/geom/eli/g_eli.c  Mon Jun  3 21:04:23 2019
(r348588)
@@ -873,8 +873,25 @@ g_eli_create(struct gctl_req *req, struct g_class *mp,
G_ELI_DEBUG(0, "Device %s created.", pp->name);
G_ELI_DEBUG(0, "Encryption: %s %u", g_eli_algo2str(sc->sc_ealgo),
sc->sc_ekeylen);
-   if (sc->sc_flags & G_ELI_FLAG_AUTH)
+   switch (sc->sc_ealgo) {
+   case CRYPTO_3DES_CBC:
+   gone_in(13,
+   "support for GEOM_ELI volumes encrypted with 3des");
+   break;
+   case CRYPTO_BLF_CBC:
+   gone_in(13,
+   "support for GEOM_ELI volumes encrypted with blowfish");
+   break;
+   }
+   if (sc->sc_flags & G_ELI_FLAG_AUTH) {
 

svn commit: r348587 - in stable/12: lib/geom/eli sys/geom/eli tests/sys/geom/class/eli

2019-06-03 Thread John Baldwin
Author: jhb
Date: Mon Jun  3 21:03:28 2019
New Revision: 348587
URL: https://svnweb.freebsd.org/changeset/base/348587

Log:
  MFC 348206,348231,348454: GELI crypto deprecation warnings.
  
  348206:
  Add deprecation warnings for weaker algorithms to geli(4).
  
  - Triple DES has been formally deprecated in Kerberos (RFC 8429)
and is soon to be deprecated in IPsec (RFC 8221).
  - Blowfish is deprecated.  FreeBSD doesn't support its successor
(Twofish).
  - MD5 is generally considered a weak digest that has known attacks.
  
  geli refuses to create new volumes using these algorithms via 'geli
  init'.  It also warns when attaching to existing volumes or creating
  temporary volumes via 'geli onetime' .  The plan is to fully remove
  support for these algorithms in FreeBSD 13.
  
  Note that none of these algorithms have ever been the default
  algorithm used by geli(8).  Users would have had to explicitly select
  these algorithms when creating volumes in the past.
  
  348231:
  Correct the argument passed to g_eli_algo2str()
  
  348454:
  Remove tests for the deprecated algorithms in r348206
  
  The tests are failing because the return value and output have changed, but
  before test code structure adjusted, removing these test cases help people
  be able to focus on more important cases.
  
  Relnotes: yes

Modified:
  stable/12/lib/geom/eli/geli.8
  stable/12/lib/geom/eli/geom_eli.c
  stable/12/sys/geom/eli/g_eli.c
  stable/12/tests/sys/geom/class/eli/conf.sh
  stable/12/tests/sys/geom/class/eli/init_test.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/geom/eli/geli.8
==
--- stable/12/lib/geom/eli/geli.8   Mon Jun  3 20:55:52 2019
(r348586)
+++ stable/12/lib/geom/eli/geli.8   Mon Jun  3 21:03:28 2019
(r348587)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 24, 2018
+.Dd May 23, 2019
 .Dt GELI 8
 .Os
 .Sh NAME
@@ -877,6 +877,18 @@ specified in
 .El
 .Sh EXIT STATUS
 Exit status is 0 on success, and 1 if the command fails.
+.Sh DEPRECATION NOTICE
+Support for the
+.Nm Blowfish-CBC
+and
+.Nm 3DES-CBC
+cryptographic algorithms and
+.Nm HMAC/MD5
+authentication algorithm will be removed in
+.Fx 13.0 .
+New volumes cannot be created using these algorithms.
+Existing volumes should be migrated to a new volume that uses
+non-deprecated algorithms.
 .Sh EXAMPLES
 Initialize a provider which is going to be encrypted with a
 passphrase and random data from a file on the user's pen drive.
@@ -1110,7 +1122,7 @@ utility appeared in
 .Fx 6.0 .
 Support for the
 .Nm Camellia
-block cipher is implemented by Yoshisato Yanagisawa in
+block cipher was implemented by Yoshisato Yanagisawa in
 .Fx 7.0 .
 .Pp
 Highest

Modified: stable/12/lib/geom/eli/geom_eli.c
==
--- stable/12/lib/geom/eli/geom_eli.c   Mon Jun  3 20:55:52 2019
(r348586)
+++ stable/12/lib/geom/eli/geom_eli.c   Mon Jun  3 21:03:28 2019
(r348587)
@@ -797,6 +797,22 @@ eli_init(struct gctl_req *req)
return;
}
}
+   if (md.md_flags & G_ELI_FLAG_AUTH) {
+   switch (md.md_aalgo) {
+   case CRYPTO_MD5_HMAC:
+   gctl_error(req,
+   "The %s authentication algorithm is deprecated.",
+   g_eli_algo2str(md.md_aalgo));
+   return;
+   }
+   }
+   switch (md.md_ealgo) {
+   case CRYPTO_3DES_CBC:
+   case CRYPTO_BLF_CBC:
+   gctl_error(req, "The %s encryption algorithm is deprecated.",
+   g_eli_algo2str(md.md_ealgo));
+   return;
+   }
val = gctl_get_intmax(req, "keylen");
md.md_keylen = val;
md.md_keylen = g_eli_keylen(md.md_ealgo, md.md_keylen);

Modified: stable/12/sys/geom/eli/g_eli.c
==
--- stable/12/sys/geom/eli/g_eli.c  Mon Jun  3 20:55:52 2019
(r348586)
+++ stable/12/sys/geom/eli/g_eli.c  Mon Jun  3 21:03:28 2019
(r348587)
@@ -875,8 +875,25 @@ g_eli_create(struct gctl_req *req, struct g_class *mp,
G_ELI_DEBUG(0, "Device %s created.", pp->name);
G_ELI_DEBUG(0, "Encryption: %s %u", g_eli_algo2str(sc->sc_ealgo),
sc->sc_ekeylen);
-   if (sc->sc_flags & G_ELI_FLAG_AUTH)
+   switch (sc->sc_ealgo) {
+   case CRYPTO_3DES_CBC:
+   gone_in(13,
+   "support for GEOM_ELI volumes encrypted with 3des");
+   break;
+   case CRYPTO_BLF_CBC:
+   gone_in(13,
+   "support for GEOM_ELI volumes encrypted with blowfish");
+   break;
+   }
+   if (sc->sc_flags & G_ELI_FLAG_AUTH) {
G_ELI_DEBUG(0, " Integrity: %s", g_eli_algo2str(sc->sc_aalgo));
+   

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

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:55:52 2019
New Revision: 348586
URL: https://svnweb.freebsd.org/changeset/base/348586

Log:
  MFV r348585: 9683 Allow bypassing devid in vdev_disk_open()
  
  illumos/illumos-gate@6fe4f3002ca33af5ab7123ed78d81899dadf2fbb
  
  Reviewed by: Sara Hartse 
  Reviewed by: George Wilson 
  Approved by: Dan McDonald 
  Author: Pavel Zakharov 
  
  This is irrelevant to FreeBSD, just to reduce divergence.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.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 Mon Jun 
 3 20:52:19 2019(r348585)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Mon Jun 
 3 20:55:52 2019(r348586)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
  * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
  */
@@ -50,6 +50,21 @@ typedef struct vdev_disk_ldi_cb {
ldi_callback_id_t   lcb_id;
 } vdev_disk_ldi_cb_t;
 
+/*
+ * Bypass the devid when opening a disk vdev.
+ * There have been issues where the devids of several devices were shuffled,
+ * causing pool open failures. Note, that this flag is intended to be used
+ * for pool recovery only.
+ *
+ * Note that if a pool is imported with the devids bypassed, all its vdevs will
+ * cease storing devid information permanently. In practice, the devid is 
rarely
+ * useful as vdev paths do not tend to change unless the hardware is
+ * reconfigured. That said, if the paths do change and a pool fails to open
+ * automatically at boot, a simple zpool import should re-scan the paths and 
fix
+ * the issue.
+ */
+boolean_t vdev_disk_bypass_devid = B_FALSE;
+
 static void
 vdev_disk_alloc(vdev_t *vd)
 {
@@ -306,6 +321,16 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *
dvd = vd->vdev_tsd;
 
/*
+* Allow bypassing the devid.
+*/
+   if (vd->vdev_devid != NULL && vdev_disk_bypass_devid) {
+   vdev_dbgmsg(vd, "vdev_disk_open, devid %s bypassed",
+   vd->vdev_devid);
+   spa_strfree(vd->vdev_devid);
+   vd->vdev_devid = NULL;
+   }
+
+   /*
 * When opening a disk device, we want to preserve the user's original
 * intent.  We always want to open the device by the path the user gave
 * us, even if it is one of multiple paths to the save device.  But we
@@ -367,6 +392,19 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *
if (error == 0 && vd->vdev_devid != NULL &&
ldi_get_devid(dvd->vd_lh, ) == 0) {
if (ddi_devid_compare(devid, dvd->vd_devid) != 0) {
+   /*
+* A mismatch here is unexpected, log it.
+*/
+   char *devid_str = ddi_devid_str_encode(devid,
+   dvd->vd_minor);
+   vdev_dbgmsg(vd, "vdev_disk_open: devid "
+   "mismatch: %s != %s", vd->vdev_devid,
+   devid_str);
+   cmn_err(CE_NOTE, "vdev_disk_open %s: devid "
+   "mismatch: %s != %s", vd->vdev_path,
+   vd->vdev_devid, devid_str);
+   ddi_devid_str_free(devid_str);
+
error = SET_ERROR(EINVAL);
(void) ldi_close(dvd->vd_lh, spa_mode(spa),
kcred);
@@ -390,6 +428,10 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *
if (error != 0 && vd->vdev_devid != NULL) {
error = ldi_open_by_devid(dvd->vd_devid, dvd->vd_minor,
spa_mode(spa), kcred, >vd_lh, zfs_li);
+   if (error != 0) {
+   vdev_dbgmsg(vd, "Failed to open by devid (%s)",
+   vd->vdev_devid);
+   }
}
 
/*
@@ -436,6 +478,9 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *
vd_devid = ddi_devid_str_encode(devid, dvd->vd_minor);
vdev_dbgmsg(vd, "vdev_disk_open: update devid from "
"'%s' to '%s'", vd->vdev_devid, vd_devid);
+   cmn_err(CE_NOTE, "vdev_disk_open %s: update devid "
+   "from '%s' to '%s'", vd->vdev_path != NULL ?
+ 

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

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:52:19 2019
New Revision: 348585
URL: https://svnweb.freebsd.org/changeset/base/348585

Log:
  9683 Allow bypassing devid in vdev_disk_open()
  
  illumos/illumos-gate@6fe4f3002ca33af5ab7123ed78d81899dadf2fbb
  
  Reviewed by: Sara Hartse 
  Reviewed by: George Wilson 
  Approved by: Dan McDonald 
  Author: Pavel Zakharov 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c   Mon Jun  3 
20:49:20 2019(r348584)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c   Mon Jun  3 
20:52:19 2019(r348585)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
  * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
  */
@@ -57,6 +57,21 @@ typedef struct vdev_disk_ldi_cb {
ldi_callback_id_t   lcb_id;
 } vdev_disk_ldi_cb_t;
 
+/*
+ * Bypass the devid when opening a disk vdev.
+ * There have been issues where the devids of several devices were shuffled,
+ * causing pool open failures. Note, that this flag is intended to be used
+ * for pool recovery only.
+ *
+ * Note that if a pool is imported with the devids bypassed, all its vdevs will
+ * cease storing devid information permanently. In practice, the devid is 
rarely
+ * useful as vdev paths do not tend to change unless the hardware is
+ * reconfigured. That said, if the paths do change and a pool fails to open
+ * automatically at boot, a simple zpool import should re-scan the paths and 
fix
+ * the issue.
+ */
+boolean_t vdev_disk_bypass_devid = B_FALSE;
+
 static void
 vdev_disk_alloc(vdev_t *vd)
 {
@@ -313,6 +328,16 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *
dvd = vd->vdev_tsd;
 
/*
+* Allow bypassing the devid.
+*/
+   if (vd->vdev_devid != NULL && vdev_disk_bypass_devid) {
+   vdev_dbgmsg(vd, "vdev_disk_open, devid %s bypassed",
+   vd->vdev_devid);
+   spa_strfree(vd->vdev_devid);
+   vd->vdev_devid = NULL;
+   }
+
+   /*
 * When opening a disk device, we want to preserve the user's original
 * intent.  We always want to open the device by the path the user gave
 * us, even if it is one of multiple paths to the same device.  But we
@@ -374,6 +399,19 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *
if (error == 0 && vd->vdev_devid != NULL &&
ldi_get_devid(dvd->vd_lh, ) == 0) {
if (ddi_devid_compare(devid, dvd->vd_devid) != 0) {
+   /*
+* A mismatch here is unexpected, log it.
+*/
+   char *devid_str = ddi_devid_str_encode(devid,
+   dvd->vd_minor);
+   vdev_dbgmsg(vd, "vdev_disk_open: devid "
+   "mismatch: %s != %s", vd->vdev_devid,
+   devid_str);
+   cmn_err(CE_NOTE, "vdev_disk_open %s: devid "
+   "mismatch: %s != %s", vd->vdev_path,
+   vd->vdev_devid, devid_str);
+   ddi_devid_str_free(devid_str);
+
error = SET_ERROR(EINVAL);
(void) ldi_close(dvd->vd_lh, spa_mode(spa),
kcred);
@@ -397,6 +435,10 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *
if (error != 0 && vd->vdev_devid != NULL) {
error = ldi_open_by_devid(dvd->vd_devid, dvd->vd_minor,
spa_mode(spa), kcred, >vd_lh, zfs_li);
+   if (error != 0) {
+   vdev_dbgmsg(vd, "Failed to open by devid (%s)",
+   vd->vdev_devid);
+   }
}
 
/*
@@ -443,6 +485,9 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *
vd_devid = ddi_devid_str_encode(devid, dvd->vd_minor);
vdev_dbgmsg(vd, "vdev_disk_open: update devid from "
"'%s' to '%s'", vd->vdev_devid, vd_devid);
+   cmn_err(CE_NOTE, "vdev_disk_open %s: update devid "
+   "from '%s' to '%s'", vd->vdev_path != NULL ?
+   vd->vdev_path : "?", vd->vdev_devid, vd_devid);
spa_strfree(vd->vdev_devid);
vd->vdev_devid = spa_strdup(vd_devid);
   

svn commit: r348584 - in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:49:20 2019
New Revision: 348584
URL: https://svnweb.freebsd.org/changeset/base/348584

Log:
  MFV r348583: 9847 leaking dd_clones (DMU_OT_DSL_CLONES) objects
  
  illumos/illumos-gate@17fb938fd6cdce3ff1bb47dafda0774f742249a3
  
  Reviewed by: George Wilson 
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Brian Behlendorf 
  Approved by: Richard Lowe 
  Author: Matthew Ahrens 

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

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Jun  3 20:45:48 2019
(r348583)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Jun  3 20:49:20 2019
(r348584)
@@ -63,6 +63,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #undef verify
@@ -111,6 +112,7 @@ static uint64_t max_inflight = 1000;
 static int leaked_objects = 0;
 
 static void snprintf_blkptr_compact(char *, size_t, const blkptr_t *);
+static void mos_obj_refd(uint64_t);
 
 /*
  * These libumem hooks provide a reasonable set of defaults for the allocator's
@@ -1592,6 +1594,8 @@ dump_dsl_dir(objset_t *os, uint64_t object, void *data
DO(CHILD_RSRV);
DO(REFRSRV);
 #undef DO
+   (void) printf("\t\tclones = %llu\n",
+   (u_longlong_t)dd->dd_clones);
 }
 
 /*ARGSUSED*/
@@ -1774,6 +1778,33 @@ dump_full_bpobj(bpobj_t *bpo, const char *name, int in
 }
 
 static void
+bpobj_count_refd(bpobj_t *bpo)
+{
+   mos_obj_refd(bpo->bpo_object);
+
+   if (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_subobjs != 0) {
+   mos_obj_refd(bpo->bpo_phys->bpo_subobjs);
+   for (uint64_t i = 0; i < bpo->bpo_phys->bpo_num_subobjs; i++) {
+   uint64_t subobj;
+   bpobj_t subbpo;
+   int error;
+   VERIFY0(dmu_read(bpo->bpo_os,
+   bpo->bpo_phys->bpo_subobjs,
+   i * sizeof (subobj), sizeof (subobj), , 0));
+   error = bpobj_open(, bpo->bpo_os, subobj);
+   if (error != 0) {
+   (void) printf("ERROR %u while trying to open "
+   "subobj id %llu\n",
+   error, (u_longlong_t)subobj);
+   continue;
+   }
+   bpobj_count_refd();
+   bpobj_close();
+   }
+   }
+}
+
+static void
 dump_deadlist(dsl_deadlist_t *dl)
 {
dsl_deadlist_entry_t *dle;
@@ -1781,7 +1812,24 @@ dump_deadlist(dsl_deadlist_t *dl)
char bytes[32];
char comp[32];
char uncomp[32];
+   uint64_t empty_bpobj =
+   dmu_objset_spa(dl->dl_os)->spa_dsl_pool->dp_empty_bpobj;
 
+   /* force the tree to be loaded */
+   dsl_deadlist_space_range(dl, 0, UINT64_MAX, , , );
+
+   if (dl->dl_oldfmt) {
+   if (dl->dl_bpobj.bpo_object != empty_bpobj)
+   bpobj_count_refd(>dl_bpobj);
+   } else {
+   mos_obj_refd(dl->dl_object);
+   for (dle = avl_first(>dl_tree); dle;
+   dle = AVL_NEXT(>dl_tree, dle)) {
+   if (dle->dle_bpobj.bpo_object != empty_bpobj)
+   bpobj_count_refd(>dle_bpobj);
+   }
+   }
+
/* make sure nicenum has enough space */
CTASSERT(sizeof (bytes) >= NN_NUMBUF_SZ);
CTASSERT(sizeof (comp) >= NN_NUMBUF_SZ);
@@ -1806,9 +1854,6 @@ dump_deadlist(dsl_deadlist_t *dl)
 
(void) printf("\n");
 
-   /* force the tree to be loaded */
-   dsl_deadlist_space_range(dl, 0, UINT64_MAX, , , );
-
for (dle = avl_first(>dl_tree); dle;
dle = AVL_NEXT(>dl_tree, dle)) {
if (dump_opt['d'] >= 5) {
@@ -2219,6 +2264,30 @@ dump_object(objset_t *os, uint64_t object, int verbosi
dmu_buf_rele(db, FTAG);
 }
 
+static void
+count_dir_mos_objects(dsl_dir_t *dd)
+{
+   mos_obj_refd(dd->dd_object);
+   mos_obj_refd(dsl_dir_phys(dd)->dd_child_dir_zapobj);
+   mos_obj_refd(dsl_dir_phys(dd)->dd_deleg_zapobj);
+   mos_obj_refd(dsl_dir_phys(dd)->dd_props_zapobj);
+   mos_obj_refd(dsl_dir_phys(dd)->dd_clones);
+}
+
+static void
+count_ds_mos_objects(dsl_dataset_t *ds)
+{
+   mos_obj_refd(ds->ds_object);
+   mos_obj_refd(dsl_dataset_phys(ds)->ds_next_clones_obj);
+   mos_obj_refd(dsl_dataset_phys(ds)->ds_props_obj);
+   mos_obj_refd(dsl_dataset_phys(ds)->ds_userrefs_obj);
+   

svn commit: r348583 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zdb

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:45:48 2019
New Revision: 348583
URL: https://svnweb.freebsd.org/changeset/base/348583

Log:
  9847 leaking dd_clones (DMU_OT_DSL_CLONES) objects
  
  illumos/illumos-gate@17fb938fd6cdce3ff1bb47dafda0774f742249a3
  
  Reviewed by: George Wilson 
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Brian Behlendorf 
  Approved by: Richard Lowe 
  Author: Matthew Ahrens 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/cmd/zdb/zdb.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c Mon Jun  3 
20:45:32 2019(r348582)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c Mon Jun  3 
20:45:48 2019(r348583)
@@ -786,6 +786,8 @@ dsl_dir_destroy_sync(uint64_t ddobj, dmu_tx_t *tx)
 
VERIFY0(zap_destroy(mos, dsl_dir_phys(dd)->dd_child_dir_zapobj, tx));
VERIFY0(zap_destroy(mos, dsl_dir_phys(dd)->dd_props_zapobj, tx));
+   if (dsl_dir_phys(dd)->dd_clones != 0)
+   VERIFY0(zap_destroy(mos, dsl_dir_phys(dd)->dd_clones, tx));
VERIFY0(dsl_deleg_destroy(mos, dsl_dir_phys(dd)->dd_deleg_zapobj, tx));
VERIFY0(zap_remove(mos,
dsl_dir_phys(dd->dd_parent)->dd_child_dir_zapobj,

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c   Mon Jun 
 3 20:45:32 2019(r348582)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c   Mon Jun 
 3 20:45:48 2019(r348583)
@@ -279,7 +279,6 @@ vdev_indirect_mapping_entry_for_offset_or_next(vdev_in
B_TRUE));
 }
 
-
 void
 vdev_indirect_mapping_close(vdev_indirect_mapping_t *vim)
 {
___
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: r348583 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zdb

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:45:48 2019
New Revision: 348583
URL: https://svnweb.freebsd.org/changeset/base/348583

Log:
  9847 leaking dd_clones (DMU_OT_DSL_CLONES) objects
  
  illumos/illumos-gate@17fb938fd6cdce3ff1bb47dafda0774f742249a3
  
  Reviewed by: George Wilson 
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Brian Behlendorf 
  Approved by: Richard Lowe 
  Author: Matthew Ahrens 

Modified:
  vendor/illumos/dist/cmd/zdb/zdb.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_destroy.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c

Modified: vendor/illumos/dist/cmd/zdb/zdb.c
==
--- vendor/illumos/dist/cmd/zdb/zdb.c   Mon Jun  3 20:45:32 2019
(r348582)
+++ vendor/illumos/dist/cmd/zdb/zdb.c   Mon Jun  3 20:45:48 2019
(r348583)
@@ -63,6 +63,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #undef verify
@@ -111,6 +112,7 @@ uint64_t max_inflight = 1000;
 static int leaked_objects = 0;
 
 static void snprintf_blkptr_compact(char *, size_t, const blkptr_t *);
+static void mos_obj_refd(uint64_t);
 
 /*
  * These libumem hooks provide a reasonable set of defaults for the allocator's
@@ -1565,6 +1567,8 @@ dump_dsl_dir(objset_t *os, uint64_t object, void *data
DO(CHILD_RSRV);
DO(REFRSRV);
 #undef DO
+   (void) printf("\t\tclones = %llu\n",
+   (u_longlong_t)dd->dd_clones);
 }
 
 /*ARGSUSED*/
@@ -1747,6 +1751,33 @@ dump_full_bpobj(bpobj_t *bpo, const char *name, int in
 }
 
 static void
+bpobj_count_refd(bpobj_t *bpo)
+{
+   mos_obj_refd(bpo->bpo_object);
+
+   if (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_subobjs != 0) {
+   mos_obj_refd(bpo->bpo_phys->bpo_subobjs);
+   for (uint64_t i = 0; i < bpo->bpo_phys->bpo_num_subobjs; i++) {
+   uint64_t subobj;
+   bpobj_t subbpo;
+   int error;
+   VERIFY0(dmu_read(bpo->bpo_os,
+   bpo->bpo_phys->bpo_subobjs,
+   i * sizeof (subobj), sizeof (subobj), , 0));
+   error = bpobj_open(, bpo->bpo_os, subobj);
+   if (error != 0) {
+   (void) printf("ERROR %u while trying to open "
+   "subobj id %llu\n",
+   error, (u_longlong_t)subobj);
+   continue;
+   }
+   bpobj_count_refd();
+   bpobj_close();
+   }
+   }
+}
+
+static void
 dump_deadlist(dsl_deadlist_t *dl)
 {
dsl_deadlist_entry_t *dle;
@@ -1754,7 +1785,24 @@ dump_deadlist(dsl_deadlist_t *dl)
char bytes[32];
char comp[32];
char uncomp[32];
+   uint64_t empty_bpobj =
+   dmu_objset_spa(dl->dl_os)->spa_dsl_pool->dp_empty_bpobj;
 
+   /* force the tree to be loaded */
+   dsl_deadlist_space_range(dl, 0, UINT64_MAX, , , );
+
+   if (dl->dl_oldfmt) {
+   if (dl->dl_bpobj.bpo_object != empty_bpobj)
+   bpobj_count_refd(>dl_bpobj);
+   } else {
+   mos_obj_refd(dl->dl_object);
+   for (dle = avl_first(>dl_tree); dle;
+   dle = AVL_NEXT(>dl_tree, dle)) {
+   if (dle->dle_bpobj.bpo_object != empty_bpobj)
+   bpobj_count_refd(>dle_bpobj);
+   }
+   }
+
/* make sure nicenum has enough space */
CTASSERT(sizeof (bytes) >= NN_NUMBUF_SZ);
CTASSERT(sizeof (comp) >= NN_NUMBUF_SZ);
@@ -1779,9 +1827,6 @@ dump_deadlist(dsl_deadlist_t *dl)
 
(void) printf("\n");
 
-   /* force the tree to be loaded */
-   dsl_deadlist_space_range(dl, 0, UINT64_MAX, , , );
-
for (dle = avl_first(>dl_tree); dle;
dle = AVL_NEXT(>dl_tree, dle)) {
if (dump_opt['d'] >= 5) {
@@ -1796,7 +1841,6 @@ dump_deadlist(dsl_deadlist_t *dl)
(void) printf("mintxg %llu -> obj %llu\n",
(longlong_t)dle->dle_mintxg,
(longlong_t)dle->dle_bpobj.bpo_object);
-
}
}
 }
@@ -2193,6 +2237,30 @@ dump_object(objset_t *os, uint64_t object, int verbosi
dmu_buf_rele(db, FTAG);
 }
 
+static void
+count_dir_mos_objects(dsl_dir_t *dd)
+{
+   mos_obj_refd(dd->dd_object);
+   mos_obj_refd(dsl_dir_phys(dd)->dd_child_dir_zapobj);
+   mos_obj_refd(dsl_dir_phys(dd)->dd_deleg_zapobj);
+   mos_obj_refd(dsl_dir_phys(dd)->dd_props_zapobj);
+   mos_obj_refd(dsl_dir_phys(dd)->dd_clones);
+}
+
+static void
+count_ds_mos_objects(dsl_dataset_t *ds)
+{
+   mos_obj_refd(ds->ds_object);
+   mos_obj_refd(dsl_dataset_phys(ds)->ds_next_clones_obj);
+   

svn commit: r348581 - head/cddl/contrib/opensolaris/lib/libzfs/common

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:40:32 2019
New Revision: 348581
URL: https://svnweb.freebsd.org/changeset/base/348581

Log:
  MFV r348580: 9559 zfs diff handles files on delete queue in fromsnap poorly
  
  illumos/illumos-gate@20633e304b57bc98f70fdb194081b7023adf527b
  
  Reviewed by: Joshua M. Clulow 
  Approved by: Richard Lowe 
  Author: Paul Dagnelie 

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c   Mon Jun 
 3 20:39:13 2019(r348580)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c   Mon Jun 
 3 20:40:32 2019(r348581)
@@ -22,7 +22,7 @@
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2015, 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2015, 2018 by Delphix. All rights reserved.
  * Copyright 2016 Joyent, Inc.
  * Copyright 2016 Igor Kozhukhov 
  */
@@ -47,7 +47,7 @@
 #include "libzfs_impl.h"
 
 #defineZDIFF_SNAPDIR   "/.zfs/snapshot/"
-#defineZDIFF_SHARESDIR "/.zfs/shares/"
+#defineZDIFF_SHARESDIR "/.zfs/shares/"
 #defineZDIFF_PREFIX"zfs-diff-%d"
 
 #defineZDIFF_ADDED '+'
@@ -361,12 +361,12 @@ describe_free(FILE *fp, differ_info_t *di, uint64_t ob
 
if (get_stats_for_obj(di, di->fromsnap, object, namebuf,
maxlen, ) != 0) {
-   /* Let it slide, if in the delete queue on from side */
-   if (di->zerr == ENOENT && sb.zs_links == 0) {
-   di->zerr = 0;
-   return (0);
-   }
return (-1);
+   }
+   /* Don't print if in the delete queue on from side */
+   if (di->zerr == ESTALE) {
+   di->zerr = 0;
+   return (0);
}
 
print_file(fp, di, ZDIFF_REMOVED, namebuf, );
___
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: r348580 - vendor/illumos/dist/lib/libzfs/common

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:39:13 2019
New Revision: 348580
URL: https://svnweb.freebsd.org/changeset/base/348580

Log:
  9559 zfs diff handles files on delete queue in fromsnap poorly
  
  illumos/illumos-gate@20633e304b57bc98f70fdb194081b7023adf527b
  
  Reviewed by: Joshua M. Clulow 
  Approved by: Richard Lowe 
  Author: Paul Dagnelie 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_diff.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_diff.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_diff.c Mon Jun  3 20:24:40 
2019(r348579)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_diff.c Mon Jun  3 20:39:13 
2019(r348580)
@@ -22,7 +22,7 @@
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2015, 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2015, 2018 by Delphix. All rights reserved.
  * Copyright 2016 Joyent, Inc.
  * Copyright 2016 Igor Kozhukhov 
  */
@@ -49,7 +49,7 @@
 #include "libzfs_impl.h"
 
 #defineZDIFF_SNAPDIR   "/.zfs/snapshot/"
-#defineZDIFF_SHARESDIR "/.zfs/shares/"
+#defineZDIFF_SHARESDIR "/.zfs/shares/"
 #defineZDIFF_PREFIX"zfs-diff-%d"
 
 #defineZDIFF_ADDED '+'
@@ -359,12 +359,12 @@ describe_free(FILE *fp, differ_info_t *di, uint64_t ob
 
if (get_stats_for_obj(di, di->fromsnap, object, namebuf,
maxlen, ) != 0) {
-   /* Let it slide, if in the delete queue on from side */
-   if (di->zerr == ENOENT && sb.zs_links == 0) {
-   di->zerr = 0;
-   return (0);
-   }
return (-1);
+   }
+   /* Don't print if in the delete queue on from side */
+   if (di->zerr == ESTALE) {
+   di->zerr = 0;
+   return (0);
}
 
print_file(fp, di, ZDIFF_REMOVED, namebuf, );
___
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: r348579 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:24:40 2019
New Revision: 348579
URL: https://svnweb.freebsd.org/changeset/base/348579

Log:
  MFV r348578: 9962 zil_commit should omit cache thrash
  
  illumos/illumos-gate@cab3a55e158118937e07d059c46f1bc14d1f254d
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Brad Lewis 
  Reviewed by: Patrick Mooney 
  Reviewed by: Jerry Jelinek 
  Approved by: Joshua M. Clulow 
  Author: Prakash Surya 

Modified:
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Jun  3 20:18:02 
2019(r348578)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Jun  3 20:24:40 
2019(r348579)
@@ -1933,6 +1933,7 @@ zil_replay_func_t *ztest_replay_vector[TX_MAX_TYPE] = 
  * ZIL get_data callbacks
  */
 
+/* ARGSUSED */
 static void
 ztest_get_done(zgd_t *zgd, int error)
 {
@@ -1944,9 +1945,6 @@ ztest_get_done(zgd_t *zgd, int error)
 
ztest_range_unlock(zgd->zgd_rl);
ztest_object_unlock(zd, object);
-
-   if (error == 0 && zgd->zgd_bp)
-   zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
 
umem_free(zgd, sizeof (*zgd));
 }

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Mon Jun  3 
20:18:02 2019(r348578)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Mon Jun  3 
20:24:40 2019(r348579)
@@ -1982,7 +1982,16 @@ dmu_sync_done(zio_t *zio, arc_buf_t *buf, void *varg)
dmu_sync_arg_t *dsa = varg;
dbuf_dirty_record_t *dr = dsa->dsa_dr;
dmu_buf_impl_t *db = dr->dr_dbuf;
+   zgd_t *zgd = dsa->dsa_zgd;
 
+   /*
+* Record the vdev(s) backing this blkptr so they can be flushed after
+* the writes for the lwb have completed.
+*/
+   if (zio->io_error == 0) {
+   zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
+   }
+
mutex_enter(>db_mtx);
ASSERT(dr->dt.dl.dr_override_state == DR_IN_DMU_SYNC);
if (zio->io_error == 0) {
@@ -2032,13 +2041,22 @@ dmu_sync_late_arrival_done(zio_t *zio)
blkptr_t *bp = zio->io_bp;
dmu_sync_arg_t *dsa = zio->io_private;
blkptr_t *bp_orig = >io_bp_orig;
+   zgd_t *zgd = dsa->dsa_zgd;
 
-   if (zio->io_error == 0 && !BP_IS_HOLE(bp)) {
-   ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE));
-   ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
-   ASSERT(zio->io_bp->blk_birth == zio->io_txg);
-   ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
-   zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
+   if (zio->io_error == 0) {
+   /*
+* Record the vdev(s) backing this blkptr so they can be
+* flushed after the writes for the lwb have completed.
+*/
+   zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
+
+   if (!BP_IS_HOLE(bp)) {
+   ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE));
+   ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
+   ASSERT(zio->io_bp->blk_birth == zio->io_txg);
+   ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
+   zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
+   }
}
 
dmu_tx_commit(dsa->dsa_tx);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h  Mon Jun 
 3 20:18:02 2019(r348578)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h  Mon Jun 
 3 20:24:40 2019(r348579)
@@ -48,10 +48,11 @@ extern "C" {
  * via zil_lwb_write_issue(). Again, the zilog's "zl_issuer_lock" must
  * be held when making this transition.
  *
- * After the lwb's zio completes, and the vdev's are flushed, the lwb
- * will transition into the "done" state via zil_lwb_write_done(). When
- * transitioning from "issued" to "done", the zilog's "zl_lock" must be
- * held, *not* the "zl_issuer_lock".
+ * After the lwb's write zio completes, it transitions into the "write
+ * done" state via zil_lwb_write_done(); and 

svn commit: r348578 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/ztest

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:18:02 2019
New Revision: 348578
URL: https://svnweb.freebsd.org/changeset/base/348578

Log:
  9962 zil_commit should omit cache thrash
  
  illumos/illumos-gate@cab3a55e158118937e07d059c46f1bc14d1f254d
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Brad Lewis 
  Reviewed by: Patrick Mooney 
  Reviewed by: Jerry Jelinek 
  Approved by: Joshua M. Clulow 
  Author: Prakash Surya 

Modified:
  vendor/illumos/dist/cmd/ztest/ztest.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c

Modified: vendor/illumos/dist/cmd/ztest/ztest.c
==
--- vendor/illumos/dist/cmd/ztest/ztest.c   Mon Jun  3 20:05:43 2019
(r348577)
+++ vendor/illumos/dist/cmd/ztest/ztest.c   Mon Jun  3 20:18:02 2019
(r348578)
@@ -1840,6 +1840,7 @@ zil_replay_func_t *ztest_replay_vector[TX_MAX_TYPE] = 
  * ZIL get_data callbacks
  */
 
+/* ARGSUSED */
 static void
 ztest_get_done(zgd_t *zgd, int error)
 {
@@ -1851,9 +1852,6 @@ ztest_get_done(zgd_t *zgd, int error)
 
ztest_range_unlock(zgd->zgd_rl);
ztest_object_unlock(zd, object);
-
-   if (error == 0 && zgd->zgd_bp)
-   zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
 
umem_free(zgd, sizeof (*zgd));
 }
___
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: r348578 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/ztest

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:18:02 2019
New Revision: 348578
URL: https://svnweb.freebsd.org/changeset/base/348578

Log:
  9962 zil_commit should omit cache thrash
  
  illumos/illumos-gate@cab3a55e158118937e07d059c46f1bc14d1f254d
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Brad Lewis 
  Reviewed by: Patrick Mooney 
  Reviewed by: Jerry Jelinek 
  Approved by: Joshua M. Clulow 
  Author: Prakash Surya 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/cmd/ztest/ztest.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Mon Jun  3 20:05:43 
2019(r348577)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Mon Jun  3 20:18:02 
2019(r348578)
@@ -1706,7 +1706,16 @@ dmu_sync_done(zio_t *zio, arc_buf_t *buf, void *varg)
dmu_sync_arg_t *dsa = varg;
dbuf_dirty_record_t *dr = dsa->dsa_dr;
dmu_buf_impl_t *db = dr->dr_dbuf;
+   zgd_t *zgd = dsa->dsa_zgd;
 
+   /*
+* Record the vdev(s) backing this blkptr so they can be flushed after
+* the writes for the lwb have completed.
+*/
+   if (zio->io_error == 0) {
+   zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
+   }
+
mutex_enter(>db_mtx);
ASSERT(dr->dt.dl.dr_override_state == DR_IN_DMU_SYNC);
if (zio->io_error == 0) {
@@ -1756,13 +1765,22 @@ dmu_sync_late_arrival_done(zio_t *zio)
blkptr_t *bp = zio->io_bp;
dmu_sync_arg_t *dsa = zio->io_private;
blkptr_t *bp_orig = >io_bp_orig;
+   zgd_t *zgd = dsa->dsa_zgd;
 
-   if (zio->io_error == 0 && !BP_IS_HOLE(bp)) {
-   ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE));
-   ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
-   ASSERT(zio->io_bp->blk_birth == zio->io_txg);
-   ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
-   zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
+   if (zio->io_error == 0) {
+   /*
+* Record the vdev(s) backing this blkptr so they can be
+* flushed after the writes for the lwb have completed.
+*/
+   zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
+
+   if (!BP_IS_HOLE(bp)) {
+   ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE));
+   ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
+   ASSERT(zio->io_bp->blk_birth == zio->io_txg);
+   ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
+   zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
+   }
}
 
dmu_tx_commit(dsa->dsa_tx);

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.hMon Jun  3 
20:05:43 2019(r348577)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zil_impl.hMon Jun  3 
20:18:02 2019(r348578)
@@ -48,10 +48,11 @@ extern "C" {
  * via zil_lwb_write_issue(). Again, the zilog's "zl_issuer_lock" must
  * be held when making this transition.
  *
- * After the lwb's zio completes, and the vdev's are flushed, the lwb
- * will transition into the "done" state via zil_lwb_write_done(). When
- * transitioning from "issued" to "done", the zilog's "zl_lock" must be
- * held, *not* the "zl_issuer_lock".
+ * After the lwb's write zio completes, it transitions into the "write
+ * done" state via zil_lwb_write_done(); and then into the "flush done"
+ * state via zil_lwb_flush_vdevs_done(). When transitioning from
+ * "issued" to "write done", and then from "write done" to "flush done",
+ * the zilog's "zl_lock" must be held, *not* the "zl_issuer_lock".
  *
  * The zilog's "zl_issuer_lock" can become heavily contended in certain
  * workloads, so we specifically avoid acquiring that lock when
@@ -68,13 +69,14 @@ extern "C" {
  * "zl_issuer_lock" will prevent a concurrent thread from transitioning
  * that lwb to the "issued" state. Likewise, if an lwb is already in the
  * "issued" state, holding the "zl_lock" will prevent a concurrent
- * thread from transitioning that lwb to the "done" state.
+ * thread from transitioning that lwb to the "write done" state.
  */
 typedef enum {
 LWB_STATE_CLOSED,
 LWB_STATE_OPENED,
 LWB_STATE_ISSUED,
-LWB_STATE_DONE,
+LWB_STATE_WRITE_DONE,
+LWB_STATE_FLUSH_DONE,
 LWB_NUM_STATES
 } lwb_state_t;
 

Modified: 

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

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 20:05:43 2019
New Revision: 348577
URL: https://svnweb.freebsd.org/changeset/base/348577

Log:
  MFV r348576: 9963 Seperate tunable for disabling ZIL vdev flush
  
  illumos/illumos-gate@f8fdf6812567ce1a3b76a6bee2ee3f04bd3fcaca
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Brad Lewis 
  Reviewed by: Patrick Mooney 
  Approved by: Dan McDonald 
  Author: Prakash Surya 

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Mon Jun  3 
19:53:39 2019(r348576)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Mon Jun  3 
20:05:43 2019(r348577)
@@ -217,6 +217,15 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, standard_sm_blksz, CTLF
 _standard_sm_blksz, 0,
 "Block size for standard space map.  Power of 2 and greater than 4096.");
 
+/*
+ * Tunable parameter for debugging or performance analysis. Setting this
+ * will cause pool corruption on power loss if a volatile out-of-order
+ * write cache is enabled.
+ */
+boolean_t zfs_nocacheflush = B_FALSE;
+SYSCTL_INT(_vfs_zfs, OID_AUTO, cache_flush_disable, CTLFLAG_RWTUN,
+_nocacheflush, 0, "Disable cache flush");
+
 /*PRINTFLIKE2*/
 void
 vdev_dbgmsg(vdev_t *vd, const char *fmt, ...)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Mon Jun 
 3 19:53:39 2019(r348576)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Mon Jun 
 3 20:05:43 2019(r348577)
@@ -239,6 +239,10 @@ vdev_file_io_start(zio_t *zio)
 
switch (zio->io_cmd) {
case DKIOCFLUSHWRITECACHE:
+
+   if (zfs_nocacheflush)
+   break;
+
zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC,
kcred, NULL);
break;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Mon Jun  3 
19:53:39 2019(r348576)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Mon Jun  3 
20:05:43 2019(r348577)
@@ -98,13 +98,15 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, zil_replay_disable, CTL
 _replay_disable, 0, "Disable intent logging replay");
 
 /*
- * Tunable parameter for debugging or performance analysis.  Setting
- * zfs_nocacheflush will cause corruption on power loss if a volatile
- * out-of-order write cache is enabled.
+ * Disable the DKIOCFLUSHWRITECACHE commands that are normally sent to
+ * the disk(s) by the ZIL after an LWB write has completed. Setting this
+ * will cause ZIL corruption on power loss if a volatile out-of-order
+ * write cache is enabled.
  */
-boolean_t zfs_nocacheflush = B_FALSE;
-SYSCTL_INT(_vfs_zfs, OID_AUTO, cache_flush_disable, CTLFLAG_RWTUN,
-_nocacheflush, 0, "Disable cache flush");
+boolean_t zil_nocacheflush = B_FALSE;
+SYSCTL_INT(_vfs_zfs, OID_AUTO, zil_nocacheflush, CTLFLAG_RWTUN,
+_nocacheflush, 0, "Disable ZIL cache flush");
+
 boolean_t zfs_trim_enabled = B_TRUE;
 SYSCTL_DECL(_vfs_zfs_trim);
 SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enabled, CTLFLAG_RDTUN, _trim_enabled, 
0,
@@ -989,7 +991,7 @@ zil_lwb_add_block(lwb_t *lwb, const blkptr_t *bp)
int ndvas = BP_GET_NDVAS(bp);
int i;
 
-   if (zfs_nocacheflush)
+   if (zil_nocacheflush)
return;
 
mutex_enter(>lwb_vdev_lock);
@@ -1013,7 +1015,7 @@ zil_lwb_add_txg(lwb_t *lwb, uint64_t txg)
 /*
  * This function is a called after all VDEVs associated with a given lwb
  * write have completed their DKIOCFLUSHWRITECACHE command; or as soon
- * as the lwb write completes, if "zfs_nocacheflush" is set.
+ * as the lwb write completes, if "zil_nocacheflush" is set.
  *
  * The intention is for this function to be called as soon as the
  * contents of an lwb are considered "stable" on disk, and will survive
___
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: r348576 - vendor-sys/illumos/dist/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 19:53:39 2019
New Revision: 348576
URL: https://svnweb.freebsd.org/changeset/base/348576

Log:
  9963 Seperate tunable for disabling ZIL vdev flush
  
  illumos/illumos-gate@f8fdf6812567ce1a3b76a6bee2ee3f04bd3fcaca
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Brad Lewis 
  Reviewed by: Patrick Mooney 
  Approved by: Dan McDonald 
  Author: Prakash Surya 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c   Mon Jun  3 
19:37:14 2019(r348575)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c   Mon Jun  3 
19:53:39 2019(r348576)
@@ -38,6 +38,13 @@
 #include 
 
 /*
+ * Tunable parameter for debugging or performance analysis. Setting this
+ * will cause pool corruption on power loss if a volatile out-of-order
+ * write cache is enabled.
+ */
+boolean_t zfs_nocacheflush = B_FALSE;
+
+/*
  * Virtual device vector for disks.
  */
 

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Mon Jun  3 19:37:14 
2019(r348575)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Mon Jun  3 19:53:39 
2019(r348576)
@@ -95,11 +95,12 @@ int zfs_commit_timeout_pct = 5;
 int zil_replay_disable = 0;
 
 /*
- * Tunable parameter for debugging or performance analysis.  Setting
- * zfs_nocacheflush will cause corruption on power loss if a volatile
- * out-of-order write cache is enabled.
+ * Disable the DKIOCFLUSHWRITECACHE commands that are normally sent to
+ * the disk(s) by the ZIL after an LWB write has completed. Setting this
+ * will cause ZIL corruption on power loss if a volatile out-of-order
+ * write cache is enabled.
  */
-boolean_t zfs_nocacheflush = B_FALSE;
+boolean_t zil_nocacheflush = B_FALSE;
 
 /*
  * Limit SLOG write size per commit executed with synchronous priority.
@@ -991,7 +992,7 @@ zil_lwb_add_block(lwb_t *lwb, const blkptr_t *bp)
int ndvas = BP_GET_NDVAS(bp);
int i;
 
-   if (zfs_nocacheflush)
+   if (zil_nocacheflush)
return;
 
mutex_enter(>lwb_vdev_lock);
@@ -1015,7 +1016,7 @@ zil_lwb_add_txg(lwb_t *lwb, uint64_t txg)
 /*
  * This function is a called after all VDEVs associated with a given lwb
  * write have completed their DKIOCFLUSHWRITECACHE command; or as soon
- * as the lwb write completes, if "zfs_nocacheflush" is set.
+ * as the lwb write completes, if "zil_nocacheflush" is set.
  *
  * The intention is for this function to be called as soon as the
  * contents of an lwb are considered "stable" on disk, and will survive
___
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: r348575 - head/sys/contrib/ipfilter/netinet

2019-06-03 Thread Cy Schubert
Author: cy
Date: Mon Jun  3 19:37:14 2019
New Revision: 348575
URL: https://svnweb.freebsd.org/changeset/base/348575

Log:
  Properly define the fourth argument to ipf_check, the main entry point
  into ipfilter. A proper definition simplifies dtrace scripts a little.
  
  MFC after:1 week

Modified:
  head/sys/contrib/ipfilter/netinet/fil.c
  head/sys/contrib/ipfilter/netinet/ip_fil.h

Modified: head/sys/contrib/ipfilter/netinet/fil.c
==
--- head/sys/contrib/ipfilter/netinet/fil.c Mon Jun  3 19:25:53 2019
(r348574)
+++ head/sys/contrib/ipfilter/netinet/fil.c Mon Jun  3 19:37:14 2019
(r348575)
@@ -2810,7 +2810,7 @@ ipf_check(ctx, ip, hlen, ifp, out
mb_t **mp;
ip_t *ip;
int hlen;
-   void *ifp;
+   struct ifnet *ifp;
int out;
void *ctx;
 {

Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h
==
--- head/sys/contrib/ipfilter/netinet/ip_fil.h  Mon Jun  3 19:25:53 2019
(r348574)
+++ head/sys/contrib/ipfilter/netinet/ip_fil.h  Mon Jun  3 19:37:14 2019
(r348575)
@@ -1655,7 +1655,7 @@ typedef struct ipf_main_softc_s {
} while (0)
 
 #ifndef_KERNEL
-extern int ipf_check __P((void *, struct ip *, int, void *, int, mb_t **));
+extern int ipf_check __P((void *, struct ip *, int, struct ifnet *, int, 
mb_t **));
 extern struct  ifnet *get_unit __P((char *, int));
 extern char*get_ifname __P((struct ifnet *));
 extern int ipfioctl __P((ipf_main_softc_t *, int, ioctlcmd_t,
@@ -1672,7 +1672,7 @@ externint ipl_enable __P((void));
 extern int ipl_disable __P((void));
 # ifdef MENTAT
 /* XXX MENTAT is always defined for Solaris */
-extern int ipf_check __P((void *, struct ip *, int, void *, int, void *,
+extern int ipf_check __P((void *, struct ip *, int, struct ifnet *, int, 
void *,
   mblk_t **));
 #  if SOLARIS
 extern voidipf_prependmbt(fr_info_t *, mblk_t *);
@@ -1681,7 +1681,7 @@ externint ipfioctl __P((dev_t, int, intptr_t, 
int, cr
 extern int ipf_qout __P((queue_t *, mblk_t *));
 # else /* MENTAT */
 /* XXX MENTAT is never defined for FreeBSD & NetBSD */
-extern int ipf_check __P((void *, struct ip *, int, void *, int, mb_t **));
+extern int ipf_check __P((void *, struct ip *, int, struct ifnet *, int, 
mb_t **));
 extern int (*fr_checkp) __P((ip_t *, int, void *, int, mb_t **));
 extern size_t  mbufchainlen __P((mb_t *));
 #   ifdef  IPFILTER_LKM
___
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: r348574 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 19:25:53 2019
New Revision: 348574
URL: https://svnweb.freebsd.org/changeset/base/348574

Log:
  MFV r348573: 9993 zil writes can get delayed in zio pipeline
  
  illumos/illumos-gate@2258ad0b755b24a55c6173b1e6bb6188389f72dd
  
  Reviewed by: Prakash Surya 
  Reviewed by: Brad Lewis 
  Reviewed by: Matt Ahrens 
  Approved by: Dan McDonald 
  Author: George Wilson 

Modified:
  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/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon Jun  3 
19:24:40 2019(r348573)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon Jun  3 
19:25:53 2019(r348574)
@@ -1614,7 +1614,8 @@ zio_taskq_dispatch(zio_t *zio, zio_taskq_type_t q, boo
 * If this is a high priority I/O, then use the high priority taskq if
 * available.
 */
-   if (zio->io_priority == ZIO_PRIORITY_NOW &&
+   if ((zio->io_priority == ZIO_PRIORITY_NOW ||
+   zio->io_priority == ZIO_PRIORITY_SYNC_WRITE) &&
spa->spa_zio_taskq[t][q + 1].stqs_count != 0)
q++;
 
___
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: r348573 - vendor-sys/illumos/dist/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 19:24:40 2019
New Revision: 348573
URL: https://svnweb.freebsd.org/changeset/base/348573

Log:
  9993 zil writes can get delayed in zio pipeline
  
  illumos/illumos-gate@2258ad0b755b24a55c6173b1e6bb6188389f72dd
  
  Reviewed by: Prakash Surya 
  Reviewed by: Brad Lewis 
  Reviewed by: Matt Ahrens 
  Approved by: Dan McDonald 
  Author: George Wilson 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Mon Jun  3 19:20:10 
2019(r348572)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Mon Jun  3 19:24:40 
2019(r348573)
@@ -1497,7 +1497,8 @@ zio_taskq_dispatch(zio_t *zio, zio_taskq_type_t q, boo
 * If this is a high priority I/O, then use the high priority taskq if
 * available.
 */
-   if (zio->io_priority == ZIO_PRIORITY_NOW &&
+   if ((zio->io_priority == ZIO_PRIORITY_NOW ||
+   zio->io_priority == ZIO_PRIORITY_SYNC_WRITE) &&
spa->spa_zio_taskq[t][q + 1].stqs_count != 0)
q++;
 
___
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: r348572 - vendor/illumos/dist/lib/libzfs/common

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 19:20:10 2019
New Revision: 348572
URL: https://svnweb.freebsd.org/changeset/base/348572

Log:
  9880 Race in ZFS parallel mount
  
  illumos/illumos-gate@bc4c0ff1343a311cc24933908ac6c4455af09031
  
  Reviewed by: Jason King 
  Reviewed by: Sebastien Roy 
  Approved by: Joshua M. Clulow 
  Author: Andy Fiddaman 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_mount.cMon Jun  3 
19:19:35 2019(r348571)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_mount.cMon Jun  3 
19:20:10 2019(r348572)
@@ -26,6 +26,7 @@
  * Copyright 2016 Igor Kozhukhov 
  * Copyright 2017 Joyent, Inc.
  * Copyright 2017 RackTop Systems.
+ * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
  */
 
 /*
@@ -1142,19 +1143,28 @@ zfs_iter_cb(zfs_handle_t *zhp, void *data)
 /*
  * Sort comparator that compares two mountpoint paths. We sort these paths so
  * that subdirectories immediately follow their parents. This means that we
- * effectively treat the '/' character as the lowest value non-nul char. An
- * example sorted list using this comparator would look like:
+ * effectively treat the '/' character as the lowest value non-nul char.
+ * Since filesystems from non-global zones can have the same mountpoint
+ * as other filesystems, the comparator sorts global zone filesystems to
+ * the top of the list. This means that the global zone will traverse the
+ * filesystem list in the correct order and can stop when it sees the
+ * first zoned filesystem. In a non-global zone, only the delegated
+ * filesystems are seen.
  *
+ * An example sorted list using this comparator would look like:
+ *
  * /foo
  * /foo/bar
  * /foo/bar/baz
  * /foo/baz
  * /foo.bar
+ * /foo (NGZ1)
+ * /foo (NGZ2)
  *
  * The mounting code depends on this ordering to deterministically iterate
  * over filesystems in order to spawn parallel mount tasks.
  */
-int
+static int
 mountpoint_cmp(const void *arga, const void *argb)
 {
zfs_handle_t *const *zap = arga;
@@ -1166,7 +1176,15 @@ mountpoint_cmp(const void *arga, const void *argb)
const char *a = mounta;
const char *b = mountb;
boolean_t gota, gotb;
+   uint64_t zoneda, zonedb;
 
+   zoneda = zfs_prop_get_int(za, ZFS_PROP_ZONED);
+   zonedb = zfs_prop_get_int(zb, ZFS_PROP_ZONED);
+   if (zoneda && !zonedb)
+   return (1);
+   if (!zoneda && zonedb)
+   return (-1);
+
gota = (zfs_get_type(za) == ZFS_TYPE_FILESYSTEM);
if (gota) {
verify(zfs_prop_get(za, ZFS_PROP_MOUNTPOINT, mounta,
@@ -1379,6 +1397,8 @@ void
 zfs_foreach_mountpoint(libzfs_handle_t *hdl, zfs_handle_t **handles,
 size_t num_handles, zfs_iter_f func, void *data, boolean_t parallel)
 {
+   zoneid_t zoneid = getzoneid();
+
/*
 * The ZFS_SERIAL_MOUNT environment variable is an undocumented
 * variable that can be used as a convenience to do a/b comparison
@@ -1414,6 +1434,14 @@ zfs_foreach_mountpoint(libzfs_handle_t *hdl, zfs_handl
 */
for (int i = 0; i < num_handles;
i = non_descendant_idx(handles, num_handles, i)) {
+   /*
+* Since the mountpoints have been sorted so that the zoned
+* filesystems are at the end, a zoned filesystem seen from
+* the global zone means that we're done.
+*/
+   if (zoneid == GLOBAL_ZONEID &&
+   zfs_prop_get_int(handles[i], ZFS_PROP_ZONED))
+   break;
zfs_dispatch_mount(hdl, handles, num_handles, i, func, data,
tq);
}
___
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: r348571 - in head/sys: arm64/arm64 x86/iommu x86/x86

2019-06-03 Thread Tycho Nightingale
Author: tychon
Date: Mon Jun  3 19:19:35 2019
New Revision: 348571
URL: https://svnweb.freebsd.org/changeset/base/348571

Log:
  very large dma mappings can cause integer overflow
  
  Reviewed by:  kib
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20505

Modified:
  head/sys/arm64/arm64/busdma_bounce.c
  head/sys/x86/iommu/busdma_dmar.c
  head/sys/x86/x86/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==
--- head/sys/arm64/arm64/busdma_bounce.cMon Jun  3 19:15:06 2019
(r348570)
+++ head/sys/arm64/arm64/busdma_bounce.cMon Jun  3 19:19:35 2019
(r348571)
@@ -660,7 +660,7 @@ _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmam
 /*
  * Add a single contiguous physical range to the segment list.
  */
-static int
+static bus_size_t
 _bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr,
 bus_size_t sgsize, bus_dma_segment_t *segs, int *segp)
 {

Modified: head/sys/x86/iommu/busdma_dmar.c
==
--- head/sys/x86/iommu/busdma_dmar.cMon Jun  3 19:15:06 2019
(r348570)
+++ head/sys/x86/iommu/busdma_dmar.cMon Jun  3 19:19:35 2019
(r348571)
@@ -686,7 +686,7 @@ dmar_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmam
return (ENOMEM);
fma = NULL;
for (i = 0; i < ma_cnt; i++) {
-   paddr = pstart + i * PAGE_SIZE;
+   paddr = pstart + ptoa(i);
ma[i] = PHYS_TO_VM_PAGE(paddr);
if (ma[i] == NULL || VM_PAGE_TO_PHYS(ma[i]) != paddr) {
/*

Modified: head/sys/x86/x86/busdma_bounce.c
==
--- head/sys/x86/x86/busdma_bounce.cMon Jun  3 19:15:06 2019
(r348570)
+++ head/sys/x86/x86/busdma_bounce.cMon Jun  3 19:19:35 2019
(r348571)
@@ -667,7 +667,7 @@ _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmam
 /*
  * Add a single contiguous physical range to the segment list.
  */
-static int
+static bus_size_t
 _bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t curaddr,
 bus_size_t sgsize, bus_dma_segment_t *segs, int *segp)
 {
___
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: r348570 - head/cddl/contrib/opensolaris/cmd/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 19:15:06 2019
New Revision: 348570
URL: https://svnweb.freebsd.org/changeset/base/348570

Log:
  MFV r348568: 9466 add JSON output support to channel programs
  
  illumos/illumos-gate@5267591016146502784860802129b16dab6f135c
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Sara Hartse 
  Reviewed by: John Kennedy 
  Approved by: Dan McDonald 
  Author: Alek Pinchuk 

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Mon Jun  3 19:10:46 
2019(r348569)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs-program.8 Mon Jun  3 19:15:06 
2019(r348570)
@@ -9,6 +9,7 @@
 .\"
 .\"
 .\" Copyright (c) 2016, 2017 by Delphix. All rights reserved.
+.\" Copyright (c) 2018 Datto Inc.
 .\"
 .Dd October 02, 2017
 .Dt ZFS-PROGRAM 1M
@@ -18,7 +19,7 @@
 .Nd executes ZFS channel programs
 .Sh SYNOPSIS
 .Cm zfs program
-.Op Fl n
+.Op Fl jn
 .Op Fl t Ar instruction-limit
 .Op Fl m Ar memory-limit
 .Ar pool
@@ -46,6 +47,11 @@ will be run on
 and any attempts to access or modify other pools will cause an error.
 .Sh OPTIONS
 .Bl -tag -width "-t"
+.It Fl j
+Display channel program output in JSON format.
+When this flag is specified and standard output is empty -
+channel program encountered an error.
+The details of such an error will be printed to standard error in plain text.
 .It Fl n
 Executes a read-only channel program, which runs faster.
 The program cannot change on-disk state by calling functions from the

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Jun  3 19:10:46 2019
(r348569)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Jun  3 19:15:06 2019
(r348570)
@@ -29,6 +29,7 @@
 .\" Copyright (c) 2014, Xin LI 
 .\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved.
 .\" Copyright 2018 Joyent, Inc.
+.\" Copyright (c) 2018 Datto Inc.
 .\"
 .\" $FreeBSD$
 .\"
@@ -291,7 +292,7 @@
 .Op Ar snapshot Ns | Ns Ar filesystem
 .Nm
 .Cm program
-.Op Fl n
+.Op Fl jn
 .Op Fl t Ar timeout
 .Op Fl m Ar memory_limit
 .Ar pool script
@@ -3364,7 +3365,7 @@ Display the path's inode change time as the first colu
 .It Xo
 .Nm
 .Cm program
-.Op Fl n
+.Op Fl jn
 .Op Fl t Ar timeout
 .Op Fl m Ar memory_limit
 .Ar pool script
@@ -3387,6 +3388,11 @@ For full documentation of the ZFS channel program inte
 page for
 .Xr zfs-program 8 .
 .Bl -tag -width indent
+.It Fl j
+Display channel program output in JSON format.
+When this flag is specified and standard output is empty -
+channel program encountered an error.
+The details of such an error will be printed to standard error in plain text.
 .It Fl n
 Executes a read-only channel program, which runs faster.
 The program cannot change on-disk state by calling functions from

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cMon Jun  3 19:10:46 
2019(r348569)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cMon Jun  3 19:15:06 
2019(r348570)
@@ -30,6 +30,7 @@
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2016 Igor Kozhukhov .
  * Copyright 2016 Nexenta Systems, Inc.
+ * Copyright (c) 2018 Datto Inc.
  */
 
 #include 
@@ -351,7 +352,7 @@ get_usage(zfs_help_t idx)
case HELP_BOOKMARK:
return (gettext("\tbookmark  \n"));
case HELP_CHANNEL_PROGRAM:
-   return (gettext("\tprogram [-n] [-t ] "
+   return (gettext("\tprogram [-jn] [-t ] "
"[-m ]   "
"[lua args...]\n"));
}
@@ -7238,12 +7239,12 @@ zfs_do_channel_program(int argc, char **argv)
nvlist_t *outnvl;
uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT;
uint64_t memlimit = ZCP_DEFAULT_MEMLIMIT;
-   boolean_t sync_flag = B_TRUE;
+   boolean_t sync_flag = B_TRUE, json_output = B_FALSE;
zpool_handle_t *zhp;
 
/* check options */
while (-1 !=
-   (c = getopt(argc, argv, "nt:(instr-limit)m:(memory-limit)"))) {
+   (c = getopt(argc, argv, "jnt:(instr-limit)m:(memory-limit)"))) {
switch (c) {
case 't':
case 'm': {
@@ -7285,6 +7286,10 @@ zfs_do_channel_program(int argc, char **argv)
sync_flag = B_FALSE;
break;
}
+

svn commit: r348569 - in head/stand: common i386/zfsboot

2019-06-03 Thread Warner Losh
Author: imp
Date: Mon Jun  3 19:10:46 2019
New Revision: 348569
URL: https://svnweb.freebsd.org/changeset/base/348569

Log:
  [zfsboot] Fix boot env back compat (#190)
  
  * Fix boot env back compat
  
  zfsboot must try zfsloader before loader in order to remain compatible
  with boot environments created prior to zfs functionality being rolled
  into loader proper.
  
  * Improve comments in zfsboot
  
  Explain the significance of the load path order, and put the comment
  about looping through the paths in the appropriate scope.
  
  Obtained From:  TrueNAS commit 4c60c62fcf0b6b6eac98ee8d46e7bbea64bc86f5
  Submitted by: Ryan Moeller 

Modified:
  head/stand/common/paths.h
  head/stand/i386/zfsboot/zfsboot.c

Modified: head/stand/common/paths.h
==
--- head/stand/common/paths.h   Mon Jun  3 19:09:39 2019(r348568)
+++ head/stand/common/paths.h   Mon Jun  3 19:10:46 2019(r348569)
@@ -33,6 +33,7 @@
 #define PATH_CONFIG"/boot/config"
 #define PATH_LOADER"/boot/loader"
 #define PATH_LOADER_EFI"/boot/loader.efi"
+#define PATH_LOADER_ZFS"/boot/zfsloader"
 #define PATH_KERNEL"/boot/kernel/kernel"
 
 #endif /* _PATHS_H_ */

Modified: head/stand/i386/zfsboot/zfsboot.c
==
--- head/stand/i386/zfsboot/zfsboot.c   Mon Jun  3 19:09:39 2019
(r348568)
+++ head/stand/i386/zfsboot/zfsboot.c   Mon Jun  3 19:10:46 2019
(r348569)
@@ -87,6 +87,24 @@ static const unsigned char flags[NOPT] = {
 };
 uint32_t opts;
 
+/*
+ * Paths to try loading before falling back to the boot2 prompt.
+ *
+ * /boot/zfsloader must be tried before /boot/loader in order to remain
+ * backward compatible with ZFS boot environments where /boot/loader exists
+ * but does not have ZFS support, which was the case before FreeBSD 12.
+ *
+ * If no loader is found, try to load a kernel directly instead.
+ */
+static const struct string {
+const char *p;
+size_t len;
+} loadpath[] = {
+{ PATH_LOADER_ZFS, sizeof(PATH_LOADER_ZFS) },
+{ PATH_LOADER, sizeof(PATH_LOADER) },
+{ PATH_KERNEL, sizeof(PATH_KERNEL) },
+};
+
 static const unsigned char dev_maj[NDEV] = {30, 4, 2};
 
 static char cmd[512];
@@ -857,16 +875,17 @@ main(void)
 if (nextboot && !autoboot)
reboot();
 
-/*
- * Try to exec /boot/loader. If interrupted by a keypress,
- * or in case of failure, try to load a kernel directly instead.
- */
-
 if (autoboot && !*kname) {
-   memcpy(kname, PATH_LOADER, sizeof(PATH_LOADER));
-   if (!keyhit(3)) {
+   /*
+* Iterate through the list of loader and kernel paths, trying to load.
+* If interrupted by a keypress, or in case of failure, drop the user
+* to the boot2 prompt.
+*/
+   for (i = 0; i < nitems(loadpath); i++) {
+   memcpy(kname, loadpath[i].p, loadpath[i].len);
+   if (keyhit(3))
+   break;
load();
-   memcpy(kname, PATH_KERNEL, sizeof(PATH_KERNEL));
}
 }
 
___
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: r348568 - in vendor/illumos/dist: cmd/zfs man/man1m

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 19:09:39 2019
New Revision: 348568
URL: https://svnweb.freebsd.org/changeset/base/348568

Log:
  9466 add JSON output support to channel programs
  
  illumos/illumos-gate@5267591016146502784860802129b16dab6f135c
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Sara Hartse 
  Reviewed by: John Kennedy 
  Approved by: Dan McDonald 
  Author: Alek Pinchuk 

Modified:
  vendor/illumos/dist/cmd/zfs/zfs_main.c
  vendor/illumos/dist/man/man1m/zfs-program.1m
  vendor/illumos/dist/man/man1m/zfs.1m

Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c
==
--- vendor/illumos/dist/cmd/zfs/zfs_main.c  Mon Jun  3 19:03:24 2019
(r348567)
+++ vendor/illumos/dist/cmd/zfs/zfs_main.c  Mon Jun  3 19:09:39 2019
(r348568)
@@ -29,6 +29,7 @@
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2016 Igor Kozhukhov .
  * Copyright 2016 Nexenta Systems, Inc.
+ * Copyright (c) 2018 Datto Inc.
  */
 
 #include 
@@ -335,7 +336,7 @@ get_usage(zfs_help_t idx)
case HELP_BOOKMARK:
return (gettext("\tbookmark  \n"));
case HELP_CHANNEL_PROGRAM:
-   return (gettext("\tprogram [-n] [-t ] "
+   return (gettext("\tprogram [-jn] [-t ] "
"[-m ]   "
"[lua args...]\n"));
}
@@ -7072,12 +7073,12 @@ zfs_do_channel_program(int argc, char **argv)
nvlist_t *outnvl;
uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT;
uint64_t memlimit = ZCP_DEFAULT_MEMLIMIT;
-   boolean_t sync_flag = B_TRUE;
+   boolean_t sync_flag = B_TRUE, json_output = B_FALSE;
zpool_handle_t *zhp;
 
/* check options */
while (-1 !=
-   (c = getopt(argc, argv, "nt:(instr-limit)m:(memory-limit)"))) {
+   (c = getopt(argc, argv, "jnt:(instr-limit)m:(memory-limit)"))) {
switch (c) {
case 't':
case 'm': {
@@ -7119,6 +7120,10 @@ zfs_do_channel_program(int argc, char **argv)
sync_flag = B_FALSE;
break;
}
+   case 'j': {
+   json_output = B_TRUE;
+   break;
+   }
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
@@ -7237,11 +7242,14 @@ zfs_do_channel_program(int argc, char **argv)
gettext("Channel program execution failed:\n%s\n"),
errstring);
} else {
-   (void) printf("Channel program fully executed ");
-   if (nvlist_empty(outnvl)) {
-   (void) printf("with no return value.\n");
+   if (json_output) {
+   (void) nvlist_print_json(stdout, outnvl);
+   } else if (nvlist_empty(outnvl)) {
+   (void) fprintf(stdout, gettext("Channel program fully "
+   "executed and did not produce output.\n"));
} else {
-   (void) printf("with return value:\n");
+   (void) fprintf(stdout, gettext("Channel program fully "
+   "executed and produced output:\n"));
dump_nvlist(outnvl, 4);
}
}

Modified: vendor/illumos/dist/man/man1m/zfs-program.1m
==
--- vendor/illumos/dist/man/man1m/zfs-program.1mMon Jun  3 19:03:24 
2019(r348567)
+++ vendor/illumos/dist/man/man1m/zfs-program.1mMon Jun  3 19:09:39 
2019(r348568)
@@ -9,6 +9,7 @@
 .\"
 .\"
 .\" Copyright (c) 2016, 2017 by Delphix. All rights reserved.
+.\" Copyright (c) 2018 Datto Inc.
 .\"
 .Dd January 21, 2016
 .Dt ZFS-PROGRAM 1M
@@ -18,7 +19,7 @@
 .Nd executes ZFS channel programs
 .Sh SYNOPSIS
 .Cm "zfs program"
-.Op Fl n
+.Op Fl jn
 .Op Fl t Ar instruction-limit
 .Op Fl m Ar memory-limit
 .Ar pool
@@ -46,6 +47,11 @@ will be run on
 and any attempts to access or modify other pools will cause an error.
 .Sh OPTIONS
 .Bl -tag -width "-t"
+.It Fl j
+Display channel program output in JSON format.
+When this flag is specified and standard output is empty -
+channel program encountered an error.
+The details of such an error will be printed to standard error in plain text.
 .It Fl n
 Executes a read-only channel program, which runs faster.
 The program cannot change on-disk state by calling functions from the

Modified: vendor/illumos/dist/man/man1m/zfs.1m
==
--- vendor/illumos/dist/man/man1m/zfs.1mMon Jun  3 19:03:24 2019
(r348567)
+++ vendor/illumos/dist/man/man1m/zfs.1mMon Jun  3 19:09:39 2019
(r348568)
@@ -28,6 +28,7 @@
 .\" Copyright (c) 2014 

Re: svn commit: r348540 - head

2019-06-03 Thread Rodney W. Grimes
> Author: sobomax
> Date: Mon Jun  3 15:34:00 2019
> New Revision: 348540
> URL: https://svnweb.freebsd.org/changeset/base/348540
> 
> Log:
>   Rollback the rest of the botched r348521. Re-work would be posted to
>   reviews. Sorry.
>   
>   Reported by:Enji Cooper
> 
> Modified:
>   head/Makefile.inc1
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Mon Jun  3 15:32:42 2019(r348539)
> +++ head/Makefile.inc1Mon Jun  3 15:34:00 2019(r348540)
> @@ -887,7 +887,7 @@ MTREEFLAGS+=  -W
>  INSTALLFLAGS+=   -h sha256
>  .endif
>  .if defined(DB_FROM_SRC) || defined(NO_ROOT)
> -IMAKE_INSTALL=   INSTALL="${INSTALL} ${INSTALLFLAGS}"
> +IMAKE_INSTALL=   INSTALL="install ${INSTALLFLAGS}"

This is a correct change,
ngie please explain exactly why this is an exception to INSTALL?=install.

>  IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
>  .endif

-- 
Rod Grimes rgri...@freebsd.org
___
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: r348532 - in head: . etc

2019-06-03 Thread Rodney W. Grimes
> Author: sobomax
> Date: Mon Jun  3 15:12:44 2019
> New Revision: 348532
> URL: https://svnweb.freebsd.org/changeset/base/348532
> 
> Log:
>   Leave mtree hardcoded for now. Reverting partially 348521 and also
>   the followup stopgap change, because I don't think it's a correct. I still
>   need to figure out where to stick it in. In cannot be in Makefile.inc1
>   and it cannot be in etc/Makefile from the looks of it to avoid
>   chicken-and-egg problem.

A quick and incomplete look at this leads me to believe that much of the
mtree related stuff in src/Makefile.inc1 should of been in src/etc
in the first place.
It ends up invoking etc/Makefile in the end anyway.
Can someone explain why this is pulled up a level?
Why do we now have distrib-dirs, distribution in
src/Makefile.inc1, these were and should be in etc/Makefile?
iirc hierarchy was pulled up to src/Makefile at one point,
but forgetting the reasoning for that.

> Modified:
>   head/Makefile.inc1
>   head/etc/Makefile
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Mon Jun  3 15:10:37 2019(r348531)
> +++ head/Makefile.inc1Mon Jun  3 15:12:44 2019(r348532)
> @@ -888,7 +888,7 @@ INSTALLFLAGS+=-h sha256
>  .endif
>  .if defined(DB_FROM_SRC) || defined(NO_ROOT)
>  IMAKE_INSTALL=   INSTALL="${INSTALL} ${INSTALLFLAGS}"
> -IMAKE_MTREE= MTREE_CMD="${MTREE} ${MTREEFLAGS}"
> +IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
>  .endif
>  
>  DESTDIR_MTREEFLAGS=  -deU
> 
> Modified: head/etc/Makefile
> ==
> --- head/etc/Makefile Mon Jun  3 15:10:37 2019(r348531)
> +++ head/etc/Makefile Mon Jun  3 15:12:44 2019(r348532)
> @@ -93,8 +93,6 @@ distribution:
>  .endif
>  .endif
>  
> -MTREE_CMD?=  mtree
> -
>  MTREES=  mtree/BSD.root.dist /   \
>   mtree/BSD.var.dist  /var\
>   mtree/BSD.usr.dist  /usr\
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r348567 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 19:03:24 2019
New Revision: 348567
URL: https://svnweb.freebsd.org/changeset/base/348567

Log:
  MFV r348555: 9690 metaslab of vdev with no space maps was flushed during 
removal
  
  illumos/illumos-gate@4e75ba682600b2bf19d158577d528c3db65050e8
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Brad Lewis 
  Approved by: Robert Mustacchi 
  Author: Serapheim Dimitropoulos 

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Mon Jun  3 
19:00:24 2019(r348566)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Mon Jun  3 
19:03:24 2019(r348567)
@@ -3031,11 +3031,11 @@ vdev_destroy_spacemaps(vdev_t *vd, dmu_tx_t *tx)
 }
 
 static void
-vdev_remove_empty(vdev_t *vd, uint64_t txg)
+vdev_remove_empty_log(vdev_t *vd, uint64_t txg)
 {
spa_t *spa = vd->vdev_spa;
-   dmu_tx_t *tx;
 
+   ASSERT(vd->vdev_islog);
ASSERT(vd == vd->vdev_top);
ASSERT3U(txg, ==, spa_syncing_txg(spa));
 
@@ -3079,13 +3079,14 @@ vdev_remove_empty(vdev_t *vd, uint64_t txg)
ASSERT0(mg->mg_histogram[i]);
}
 
-   tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg);
-   vdev_destroy_spacemaps(vd, tx);
+   dmu_tx_t *tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg);
 
-   if (vd->vdev_islog && vd->vdev_top_zap != 0) {
+   vdev_destroy_spacemaps(vd, tx);
+   if (vd->vdev_top_zap != 0) {
vdev_destroy_unlink_zap(vd, vd->vdev_top_zap, tx);
vd->vdev_top_zap = 0;
}
+
dmu_tx_commit(tx);
 }
 
@@ -3157,14 +3158,11 @@ vdev_sync(vdev_t *vd, uint64_t txg)
vdev_dtl_sync(lvd, txg);
 
/*
-* Remove the metadata associated with this vdev once it's empty.
-* Note that this is typically used for log/cache device removal;
-* we don't empty toplevel vdevs when removing them.  But if
-* a toplevel happens to be emptied, this is not harmful.
+* If this is an empty log device being removed, destroy the
+* metadata associated with it.
 */
-   if (vd->vdev_stat.vs_alloc == 0 && vd->vdev_removing) {
-   vdev_remove_empty(vd, txg);
-   }
+   if (vd->vdev_islog && vd->vdev_stat.vs_alloc == 0 && vd->vdev_removing)
+   vdev_remove_empty_log(vd, txg);
 
(void) txg_list_add(>spa_vdev_txg_list, vd, TXG_CLEAN(txg));
 }
___
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: r348566 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 19:00:24 2019
New Revision: 348566
URL: https://svnweb.freebsd.org/changeset/base/348566

Log:
  MFC r348554: 9688 aggsum_fini leaks memory
  
  illumos/illumos-gate@29bf2d68bef208274f5a54a14cc80c4a8cb76f53
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Matt Ahrens 
  Reviewed by: Prashanth Sreenivasa 
  Reviewed by: Jorgen Lundman 
  Reviewed by: Igor Kozhukhov 
  Approved by: Robert Mustacchi 
  Author: Paul Dagnelie 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c
  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/aggsum.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.cMon Jun 
 3 18:32:56 2019(r348565)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.cMon Jun 
 3 19:00:24 2019(r348566)
@@ -13,7 +13,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright (c) 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2017, 2018 by Delphix. All rights reserved.
  */
 
 #include 
@@ -99,6 +99,7 @@ aggsum_fini(aggsum_t *as)
 {
for (int i = 0; i < as->as_numbuckets; i++)
mutex_destroy(>as_buckets[i].asc_lock);
+   kmem_free(as->as_buckets, as->as_numbuckets * sizeof (aggsum_bucket_t));
mutex_destroy(>as_lock);
 }
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Mon Jun  3 
18:32:56 2019(r348565)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Mon Jun  3 
19:00:24 2019(r348566)
@@ -7074,6 +7074,16 @@ arc_state_fini(void)
multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_DATA]);
multilist_destroy(arc_mfu->arcs_list[ARC_BUFC_DATA]);
multilist_destroy(arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]);
+
+   aggsum_fini(_meta_used);
+   aggsum_fini(_size);
+   aggsum_fini(_data_size);
+   aggsum_fini(_metadata_size);
+   aggsum_fini(_hdr_size);
+   aggsum_fini(_bonus_size);
+   aggsum_fini(_dnode_size);
+   aggsum_fini(_dbuf_size);
+   aggsum_fini(_l2_hdr_size);
 }
 
 uint64_t
@@ -7357,8 +7367,13 @@ arc_fini(void)
mutex_destroy(_adjust_lock);
cv_destroy(_adjust_waiters_cv);
 
-   arc_state_fini();
+   /*
+* buf_fini() must proceed arc_state_fini() because buf_fin() may
+* trigger the release of kmem magazines, which can callback to
+* arc_space_return() which accesses aggsums freed in act_state_fini().
+*/
buf_fini();
+   arc_state_fini();
 
ASSERT0(arc_loaned_bytes);
 }
___
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: r348521 - in head: . etc sys/conf sys/modules usr.bin/login usr.sbin/services_mkdb

2019-06-03 Thread Rodney W. Grimes
> On Mon, Jun 3, 2019 at 7:28 AM Enji Cooper  wrote:
> 
> > Hi Maxim,
> >
> >
> > > Modified: head/Makefile.inc1
> > >
> > ==
> > > --- head/Makefile.inc1Sun Jun  2 22:27:26 2019(r348520)
> > > +++ head/Makefile.inc1Sun Jun  2 23:38:19 2019(r348521)
> > > @@ -887,8 +887,8 @@ MTREEFLAGS+=-W
> > > INSTALLFLAGS+=-h sha256
> > > .endif
> > > .if defined(DB_FROM_SRC) || defined(NO_ROOT)
> > > -IMAKE_INSTALL=INSTALL="install ${INSTALLFLAGS}"
> > > -IMAKE_MTREE=MTREE_CMD="mtree ${MTREEFLAGS}"
> > > +IMAKE_INSTALL=INSTALL="${INSTALL} ${INSTALLFLAGS}"
> > > +IMAKE_MTREE=MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"

I see the bugger with this change now, it is a loop,
MTREE_CMD=${MTREE_CMD}... and I do not think MTREE_CMD is defined
at this point, see below.

> > > .endif
> >
> > Please back out this part of the change as it is unnecessary and adds
> > a dependency on sys.mk?s definitions. $PATH should contain, i.e., be
> > populated, with these tools when running make installworld. This is part of
> > the logic behind how $ITOOLS, etc, works.

That would be in direct conflict with how preceding tools
worked,  INSTALL?=install has been there for a very very long time
and any direct invoke of install in our Makefile/.mk files is just wrong,
and for the very reasoning that Max is trying to do.

I made the mistake of following someone else earlier that thought
it was INSTALL that was undefined, and as we known now that was
not the case, it was MTREE_CMD that was undefined, and that is
less clear, as iirc when that was originally done mtree was
contained soly in src/etc/Makefile by design.  It appears as
if that hos how crept up directly into head/Makefile.inc1, and
the definition for MTREE_CMD?= did not get moved to a more
appropriate place.

> > Thank you very much for your work and the rest of the change though!
> >
> 
>  Thanks Enji, for a clarification, will do. I still cannot understand why
> can't we have those tools being re-defined with top-level make environment?

You should and must be able to do this.
Especially for INSTALL, I fully support that part of this change staying.
 
> What I am striving at is being able to do say, make INSTALL="abcd"
> installworld. Yes, I understand I can call "abcd" "install" (or make a
> symlink to it) and put it into PATH, but there are at least one issue here,
> namely what if I need to pass some distinct argument to abcd based on usage
> scenario. E.g. make INSTALL="abcd foo" distributiuon. In your case I should
> be resorting to setting up some global environment variable and hope it
> won't get erased somewhere in the call chain, but that's bit "how you
> doing" IMHO. My approach makes certain things so much easier by cutting
> those un-neded steps.
> 
> At any rate thank for a feedback and some background info, I will do more
> work on this. I was thinking more in terms of having some sort of
> bsd.bootools.mk where this can be defined in a centralized manner.
> 
> -Max

-- 
Rod Grimes rgri...@freebsd.org
___
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: r348565 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 18:32:56 2019
New Revision: 348565
URL: https://svnweb.freebsd.org/changeset/base/348565

Log:
  MFV r348553: 9681 ztest failure in spa_history_log_internal due to 
spa_rename()
  
  illumos/illumos-gate@6aee0ad76969eb0027131b3a338f2d94ae86f728
  
  Reviewed by: Prakash Surya 
  Reviewed by: Serapheim Dimitropoulos 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

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

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Jun  3 17:56:44 
2019(r348564)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Jun  3 18:32:56 
2019(r348565)
@@ -338,7 +338,6 @@ ztest_func_t ztest_spa_create_destroy;
 ztest_func_t ztest_fault_inject;
 ztest_func_t ztest_ddt_repair;
 ztest_func_t ztest_dmu_snapshot_hold;
-ztest_func_t ztest_spa_rename;
 ztest_func_t ztest_scrub;
 ztest_func_t ztest_dsl_dataset_promote_busy;
 ztest_func_t ztest_vdev_attach_detach;
@@ -384,7 +383,6 @@ ztest_info_t ztest_info[] = {
{ ztest_ddt_repair, 1,  _sometimes },
{ ztest_dmu_snapshot_hold,  1,  _sometimes },
{ ztest_reguid, 1,  _rarely},
-   { ztest_spa_rename, 1,  _rarely},
{ ztest_scrub,  1,  _often },
{ ztest_spa_upgrade,1,  _rarely},
{ ztest_dsl_dataset_promote_busy,   1,  _rarely},
@@ -5550,59 +5548,6 @@ ztest_reguid(ztest_ds_t *zd, uint64_t id)
VERIFY3U(load, ==, spa_load_guid(spa));
 }
 
-/*
- * Rename the pool to a different name and then rename it back.
- */
-/* ARGSUSED */
-void
-ztest_spa_rename(ztest_ds_t *zd, uint64_t id)
-{
-   char *oldname, *newname;
-   spa_t *spa;
-
-   rw_enter(_name_lock, RW_WRITER);
-
-   oldname = ztest_opts.zo_pool;
-   newname = umem_alloc(strlen(oldname) + 5, UMEM_NOFAIL);
-   (void) strcpy(newname, oldname);
-   (void) strcat(newname, "_tmp");
-
-   /*
-* Do the rename
-*/
-   VERIFY3U(0, ==, spa_rename(oldname, newname));
-
-   /*
-* Try to open it under the old name, which shouldn't exist
-*/
-   VERIFY3U(ENOENT, ==, spa_open(oldname, , FTAG));
-
-   /*
-* Open it under the new name and make sure it's still the same spa_t.
-*/
-   VERIFY3U(0, ==, spa_open(newname, , FTAG));
-
-   ASSERT(spa == ztest_spa);
-   spa_close(spa, FTAG);
-
-   /*
-* Rename it back to the original
-*/
-   VERIFY3U(0, ==, spa_rename(newname, oldname));
-
-   /*
-* Make sure it can still be opened
-*/
-   VERIFY3U(0, ==, spa_open(oldname, , FTAG));
-
-   ASSERT(spa == ztest_spa);
-   spa_close(spa, FTAG);
-
-   umem_free(newname, strlen(newname) + 1);
-
-   rw_exit(_name_lock);
-}
-
 static vdev_t *
 ztest_random_concrete_vdev_leaf(vdev_t *vd)
 {
@@ -6661,7 +6606,6 @@ main(int argc, char **argv)
ztest_shared_callstate_t *zc;
char timebuf[100];
char numbuf[NN_NUMBUF_SZ];
-   spa_t *spa;
char *cmd;
boolean_t hasalt;
char *fd_data_str = getenv("ZTEST_FD_DATA");
@@ -6835,24 +6779,6 @@ main(int argc, char **argv)
}
(void) printf("\n");
}
-
-   /*
-* It's possible that we killed a child during a rename test,
-* in which case we'll have a 'ztest_tmp' pool lying around
-* instead of 'ztest'.  Do a blind rename in case this happened.
-*/
-   kernel_init(FREAD);
-   if (spa_open(ztest_opts.zo_pool, , FTAG) == 0) {
-   spa_close(spa, FTAG);
-   } else {
-   char tmpname[ZFS_MAX_DATASET_NAME_LEN];
-   kernel_fini();
-   kernel_init(FREAD | FWRITE);
-   (void) snprintf(tmpname, sizeof (tmpname), "%s_tmp",
-   ztest_opts.zo_pool);
-   (void) spa_rename(tmpname, ztest_opts.zo_pool);
-   }
-   kernel_fini();
 
ztest_run_zdb(ztest_opts.zo_pool);
}

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Mon Jun 
 3 17:56:44 2019(r348564)
+++ 

svn commit: r348564 - in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:56:44 2019
New Revision: 348564
URL: https://svnweb.freebsd.org/changeset/base/348564

Log:
  MFV r348552: 9682 page fault in dsl_async_clone_destroy() while opening pool
  
  illumos/illumos-gate@ade2c82828f0dca1f46919aa1bd936ea1a5a0047
  
  Reviewed by: Brad Lewis 
  Reviewed by: Matt Ahrens 
  Reviewed by: Sara Hartse 
  Approved by: Robert Mustacchi 
  Author: Serapheim Dimitropoulos 

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

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Jun  3 17:44:47 2019
(r348563)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Jun  3 17:56:44 2019
(r348564)
@@ -2271,10 +2271,11 @@ dump_dir(objset_t *os)
dmu_objset_name(os, osname);
 
(void) printf("Dataset %s [%s], ID %llu, cr_txg %llu, "
-   "%s, %llu objects%s\n",
+   "%s, %llu objects%s%s\n",
osname, type, (u_longlong_t)dmu_objset_id(os),
(u_longlong_t)dds.dds_creation_txg,
-   numbuf, (u_longlong_t)usedobjs, blkbuf);
+   numbuf, (u_longlong_t)usedobjs, blkbuf,
+   (dds.dds_inconsistent) ? " (inconsistent)" : "");
 
if (zopt_objects != 0) {
for (i = 0; i < zopt_objects; i++)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Mon Jun  3 
17:44:47 2019(r348563)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Mon Jun  3 
17:56:44 2019(r348564)
@@ -3953,8 +3953,17 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char
 */
spa_history_log_version(spa, "open");
 
+   spa_restart_removal(spa);
+   spa_spawn_aux_threads(spa);
+
/*
 * Delete any inconsistent datasets.
+*
+* Note:
+* Since we may be issuing deletes for clones here,
+* we make sure to do so after we've spawned all the
+* auxiliary threads above (from which the livelist
+* deletion zthr is part of).
 */
(void) dmu_objset_find(spa_name(spa),
dsl_destroy_inconsistent, NULL, DS_FIND_CHILDREN);
@@ -3963,10 +3972,6 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char
 * Clean up any stale temporary dataset userrefs.
 */
dsl_pool_clean_tmp_userrefs(spa->spa_dsl_pool);
-
-   spa_restart_removal(spa);
-
-   spa_spawn_aux_threads(spa);
 
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
vdev_initialize_restart(spa->spa_root_vdev);
___
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: r348563 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:44:47 2019
New Revision: 348563
URL: https://svnweb.freebsd.org/changeset/base/348563

Log:
  MFV r348551: 9862 fix typo in comment in vdev_impl.h
  
  illumos/illumos-gate@84927f52bd837f6e4882a19e43fd026f1828d910
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Brian Behlendorf 
  Approved by: Robert Mustacchi 
  Author: Allan Jude 

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Mon Jun 
 3 17:43:32 2019(r348562)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Mon Jun 
 3 17:44:47 2019(r348563)
@@ -319,7 +319,7 @@ struct vdev {
 
/*
 * The queue depth parameters determine how many async writes are
-* still pending (i.e. allocated by net yet issued to disk) per
+* still pending (i.e. allocated but not yet issued to disk) per
 * top-level (vdev_async_write_queue_depth) and the maximum allowed
 * (vdev_max_async_write_queue_depth). These values only apply to
 * top-level vdevs.
___
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: r348562 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:43:32 2019
New Revision: 348562
URL: https://svnweb.freebsd.org/changeset/base/348562

Log:
  MFV r348550: 1700 Add SCSI UNMAP support
  
  illumos/illumos-gate@047c81d31d0f571d6652e97143cd15281de61e84
  
  Reviewed by: Jerry Jelinek 
  Reviewed by: Garrett D'Amore 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Saso Kiselkov 
  
  This is irrelevant to FreeBSD, just a diff reduction.

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  Mon Jun  3 
17:40:11 2019(r348561)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Mon Jun  3 
17:43:32 2019(r348562)
@@ -26,7 +26,7 @@
  *
  * Portions Copyright 2010 Robert Milkowski
  *
- * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
@@ -2259,44 +2259,64 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag,
 
case DKIOCFREE:
{
-   dkioc_free_t df;
+   dkioc_free_list_t *dfl;
dmu_tx_t *tx;
 
if (!zvol_unmap_enabled)
break;
 
-   if (ddi_copyin((void *)arg, , sizeof (df), flag)) {
-   error = SET_ERROR(EFAULT);
-   break;
+   if (!(flag & FKIOCTL)) {
+   error = dfl_copyin((void *)arg, , flag, KM_SLEEP);
+   if (error != 0)
+   break;
+   } else {
+   dfl = (dkioc_free_list_t *)arg;
+   ASSERT3U(dfl->dfl_num_exts, <=, DFL_COPYIN_MAX_EXTS);
+   if (dfl->dfl_num_exts > DFL_COPYIN_MAX_EXTS) {
+   error = SET_ERROR(EINVAL);
+   break;
+   }
}
 
-   /*
-* Apply Postel's Law to length-checking.  If they overshoot,
-* just blank out until the end, if there's a need to blank
-* out anything.
-*/
-   if (df.df_start >= zv->zv_volsize)
-   break;  /* No need to do anything... */
-
mutex_exit(_state_lock);
 
-   rl = zfs_range_lock(>zv_znode, df.df_start, df.df_length,
-   RL_WRITER);
-   tx = dmu_tx_create(zv->zv_objset);
-   dmu_tx_mark_netfree(tx);
-   error = dmu_tx_assign(tx, TXG_WAIT);
-   if (error != 0) {
-   dmu_tx_abort(tx);
-   } else {
-   zvol_log_truncate(zv, tx, df.df_start,
-   df.df_length, B_TRUE);
-   dmu_tx_commit(tx);
-   error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ,
-   df.df_start, df.df_length);
-   }
+   for (int i = 0; i < dfl->dfl_num_exts; i++) {
+   uint64_t start = dfl->dfl_exts[i].dfle_start,
+   length = dfl->dfl_exts[i].dfle_length,
+   end = start + length;
 
-   zfs_range_unlock(rl);
+   /*
+* Apply Postel's Law to length-checking.  If they
+* overshoot, just blank out until the end, if there's
+* a need to blank out anything.
+*/
+   if (start >= zv->zv_volsize)
+   continue;   /* No need to do anything... */
+   if (end > zv->zv_volsize) {
+   end = DMU_OBJECT_END;
+   length = end - start;
+   }
 
+   rl = zfs_range_lock(>zv_znode, start, length,
+   RL_WRITER);
+   tx = dmu_tx_create(zv->zv_objset);
+   error = dmu_tx_assign(tx, TXG_WAIT);
+   if (error != 0) {
+   dmu_tx_abort(tx);
+   } else {
+   zvol_log_truncate(zv, tx, start, length,
+   B_TRUE);
+   dmu_tx_commit(tx);
+   error = dmu_free_long_range(zv->zv_objset,
+   ZVOL_OBJ, start, length);
+   }
+
+   zfs_range_unlock(rl);
+
+   

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

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:40:11 2019
New Revision: 348561
URL: https://svnweb.freebsd.org/changeset/base/348561

Log:
  MFV r348548: 9617 too-frequent TXG sync causes excessive write inflation
  
  illumos/illumos-gate@7928f4baf4ab3230557eb6289be68aa7a3003f38
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Brad Lewis 
  Reviewed by: George Wilson 
  Reviewed by: Andrew Stormont 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  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
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Mon Jun 
 3 17:34:01 2019(r348560)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Mon Jun 
 3 17:40:11 2019(r348561)
@@ -108,9 +108,11 @@ uint64_t zfs_dirty_data_max_max = 4ULL * 1024 * 1024 *
 int zfs_dirty_data_max_percent = 10;
 
 /*
- * If there is at least this much dirty data, push out a txg.
+ * If there's at least this much dirty data (as a percentage of
+ * zfs_dirty_data_max), push out a txg.  This should be less than
+ * zfs_vdev_async_write_active_min_dirty_percent.
  */
-uint64_t zfs_dirty_data_sync = 64 * 1024 * 1024;
+uint64_t zfs_dirty_data_sync_pct = 20;
 
 /*
  * Once there is this amount of dirty data, the dmu_tx_delay() will kick in
@@ -190,9 +192,9 @@ SYSCTL_PROC(_vfs_zfs, OID_AUTO, dirty_data_max_percent
 sysctl_zfs_dirty_data_max_percent, "I",
 "The percent of physical memory used to auto calculate dirty_data_max");
 
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_sync, CTLFLAG_RWTUN,
-_dirty_data_sync, 0,
-"Force a txg if the number of dirty buffer bytes exceed this value");
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_sync_pct, CTLFLAG_RWTUN,
+_dirty_data_sync_pct, 0,
+"Force a txg if the percent of dirty buffer bytes exceed this value");
 
 static int sysctl_zfs_delay_min_dirty_percent(SYSCTL_HANDLER_ARGS);
 /* No zfs_delay_min_dirty_percent tunable due to limit requirements */
@@ -926,10 +928,12 @@ dsl_pool_need_dirty_delay(dsl_pool_t *dp)
 {
uint64_t delay_min_bytes =
zfs_dirty_data_max * zfs_delay_min_dirty_percent / 100;
+   uint64_t dirty_min_bytes =
+   zfs_dirty_data_max * zfs_dirty_data_sync_pct / 100;
boolean_t rv;
 
mutex_enter(>dp_lock);
-   if (dp->dp_dirty_total > zfs_dirty_data_sync)
+   if (dp->dp_dirty_total > dirty_min_bytes)
txg_kick(dp);
rv = (dp->dp_dirty_total > delay_min_bytes);
mutex_exit(>dp_lock);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h  Mon Jun 
 3 17:34:01 2019(r348560)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h  Mon Jun 
 3 17:40:11 2019(r348561)
@@ -53,7 +53,7 @@ struct dsl_scan;
 
 extern uint64_t zfs_dirty_data_max;
 extern uint64_t zfs_dirty_data_max_max;
-extern uint64_t zfs_dirty_data_sync;
+extern uint64_t zfs_dirty_data_sync_pct;
 extern int zfs_dirty_data_max_percent;
 extern int zfs_delay_min_dirty_percent;
 extern uint64_t zfs_delay_scale;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c   Mon Jun  3 
17:34:01 2019(r348560)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c   Mon Jun  3 
17:40:11 2019(r348561)
@@ -490,6 +490,8 @@ txg_sync_thread(void *arg)
uint64_t timeout = zfs_txg_timeout * hz;
uint64_t timer;
uint64_t txg;
+   uint64_t dirty_min_bytes =
+   zfs_dirty_data_max * zfs_dirty_data_sync_pct / 100;
 
/*
 * We sync when we're scanning, there's someone waiting
@@ -501,7 +503,7 @@ txg_sync_thread(void *arg)
!tx->tx_exiting && timer > 0 &&
tx->tx_synced_txg >= tx->tx_sync_txg_waiting &&
!txg_has_quiesced_to_sync(dp) &&
-   dp->dp_dirty_total < zfs_dirty_data_sync) {
+   dp->dp_dirty_total < dirty_min_bytes) {
dprintf("waiting; tx_synced=%llu waiting=%llu dp=%p\n",
tx->tx_synced_txg, tx->tx_sync_txg_waiting, dp);
txg_thread_wait(tx, , >tx_sync_more_cv, timer);
___
svn-src-all@freebsd.org mailing list

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

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:29:57 2019
New Revision: 348559
URL: https://svnweb.freebsd.org/changeset/base/348559

Log:
  MFV r348537: 8601 memory leak in get_special_prop()
  
  illumos/illumos-gate@e19b450bec203d8be04447ea476d7a86b36d63a1
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Sara Hartse 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Matt Ahrens 
  Reviewed by: Robert Mustacchi 
  Approved by: Dan McDonald 
  Author: John Gallagher 

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c   Mon Jun 
 3 17:27:25 2019(r348558)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c   Mon Jun 
 3 17:29:57 2019(r348559)
@@ -14,7 +14,7 @@
  */
 
 /*
- * Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2016, 2017 by Delphix. All rights reserved.
  */
 
 #include "lua.h"
@@ -431,16 +431,21 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, 
case ZFS_PROP_INCONSISTENT:
numval = dsl_get_inconsistent(ds);
break;
-   case ZFS_PROP_RECEIVE_RESUME_TOKEN:
-   VERIFY3U(strlcpy(strval, get_receive_resume_stats_impl(ds),
-   ZAP_MAXVALUELEN), <, ZAP_MAXVALUELEN);
+   case ZFS_PROP_RECEIVE_RESUME_TOKEN: {
+   char *token = get_receive_resume_stats_impl(ds);
+   VERIFY3U(strlcpy(strval, token, ZAP_MAXVALUELEN), <,
+   ZAP_MAXVALUELEN);
+   strfree(token);
if (strcmp(strval, "") == 0) {
-   VERIFY3U(strlcpy(strval, get_child_receive_stats(ds),
-   ZAP_MAXVALUELEN), <, ZAP_MAXVALUELEN);
+   token = get_child_receive_stats(ds);
+   VERIFY3U(strlcpy(strval, token, ZAP_MAXVALUELEN), <,
+   ZAP_MAXVALUELEN);
+   strfree(token);
if (strcmp(strval, "") == 0)
error = ENOENT;
}
break;
+   }
case ZFS_PROP_VOLSIZE:
ASSERT(ds_type == ZFS_TYPE_VOLUME);
error = dmu_objset_from_ds(ds, );
___
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: r348558 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:27:25 2019
New Revision: 348558
URL: https://svnweb.freebsd.org/changeset/base/348558

Log:
  MFV r348535: 9677 panic from zio_write_gang_block() when creating dump device 
on fragmented rpool
  
  illumos/illumos-gate@7341a7de4f0489193e0cfe11049a7bcf1596a4db
  
  Reviewed by: Matt Ahrens 
  Reviewed by: George Wilson 
  Reviewed by: Prashanth Sreenivasa 
  Approved by: Robert Mustacchi 
  Author: Brad Lewis 

Modified:
  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/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon Jun  3 
17:19:05 2019(r348557)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon Jun  3 
17:27:25 2019(r348558)
@@ -2319,7 +2319,13 @@ zio_write_gang_member_ready(zio_t *zio)
 static void
 zio_write_gang_done(zio_t *zio)
 {
-   abd_put(zio->io_abd);
+   /*
+* The io_abd field will be NULL for a zio with no data.  The io_flags
+* will initially have the ZIO_FLAG_NODATA bit flag set, but we can't
+* check for it here as it is cleared in zio_ready.
+*/
+   if (zio->io_abd != NULL)
+   abd_put(zio->io_abd);
 }
 
 static zio_t *
@@ -2340,11 +2346,12 @@ zio_write_gang_block(zio_t *pio)
int gbh_copies = MIN(copies + 1, spa_max_replication(spa));
zio_prop_t zp;
int error;
+   boolean_t has_data = !(pio->io_flags & ZIO_FLAG_NODATA);
 
int flags = METASLAB_HINTBP_FAVOR | METASLAB_GANG_HEADER;
if (pio->io_flags & ZIO_FLAG_IO_ALLOCATING) {
ASSERT(pio->io_priority == ZIO_PRIORITY_ASYNC_WRITE);
-   ASSERT(!(pio->io_flags & ZIO_FLAG_NODATA));
+   ASSERT(has_data);
 
flags |= METASLAB_ASYNC_ALLOC;
VERIFY(refcount_held(>mc_alloc_slots[pio->io_allocator],
@@ -2368,7 +2375,7 @@ zio_write_gang_block(zio_t *pio)
if (error) {
if (pio->io_flags & ZIO_FLAG_IO_ALLOCATING) {
ASSERT(pio->io_priority == ZIO_PRIORITY_ASYNC_WRITE);
-   ASSERT(!(pio->io_flags & ZIO_FLAG_NODATA));
+   ASSERT(has_data);
 
/*
 * If we failed to allocate the gang block header then
@@ -2421,14 +2428,15 @@ zio_write_gang_block(zio_t *pio)
zp.zp_nopwrite = B_FALSE;
 
zio_t *cio = zio_write(zio, spa, txg, >zg_blkptr[g],
-   abd_get_offset(pio->io_abd, pio->io_size - resid), lsize,
-   lsize, , zio_write_gang_member_ready, NULL, NULL,
+   has_data ? abd_get_offset(pio->io_abd, pio->io_size -
+   resid) : NULL, lsize, lsize, ,
+   zio_write_gang_member_ready, NULL, NULL,
zio_write_gang_done, >gn_child[g], pio->io_priority,
ZIO_GANG_CHILD_FLAGS(pio), >io_bookmark);
 
if (pio->io_flags & ZIO_FLAG_IO_ALLOCATING) {
ASSERT(pio->io_priority == ZIO_PRIORITY_ASYNC_WRITE);
-   ASSERT(!(pio->io_flags & ZIO_FLAG_NODATA));
+   ASSERT(has_data);
 
/*
 * Gang children won't throttle but we should
___
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: r348557 - head/cddl/contrib/opensolaris/lib/libzfs/common

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:19:05 2019
New Revision: 348557
URL: https://svnweb.freebsd.org/changeset/base/348557

Log:
  MFV r348534: 9616 Bogus error when attempting to set property on read-only 
pool
  
  illumos/illumos-gate@f62db44dbcda5dd786bb821f1e6fd3ca2e6d4391
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: Matt Ahrens 
  Approved by: Robert Mustacchi 
  Author: Andrew Stormont 

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cMon Jun 
 3 17:14:54 2019(r348556)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cMon Jun 
 3 17:19:05 2019(r348557)
@@ -30,7 +30,7 @@
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2017 Nexenta Systems, Inc.
  * Copyright 2016 Igor Kozhukhov 
- * Copyright 2017 RackTop Systems.
+ * Copyright 2017-2018 RackTop Systems.
  */
 
 #include 
@@ -1842,13 +1842,18 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
ret = zfs_ioctl(hdl, ZFS_IOC_SET_PROP, );
 
if (ret != 0) {
+   if (zc.zc_nvlist_dst_filled == B_FALSE) {
+   (void) zfs_standard_error(hdl, errno, errbuf);
+   goto error;
+   }
+
/* Get the list of unset properties back and report them. */
nvlist_t *errorprops = NULL;
if (zcmd_read_dst_nvlist(hdl, , ) != 0)
goto error;
-   for (nvpair_t *elem = nvlist_next_nvpair(nvl, NULL);
+   for (nvpair_t *elem = nvlist_next_nvpair(errorprops, NULL);
elem != NULL;
-   elem = nvlist_next_nvpair(nvl, elem)) {
+   elem = nvlist_next_nvpair(errorprops, elem)) {
zfs_prop_t prop = zfs_name_to_prop(nvpair_name(elem));
zfs_setprop_error(hdl, prop, errno, errbuf);
}
___
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: r348556 - vendor-sys/illumos/dist/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:14:54 2019
New Revision: 348556
URL: https://svnweb.freebsd.org/changeset/base/348556

Log:
  9738 9112 broke third block copy allocations within one metaslab group
  
  illumos/illumos-gate@b86e7e3f0e50748bb5bb5cc91632d72ff17f08dd
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Alexander Motin 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.cMon Jun  3 
17:13:35 2019(r348555)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.cMon Jun  3 
17:14:54 2019(r348556)
@@ -3080,7 +3080,6 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
metaslab_t *msp = NULL;
uint64_t offset = -1ULL;
uint64_t activation_weight;
-   boolean_t tertiary = B_FALSE;
 
activation_weight = METASLAB_WEIGHT_PRIMARY;
for (int i = 0; i < d; i++) {
@@ -3089,7 +3088,7 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
activation_weight = METASLAB_WEIGHT_SECONDARY;
} else if (activation_weight == METASLAB_WEIGHT_SECONDARY &&
DVA_GET_VDEV([i]) == mg->mg_vd->vdev_id) {
-   tertiary = B_TRUE;
+   activation_weight = METASLAB_WEIGHT_CLAIM;
break;
}
}
@@ -3098,10 +3097,8 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
 * If we don't have enough metaslabs active to fill the entire array, we
 * just use the 0th slot.
 */
-   if (mg->mg_ms_ready < mg->mg_allocators * 2) {
-   tertiary = B_FALSE;
+   if (mg->mg_ms_ready < mg->mg_allocators * 3)
allocator = 0;
-   }
 
ASSERT3U(mg->mg_vd->vdev_ms_count, >=, 2);
 
@@ -3127,7 +3124,7 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
msp = mg->mg_primaries[allocator];
was_active = B_TRUE;
} else if (activation_weight == METASLAB_WEIGHT_SECONDARY &&
-   mg->mg_secondaries[allocator] != NULL && !tertiary) {
+   mg->mg_secondaries[allocator] != NULL) {
msp = mg->mg_secondaries[allocator];
was_active = B_TRUE;
} else {
@@ -3170,7 +3167,8 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_
continue;
}
 
-   if (msp->ms_weight & METASLAB_WEIGHT_CLAIM) {
+   if (msp->ms_weight & METASLAB_WEIGHT_CLAIM &&
+   activation_weight != METASLAB_WEIGHT_CLAIM) {
metaslab_passivate(msp, msp->ms_weight &
~METASLAB_WEIGHT_CLAIM);
mutex_exit(>ms_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: r348555 - vendor-sys/illumos/dist/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:13:35 2019
New Revision: 348555
URL: https://svnweb.freebsd.org/changeset/base/348555

Log:
  9690 metaslab of vdev with no space maps was flushed during removal
  
  illumos/illumos-gate@4e75ba682600b2bf19d158577d528c3db65050e8
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Brad Lewis 
  Approved by: Robert Mustacchi 
  Author: Serapheim Dimitropoulos 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.cMon Jun  3 17:11:26 
2019(r348554)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.cMon Jun  3 17:13:35 
2019(r348555)
@@ -2823,11 +2823,11 @@ vdev_destroy_spacemaps(vdev_t *vd, dmu_tx_t *tx)
 }
 
 static void
-vdev_remove_empty(vdev_t *vd, uint64_t txg)
+vdev_remove_empty_log(vdev_t *vd, uint64_t txg)
 {
spa_t *spa = vd->vdev_spa;
-   dmu_tx_t *tx;
 
+   ASSERT(vd->vdev_islog);
ASSERT(vd == vd->vdev_top);
ASSERT3U(txg, ==, spa_syncing_txg(spa));
 
@@ -2871,13 +2871,14 @@ vdev_remove_empty(vdev_t *vd, uint64_t txg)
ASSERT0(mg->mg_histogram[i]);
}
 
-   tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg);
-   vdev_destroy_spacemaps(vd, tx);
+   dmu_tx_t *tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg);
 
-   if (vd->vdev_islog && vd->vdev_top_zap != 0) {
+   vdev_destroy_spacemaps(vd, tx);
+   if (vd->vdev_top_zap != 0) {
vdev_destroy_unlink_zap(vd, vd->vdev_top_zap, tx);
vd->vdev_top_zap = 0;
}
+
dmu_tx_commit(tx);
 }
 
@@ -2949,14 +2950,11 @@ vdev_sync(vdev_t *vd, uint64_t txg)
vdev_dtl_sync(lvd, txg);
 
/*
-* Remove the metadata associated with this vdev once it's empty.
-* Note that this is typically used for log/cache device removal;
-* we don't empty toplevel vdevs when removing them.  But if
-* a toplevel happens to be emptied, this is not harmful.
+* If this is an empty log device being removed, destroy the
+* metadata associated with it.
 */
-   if (vd->vdev_stat.vs_alloc == 0 && vd->vdev_removing) {
-   vdev_remove_empty(vd, txg);
-   }
+   if (vd->vdev_islog && vd->vdev_stat.vs_alloc == 0 && vd->vdev_removing)
+   vdev_remove_empty_log(vd, txg);
 
(void) txg_list_add(>spa_vdev_txg_list, vd, TXG_CLEAN(txg));
 }
___
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: r348554 - vendor-sys/illumos/dist/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:11:26 2019
New Revision: 348554
URL: https://svnweb.freebsd.org/changeset/base/348554

Log:
  9688 aggsum_fini leaks memory
  
  illumos/illumos-gate@29bf2d68bef208274f5a54a14cc80c4a8cb76f53
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Matt Ahrens 
  Reviewed by: Prashanth Sreenivasa 
  Reviewed by: Jorgen Lundman 
  Reviewed by: Igor Kozhukhov 
  Approved by: Robert Mustacchi 
  Author: Paul Dagnelie 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c  Mon Jun  3 17:08:49 
2019(r348553)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/aggsum.c  Mon Jun  3 17:11:26 
2019(r348554)
@@ -13,7 +13,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright (c) 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2017, 2018 by Delphix. All rights reserved.
  */
 
 #include 
@@ -99,6 +99,7 @@ aggsum_fini(aggsum_t *as)
 {
for (int i = 0; i < as->as_numbuckets; i++)
mutex_destroy(>as_buckets[i].asc_lock);
+   kmem_free(as->as_buckets, as->as_numbuckets * sizeof (aggsum_bucket_t));
mutex_destroy(>as_lock);
 }
 

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Mon Jun  3 17:08:49 
2019(r348553)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Mon Jun  3 17:11:26 
2019(r348554)
@@ -6159,6 +6159,14 @@ arc_state_fini(void)
multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_DATA]);
multilist_destroy(arc_mfu->arcs_list[ARC_BUFC_DATA]);
multilist_destroy(arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]);
+
+   aggsum_fini(_meta_used);
+   aggsum_fini(_size);
+   aggsum_fini(_data_size);
+   aggsum_fini(_metadata_size);
+   aggsum_fini(_hdr_size);
+   aggsum_fini(_other_size);
+   aggsum_fini(_l2_hdr_size);
 }
 
 uint64_t
@@ -6328,8 +6336,13 @@ arc_fini(void)
mutex_destroy(_adjust_lock);
cv_destroy(_adjust_waiters_cv);
 
-   arc_state_fini();
+   /*
+* buf_fini() must proceed arc_state_fini() because buf_fin() may
+* trigger the release of kmem magazines, which can callback to
+* arc_space_return() which accesses aggsums freed in act_state_fini().
+*/
buf_fini();
+   arc_state_fini();
 
ASSERT0(arc_loaned_bytes);
 }
___
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: r348553 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/ztest

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:08:49 2019
New Revision: 348553
URL: https://svnweb.freebsd.org/changeset/base/348553

Log:
  9681 ztest failure in spa_history_log_internal due to spa_rename()
  
  illumos/illumos-gate@6aee0ad76969eb0027131b3a338f2d94ae86f728
  
  Reviewed by: Prakash Surya 
  Reviewed by: Serapheim Dimitropoulos 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  vendor/illumos/dist/cmd/ztest/ztest.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h

Modified: vendor/illumos/dist/cmd/ztest/ztest.c
==
--- vendor/illumos/dist/cmd/ztest/ztest.c   Mon Jun  3 17:06:02 2019
(r348552)
+++ vendor/illumos/dist/cmd/ztest/ztest.c   Mon Jun  3 17:08:49 2019
(r348553)
@@ -334,7 +334,6 @@ ztest_func_t ztest_spa_create_destroy;
 ztest_func_t ztest_fault_inject;
 ztest_func_t ztest_ddt_repair;
 ztest_func_t ztest_dmu_snapshot_hold;
-ztest_func_t ztest_spa_rename;
 ztest_func_t ztest_scrub;
 ztest_func_t ztest_dsl_dataset_promote_busy;
 ztest_func_t ztest_vdev_attach_detach;
@@ -379,7 +378,6 @@ ztest_info_t ztest_info[] = {
{ ztest_ddt_repair, 1,  _sometimes },
{ ztest_dmu_snapshot_hold,  1,  _sometimes },
{ ztest_reguid, 1,  _rarely},
-   { ztest_spa_rename, 1,  _rarely},
{ ztest_scrub,  1,  _rarely},
{ ztest_spa_upgrade,1,  _rarely},
{ ztest_dsl_dataset_promote_busy,   1,  _rarely},
@@ -5420,59 +5418,6 @@ ztest_reguid(ztest_ds_t *zd, uint64_t id)
VERIFY3U(load, ==, spa_load_guid(spa));
 }
 
-/*
- * Rename the pool to a different name and then rename it back.
- */
-/* ARGSUSED */
-void
-ztest_spa_rename(ztest_ds_t *zd, uint64_t id)
-{
-   char *oldname, *newname;
-   spa_t *spa;
-
-   rw_enter(_name_lock, RW_WRITER);
-
-   oldname = ztest_opts.zo_pool;
-   newname = umem_alloc(strlen(oldname) + 5, UMEM_NOFAIL);
-   (void) strcpy(newname, oldname);
-   (void) strcat(newname, "_tmp");
-
-   /*
-* Do the rename
-*/
-   VERIFY3U(0, ==, spa_rename(oldname, newname));
-
-   /*
-* Try to open it under the old name, which shouldn't exist
-*/
-   VERIFY3U(ENOENT, ==, spa_open(oldname, , FTAG));
-
-   /*
-* Open it under the new name and make sure it's still the same spa_t.
-*/
-   VERIFY3U(0, ==, spa_open(newname, , FTAG));
-
-   ASSERT(spa == ztest_spa);
-   spa_close(spa, FTAG);
-
-   /*
-* Rename it back to the original
-*/
-   VERIFY3U(0, ==, spa_rename(newname, oldname));
-
-   /*
-* Make sure it can still be opened
-*/
-   VERIFY3U(0, ==, spa_open(oldname, , FTAG));
-
-   ASSERT(spa == ztest_spa);
-   spa_close(spa, FTAG);
-
-   umem_free(newname, strlen(newname) + 1);
-
-   rw_exit(_name_lock);
-}
-
 static vdev_t *
 ztest_random_concrete_vdev_leaf(vdev_t *vd)
 {
@@ -6525,7 +6470,6 @@ main(int argc, char **argv)
ztest_shared_callstate_t *zc;
char timebuf[100];
char numbuf[NN_NUMBUF_SZ];
-   spa_t *spa;
char *cmd;
boolean_t hasalt;
char *fd_data_str = getenv("ZTEST_FD_DATA");
@@ -6699,24 +6643,6 @@ main(int argc, char **argv)
}
(void) printf("\n");
}
-
-   /*
-* It's possible that we killed a child during a rename test,
-* in which case we'll have a 'ztest_tmp' pool lying around
-* instead of 'ztest'.  Do a blind rename in case this happened.
-*/
-   kernel_init(FREAD);
-   if (spa_open(ztest_opts.zo_pool, , FTAG) == 0) {
-   spa_close(spa, FTAG);
-   } else {
-   char tmpname[ZFS_MAX_DATASET_NAME_LEN];
-   kernel_fini();
-   kernel_init(FREAD | FWRITE);
-   (void) snprintf(tmpname, sizeof (tmpname), "%s_tmp",
-   ztest_opts.zo_pool);
-   (void) spa_rename(tmpname, ztest_opts.zo_pool);
-   }
-   kernel_fini();
 
ztest_run_zdb(ztest_opts.zo_pool);
}
___
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: r348553 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/ztest

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:08:49 2019
New Revision: 348553
URL: https://svnweb.freebsd.org/changeset/base/348553

Log:
  9681 ztest failure in spa_history_log_internal due to spa_rename()
  
  illumos/illumos-gate@6aee0ad76969eb0027131b3a338f2d94ae86f728
  
  Reviewed by: Prakash Surya 
  Reviewed by: Serapheim Dimitropoulos 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/cmd/ztest/ztest.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.cMon Jun  3 
17:06:02 2019(r348552)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.cMon Jun  3 
17:08:49 2019(r348553)
@@ -222,9 +222,6 @@
  * vdev state is protected by spa_vdev_state_enter() / spa_vdev_state_exit().
  * Like spa_vdev_enter/exit, these are convenience wrappers -- the actual
  * locking is, always, based on spa_namespace_lock and spa_config_lock[].
- *
- * spa_rename() is also implemented within this file since it requires
- * manipulation of the namespace.
  */
 
 static avl_tree_t spa_namespace_avl;
@@ -1331,56 +1328,6 @@ spa_deactivate_mos_feature(spa_t *spa, const char *fea
 {
if (nvlist_remove_all(spa->spa_label_features, feature) == 0)
vdev_config_dirty(spa->spa_root_vdev);
-}
-
-/*
- * Rename a spa_t.
- */
-int
-spa_rename(const char *name, const char *newname)
-{
-   spa_t *spa;
-   int err;
-
-   /*
-* Lookup the spa_t and grab the config lock for writing.  We need to
-* actually open the pool so that we can sync out the necessary labels.
-* It's OK to call spa_open() with the namespace lock held because we
-* allow recursive calls for other reasons.
-*/
-   mutex_enter(_namespace_lock);
-   if ((err = spa_open(name, , FTAG)) != 0) {
-   mutex_exit(_namespace_lock);
-   return (err);
-   }
-
-   spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
-
-   avl_remove(_namespace_avl, spa);
-   (void) strlcpy(spa->spa_name, newname, sizeof (spa->spa_name));
-   avl_add(_namespace_avl, spa);
-
-   /*
-* Sync all labels to disk with the new names by marking the root vdev
-* dirty and waiting for it to sync.  It will pick up the new pool name
-* during the sync.
-*/
-   vdev_config_dirty(spa->spa_root_vdev);
-
-   spa_config_exit(spa, SCL_ALL, FTAG);
-
-   txg_wait_synced(spa->spa_dsl_pool, 0);
-
-   /*
-* Sync the updated config cache.
-*/
-   spa_write_cachefile(spa, B_FALSE, B_TRUE);
-
-   spa_close(spa, FTAG);
-
-   mutex_exit(_namespace_lock);
-
-   return (0);
 }
 
 /*

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Mon Jun  3 17:06:02 
2019(r348552)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Mon Jun  3 17:08:49 
2019(r348553)
@@ -821,7 +821,6 @@ extern void spa_load_note(spa_t *spa, const char *fmt,
 extern void spa_activate_mos_feature(spa_t *spa, const char *feature,
 dmu_tx_t *tx);
 extern void spa_deactivate_mos_feature(spa_t *spa, const char *feature);
-extern int spa_rename(const char *oldname, const char *newname);
 extern spa_t *spa_by_guid(uint64_t pool_guid, uint64_t device_guid);
 extern boolean_t spa_guid_exists(uint64_t pool_guid, uint64_t device_guid);
 extern char *spa_strdup(const char *);
___
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: r348552 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zdb

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:06:02 2019
New Revision: 348552
URL: https://svnweb.freebsd.org/changeset/base/348552

Log:
  9682 page fault in dsl_async_clone_destroy() while opening pool
  
  illumos/illumos-gate@ade2c82828f0dca1f46919aa1bd936ea1a5a0047
  
  Reviewed by: Brad Lewis 
  Reviewed by: Matt Ahrens 
  Reviewed by: Sara Hartse 
  Approved by: Robert Mustacchi 
  Author: Serapheim Dimitropoulos 

Modified:
  vendor/illumos/dist/cmd/zdb/zdb.c

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c

Modified: vendor/illumos/dist/cmd/zdb/zdb.c
==
--- vendor/illumos/dist/cmd/zdb/zdb.c   Mon Jun  3 17:02:35 2019
(r348551)
+++ vendor/illumos/dist/cmd/zdb/zdb.c   Mon Jun  3 17:06:02 2019
(r348552)
@@ -2245,10 +2245,11 @@ dump_dir(objset_t *os)
dmu_objset_name(os, osname);
 
(void) printf("Dataset %s [%s], ID %llu, cr_txg %llu, "
-   "%s, %llu objects%s\n",
+   "%s, %llu objects%s%s\n",
osname, type, (u_longlong_t)dmu_objset_id(os),
(u_longlong_t)dds.dds_creation_txg,
-   numbuf, (u_longlong_t)usedobjs, blkbuf);
+   numbuf, (u_longlong_t)usedobjs, blkbuf,
+   (dds.dds_inconsistent) ? " (inconsistent)" : "");
 
if (zopt_objects != 0) {
for (i = 0; i < zopt_objects; i++)
___
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: r348552 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/cmd/zdb

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:06:02 2019
New Revision: 348552
URL: https://svnweb.freebsd.org/changeset/base/348552

Log:
  9682 page fault in dsl_async_clone_destroy() while opening pool
  
  illumos/illumos-gate@ade2c82828f0dca1f46919aa1bd936ea1a5a0047
  
  Reviewed by: Brad Lewis 
  Reviewed by: Matt Ahrens 
  Reviewed by: Sara Hartse 
  Approved by: Robert Mustacchi 
  Author: Serapheim Dimitropoulos 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c

Changes in other areas also in this revision:
Modified:
  vendor/illumos/dist/cmd/zdb/zdb.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Mon Jun  3 17:02:35 
2019(r348551)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Mon Jun  3 17:06:02 
2019(r348552)
@@ -3862,8 +3862,17 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char
 */
spa_history_log_version(spa, "open");
 
+   spa_restart_removal(spa);
+   spa_spawn_aux_threads(spa);
+
/*
 * Delete any inconsistent datasets.
+*
+* Note:
+* Since we may be issuing deletes for clones here,
+* we make sure to do so after we've spawned all the
+* auxiliary threads above (from which the livelist
+* deletion zthr is part of).
 */
(void) dmu_objset_find(spa_name(spa),
dsl_destroy_inconsistent, NULL, DS_FIND_CHILDREN);
@@ -3872,10 +3881,6 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char
 * Clean up any stale temporary dataset userrefs.
 */
dsl_pool_clean_tmp_userrefs(spa->spa_dsl_pool);
-
-   spa_restart_removal(spa);
-
-   spa_spawn_aux_threads(spa);
 
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
vdev_initialize_restart(spa->spa_root_vdev);
___
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: r348551 - vendor-sys/illumos/dist/uts/common/fs/zfs/sys

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:02:35 2019
New Revision: 348551
URL: https://svnweb.freebsd.org/changeset/base/348551

Log:
  9862 fix typo in comment in vdev_impl.h
  
  illumos/illumos-gate@84927f52bd837f6e4882a19e43fd026f1828d910
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Brian Behlendorf 
  Approved by: Robert Mustacchi 
  Author: Allan Jude 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h   Mon Jun  3 
17:01:16 2019(r348550)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h   Mon Jun  3 
17:02:35 2019(r348551)
@@ -297,7 +297,7 @@ struct vdev {
 
/*
 * The queue depth parameters determine how many async writes are
-* still pending (i.e. allocated by net yet issued to disk) per
+* still pending (i.e. allocated but not yet issued to disk) per
 * top-level (vdev_async_write_queue_depth) and the maximum allowed
 * (vdev_max_async_write_queue_depth). These values only apply to
 * top-level vdevs.
___
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: r348550 - vendor-sys/illumos/dist/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 17:01:16 2019
New Revision: 348550
URL: https://svnweb.freebsd.org/changeset/base/348550

Log:
  1700 Add SCSI UNMAP support
  
  illumos/illumos-gate@047c81d31d0f571d6652e97143cd15281de61e84
  
  Reviewed by: Jerry Jelinek 
  Reviewed by: Garrett D'Amore 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Saso Kiselkov 

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.cMon Jun  3 16:59:56 
2019(r348549)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.cMon Jun  3 17:01:16 
2019(r348550)
@@ -23,7 +23,7 @@
  *
  * Portions Copyright 2010 Robert Milkowski
  *
- * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
@@ -89,6 +89,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "zfs_namecheck.h"
 
@@ -1778,44 +1779,64 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag,
 
case DKIOCFREE:
{
-   dkioc_free_t df;
+   dkioc_free_list_t *dfl;
dmu_tx_t *tx;
 
if (!zvol_unmap_enabled)
break;
 
-   if (ddi_copyin((void *)arg, , sizeof (df), flag)) {
-   error = SET_ERROR(EFAULT);
-   break;
+   if (!(flag & FKIOCTL)) {
+   error = dfl_copyin((void *)arg, , flag, KM_SLEEP);
+   if (error != 0)
+   break;
+   } else {
+   dfl = (dkioc_free_list_t *)arg;
+   ASSERT3U(dfl->dfl_num_exts, <=, DFL_COPYIN_MAX_EXTS);
+   if (dfl->dfl_num_exts > DFL_COPYIN_MAX_EXTS) {
+   error = SET_ERROR(EINVAL);
+   break;
+   }
}
 
-   /*
-* Apply Postel's Law to length-checking.  If they overshoot,
-* just blank out until the end, if there's a need to blank
-* out anything.
-*/
-   if (df.df_start >= zv->zv_volsize)
-   break;  /* No need to do anything... */
-
mutex_exit(_state_lock);
 
-   rl = zfs_range_lock(>zv_znode, df.df_start, df.df_length,
-   RL_WRITER);
-   tx = dmu_tx_create(zv->zv_objset);
-   dmu_tx_mark_netfree(tx);
-   error = dmu_tx_assign(tx, TXG_WAIT);
-   if (error != 0) {
-   dmu_tx_abort(tx);
-   } else {
-   zvol_log_truncate(zv, tx, df.df_start,
-   df.df_length, B_TRUE);
-   dmu_tx_commit(tx);
-   error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ,
-   df.df_start, df.df_length);
-   }
+   for (int i = 0; i < dfl->dfl_num_exts; i++) {
+   uint64_t start = dfl->dfl_exts[i].dfle_start,
+   length = dfl->dfl_exts[i].dfle_length,
+   end = start + length;
 
-   zfs_range_unlock(rl);
+   /*
+* Apply Postel's Law to length-checking.  If they
+* overshoot, just blank out until the end, if there's
+* a need to blank out anything.
+*/
+   if (start >= zv->zv_volsize)
+   continue;   /* No need to do anything... */
+   if (end > zv->zv_volsize) {
+   end = DMU_OBJECT_END;
+   length = end - start;
+   }
 
+   rl = zfs_range_lock(>zv_znode, start, length,
+   RL_WRITER);
+   tx = dmu_tx_create(zv->zv_objset);
+   error = dmu_tx_assign(tx, TXG_WAIT);
+   if (error != 0) {
+   dmu_tx_abort(tx);
+   } else {
+   zvol_log_truncate(zv, tx, start, length,
+   B_TRUE);
+   dmu_tx_commit(tx);
+   error = dmu_free_long_range(zv->zv_objset,
+   ZVOL_OBJ, start, length);
+   }
+
+   zfs_range_unlock(rl);
+
+   if (error != 0)
+   break;
+   

svn commit: r348549 - stable/12/share/man/man9

2019-06-03 Thread Mark Johnston
Author: markj
Date: Mon Jun  3 16:59:56 2019
New Revision: 348549
URL: https://svnweb.freebsd.org/changeset/base/348549

Log:
  MFC r348003, r348011:
  Add a man page for DEFINE_IFUNC.

Added:
  stable/12/share/man/man9/DEFINE_IFUNC.9
 - copied unchanged from r348003, head/share/man/man9/DEFINE_IFUNC.9
Modified:
  stable/12/share/man/man9/Makefile
Directory Properties:
  stable/12/   (props changed)

Copied: stable/12/share/man/man9/DEFINE_IFUNC.9 (from r348003, 
head/share/man/man9/DEFINE_IFUNC.9)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/share/man/man9/DEFINE_IFUNC.9 Mon Jun  3 16:59:56 2019
(r348549, copy of r348003, head/share/man/man9/DEFINE_IFUNC.9)
@@ -0,0 +1,143 @@
+.\" Copyright (c) 2019 The FreeBSD Foundation
+.\"
+.\" This documentation was written by Mark Johnston 
+.\" under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 18, 2019
+.Dt DEFINE_IFUNC 9
+.Os
+.Sh NAME
+.Nm DEFINE_IFUNC
+.Nd define a kernel function with an implementation selected at run-time
+.Sh SYNOPSIS
+.In machine/ifunc.h
+.Fn DEFINE_IFUNC qual ret_type name args
+.Sh DESCRIPTION
+ifuncs are a linker feature which allows the programmer to define functions
+whose implementation is selected at boot-time or module load-time.
+The
+.Nm
+macro can be used to define an ifunc.
+The selection is performed by a resolver function, which returns a pointer
+to the selected function.
+ifunc resolvers are invoked very early during the machine-dependent
+initialization routine, or at load time for dynamically loaded modules.
+Resolution must occur before the first call to an ifunc.
+ifunc resolution is performed after CPU features are enumerated and after the
+kernel's environment is initialized.
+The typical use-case for an ifunc is a routine whose behavior depends on
+optional CPU features.
+For example, newer generations of a given CPU architecture may provide an
+instruction to optimize a common operation.
+To avoid the overhead of testing for the CPU feature each time the operation
+is performed, an ifunc can be used to provide two implementations for the
+operation: one targeting platforms with the extra instruction, and one
+for older platforms.
+.Pp
+Because
+.Nm
+is a macro that defines a dynamically typed function, its usage looks somewhat
+unusual.
+The
+.Ar qual
+parameter is a list of zero or more C function qualifiers to be applied to the
+ifunc.
+This parameter is typically empty or the
+.Dv static
+qualifier.
+.Ar ret_type
+is the return type of the ifunc.
+.Ar name
+is the name of the ifunc.
+.Ar args
+is a parenthesized, comma-separated list of the parameter types of the 
function,
+as they would appear in a C function declaration.
+.Pp
+The
+.Nm
+usage must be followed by the resolver function body.
+The resolver must return a function with return type
+.Ar ret_type
+and parameter types
+.Ar args .
+The resolver function is defined with the
+.Ql resolver
+gcc-style function attribute, causing the corresponding
+.Xr elf 5
+function symbol to be of type
+.Dv STT_GNU_IFUNC
+instead of
+.Dv STT_FUNC .
+The kernel linker invokes the resolver to process relocations targeting ifunc
+calls and PLT entries referencing such symbols.
+.Sh EXAMPLES
+ifunc resolvers are executed early during boot, before most kernel facilities
+are available.
+They are effectively limited to checking CPU feature flags and tunables.
+.Bd -literal
+static size_t
+fast_strlen(const char *s __unused)
+{
+   size_t len;
+
+   /* Fast, but may not be correct in all cases. */
+   

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

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 16:57:06 2019
New Revision: 348548
URL: https://svnweb.freebsd.org/changeset/base/348548

Log:
  9617 too-frequent TXG sync causes excessive write inflation
  
  illumos/illumos-gate@7928f4baf4ab3230557eb6289be68aa7a3003f38
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Brad Lewis 
  Reviewed by: George Wilson 
  Reviewed by: Andrew Stormont 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

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

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.cMon Jun  3 
16:51:07 2019(r348547)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.cMon Jun  3 
16:57:06 2019(r348548)
@@ -103,9 +103,11 @@ uint64_t zfs_dirty_data_max_max = 4ULL * 1024 * 1024 *
 int zfs_dirty_data_max_percent = 10;
 
 /*
- * If there is at least this much dirty data, push out a txg.
+ * If there's at least this much dirty data (as a percentage of
+ * zfs_dirty_data_max), push out a txg.  This should be less than
+ * zfs_vdev_async_write_active_min_dirty_percent.
  */
-uint64_t zfs_dirty_data_sync = 64 * 1024 * 1024;
+uint64_t zfs_dirty_data_sync_pct = 20;
 
 /*
  * Once there is this amount of dirty data, the dmu_tx_delay() will kick in
@@ -824,10 +826,12 @@ dsl_pool_need_dirty_delay(dsl_pool_t *dp)
 {
uint64_t delay_min_bytes =
zfs_dirty_data_max * zfs_delay_min_dirty_percent / 100;
+   uint64_t dirty_min_bytes =
+   zfs_dirty_data_max * zfs_dirty_data_sync_pct / 100;
boolean_t rv;
 
mutex_enter(>dp_lock);
-   if (dp->dp_dirty_total > zfs_dirty_data_sync)
+   if (dp->dp_dirty_total > dirty_min_bytes)
txg_kick(dp);
rv = (dp->dp_dirty_total > delay_min_bytes);
mutex_exit(>dp_lock);

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.hMon Jun  3 
16:51:07 2019(r348547)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.hMon Jun  3 
16:57:06 2019(r348548)
@@ -53,7 +53,7 @@ struct dsl_scan;
 
 extern uint64_t zfs_dirty_data_max;
 extern uint64_t zfs_dirty_data_max_max;
-extern uint64_t zfs_dirty_data_sync;
+extern uint64_t zfs_dirty_data_sync_pct;
 extern int zfs_dirty_data_max_percent;
 extern int zfs_delay_min_dirty_percent;
 extern uint64_t zfs_delay_scale;

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c Mon Jun  3 16:51:07 
2019(r348547)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/txg.c Mon Jun  3 16:57:06 
2019(r348548)
@@ -484,6 +484,8 @@ txg_sync_thread(void *arg)
uint64_t timeout = zfs_txg_timeout * hz;
uint64_t timer;
uint64_t txg;
+   uint64_t dirty_min_bytes =
+   zfs_dirty_data_max * zfs_dirty_data_sync_pct / 100;
 
/*
 * We sync when we're scanning, there's someone waiting
@@ -495,7 +497,7 @@ txg_sync_thread(void *arg)
!tx->tx_exiting && timer > 0 &&
tx->tx_synced_txg >= tx->tx_sync_txg_waiting &&
!txg_has_quiesced_to_sync(dp) &&
-   dp->dp_dirty_total < zfs_dirty_data_sync) {
+   dp->dp_dirty_total < dirty_min_bytes) {
dprintf("waiting; tx_synced=%llu waiting=%llu dp=%p\n",
tx->tx_synced_txg, tx->tx_sync_txg_waiting, dp);
txg_thread_wait(tx, , >tx_sync_more_cv, timer);
___
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: r348547 - head/usr.sbin/rpc.yppasswdd

2019-06-03 Thread Mark Johnston
Author: markj
Date: Mon Jun  3 16:51:07 2019
New Revision: 348547
URL: https://svnweb.freebsd.org/changeset/base/348547

Log:
  rpc.yppasswdd: Fix dirname(3) usage after r305952.
  
  PR:   234972
  Submitted by: Edward Fuhr  (original)
  MFC after:3 days

Modified:
  head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c

Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
==
--- head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c  Mon Jun  3 16:47:51 
2019(r348546)
+++ head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c  Mon Jun  3 16:51:07 
2019(r348547)
@@ -468,7 +468,9 @@ yppasswdproc_update_1_svc(yppasswd *argp, struct svc_r
char *cryptpw;
char *oldshell = NULL;
char *oldgecos = NULL;
+   char *passdir;
char *passfile_hold;
+   char passdir_buf[MAXPATHLEN + 2];
char passfile_buf[MAXPATHLEN + 2];
char passfile_hold_buf[MAXPATHLEN + 2];
char *domain = yppasswd_domain;
@@ -602,11 +604,14 @@ yppasswdproc_update_1_svc(yppasswd *argp, struct svc_r
snprintf(passfile_hold_buf, sizeof(passfile_hold_buf),
"%s.hold", passfile);
passfile_hold = (char *)_hold_buf;
-   
 
+
/* Step 5: make a new password file with the updated info. */
 
-   if (pw_init(dirname(passfile), passfile)) {
+   snprintf(passdir_buf, sizeof(passdir_buf), "%s", passfile);
+   passdir = dirname(passdir_buf);
+
+   if (pw_init(passdir, passfile)) {
yp_error("pw_init() failed");
return 
}
@@ -726,7 +731,9 @@ yppasswdproc_update_master_1_svc(master_yppasswd *argp
uid_t uid;
int rval = 0;
DBT key, data;
+   char *passdir;
char *passfile_hold;
+   char passdir_buf[MAXPATHLEN + 2];
char passfile_buf[MAXPATHLEN + 2];
char passfile_hold_buf[MAXPATHLEN + 2];
struct sockaddr_in *rqhost;
@@ -829,7 +836,10 @@ allow additions to be made to the password database");
"%s.hold", passfile);
passfile_hold = (char *)_hold_buf;
 
-   if (pw_init(dirname(passfile), passfile)) {
+   snprintf(passdir_buf, sizeof(passdir_buf), "%s", passfile);
+   passdir = dirname(passdir_buf);
+
+   if (pw_init(passdir, passfile)) {
yp_error("pw_init() failed");
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: r348546 - stable/11/lib/libjail

2019-06-03 Thread Kyle Evans
Author: kevans
Date: Mon Jun  3 16:47:51 2019
New Revision: 348546
URL: https://svnweb.freebsd.org/changeset/base/348546

Log:
  MFC r348509: jail_getid(3): add special-case immediate return for jid 0
  
  As depicted in the comment: jid 0 always exists, but the lookup will fail as
  it does not appear in the kernel's alljails list being a special jail. Some
  callers will expect/rely on this, and we have no reason to lie because it
  does always exist.
  
  Approved by:  re (gjb)

Modified:
  stable/11/lib/libjail/jail_getid.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libjail/jail_getid.c
==
--- stable/11/lib/libjail/jail_getid.c  Mon Jun  3 16:47:00 2019
(r348545)
+++ stable/11/lib/libjail/jail_getid.c  Mon Jun  3 16:47:51 2019
(r348546)
@@ -52,6 +52,15 @@ jail_getid(const char *name)
 
jid = strtoul(name, , 10);
if (*name && !*ep) {
+   /*
+* jid == 0 is a special case; it will not appear in the
+* kernel's jail list, but naturally processes will be assigned
+* to it because it is prison 0.  Trivially return this one
+* without a trip to the kernel, because it always exists but
+* the lookup won't succeed.
+*/
+   if (jid == 0)
+   return jid;
jiov[0].iov_base = __DECONST(char *, "jid");
jiov[0].iov_len = sizeof("jid");
jiov[1].iov_base = 
___
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: r348545 - head/lib/libutil

2019-06-03 Thread Mark Johnston
Author: markj
Date: Mon Jun  3 16:47:00 2019
New Revision: 348545
URL: https://svnweb.freebsd.org/changeset/base/348545

Log:
  Typo.
  
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libutil/pw_util.3

Modified: head/lib/libutil/pw_util.3
==
--- head/lib/libutil/pw_util.3  Mon Jun  3 16:21:09 2019(r348544)
+++ head/lib/libutil/pw_util.3  Mon Jun  3 16:47:00 2019(r348545)
@@ -58,7 +58,7 @@
 .Ft void
 .Fn pw_fini "void"
 .Ft int
-.Fn pw_init "const char *dir" const char *master"
+.Fn pw_init "const char *dir" "const char *master"
 .Ft void
 .Fn pw_initpwd "struct passwd *pw"
 .Ft "char *"
___
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: r348355 - head/sys/dev/iicbus

2019-06-03 Thread Ian Lepore
On Mon, 2019-06-03 at 18:19 +0300, Andriy Gapon wrote:
> On 03/06/2019 17:52, Ian Lepore wrote:
> > Please don't.  We still have a situation where nobody has shown a
> > runtime failure at all.  This build failure could be fixed by
> > simply
> > defining a do-nothing iicbus_set_nostop() function if a quick fix
> > is
> > needed.
> 
> Well, I am quite certain that the run-time failure will follow after
> the build
> time failure is fixed.
> 
> > Putting this nostop concept into code that is shared by many
> > drivers is
> > an abomination.  We have exactly one driver that needs this
> > functionality, so the right fix is to implement it wholly within
> > that
> > one driver.  I'll put together a diff for that.
> 
> That's true that we have just one such driver.
> At the same time, the "no stop" (or rather, repeated start) behavior
> makes more
> sense.  If stop+start between transfers are needed then that can be
> done with
> multiple calls to iicbus_transfer.  If multiple messages are given to
> iicbus_transfer, then it's reasonable to assume that a repeated
> started is
> wanted between them.  But it would be a big change to review and, if
> needed, fix
> or tidy up all code that uses iicbus_transfer.  So,
> iicbus_set_nostop() could be
> just a small step towards the bigger goal.
> 
> But I really don't have a strong opinion.
> Fixing drm2 directly is just as good for me as iicbus_set_nostop.
> 

I agree with you that the freebsd iic stuff is a Big Mess, poorly
designed.  But it is what it is, we can't change things now without
breaking every out-of-tree driver in the world (and I know for sure
they exist, because we have some at $work).  So we're stuck with
explicitly setting NOSTOP flags in iic_msg descriptors even though it
would be sensible to assume NOSTOP on all but the last one.

Anyway, the bad news is I mis-remembered how the iicbb interface and
driver are structured.  The hook point I wanted isn't there, making it
hard to put the fix I was picturing in the intel_iic code.  I'd still
like to think of a better fix, but it's going to take more than a few
minutes.  So I guess we'd better go with your fix to get things working
right away.  If I can think up something more elegant we can always
switch to it later.

-- 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"


Re: svn commit: r348355 - head/sys/dev/iicbus

2019-06-03 Thread Niclas Zeising

On 2019-06-03 17:19, Andriy Gapon wrote:

On 03/06/2019 17:52, Ian Lepore wrote:

Please don't.  We still have a situation where nobody has shown a
runtime failure at all.  This build failure could be fixed by simply
defining a do-nothing iicbus_set_nostop() function if a quick fix is
needed.


Well, I am quite certain that the run-time failure will follow after the build
time failure is fixed.


Putting this nostop concept into code that is shared by many drivers is
an abomination.  We have exactly one driver that needs this
functionality, so the right fix is to implement it wholly within that
one driver.  I'll put together a diff for that.


That's true that we have just one such driver.
At the same time, the "no stop" (or rather, repeated start) behavior makes more
sense.  If stop+start between transfers are needed then that can be done with
multiple calls to iicbus_transfer.  If multiple messages are given to
iicbus_transfer, then it's reasonable to assume that a repeated started is
wanted between them.  But it would be a big change to review and, if needed, fix
or tidy up all code that uses iicbus_transfer.  So, iicbus_set_nostop() could be
just a small step towards the bigger goal.

But I really don't have a strong opinion.
Fixing drm2 directly is just as good for me as iicbus_set_nostop.



Hi!
From my perspective, either solution is fine, as long as the drm-legacy 
drivers keep on working, and I get some help fixing the issue.


Is there any way we can revert this change while we're discussing the 
best solution to this?

Regards
--
Niclas Zeising
___
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: r348544 - head/sys/dev/hwpmc

2019-06-03 Thread Konstantin Belousov
Author: kib
Date: Mon Jun  3 16:21:09 2019
New Revision: 348544
URL: https://svnweb.freebsd.org/changeset/base/348544

Log:
  hwpmc_intel: List all Silvermont ids.
  
  PR:   238310
  Based on submission by:   Masse Nicolas 
  MFC after:1 week

Modified:
  head/sys/dev/hwpmc/hwpmc_intel.c

Modified: head/sys/dev/hwpmc/hwpmc_intel.c
==
--- head/sys/dev/hwpmc/hwpmc_intel.cMon Jun  3 15:43:40 2019
(r348543)
+++ head/sys/dev/hwpmc/hwpmc_intel.cMon Jun  3 16:21:09 2019
(r348544)
@@ -195,7 +195,11 @@ pmc_intel_initialize(void)
cputype = PMC_CPU_INTEL_HASWELL;
nclasses = 5;
break;
+   case 0x37:
+   case 0x4A:
case 0x4D:  /* Per Intel document 330061-001 01/2014. */
+   case 0x5A:
+   case 0x5D:
cputype = PMC_CPU_INTEL_ATOM_SILVERMONT;
nclasses = 3;
break;
___
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: r348521 - in head: . etc sys/conf sys/modules usr.bin/login usr.sbin/services_mkdb

2019-06-03 Thread Maxim Sobolev
On Mon, Jun 3, 2019 at 7:28 AM Enji Cooper  wrote:

> Hi Maxim,
>
>
> > Modified: head/Makefile.inc1
> >
> ==
> > --- head/Makefile.inc1Sun Jun  2 22:27:26 2019(r348520)
> > +++ head/Makefile.inc1Sun Jun  2 23:38:19 2019(r348521)
> > @@ -887,8 +887,8 @@ MTREEFLAGS+=-W
> > INSTALLFLAGS+=-h sha256
> > .endif
> > .if defined(DB_FROM_SRC) || defined(NO_ROOT)
> > -IMAKE_INSTALL=INSTALL="install ${INSTALLFLAGS}"
> > -IMAKE_MTREE=MTREE_CMD="mtree ${MTREEFLAGS}"
> > +IMAKE_INSTALL=INSTALL="${INSTALL} ${INSTALLFLAGS}"
> > +IMAKE_MTREE=MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
> > .endif
>
> Please back out this part of the change as it is unnecessary and adds
> a dependency on sys.mk’s definitions. $PATH should contain, i.e., be
> populated, with these tools when running make installworld. This is part of
> the logic behind how $ITOOLS, etc, works.
> Thank you very much for your work and the rest of the change though!
>

 Thanks Enji, for a clarification, will do. I still cannot understand why
can't we have those tools being re-defined with top-level make environment?

What I am striving at is being able to do say, make INSTALL="abcd"
installworld. Yes, I understand I can call "abcd" "install" (or make a
symlink to it) and put it into PATH, but there are at least one issue here,
namely what if I need to pass some distinct argument to abcd based on usage
scenario. E.g. make INSTALL="abcd foo" distributiuon. In your case I should
be resorting to setting up some global environment variable and hope it
won't get erased somewhere in the call chain, but that's bit "how you
doing" IMHO. My approach makes certain things so much easier by cutting
those un-neded steps.

At any rate thank for a feedback and some background info, I will do more
work on this. I was thinking more in terms of having some sort of
bsd.bootools.mk where this can be defined in a centralized manner.

-Max
___
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: r348543 - head/sys/kern

2019-06-03 Thread John Baldwin
Author: jhb
Date: Mon Jun  3 15:43:40 2019
New Revision: 348543
URL: https://svnweb.freebsd.org/changeset/base/348543

Log:
  Warn about deprecated features on all major OS versions.
  
  Reviewed by:  imp
  MFC after:3 days
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D20490

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cMon Jun  3 15:41:54 2019(r348542)
+++ head/sys/kern/subr_bus.cMon Jun  3 15:43:40 2019(r348543)
@@ -5948,7 +5948,7 @@ _gone_in(int major, const char *msg)
gone_panic(major, P_OSREL_MAJOR(__FreeBSD_version), msg);
if (P_OSREL_MAJOR(__FreeBSD_version) >= major)
printf("Obsolete code will removed soon: %s\n", msg);
-   else if (P_OSREL_MAJOR(__FreeBSD_version) + 1 == major)
+   else
printf("Deprecated code (to be removed in FreeBSD %d): %s\n",
major, msg);
 }
@@ -5961,7 +5961,7 @@ _gone_in_dev(device_t dev, int major, const char *msg)
if (P_OSREL_MAJOR(__FreeBSD_version) >= major)
device_printf(dev,
"Obsolete code will removed soon: %s\n", msg);
-   else if (P_OSREL_MAJOR(__FreeBSD_version) + 1 == major)
+   else
device_printf(dev,
"Deprecated code (to be removed in FreeBSD %d): %s\n",
major, msg);
___
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: r348542 - head/share/man/man4

2019-06-03 Thread John Baldwin
Author: jhb
Date: Mon Jun  3 15:41:54 2019
New Revision: 348542
URL: https://svnweb.freebsd.org/changeset/base/348542

Log:
  Add 'device cxgbe' explicitly in the synopsis.
  
  ccr depends on symbols exported by the cxgbe driver as well as having
  a runtime dependency.  While the runtime depenency was noted in the
  manpage already, the compile-time dependency wasn't as clear.
  
  PR:   238265
  MFC after:3 days
  Sponsored by: Chelsio Communications

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

Modified: head/share/man/man4/ccr.4
==
--- head/share/man/man4/ccr.4   Mon Jun  3 15:41:45 2019(r348541)
+++ head/share/man/man4/ccr.4   Mon Jun  3 15:41:54 2019(r348542)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 29, 2019
+.Dd June 3, 2019
 .Dt CCR 4
 .Os
 .Sh NAME
@@ -36,6 +36,7 @@ place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device ccr"
+.Cd "device cxgbe"
 .Ed
 .Pp
 To load the driver as a
___
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: r348541 - head/sys/dev/efidev

2019-06-03 Thread Konstantin Belousov
Author: kib
Date: Mon Jun  3 15:41:45 2019
New Revision: 348541
URL: https://svnweb.freebsd.org/changeset/base/348541

Log:
  efirt efi_enter(): Release acquired locks and restore FPU ownership if
  efi_arch_enter() returned an error.
  
  Submitted:Jan Martin Mikkelsen 
  MFC after:1 week

Modified:
  head/sys/dev/efidev/efirt.c

Modified: head/sys/dev/efidev/efirt.c
==
--- head/sys/dev/efidev/efirt.c Mon Jun  3 15:34:00 2019(r348540)
+++ head/sys/dev/efidev/efirt.c Mon Jun  3 15:41:45 2019(r348541)
@@ -275,6 +275,7 @@ efi_enter(void)
 {
struct thread *td;
pmap_t curpmap;
+   int error;
 
if (efi_runtime == NULL)
return (ENXIO);
@@ -283,7 +284,13 @@ efi_enter(void)
PMAP_LOCK(curpmap);
mtx_lock(_lock);
fpu_kern_enter(td, NULL, FPU_KERN_NOCTX);
-   return (efi_arch_enter());
+   error = efi_arch_enter();
+   if (error != 0) {
+   fpu_kern_leave(td, NULL);
+   mtx_unlock(_lock);
+   PMAP_UNLOCK(curpmap);
+   }
+   return (error);
 }
 
 static void
___
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: r348540 - head

2019-06-03 Thread Maxim Sobolev
Author: sobomax
Date: Mon Jun  3 15:34:00 2019
New Revision: 348540
URL: https://svnweb.freebsd.org/changeset/base/348540

Log:
  Rollback the rest of the botched r348521. Re-work would be posted to
  reviews. Sorry.
  
  Reported by:  Enji Cooper

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Jun  3 15:32:42 2019(r348539)
+++ head/Makefile.inc1  Mon Jun  3 15:34:00 2019(r348540)
@@ -887,7 +887,7 @@ MTREEFLAGS+=-W
 INSTALLFLAGS+= -h sha256
 .endif
 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
-IMAKE_INSTALL= INSTALL="${INSTALL} ${INSTALLFLAGS}"
+IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
 IMAKE_MTREE=   MTREE_CMD="mtree ${MTREEFLAGS}"
 .endif
 
___
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: r348539 - in head/sys/amd64: amd64 include

2019-06-03 Thread Konstantin Belousov
Author: kib
Date: Mon Jun  3 15:32:42 2019
New Revision: 348539
URL: https://svnweb.freebsd.org/changeset/base/348539

Log:
  amd64 ef_rt_arch_call: Preserve %rflags around call into EFI RT service.
  
  If service code faulted, we might end up unwinding with interrupts
  disabled.  Top-level kernel code should have interrupts enabled, which
  is enforced by checks.
  
  Save %rflags before entering EFI, and restore to the known good value
  on return.  This handles situation with disabled interrupts on fault
  and perhaps other potential bugs, e.g. invalid value for PSL_D.
  
  Reported and tested by:   Jan Martin Mikkelsen 
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/efirt_support.S
  head/sys/amd64/amd64/genassym.c
  head/sys/amd64/include/efi.h

Modified: head/sys/amd64/amd64/efirt_support.S
==
--- head/sys/amd64/amd64/efirt_support.SMon Jun  3 15:28:37 2019
(r348538)
+++ head/sys/amd64/amd64/efirt_support.SMon Jun  3 15:32:42 2019
(r348539)
@@ -47,6 +47,9 @@ ENTRY(efi_rt_arch_call)
movq%r13, EC_R13(%rdi)
movq%r14, EC_R14(%rdi)
movq%r15, EC_R15(%rdi)
+   pushfq
+   popq%rax
+   movq%rax, EC_RFLAGS(%rdi)
movqPCPU(CURTHREAD), %rax
movq%rdi, TD_MD+MD_EFIRT_TMP(%rax)
movqPCPU(CURPCB), %rsi
@@ -98,6 +101,8 @@ efi_rt_arch_call_tail:
movqEC_RBP(%rdi), %rbp
movqEC_RSP(%rdi), %rsp
movqEC_RBX(%rdi), %rbx
+   pushq   EC_RFLAGS(%rdi)
+   popfq
 
popq%rbp
ret

Modified: head/sys/amd64/amd64/genassym.c
==
--- head/sys/amd64/amd64/genassym.c Mon Jun  3 15:28:37 2019
(r348538)
+++ head/sys/amd64/amd64/genassym.c Mon Jun  3 15:32:42 2019
(r348539)
@@ -272,3 +272,4 @@ ASSYM(EC_R12, offsetof(struct efirt_callinfo, ec_r12))
 ASSYM(EC_R13, offsetof(struct efirt_callinfo, ec_r13));
 ASSYM(EC_R14, offsetof(struct efirt_callinfo, ec_r14));
 ASSYM(EC_R15, offsetof(struct efirt_callinfo, ec_r15));
+ASSYM(EC_RFLAGS, offsetof(struct efirt_callinfo, ec_rflags));

Modified: head/sys/amd64/include/efi.h
==
--- head/sys/amd64/include/efi.hMon Jun  3 15:28:37 2019
(r348538)
+++ head/sys/amd64/include/efi.hMon Jun  3 15:32:42 2019
(r348539)
@@ -72,6 +72,7 @@ struct efirt_callinfo {
register_t  ec_r13;
register_t  ec_r14;
register_t  ec_r15;
+   register_t  ec_rflags;
 };
 
 #endif /* __AMD64_INCLUDE_EFI_H_ */
___
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: r348538 - stable/12/lib/libjail

2019-06-03 Thread Kyle Evans
Author: kevans
Date: Mon Jun  3 15:28:37 2019
New Revision: 348538
URL: https://svnweb.freebsd.org/changeset/base/348538

Log:
  MFC r348509: jail_getid(3): add special-case immediate return for jid 0
  
  As depicted in the comment: jid 0 always exists, but the lookup will fail as
  it does not appear in the kernel's alljails list being a special jail. Some
  callers will expect/rely on this, and we have no reason to lie because it
  does always exist.
  
  Approved by:  re (early MFC)

Modified:
  stable/12/lib/libjail/jail_getid.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libjail/jail_getid.c
==
--- stable/12/lib/libjail/jail_getid.c  Mon Jun  3 15:25:12 2019
(r348537)
+++ stable/12/lib/libjail/jail_getid.c  Mon Jun  3 15:28:37 2019
(r348538)
@@ -54,6 +54,15 @@ jail_getid(const char *name)
 
jid = strtoul(name, , 10);
if (*name && !*ep) {
+   /*
+* jid == 0 is a special case; it will not appear in the
+* kernel's jail list, but naturally processes will be assigned
+* to it because it is prison 0.  Trivially return this one
+* without a trip to the kernel, because it always exists but
+* the lookup won't succeed.
+*/
+   if (jid == 0)
+   return jid;
jiov[0].iov_base = __DECONST(char *, "jid");
jiov[0].iov_len = sizeof("jid");
jiov[1].iov_base = 
___
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: r348537 - vendor-sys/illumos/dist/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 15:25:12 2019
New Revision: 348537
URL: https://svnweb.freebsd.org/changeset/base/348537

Log:
  8601 memory leak in get_special_prop()
  
  illumos/illumos-gate@e19b450bec203d8be04447ea476d7a86b36d63a1
  
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Sara Hartse 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Matt Ahrens 
  Reviewed by: Robert Mustacchi 
  Approved by: Dan McDonald 
  Author: John Gallagher 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c Mon Jun  3 15:23:37 
2019(r348536)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_get.c Mon Jun  3 15:25:12 
2019(r348537)
@@ -14,7 +14,7 @@
  */
 
 /*
- * Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2016, 2017 by Delphix. All rights reserved.
  */
 
 #include "lua.h"
@@ -422,16 +422,21 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, 
case ZFS_PROP_INCONSISTENT:
numval = dsl_get_inconsistent(ds);
break;
-   case ZFS_PROP_RECEIVE_RESUME_TOKEN:
-   VERIFY3U(strlcpy(strval, get_receive_resume_stats_impl(ds),
-   ZAP_MAXVALUELEN), <, ZAP_MAXVALUELEN);
+   case ZFS_PROP_RECEIVE_RESUME_TOKEN: {
+   char *token = get_receive_resume_stats_impl(ds);
+   VERIFY3U(strlcpy(strval, token, ZAP_MAXVALUELEN), <,
+   ZAP_MAXVALUELEN);
+   strfree(token);
if (strcmp(strval, "") == 0) {
-   VERIFY3U(strlcpy(strval, get_child_receive_stats(ds),
-   ZAP_MAXVALUELEN), <, ZAP_MAXVALUELEN);
+   token = get_child_receive_stats(ds);
+   VERIFY3U(strlcpy(strval, token, ZAP_MAXVALUELEN), <,
+   ZAP_MAXVALUELEN);
+   strfree(token);
if (strcmp(strval, "") == 0)
error = ENOENT;
}
break;
+   }
case ZFS_PROP_VOLSIZE:
ASSERT(ds_type == ZFS_TYPE_VOLUME);
error = dmu_objset_from_ds(ds, );
___
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: r348535 - vendor-sys/illumos/dist/uts/common/fs/zfs

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 15:23:21 2019
New Revision: 348535
URL: https://svnweb.freebsd.org/changeset/base/348535

Log:
  9677 panic from zio_write_gang_block() when creating dump device on 
fragmented rpool
  
  illumos/illumos-gate@7341a7de4f0489193e0cfe11049a7bcf1596a4db
  
  Reviewed by: Matt Ahrens 
  Reviewed by: George Wilson 
  Reviewed by: Prashanth Sreenivasa 
  Approved by: Robert Mustacchi 
  Author: Brad Lewis 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Mon Jun  3 15:19:23 
2019(r348534)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c Mon Jun  3 15:23:21 
2019(r348535)
@@ -2192,7 +2192,13 @@ zio_write_gang_member_ready(zio_t *zio)
 static void
 zio_write_gang_done(zio_t *zio)
 {
-   abd_put(zio->io_abd);
+   /*
+* The io_abd field will be NULL for a zio with no data.  The io_flags
+* will initially have the ZIO_FLAG_NODATA bit flag set, but we can't
+* check for it here as it is cleared in zio_ready.
+*/
+   if (zio->io_abd != NULL)
+   abd_put(zio->io_abd);
 }
 
 static int
@@ -2213,11 +2219,12 @@ zio_write_gang_block(zio_t *pio)
int gbh_copies = MIN(copies + 1, spa_max_replication(spa));
zio_prop_t zp;
int error;
+   boolean_t has_data = !(pio->io_flags & ZIO_FLAG_NODATA);
 
int flags = METASLAB_HINTBP_FAVOR | METASLAB_GANG_HEADER;
if (pio->io_flags & ZIO_FLAG_IO_ALLOCATING) {
ASSERT(pio->io_priority == ZIO_PRIORITY_ASYNC_WRITE);
-   ASSERT(!(pio->io_flags & ZIO_FLAG_NODATA));
+   ASSERT(has_data);
 
flags |= METASLAB_ASYNC_ALLOC;
VERIFY(refcount_held(>mc_alloc_slots[pio->io_allocator],
@@ -2241,7 +2248,7 @@ zio_write_gang_block(zio_t *pio)
if (error) {
if (pio->io_flags & ZIO_FLAG_IO_ALLOCATING) {
ASSERT(pio->io_priority == ZIO_PRIORITY_ASYNC_WRITE);
-   ASSERT(!(pio->io_flags & ZIO_FLAG_NODATA));
+   ASSERT(has_data);
 
/*
 * If we failed to allocate the gang block header then
@@ -2294,14 +2301,15 @@ zio_write_gang_block(zio_t *pio)
zp.zp_nopwrite = B_FALSE;
 
zio_t *cio = zio_write(zio, spa, txg, >zg_blkptr[g],
-   abd_get_offset(pio->io_abd, pio->io_size - resid), lsize,
-   lsize, , zio_write_gang_member_ready, NULL, NULL,
+   has_data ? abd_get_offset(pio->io_abd, pio->io_size -
+   resid) : NULL, lsize, lsize, ,
+   zio_write_gang_member_ready, NULL, NULL,
zio_write_gang_done, >gn_child[g], pio->io_priority,
ZIO_GANG_CHILD_FLAGS(pio), >io_bookmark);
 
if (pio->io_flags & ZIO_FLAG_IO_ALLOCATING) {
ASSERT(pio->io_priority == ZIO_PRIORITY_ASYNC_WRITE);
-   ASSERT(!(pio->io_flags & ZIO_FLAG_NODATA));
+   ASSERT(has_data);
 
/*
 * Gang children won't throttle but we should
___
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: r348536 - head/sys/kern

2019-06-03 Thread Konstantin Belousov
Author: kib
Date: Mon Jun  3 15:23:37 2019
New Revision: 348536
URL: https://svnweb.freebsd.org/changeset/base/348536

Log:
  Remove dead check.
  
  We already handled the case when symstrindex < 0 at line 680.
  
  Reported by:  danfe using PVS-studio
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cMon Jun  3 15:23:21 2019
(r348535)
+++ head/sys/kern/link_elf_obj.cMon Jun  3 15:23:37 2019
(r348536)
@@ -714,11 +714,6 @@ link_elf_load_file(linker_class_t cls, const char *fil
goto out;
}
 
-   if (symstrindex == -1) {
-   link_elf_error(filename, "lost symbol string index");
-   error = ENOEXEC;
-   goto out;
-   }
/* Allocate space for and load the symbol strings */
ef->ddbstrcnt = shdr[symstrindex].sh_size;
ef->ddbstrtab = malloc(shdr[symstrindex].sh_size, M_LINKER, M_WAITOK);
___
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: r348534 - vendor/illumos/dist/lib/libzfs/common

2019-06-03 Thread Alexander Motin
Author: mav
Date: Mon Jun  3 15:19:23 2019
New Revision: 348534
URL: https://svnweb.freebsd.org/changeset/base/348534

Log:
  9616 Bogus error when attempting to set property on read-only pool
  
  illumos/illumos-gate@f62db44dbcda5dd786bb821f1e6fd3ca2e6d4391
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: Matt Ahrens 
  Approved by: Robert Mustacchi 
  Author:   Andrew Stormont 

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
==
--- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Mon Jun  3 
15:19:11 2019(r348533)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c  Mon Jun  3 
15:19:23 2019(r348534)
@@ -30,7 +30,7 @@
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2017 Nexenta Systems, Inc.
  * Copyright 2016 Igor Kozhukhov 
- * Copyright 2017 RackTop Systems.
+ * Copyright 2017-2018 RackTop Systems.
  */
 
 #include 
@@ -1808,13 +1808,18 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
ret = zfs_ioctl(hdl, ZFS_IOC_SET_PROP, );
 
if (ret != 0) {
+   if (zc.zc_nvlist_dst_filled == B_FALSE) {
+   (void) zfs_standard_error(hdl, errno, errbuf);
+   goto error;
+   }
+
/* Get the list of unset properties back and report them. */
nvlist_t *errorprops = NULL;
if (zcmd_read_dst_nvlist(hdl, , ) != 0)
goto error;
-   for (nvpair_t *elem = nvlist_next_nvpair(nvl, NULL);
+   for (nvpair_t *elem = nvlist_next_nvpair(errorprops, NULL);
elem != NULL;
-   elem = nvlist_next_nvpair(nvl, elem)) {
+   elem = nvlist_next_nvpair(errorprops, elem)) {
zfs_prop_t prop = zfs_name_to_prop(nvpair_name(elem));
zfs_setprop_error(hdl, prop, errno, errbuf);
}
___
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: r348355 - head/sys/dev/iicbus

2019-06-03 Thread Andriy Gapon
On 03/06/2019 17:52, Ian Lepore wrote:
> Please don't.  We still have a situation where nobody has shown a
> runtime failure at all.  This build failure could be fixed by simply
> defining a do-nothing iicbus_set_nostop() function if a quick fix is
> needed.

Well, I am quite certain that the run-time failure will follow after the build
time failure is fixed.

> Putting this nostop concept into code that is shared by many drivers is
> an abomination.  We have exactly one driver that needs this
> functionality, so the right fix is to implement it wholly within that
> one driver.  I'll put together a diff for that.

That's true that we have just one such driver.
At the same time, the "no stop" (or rather, repeated start) behavior makes more
sense.  If stop+start between transfers are needed then that can be done with
multiple calls to iicbus_transfer.  If multiple messages are given to
iicbus_transfer, then it's reasonable to assume that a repeated started is
wanted between them.  But it would be a big change to review and, if needed, fix
or tidy up all code that uses iicbus_transfer.  So, iicbus_set_nostop() could be
just a small step towards the bigger goal.

But I really don't have a strong opinion.
Fixing drm2 directly is just as good for me as iicbus_set_nostop.

-- 
Andriy Gapon
___
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: r348533 - head/sys/vm

2019-06-03 Thread Konstantin Belousov
Author: kib
Date: Mon Jun  3 15:19:11 2019
New Revision: 348533
URL: https://svnweb.freebsd.org/changeset/base/348533

Log:
  Remove dead store.
  
  sw_flags is set to the function argument several lines later.
  
  Reported by:  danfe using PVS-studio
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cMon Jun  3 15:12:44 2019(r348532)
+++ head/sys/vm/swap_pager.cMon Jun  3 15:19:11 2019(r348533)
@@ -2230,7 +2230,6 @@ swaponsomething(struct vnode *vp, void *id, u_long nbl
sp->sw_vp = vp;
sp->sw_id = id;
sp->sw_dev = dev;
-   sp->sw_flags = 0;
sp->sw_nblks = nblks;
sp->sw_used = 0;
sp->sw_strategy = strategy;
___
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: r348532 - in head: . etc

2019-06-03 Thread Maxim Sobolev
Author: sobomax
Date: Mon Jun  3 15:12:44 2019
New Revision: 348532
URL: https://svnweb.freebsd.org/changeset/base/348532

Log:
  Leave mtree hardcoded for now. Reverting partially 348521 and also
  the followup stopgap change, because I don't think it's a correct. I still
  need to figure out where to stick it in. In cannot be in Makefile.inc1
  and it cannot be in etc/Makefile from the looks of it to avoid
  chicken-and-egg problem.

Modified:
  head/Makefile.inc1
  head/etc/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Jun  3 15:10:37 2019(r348531)
+++ head/Makefile.inc1  Mon Jun  3 15:12:44 2019(r348532)
@@ -888,7 +888,7 @@ INSTALLFLAGS+=  -h sha256
 .endif
 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
 IMAKE_INSTALL= INSTALL="${INSTALL} ${INSTALLFLAGS}"
-IMAKE_MTREE=   MTREE_CMD="${MTREE} ${MTREEFLAGS}"
+IMAKE_MTREE=   MTREE_CMD="mtree ${MTREEFLAGS}"
 .endif
 
 DESTDIR_MTREEFLAGS=-deU

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Mon Jun  3 15:10:37 2019(r348531)
+++ head/etc/Makefile   Mon Jun  3 15:12:44 2019(r348532)
@@ -93,8 +93,6 @@ distribution:
 .endif
 .endif
 
-MTREE_CMD?=mtree
-
 MTREES=mtree/BSD.root.dist /   \
mtree/BSD.var.dist  /var\
mtree/BSD.usr.dist  /usr\
___
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: r348355 - head/sys/dev/iicbus

2019-06-03 Thread Andriy Gapon
On 03/06/2019 17:17, Niclas Zeising wrote:
> On 2019-06-03 14:08, Andriy Gapon wrote:
>> Hi!  Thank you for the report.
>> I am going to restore iicbus_set_nostop, but this time as a function that
>> modifies iicbus softc (instead of an ivar accessor for the bus).
>> I am including a patch that I would like to commit.
>>
>> However, for the drm code to request the nostop mode correctly it needs to be
>> fixed as well.
>> My proposed patch is here: 
>> https://github.com/FreeBSDDesktop/drm-legacy/pull/9
>>
> 
> 
> Thank you, I will try it out.
> Will this break drm-legacy-kmod on 12, which doesn't have the iic bus change 
> you
> proposed?

No, it should not change anything for 12 / 11.
But see Ian's reaction.

-- 
Andriy Gapon
___
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: r348531 - stable/12/sys/amd64/amd64

2019-06-03 Thread Konstantin Belousov
Author: kib
Date: Mon Jun  3 15:10:37 2019
New Revision: 348531
URL: https://svnweb.freebsd.org/changeset/base/348531

Log:
  MFC r348306:
  Correct some inconsistencies in the earliest created kernel page
  tables which affect demotion.

Modified:
  stable/12/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/pmap.c
==
--- stable/12/sys/amd64/amd64/pmap.cMon Jun  3 14:14:53 2019
(r348530)
+++ stable/12/sys/amd64/amd64/pmap.cMon Jun  3 15:10:37 2019
(r348531)
@@ -964,7 +964,6 @@ static void
 create_pagetables(vm_paddr_t *firstaddr)
 {
int i, j, ndm1g, nkpdpe, nkdmpde;
-   pt_entry_t *pt_p;
pd_entry_t *pd_p;
pdp_entry_t *pdp_p;
pml4_entry_t *p4_p;
@@ -1025,20 +1024,21 @@ create_pagetables(vm_paddr_t *firstaddr)
KPTphys = allocpages(firstaddr, nkpt);
KPDphys = allocpages(firstaddr, nkpdpe);
 
-   /* Fill in the underlying page table pages */
-   /* XXX not fully used, underneath 2M pages */
-   pt_p = (pt_entry_t *)KPTphys;
-   for (i = 0; ptoa(i) < *firstaddr; i++)
-   pt_p[i] = ptoa(i) | X86_PG_V | pg_g | bootaddr_rwx(ptoa(i));
-
-   /* Now map the page tables at their location within PTmap */
+   /*
+* Connect the zero-filled PT pages to their PD entries.  This
+* implicitly maps the PT pages at their correct locations within
+* the PTmap.
+*/
pd_p = (pd_entry_t *)KPDphys;
for (i = 0; i < nkpt; i++)
pd_p[i] = (KPTphys + ptoa(i)) | X86_PG_RW | X86_PG_V;
 
-   /* Map from zero to end of allocations under 2M pages */
-   /* This replaces some of the KPTphys entries above */
-   for (i = 0; (i << PDRSHIFT) < *firstaddr; i++)
+   /*
+* Map from physical address zero to the end of loader preallocated
+* memory using 2MB pages.  This replaces some of the PD entries
+* created above.
+*/
+   for (i = 0; (i << PDRSHIFT) < KERNend; i++)
/* Preset PG_M and PG_A because demotion expects it. */
pd_p[i] = (i << PDRSHIFT) | X86_PG_V | PG_PS | pg_g |
X86_PG_M | X86_PG_A | bootaddr_rwx(i << PDRSHIFT);
@@ -1048,7 +1048,8 @@ create_pagetables(vm_paddr_t *firstaddr)
 * to record the physical blocks we've actually mapped into kernel
 * virtual address space.
 */
-   *firstaddr = round_2mpage(*firstaddr);
+   if (*firstaddr < round_2mpage(KERNend))
+   *firstaddr = round_2mpage(KERNend);
 
/* And connect up the PD to the PDP (leaving room for L4 pages) */
pdp_p = (pdp_entry_t *)(KPDPphys + ptoa(KPML4I - KPML4BASE));
@@ -1155,7 +1156,10 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 */
vm_phys_add_seg(KPTphys, KPTphys + ptoa(nkpt));
 
-   virtual_avail = (vm_offset_t) KERNBASE + *firstaddr;
+   /*
+* Account for the virtual addresses mapped by create_pagetables().
+*/
+   virtual_avail = (vm_offset_t)KERNBASE + round_2mpage(KERNend);
virtual_end = VM_MAX_KERNEL_ADDRESS;
 
/*
___
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: r348355 - head/sys/dev/iicbus

2019-06-03 Thread Ian Lepore
On Mon, 2019-06-03 at 15:08 +0300, Andriy Gapon wrote:
> On 03/06/2019 14:16, Niclas Zeising wrote:
> > Hi!
> > It seems like things broke after all, latest pkg build (on head-
> > amd64) reports
> > this:
> > 
> > 
> > /wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-
> > 12bd551/src/dev/drm2/i915/intel_iic.c:570:2:
> > error: implicit declaration of function 'iicbus_set_nostop' is
> > invalid in C99
> > [-Werror,-Wimplicit-function-declaration]
> > iicbus_set_nostop(idev, true);
> > ^
> > /wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-
> > 12bd551/src/dev/drm2/i915/intel_iic.c:570:2:
> > error: this function declaration is not a prototype [-Werror,-
> > Wstrict-prototypes]
> > 2 errors generated.
> > 
> > Full log:
> > 
> > 
http://beefy12.nyi.freebsd.org/data/head-amd64-default/p503023_s348376/logs/drm-legacy-kmod-g20190523.log
> 
> Hi!  Thank you for the report.
> I am going to restore iicbus_set_nostop, but this time as a function
> that
> modifies iicbus softc (instead of an ivar accessor for the bus).
> I am including a patch that I would like to commit.
> 
> However, for the drm code to request the nostop mode correctly it
> needs to be
> fixed as well.
> My proposed patch is here: 
> https://github.com/FreeBSDDesktop/drm-legacy/pull/9
> 
> Index: sys/dev/iicbus/iicbus.h
> ===
> --- sys/dev/iicbus/iicbus.h   (revision 348529)
> +++ sys/dev/iicbus/iicbus.h   (working copy)
> @@ -46,6 +46,8 @@ struct iicbus_softc
>* 0 if no start condition succeeded */
>   u_char strict;  /* deny operations that violate the
>* I2C protocol */
> + bool nostop;/* iicbus_transfer defaults to
> repeated
> +  * start between messages */
>   struct mtx lock;
>   u_int bus_freq; /* Configured bus Hz. */
>  };
> @@ -77,6 +79,7 @@ IICBUS_ACCESSOR(addr,   ADDR,   
> uint32_t)
> 
>  int  iicbus_generic_intr(device_t dev, int event, char *buf);
>  void iicbus_init_frequency(device_t dev, u_int bus_freq);
> +void iicbus_set_nostop(device_t dev, bool val);
> 
>  extern driver_t iicbus_driver;
>  extern devclass_t iicbus_devclass;
> Index: sys/dev/iicbus/iiconf.c
> ===
> --- sys/dev/iicbus/iiconf.c   (revision 348529)
> +++ sys/dev/iicbus/iiconf.c   (working copy)
> @@ -383,6 +383,14 @@ iicbus_block_read(device_t bus, u_char slave,
> char
>   return (error);
>  }
> 
> +void
> +iicbus_set_nostop(device_t bus, bool val)
> +{
> + struct iicbus_softc *sc = device_get_softc(bus);
> +
> + sc->nostop = val;
> +}
> +
>  /*
>   * iicbus_transfer()
>   *
> @@ -427,7 +435,8 @@ iicbus_transfer_gen(device_t dev, struct iic_msg
> *
>  {
>   int i, error, lenread, lenwrote, nkid, rpstart, addr;
>   device_t *children, bus;
> - bool started;
> + struct iicbus_softc *sc;
> + bool nostop, started;
> 
>   if ((error = device_get_children(dev, , )) != 0)
>   return (IIC_ERESOURCE);
> @@ -438,6 +447,8 @@ iicbus_transfer_gen(device_t dev, struct iic_msg
> *
>   bus = children[0];
>   rpstart = 0;
>   free(children, M_TEMP);
> + sc = device_get_softc(bus);
> + nostop = sc->nostop;
>   started = false;
>   for (i = 0, error = 0; i < nmsgs && error == 0; i++) {
>   addr = msgs[i].slave;
> @@ -465,11 +476,12 @@ iicbus_transfer_gen(device_t dev, struct
> iic_msg *
>   if (error != 0)
>   break;
> 
> - if (!(msgs[i].flags & IIC_M_NOSTOP)) {
> + if ((msgs[i].flags & IIC_M_NOSTOP) != 0 ||
> + (nostop && i + 1 < nmsgs)) {
> + rpstart = 1;/* Next message gets repeated
> start */
> + } else {
>   rpstart = 0;
>   iicbus_stop(bus);
> - } else {
> - rpstart = 1;/* Next message gets repeated
> start */
>   }
>   }
>   if (error != 0 && started)
> 
> 

Please don't.  We still have a situation where nobody has shown a
runtime failure at all.  This build failure could be fixed by simply
defining a do-nothing iicbus_set_nostop() function if a quick fix is
needed.

Putting this nostop concept into code that is shared by many drivers is
an abomination.  We have exactly one driver that needs this
functionality, so the right fix is to implement it wholly within that
one driver.  I'll put together a diff for that.

-- 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"


Re: svn commit: r248514 - head/sys/vm

2019-06-03 Thread Alexey Dokuchaev
On Tue, Mar 19, 2013 at 02:39:27PM +, Konstantin Belousov wrote:
> New Revision: 248514
> URL: http://svnweb.freebsd.org/changeset/base/248514
> 
> Log:
>   Do not map the swap i/o pbufs if the geom provider for the swap
>   partition accepts unmapped requests.
>   
> Modified: head/sys/vm/swap_pager.c
> ...
> @@ -2180,6 +2190,7 @@ swaponsomething(struct vnode *vp, void *
>   sp->sw_flags = 0;
>   sp->sw_nblks = nblks;
>   sp->sw_used = 0;
>   sp->sw_strategy = strategy;
>   sp->sw_close = close;
> + sp->sw_flags = flags;

PVS Studio complains here: /usr/src/sys/vm/swap_pager.c:2238:1: warning:
V519 The 'sp->sw_flags' variable is assigned values twice successively.
Perhaps this is a mistake. Check lines: 2233, 2238.

Looks like "sp->sw_flags = 0" should've been removed, can you confirm?

./danfe
___
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: r348521 - in head: . etc sys/conf sys/modules usr.bin/login usr.sbin/services_mkdb

2019-06-03 Thread Enji Cooper
Hi Maxim,

> On Jun 2, 2019, at 16:38, Maxim Sobolev  wrote:
> 
> Author: sobomax
> Date: Sun Jun  2 23:38:19 2019
> New Revision: 348521
> URL: https://svnweb.freebsd.org/changeset/base/348521
> 
> Log:
>  Fix several places where tool name has been hardcoded:
> 
>  install -> ${INSTALL}
>  mtree -> ${MTREE_CMD}
>  services_mkdb -> ${SERVICES_MKDB_CMD}
>  cap_mkdb -> ${CAP_MKDB_CMD}
>  pwd_mkdb -> ${PWD_MKDB_CMD}
>  kldxref -> ${KLDXREF_CMD}
> 
>  If you do custom FreeBSD builds you may want to override those
>  in some cases.
> 
>  Sponsored by:Sippy Software, Inc.

Please get review from Bryan, Simon, or Warner next time, per MAINTAINERS, 
to avoid breakage in the future. There are some sand traps in our build 
infrastructure.

...

> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Sun Jun  2 22:27:26 2019(r348520)
> +++ head/Makefile.inc1Sun Jun  2 23:38:19 2019(r348521)
> @@ -887,8 +887,8 @@ MTREEFLAGS+=-W
> INSTALLFLAGS+=-h sha256
> .endif
> .if defined(DB_FROM_SRC) || defined(NO_ROOT)
> -IMAKE_INSTALL=INSTALL="install ${INSTALLFLAGS}"
> -IMAKE_MTREE=MTREE_CMD="mtree ${MTREEFLAGS}"
> +IMAKE_INSTALL=INSTALL="${INSTALL} ${INSTALLFLAGS}"
> +IMAKE_MTREE=MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
> .endif

Please back out this part of the change as it is unnecessary and adds a 
dependency on sys.mk’s definitions. $PATH should contain, i.e., be populated, 
with these tools when running make installworld. This is part of the logic 
behind how $ITOOLS, etc, works.
Thank you very much for your work and the rest of the change though!
-Enji
___
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: r296467 - head/sys/kern

2019-06-03 Thread Alexey Dokuchaev
On Mon, Mar 07, 2016 at 06:44:07PM +, Konstantin Belousov wrote:
> New Revision: 296467
> URL: https://svnweb.freebsd.org/changeset/base/296467
> 
> Log:
>   Convert all panics from the link_elf_obj kernel linker for object
>   files format into printfs and errors to caller.  Some leaks of
>   resources are there, but the same leaks are present in other error
>   pathes.  With the change, the kernel at least boots even when module
>   with unexpected or corrupted ELF structure is preloaded.
>   
> Modified: head/sys/kern/link_elf_obj.c
> ...
> @@ -634,8 +645,11 @@ link_elf_load_file(linker_class_t cls, c
>   ef->relatab = malloc(ef->nrelatab * sizeof(*ef->relatab),
>   M_LINKER, M_WAITOK | M_ZERO);
>  
> - if (symtabindex == -1)
> - panic("lost symbol table index");
> + if (symtabindex == -1) {
> + link_elf_error(filename, "lost symbol table index");
> + error = ENOEXEC;
> + goto out;
> + }
>   /* Allocate space for and load the symbol table */
>   ef->ddbsymcnt = shdr[symtabindex].sh_size / sizeof(Elf_Sym);
>   ef->ddbsymtab = malloc(shdr[symtabindex].sh_size, M_LINKER, M_WAITOK);
> @@ -650,8 +664,11 @@ link_elf_load_file(linker_class_t cls, c
>   goto out;
>   }
>  
> - if (symstrindex == -1)
> - panic("lost symbol string index");
> + if (symstrindex == -1) {
> + link_elf_error(filename, "lost symbol string index");
> + error = ENOEXEC;
> + goto out;
> + }

PVS Studio reports: /usr/src/sys/kern/link_elf_obj.c:717:1: warning: V547
Expression 'symstrindex == - 1' is always false.

Original panic()s were added by peter@ in r129362 (CC'ed).  Could one of
you guys take a look?  Thanks,

./danfe
___
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: r348355 - head/sys/dev/iicbus

2019-06-03 Thread Niclas Zeising

On 2019-06-03 14:08, Andriy Gapon wrote:

On 03/06/2019 14:16, Niclas Zeising wrote:

Hi!
It seems like things broke after all, latest pkg build (on head-amd64) reports
this:


/wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-12bd551/src/dev/drm2/i915/intel_iic.c:570:2:
error: implicit declaration of function 'iicbus_set_nostop' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
     iicbus_set_nostop(idev, true);
     ^
/wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-12bd551/src/dev/drm2/i915/intel_iic.c:570:2:
error: this function declaration is not a prototype 
[-Werror,-Wstrict-prototypes]
2 errors generated.

Full log:

http://beefy12.nyi.freebsd.org/data/head-amd64-default/p503023_s348376/logs/drm-legacy-kmod-g20190523.log


Hi!  Thank you for the report.
I am going to restore iicbus_set_nostop, but this time as a function that
modifies iicbus softc (instead of an ivar accessor for the bus).
I am including a patch that I would like to commit.

However, for the drm code to request the nostop mode correctly it needs to be
fixed as well.
My proposed patch is here: https://github.com/FreeBSDDesktop/drm-legacy/pull/9




Thank you, I will try it out.
Will this break drm-legacy-kmod on 12, which doesn't have the iic bus 
change you proposed?

Regards
--
Niclas Zeising
___
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: r348530 - head

2019-06-03 Thread Warner Losh
Author: imp
Date: Mon Jun  3 14:14:53 2019
New Revision: 348530
URL: https://svnweb.freebsd.org/changeset/base/348530

Log:
  Stopgap fix to breakage from r348521.
  
  MTREE is defined, while MTREE_CMD isn't, use it instead.
  This may not be 'right' but it fixes the CI and other issues.
  
  Submitted by: Andreas Nilsson

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Jun  3 10:04:34 2019(r348529)
+++ head/Makefile.inc1  Mon Jun  3 14:14:53 2019(r348530)
@@ -888,7 +888,7 @@ INSTALLFLAGS+=  -h sha256
 .endif
 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
 IMAKE_INSTALL= INSTALL="${INSTALL} ${INSTALLFLAGS}"
-IMAKE_MTREE=   MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
+IMAKE_MTREE=   MTREE_CMD="${MTREE} ${MTREEFLAGS}"
 .endif
 
 DESTDIR_MTREEFLAGS=-deU
___
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: r348521 - in head: . etc sys/conf sys/modules usr.bin/login usr.sbin/services_mkdb

2019-06-03 Thread Maxim Sobolev
Looking into it, sorry for breakage. Somehow it worked here. :( I'll
backout if I cannot figure it out in a 30 minutes or so.

Sorry about that.

-Max

On Mon, Jun 3, 2019 at 7:10 AM Warner Losh  wrote:

>
>
> On Mon, Jun 3, 2019 at 7:54 AM Rodney W. Grimes 
> wrote:
>
>> > In message <7bd6b7ad-5950-4015-b95d-9ffb609f5...@fubar.geek.nz>,
>> Andrew Turner
>> > writes:
>> > >
>> > >
>> > > > On 3 Jun 2019, at 00:38, Maxim Sobolev  wrote:
>> > > >
>> > > > Author: sobomax
>> > > > Date: Sun Jun  2 23:38:19 2019
>> > > > New Revision: 348521
>> > > > URL: https://svnweb.freebsd.org/changeset/base/348521
>> > > >
>> > > > Log:
>> > > >  Fix several places where tool name has been hardcoded:
>> > > >
>> > > >  install -> ${INSTALL}
>> > > >  mtree -> ${MTREE_CMD}
>> > > >  services_mkdb -> ${SERVICES_MKDB_CMD}
>> > > >  cap_mkdb -> ${CAP_MKDB_CMD}
>> > > >  pwd_mkdb -> ${PWD_MKDB_CMD}
>> > > >  kldxref -> ${KLDXREF_CMD}
>> > > >
>> > > >  If you do custom FreeBSD builds you may want to override those
>> > > >  in some cases.
>> > > >
>> > > >  Sponsored by:Sippy Software, Inc.
>> > >
>> > > This breaks installworld in a local Jenkins instance. I???m building
>> with -DD
>> > > B_FROM_SRC and -DNO_ROOT. It looks like INSTALL is unset.
>> > >
>> > > Andrew
>> > >
>> > > --
>> > > >>> Making hierarchy
>> > > --
>> > > cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head; make -f
>> Makefile.inc1
>> > >  LOCAL_MTREE= hierarchy
>> > > cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc;
>> PATH=/jenkins/work
>> ...
>> >
>> > It also breaks poudirere builds at make distrib-dirs, amd64 and i386,
>> i386
>> > distrib-dirs on amd64 sample below. The src/etc/Makefile distrib-dirs
>> target
>> > is the failing one.
>>
>> Something is pretty broke here then, as INSTALL has been defined for
>> ever in sys.mk:
>> sys.mk:INSTALL  ?=  install
>>
>
> The problem is that MTREE isn't defined, which makes MTREE_CMD start with
> -N.
>
> Warner
>
___
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: r348521 - in head: . etc sys/conf sys/modules usr.bin/login usr.sbin/services_mkdb

2019-06-03 Thread Warner Losh
On Mon, Jun 3, 2019 at 7:54 AM Rodney W. Grimes 
wrote:

> > In message <7bd6b7ad-5950-4015-b95d-9ffb609f5...@fubar.geek.nz>, Andrew
> Turner
> > writes:
> > >
> > >
> > > > On 3 Jun 2019, at 00:38, Maxim Sobolev  wrote:
> > > >
> > > > Author: sobomax
> > > > Date: Sun Jun  2 23:38:19 2019
> > > > New Revision: 348521
> > > > URL: https://svnweb.freebsd.org/changeset/base/348521
> > > >
> > > > Log:
> > > >  Fix several places where tool name has been hardcoded:
> > > >
> > > >  install -> ${INSTALL}
> > > >  mtree -> ${MTREE_CMD}
> > > >  services_mkdb -> ${SERVICES_MKDB_CMD}
> > > >  cap_mkdb -> ${CAP_MKDB_CMD}
> > > >  pwd_mkdb -> ${PWD_MKDB_CMD}
> > > >  kldxref -> ${KLDXREF_CMD}
> > > >
> > > >  If you do custom FreeBSD builds you may want to override those
> > > >  in some cases.
> > > >
> > > >  Sponsored by:Sippy Software, Inc.
> > >
> > > This breaks installworld in a local Jenkins instance. I???m building
> with -DD
> > > B_FROM_SRC and -DNO_ROOT. It looks like INSTALL is unset.
> > >
> > > Andrew
> > >
> > > --
> > > >>> Making hierarchy
> > > --
> > > cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head; make -f
> Makefile.inc1
> > >  LOCAL_MTREE= hierarchy
> > > cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc;
> PATH=/jenkins/work
> ...
> >
> > It also breaks poudirere builds at make distrib-dirs, amd64 and i386,
> i386
> > distrib-dirs on amd64 sample below. The src/etc/Makefile distrib-dirs
> target
> > is the failing one.
>
> Something is pretty broke here then, as INSTALL has been defined for
> ever in sys.mk:
> sys.mk:INSTALL  ?=  install
>

The problem is that MTREE isn't defined, which makes MTREE_CMD start with
-N.

Warner
___
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: r348521 - in head: . etc sys/conf sys/modules usr.bin/login usr.sbin/services_mkdb

2019-06-03 Thread Rodney W. Grimes
> In message <7bd6b7ad-5950-4015-b95d-9ffb609f5...@fubar.geek.nz>, Andrew 
> Turner 
> writes:
> > 
> >
> > > On 3 Jun 2019, at 00:38, Maxim Sobolev  wrote:
> > > 
> > > Author: sobomax
> > > Date: Sun Jun  2 23:38:19 2019
> > > New Revision: 348521
> > > URL: https://svnweb.freebsd.org/changeset/base/348521
> > > 
> > > Log:
> > >  Fix several places where tool name has been hardcoded:
> > > 
> > >  install -> ${INSTALL}
> > >  mtree -> ${MTREE_CMD}
> > >  services_mkdb -> ${SERVICES_MKDB_CMD}
> > >  cap_mkdb -> ${CAP_MKDB_CMD}
> > >  pwd_mkdb -> ${PWD_MKDB_CMD}
> > >  kldxref -> ${KLDXREF_CMD}
> > > 
> > >  If you do custom FreeBSD builds you may want to override those
> > >  in some cases.
> > > 
> > >  Sponsored by:Sippy Software, Inc.
> >
> > This breaks installworld in a local Jenkins instance. I???m building with 
> > -DD
> > B_FROM_SRC and -DNO_ROOT. It looks like INSTALL is unset.
> >
> > Andrew
> >
> > --
> > >>> Making hierarchy
> > --
> > cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head; make -f 
> > Makefile.inc1 
> >  LOCAL_MTREE= hierarchy
> > cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc; 
> > PATH=/jenkins/work
...
> 
> It also breaks poudirere builds at make distrib-dirs, amd64 and i386, i386
> distrib-dirs on amd64 sample below. The src/etc/Makefile distrib-dirs target
> is the failing one.

Something is pretty broke here then, as INSTALL has been defined for
ever in sys.mk:
sys.mk:INSTALL  ?=  install

-- 
Rod Grimes rgri...@freebsd.org
___
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: r348355 - head/sys/dev/iicbus

2019-06-03 Thread Andriy Gapon
On 03/06/2019 14:16, Niclas Zeising wrote:
> Hi!
> It seems like things broke after all, latest pkg build (on head-amd64) reports
> this:
> 
> 
> /wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-12bd551/src/dev/drm2/i915/intel_iic.c:570:2:
> error: implicit declaration of function 'iicbus_set_nostop' is invalid in C99
> [-Werror,-Wimplicit-function-declaration]
>     iicbus_set_nostop(idev, true);
>     ^
> /wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-12bd551/src/dev/drm2/i915/intel_iic.c:570:2:
> error: this function declaration is not a prototype 
> [-Werror,-Wstrict-prototypes]
> 2 errors generated.
> 
> Full log:
> 
> http://beefy12.nyi.freebsd.org/data/head-amd64-default/p503023_s348376/logs/drm-legacy-kmod-g20190523.log

Hi!  Thank you for the report.
I am going to restore iicbus_set_nostop, but this time as a function that
modifies iicbus softc (instead of an ivar accessor for the bus).
I am including a patch that I would like to commit.

However, for the drm code to request the nostop mode correctly it needs to be
fixed as well.
My proposed patch is here: https://github.com/FreeBSDDesktop/drm-legacy/pull/9

Index: sys/dev/iicbus/iicbus.h
===
--- sys/dev/iicbus/iicbus.h (revision 348529)
+++ sys/dev/iicbus/iicbus.h (working copy)
@@ -46,6 +46,8 @@ struct iicbus_softc
 * 0 if no start condition succeeded */
u_char strict;  /* deny operations that violate the
 * I2C protocol */
+   bool nostop;/* iicbus_transfer defaults to repeated
+* start between messages */
struct mtx lock;
u_int bus_freq; /* Configured bus Hz. */
 };
@@ -77,6 +79,7 @@ IICBUS_ACCESSOR(addr, ADDR,   uint32_t)

 int  iicbus_generic_intr(device_t dev, int event, char *buf);
 void iicbus_init_frequency(device_t dev, u_int bus_freq);
+void iicbus_set_nostop(device_t dev, bool val);

 extern driver_t iicbus_driver;
 extern devclass_t iicbus_devclass;
Index: sys/dev/iicbus/iiconf.c
===
--- sys/dev/iicbus/iiconf.c (revision 348529)
+++ sys/dev/iicbus/iiconf.c (working copy)
@@ -383,6 +383,14 @@ iicbus_block_read(device_t bus, u_char slave, char
return (error);
 }

+void
+iicbus_set_nostop(device_t bus, bool val)
+{
+   struct iicbus_softc *sc = device_get_softc(bus);
+
+   sc->nostop = val;
+}
+
 /*
  * iicbus_transfer()
  *
@@ -427,7 +435,8 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *
 {
int i, error, lenread, lenwrote, nkid, rpstart, addr;
device_t *children, bus;
-   bool started;
+   struct iicbus_softc *sc;
+   bool nostop, started;

if ((error = device_get_children(dev, , )) != 0)
return (IIC_ERESOURCE);
@@ -438,6 +447,8 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *
bus = children[0];
rpstart = 0;
free(children, M_TEMP);
+   sc = device_get_softc(bus);
+   nostop = sc->nostop;
started = false;
for (i = 0, error = 0; i < nmsgs && error == 0; i++) {
addr = msgs[i].slave;
@@ -465,11 +476,12 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *
if (error != 0)
break;

-   if (!(msgs[i].flags & IIC_M_NOSTOP)) {
+   if ((msgs[i].flags & IIC_M_NOSTOP) != 0 ||
+   (nostop && i + 1 < nmsgs)) {
+   rpstart = 1;/* Next message gets repeated start */
+   } else {
rpstart = 0;
iicbus_stop(bus);
-   } else {
-   rpstart = 1;/* Next message gets repeated start */
}
}
if (error != 0 && started)


-- 
Andriy Gapon
___
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: r348521 - in head: . etc sys/conf sys/modules usr.bin/login usr.sbin/services_mkdb

2019-06-03 Thread Cy Schubert
In message <7bd6b7ad-5950-4015-b95d-9ffb609f5...@fubar.geek.nz>, Andrew Turner 
writes:
> 
>
> > On 3 Jun 2019, at 00:38, Maxim Sobolev  wrote:
> > 
> > Author: sobomax
> > Date: Sun Jun  2 23:38:19 2019
> > New Revision: 348521
> > URL: https://svnweb.freebsd.org/changeset/base/348521
> > 
> > Log:
> >  Fix several places where tool name has been hardcoded:
> > 
> >  install -> ${INSTALL}
> >  mtree -> ${MTREE_CMD}
> >  services_mkdb -> ${SERVICES_MKDB_CMD}
> >  cap_mkdb -> ${CAP_MKDB_CMD}
> >  pwd_mkdb -> ${PWD_MKDB_CMD}
> >  kldxref -> ${KLDXREF_CMD}
> > 
> >  If you do custom FreeBSD builds you may want to override those
> >  in some cases.
> > 
> >  Sponsored by:  Sippy Software, Inc.
>
> This breaks installworld in a local Jenkins instance. I’m building with -DD
> B_FROM_SRC and -DNO_ROOT. It looks like INSTALL is unset.
>
> Andrew
>
> --
> >>> Making hierarchy
> --
> cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head; make -f Makefile.inc1 
>  LOCAL_MTREE= hierarchy
> cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc; PATH=/jenkins/work
> space/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-hea
> d/arm64.aarch64/tmp/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkin
> s/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/bin:/jenkin
> s/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freeb
> sd-head/arm64.aarch64/tmp/legacy/usr/sbin:/jenkins/workspace/FreeBSD-arm64-he
> ad/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/le
> gacy/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/Free
> BSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/bin::/jenkins/workspace/
> FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm6
> 4.aarch64/tmp/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/work
> space/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/bin:/jenkins/work
> space/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-hea
> d/arm64.aarch64/tmp/legacy/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj
> /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/u
> sr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-ar
> m64-head/freebsd-head/arm64.aarch64/tmp/legacy/bin::/tmp/install.ZQ3PdXVZ mak
> e LOCAL_MTREE= PATH=/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspa
> ce/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/sbin:/jenkins/worksp
> ace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/
> arm64.aarch64/tmp/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/w
> orkspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/sbin:/j
> enkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/
> freebsd-head/arm64.aarch64/tmp/legacy/usr/bin:/jenkins/workspace/FreeBSD-arm6
> 4-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tm
> p/legacy/bin::/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/Fre
> eBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/sbin:/jenkins/workspace/Fr
> eeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.
> aarch64/tmp/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspa
> ce/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/sbin:/jenkins
> /workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebs
> d-head/arm64.aarch64/tmp/legacy/usr/bin:/jenkins/workspace/FreeBSD-arm64-head
> /obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/lega
> cy/bin::/tmp/install.ZQ3PdXVZ METALOG=/jenkins/workspace/FreeBSD-arm64-head/o
> bj/root//METALOG -DNO_ROOT distrib-dirs
> for file in /usr/share/doc/usd/10.exref /usr/share/doc/usd/11.edit /usr/share
> /doc/usd/12.vi /usr/share/doc/usd/13.viref; do  if [ -f /jenkins/workspace/Fr
> eeBSD-arm64-head/obj/root/${file} ]; then  rm -f /jenkins/workspace/FreeBSD-a
> rm64-head/obj/root/${file};  fi;  done
> -N /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc -W -deU -i -f /jenk
> ins/workspace/FreeBSD-arm64-head/freebsd-head/etc/mtree/BSD.root.dist -p /jen
> kins/workspace/FreeBSD-arm64-head/obj/root/
> /tmp/install.ZQ3PdXVZ/sh: -N: not found
> *** Error code 127
>
> Stop.
> make[4]: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc
> *** Error code 1
>
> Stop.
> make[3]: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head
> *** Error code 1
>
> Stop.
> make[2]: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head
> *** Error code 1
>
> Stop.
> make[1]: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head
> *** Error code 1
>
> Stop.
> make: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head
>

It also breaks poudirere builds at make 

Re: svn commit: r348355 - head/sys/dev/iicbus

2019-06-03 Thread Niclas Zeising

On 2019-05-29 22:52, Ian Lepore wrote:

On Wed, 2019-05-29 at 15:12 +0300, Andriy Gapon wrote:

On 29/05/2019 14:54, Niclas Zeising wrote:

On 2019-05-29 11:08, Andriy Gapon wrote:

Author: avg
Date: Wed May 29 09:08:20 2019
New Revision: 348355
URL: https://svnweb.freebsd.org/changeset/base/348355

Log:
revert r273728 and parts of r306589, iicbus no-stop by default feature
   Since drm2 removal, there has not been any consumer of the feature in the
tree.  I am also unaware of any out-of-tree consumer.
More importantly, the feature has been broken from the very start, both
before and after r306589, because the ivar was set on a device that does
not support it and it was read from another device that also does not
support it.
   A bus-wide no-stop flag cannot be implemented as an ivar as iicbus
attaches as a child of various drivers.  Implementing the ivar in each
and every I2C driver is just impractical.
   If we ever want to implement this feature properly, then probably the
easiest way to do it would be via a flag in the softc of iicbus.
In fact, we might have to do that in the stable branches if we want to
fix the code for them.
   Reported by:ian (long time ago)
MFC after:1 month (maybe)
X-MFC-note:cannot just merge the change, must keep drm2 happy



Hi!
Just a note, be aware that drm2 lives on in ports as drm-legacy-kmod.  I haven't
tested, but, from the description above I worry that it will affect the port.
What do you think?


Oh, I forgot about that one...
I think that it could be affected if it still uses FreeBSD iic code.
I guess I might have to revert the change.




I don't think so, because I don't think this change ever worked.  I'm
not sure how anybody convinced themselves that it did.  It attempts to
retrieve ivars from a device that doesn't have them, so the net effect
is that the nostop variable is initialized from stack garbage.  Maybe
whoever wrote and tested it was lucky enough to have that accidentally
be consistently zero or non-zero, so their testing appeared to work.

Looking at the drm2 code that is the only user of this, it appears that
the nostop value is only used in the case where the driver falls back
to using the builtin intel_iicbb_driver.  That driver relies on
iicbus_transfer_gen() which is where the nostop kludge was added.
That's the fundamental problem in all of this:  the right thing to do,
IMO, would have been to implement the iicbus_transfer method directly
in the intel_iicbb_driver (probably by just cut-and-pasting the code
from iicconf.c then doing whatever is necessary to ignore stops).  And
we can still do that, pretty trivially, if necessary.

-- Ian




Hi!
It seems like things broke after all, latest pkg build (on head-amd64) 
reports this:



/wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-12bd551/src/dev/drm2/i915/intel_iic.c:570:2: 
error: implicit declaration of function 'iicbus_set_nostop' is invalid 
in C99 [-Werror,-Wimplicit-function-declaration]

iicbus_set_nostop(idev, true);
^
/wrkdirs/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-12bd551/src/dev/drm2/i915/intel_iic.c:570:2: 
error: this function declaration is not a prototype 
[-Werror,-Wstrict-prototypes]

2 errors generated.

Full log:

http://beefy12.nyi.freebsd.org/data/head-amd64-default/p503023_s348376/logs/drm-legacy-kmod-g20190523.log

Regards
--
Niclas Zeising
___
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: r348521 - in head: . etc sys/conf sys/modules usr.bin/login usr.sbin/services_mkdb

2019-06-03 Thread Andrew Turner


> On 3 Jun 2019, at 00:38, Maxim Sobolev  wrote:
> 
> Author: sobomax
> Date: Sun Jun  2 23:38:19 2019
> New Revision: 348521
> URL: https://svnweb.freebsd.org/changeset/base/348521
> 
> Log:
>  Fix several places where tool name has been hardcoded:
> 
>  install -> ${INSTALL}
>  mtree -> ${MTREE_CMD}
>  services_mkdb -> ${SERVICES_MKDB_CMD}
>  cap_mkdb -> ${CAP_MKDB_CMD}
>  pwd_mkdb -> ${PWD_MKDB_CMD}
>  kldxref -> ${KLDXREF_CMD}
> 
>  If you do custom FreeBSD builds you may want to override those
>  in some cases.
> 
>  Sponsored by:Sippy Software, Inc.

This breaks installworld in a local Jenkins instance. I’m building with 
-DDB_FROM_SRC and -DNO_ROOT. It looks like INSTALL is unset.

Andrew

--
>>> Making hierarchy
--
cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head; make -f Makefile.inc1  
LOCAL_MTREE= hierarchy
cd /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc; 
PATH=/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/bin::/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/bin::/tmp/install.ZQ3PdXVZ
 make LOCAL_MTREE= 
PATH=/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/bin::/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/sbin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/usr/bin:/jenkins/workspace/FreeBSD-arm64-head/obj/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/arm64.aarch64/tmp/legacy/bin::/tmp/install.ZQ3PdXVZ
 METALOG=/jenkins/workspace/FreeBSD-arm64-head/obj/root//METALOG -DNO_ROOT 
distrib-dirs
for file in /usr/share/doc/usd/10.exref /usr/share/doc/usd/11.edit 
/usr/share/doc/usd/12.vi /usr/share/doc/usd/13.viref; do  if [ -f 
/jenkins/workspace/FreeBSD-arm64-head/obj/root/${file} ]; then  rm -f 
/jenkins/workspace/FreeBSD-arm64-head/obj/root/${file};  fi;  done
-N /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc -W -deU -i -f 
/jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc/mtree/BSD.root.dist -p 
/jenkins/workspace/FreeBSD-arm64-head/obj/root/
/tmp/install.ZQ3PdXVZ/sh: -N: not found
*** Error code 127

Stop.
make[4]: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head/etc
*** Error code 1

Stop.
make[3]: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head
*** Error code 1

Stop.
make[2]: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head
*** Error code 1

Stop.
make[1]: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head
*** Error code 1

Stop.
make: stopped in /jenkins/workspace/FreeBSD-arm64-head/freebsd-head
___
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: r348529 - head/sys/dev/atkbdc

2019-06-03 Thread Vladimir Kondratyev
Author: wulf
Date: Mon Jun  3 10:04:34 2019
New Revision: 348529
URL: https://svnweb.freebsd.org/changeset/base/348529

Log:
  psm(4): Add natural scrolling support to sysmouse protocol
  
  This change enables natural scrolling with two finger scroll enabled
  and when user is using a trackpad (mouse and trackpoint are not affected).
  Depending on trackpad model it can be activated with setting of
  hw.psm.synaptics.natural_scroll or hw.psm.elantech.natural_scroll sysctl
  values to 1.
  
  Evdev protocol is not affected by this change too. Tune userland client
  e.g. libinput to enable natural scrolling in that case.
  
  Submitted by: nyan_myuji.xyz
  Reviewed by:  wulf
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D20447

Modified:
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/psm.c
==
--- head/sys/dev/atkbdc/psm.c   Mon Jun  3 07:57:54 2019(r348528)
+++ head/sys/dev/atkbdc/psm.c   Mon Jun  3 10:04:34 2019(r348529)
@@ -236,6 +236,7 @@ typedef struct synapticsinfo {
int  softbutton3_x;
int  max_x;
int  max_y;
+   int  natural_scroll;
 } synapticsinfo_t;
 
 typedef struct synapticspacket {
@@ -571,6 +572,8 @@ enum {
SYNAPTICS_SYSCTL_SOFTBUTTONS_Y =SYN_OFFSET(softbuttons_y),
SYNAPTICS_SYSCTL_SOFTBUTTON2_X =SYN_OFFSET(softbutton2_x),
SYNAPTICS_SYSCTL_SOFTBUTTON3_X =SYN_OFFSET(softbutton3_x),
+   SYNAPTICS_SYSCTL_NATURAL_SCROLL =   SYN_OFFSET(natural_scroll),
+#defineSYNAPTICS_SYSCTL_LAST   SYNAPTICS_SYSCTL_NATURAL_SCROLL
 };
 
 /* packet formatting function */
@@ -4134,6 +4137,7 @@ psmsmoother(struct psm_softc *sc, finger_t *f, int smo
int len, weight_prev_x, weight_prev_y;
int div_max_x, div_max_y, div_x, div_y;
int is_fuzzy;
+   int natural_scroll;
 
/* Read sysctl. */
/* XXX Verify values? */
@@ -4161,6 +4165,7 @@ psmsmoother(struct psm_softc *sc, finger_t *f, int smo
two_finger_scroll = sc->syninfo.two_finger_scroll;
max_x = sc->syninfo.max_x;
max_y = sc->syninfo.max_y;
+   natural_scroll = sc->syninfo.natural_scroll;
 
is_fuzzy = (f->flags & PSM_FINGER_FUZZY) != 0;
 
@@ -4322,14 +4327,24 @@ psmsmoother(struct psm_softc *sc, finger_t *f, int smo
smoother_id, dx, dy, dxp, dyp));
break;
case 1: /* Vertical scrolling. */
-   if (dyp != 0)
-   ms->button |= (dyp > 0) ?
-   MOUSE_BUTTON4DOWN : MOUSE_BUTTON5DOWN;
+   if (dyp != 0) {
+   if (two_finger_scroll && natural_scroll)
+   ms->button |= (dyp > 0) ?
+   MOUSE_BUTTON5DOWN : 
MOUSE_BUTTON4DOWN;
+   else
+   ms->button |= (dyp > 0) ?
+   MOUSE_BUTTON4DOWN : 
MOUSE_BUTTON5DOWN;
+   }
break;
case 2: /* Horizontal scrolling. */
-   if (dxp != 0)
-   ms->button |= (dxp > 0) ?
-   MOUSE_BUTTON7DOWN : MOUSE_BUTTON6DOWN;
+   if (dxp != 0) {
+   if (two_finger_scroll && natural_scroll)
+   ms->button |= (dxp > 0) ?
+   MOUSE_BUTTON6DOWN : 
MOUSE_BUTTON7DOWN;
+   else
+   ms->button |= (dxp > 0) ?
+   MOUSE_BUTTON7DOWN : 
MOUSE_BUTTON6DOWN;
+   }
break;
}
 
@@ -5641,7 +5656,7 @@ synaptics_sysctl(SYSCTL_HANDLER_ARGS)
int error, arg;
 
if (oidp->oid_arg1 == NULL || oidp->oid_arg2 < 0 ||
-   oidp->oid_arg2 > SYNAPTICS_SYSCTL_SOFTBUTTON3_X)
+   oidp->oid_arg2 > SYNAPTICS_SYSCTL_LAST)
return (EINVAL);
 
sc = oidp->oid_arg1;
@@ -5730,6 +5745,7 @@ synaptics_sysctl(SYSCTL_HANDLER_ARGS)
return (EINVAL);
break;
 case SYNAPTICS_SYSCTL_TOUCHPAD_OFF:
+   case SYNAPTICS_SYSCTL_NATURAL_SCROLL:
if (arg < 0 || arg > 1)
return (EINVAL);
break;
@@ -6121,6 +6137,15 @@ synaptics_sysctl_create_tree(struct psm_softc *sc, con
sc, SYNAPTICS_SYSCTL_TOUCHPAD_OFF,
synaptics_sysctl, "I",
"Turn off touchpad");
+
+   /* 

svn commit: r348528 - svnadmin/conf

2019-06-03 Thread Konstantin Belousov
Author: kib
Date: Mon Jun  3 07:57:54 2019
New Revision: 348528
URL: https://svnweb.freebsd.org/changeset/base/348528

Log:
  Release slavash.
  
  Discussed with:   hselasky, slavash
  Approved by:  core (implicit)

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Mon Jun  3 05:25:22 2019(r348527)
+++ svnadmin/conf/mentors   Mon Jun  3 07:57:54 2019(r348528)
@@ -27,7 +27,6 @@ miwi  araujo
 mjoras rstone
 ramken Co-mentor: mav
 scottphjhb Co-mentor: emaste
-slavashkib Co-mentor: hselasky
 slmken Co-mentor: scottl, ambrisko
 thjjtl Co-mentor: bz
 tmunro mjg Co-mentor: allanjude
___
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"