svn commit: r367393 - head/usr.sbin/bhyve

2020-11-05 Thread Allan Jude
Author: allanjude
Date: Thu Nov  5 17:10:14 2020
New Revision: 367393
URL: https://svnweb.freebsd.org/changeset/base/367393

Log:
  VirtIO: Make sure the guest knows the TRIM alignment requirements
  
  If bhyve is used to emulate 512e access in guest OS, then discard addresses 
should be properly aligned.
  Otherwise ioctl DIOCGDELETE fails for 512b requires on devices with 4K sector 
size.
  see g_dev_ioctl() in sys/geom/geom_dev.c
  
  Submitted by: Vitaliy Gusev 
  MFC after:1 week
  Sponsored by: vStack.com
  Differential Revision:https://reviews.freebsd.org/D27075

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

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==
--- head/usr.sbin/bhyve/pci_virtio_block.c  Thu Nov  5 16:47:23 2020
(r367392)
+++ head/usr.sbin/bhyve/pci_virtio_block.c  Thu Nov  5 17:10:14 2020
(r367393)
@@ -523,7 +523,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *
sc->vbsc_cfg.vbc_writeback = 0;
sc->vbsc_cfg.max_discard_sectors = VTBLK_MAX_DISCARD_SECT;
sc->vbsc_cfg.max_discard_seg = VTBLK_MAX_DISCARD_SEG;
-   sc->vbsc_cfg.discard_sector_alignment = sectsz / VTBLK_BSIZE;
+   sc->vbsc_cfg.discard_sector_alignment = MAX(sectsz, sts) / VTBLK_BSIZE;
 
/*
 * Should we move some of this into virtio.c?  Could
___
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: r366729 - releng/12.2/stand/libsa/zfs

2020-10-15 Thread Allan Jude
Author: allanjude
Date: Thu Oct 15 15:07:25 2020
New Revision: 366729
URL: https://svnweb.freebsd.org/changeset/base/366729

Log:
  ZFS: whitelist zstd and encryption in the loader
  
  MFC r364787:
  MFS r366593:
  
  Please note that neither zstd nor encryption is
  supported by the loader at this instant. This
  change makes it safe to use those features in
  one's root pool, but not in one's root dataset.
  
  Approved by:  re (gjb)

Modified:
  releng/12.2/stand/libsa/zfs/zfsimpl.c
Directory Properties:
  releng/12.2/   (props changed)

Modified: releng/12.2/stand/libsa/zfs/zfsimpl.c
==
--- releng/12.2/stand/libsa/zfs/zfsimpl.c   Thu Oct 15 14:56:51 2020
(r366728)
+++ releng/12.2/stand/libsa/zfs/zfsimpl.c   Thu Oct 15 15:07:25 2020
(r366729)
@@ -127,6 +127,8 @@ static const char *features_for_read[] = {
"com.delphix:device_removal",
"com.delphix:obsolete_counts",
"com.intel:allocation_classes",
+   "org.freebsd:zstd_compress",
+   "com.datto:encryption",
NULL
 };
 
___
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: r366593 - stable/12/stand/libsa/zfs

2020-10-09 Thread Allan Jude
Author: allanjude
Date: Fri Oct  9 23:02:09 2020
New Revision: 366593
URL: https://svnweb.freebsd.org/changeset/base/366593

Log:
  MFC r364787:
  
  ZFS: whitelist zstd and encryption in the loader
  
  Please note that neither zstd nor encryption is
  supported by the loader at this instant. This
  change makes it safe to use those features in
  one's root pool, but not in one's root dataset.

Modified:
  stable/12/stand/libsa/zfs/zfsimpl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/zfs/zfsimpl.c
==
--- stable/12/stand/libsa/zfs/zfsimpl.c Fri Oct  9 22:59:27 2020
(r366592)
+++ stable/12/stand/libsa/zfs/zfsimpl.c Fri Oct  9 23:02:09 2020
(r366593)
@@ -127,6 +127,8 @@ static const char *features_for_read[] = {
"com.delphix:device_removal",
"com.delphix:obsolete_counts",
"com.intel:allocation_classes",
+   "org.freebsd:zstd_compress",
+   "com.datto:encryption",
NULL
 };
 
___
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: r366592 - in stable/12: stand/efi/loader stand/libsa/zfs usr.bin/netstat

2020-10-09 Thread Allan Jude
Author: allanjude
Date: Fri Oct  9 22:59:27 2020
New Revision: 366592
URL: https://svnweb.freebsd.org/changeset/base/366592

Log:
  Clean up the mess I made with r366590 and r366591

Modified:
  stable/12/stand/efi/loader/main.c
  stable/12/stand/libsa/zfs/zfsimpl.c
  stable/12/usr.bin/netstat/route.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/loader/main.c
==
--- stable/12/stand/efi/loader/main.c   Fri Oct  9 22:50:16 2020
(r366591)
+++ stable/12/stand/efi/loader/main.c   Fri Oct  9 22:59:27 2020
(r366592)
@@ -717,6 +717,10 @@ parse_uefi_con_out(void)
ep = buf + sz;
node = (EFI_DEVICE_PATH *)buf;
while ((char *)node < ep) {
+   if (IsDevicePathEndType(node)) {
+   if (pci_pending && vid_seen == 0)
+   vid_seen = ++seen;
+   }
pci_pending = false;
if (DevicePathType(node) == ACPI_DEVICE_PATH &&
DevicePathSubType(node) == ACPI_DP) {
@@ -749,8 +753,6 @@ parse_uefi_con_out(void)
}
node = NextDevicePathNode(node); /* Skip the end node */
}
-   if (pci_pending && vid_seen == 0)
-   vid_seen = ++seen;
 
/*
 * Truth table for RB_MULTIPLE | RB_SERIAL

Modified: stable/12/stand/libsa/zfs/zfsimpl.c
==
--- stable/12/stand/libsa/zfs/zfsimpl.c Fri Oct  9 22:50:16 2020
(r366591)
+++ stable/12/stand/libsa/zfs/zfsimpl.c Fri Oct  9 22:59:27 2020
(r366592)
@@ -127,8 +127,6 @@ static const char *features_for_read[] = {
"com.delphix:device_removal",
"com.delphix:obsolete_counts",
"com.intel:allocation_classes",
-   "org.freebsd:zstd_compress",
-   "com.datto:encryption",
NULL
 };
 

Modified: stable/12/usr.bin/netstat/route.c
==
--- stable/12/usr.bin/netstat/route.c   Fri Oct  9 22:50:16 2020
(r366591)
+++ stable/12/usr.bin/netstat/route.c   Fri Oct  9 22:59:27 2020
(r366592)
@@ -772,7 +772,12 @@ rt_stats(void)
xo_emit("{W:rtstat: symbol not in namelist}\n");
return;
}
+   if ((rttaddr = nl[N_RTTRASH].n_value) == 0) {
+   xo_emit("{W:rttrash: symbol not in namelist}\n");
+   return;
+   }
kread(rtsaddr, (char *), sizeof (rtstat));
+   kread(rttaddr, (char *), sizeof (rttrash));
xo_emit("{T:routing}:\n");
 
 #definep(f, m) if (rtstat.f || sflag <= 1) \
@@ -788,17 +793,7 @@ rt_stats(void)
"{N:/destination%s found unreachable}\n");
p(rts_wildcard, "\t{:wildcard-uses/%hu} "
"{N:/use%s of a wildcard route}\n");
-   p(rts_nh_idx_alloc_failure, "\t{:nexthop-index-alloc-failures/%hu} "
-   "{N:/nexthop index alloc failure%s}\n");
-   p(rts_nh_alloc_failure, "\t{:nexthop-alloc-failures/%hu} "
-   "{N:/nexthop allocation failure%s}\n");
 #undef p
-
-   if ((rttaddr = nl[N_RTTRASH].n_value) == 0) {
-   xo_emit("{W:rttrash: symbol not in namelist}\n");
-   return;
-   }
-   kread(rttaddr, (char *), sizeof (rttrash));
 
if (rttrash || sflag <= 1)
xo_emit("\t{:unused-but-not-freed/%u} "
___
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: r366591 - stable/12/stand/efi/loader

2020-10-09 Thread Allan Jude
Author: allanjude
Date: Fri Oct  9 22:50:16 2020
New Revision: 366591
URL: https://svnweb.freebsd.org/changeset/base/366591

Log:
  Revert r366590 that contains garbage

Modified:
  stable/12/stand/efi/loader/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/loader/main.c
==
--- stable/12/stand/efi/loader/main.c   Fri Oct  9 22:42:04 2020
(r366590)
+++ stable/12/stand/efi/loader/main.c   Fri Oct  9 22:50:16 2020
(r366591)
@@ -717,10 +717,6 @@ parse_uefi_con_out(void)
ep = buf + sz;
node = (EFI_DEVICE_PATH *)buf;
while ((char *)node < ep) {
-   if (IsDevicePathEndType(node)) {
-   if (pci_pending && vid_seen == 0)
-   vid_seen = ++seen;
-   }
pci_pending = false;
if (DevicePathType(node) == ACPI_DEVICE_PATH &&
DevicePathSubType(node) == ACPI_DP) {
@@ -753,6 +749,8 @@ parse_uefi_con_out(void)
}
node = NextDevicePathNode(node); /* Skip the end node */
}
+   if (pci_pending && vid_seen == 0)
+   vid_seen = ++seen;
 
/*
 * Truth table for RB_MULTIPLE | RB_SERIAL
___
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: r366590 - in stable/12: stand/libsa/zfs usr.bin/netstat

2020-10-09 Thread Allan Jude
Author: allanjude
Date: Fri Oct  9 22:42:04 2020
New Revision: 366590
URL: https://svnweb.freebsd.org/changeset/base/366590

Log:
  MFC r364787:
  
  ZFS: whitelist zstd and encryption in the loader
  
  Please note that neither zstd nor encryption is
  supported by the loader at this instant. This
  change makes it safe to use those features in
  one's root pool, but not in one's root dataset.

Modified:
  stable/12/stand/libsa/zfs/zfsimpl.c
  stable/12/usr.bin/netstat/route.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/zfs/zfsimpl.c
==
--- stable/12/stand/libsa/zfs/zfsimpl.c Fri Oct  9 22:23:39 2020
(r366589)
+++ stable/12/stand/libsa/zfs/zfsimpl.c Fri Oct  9 22:42:04 2020
(r366590)
@@ -127,6 +127,8 @@ static const char *features_for_read[] = {
"com.delphix:device_removal",
"com.delphix:obsolete_counts",
"com.intel:allocation_classes",
+   "org.freebsd:zstd_compress",
+   "com.datto:encryption",
NULL
 };
 

Modified: stable/12/usr.bin/netstat/route.c
==
--- stable/12/usr.bin/netstat/route.c   Fri Oct  9 22:23:39 2020
(r366589)
+++ stable/12/usr.bin/netstat/route.c   Fri Oct  9 22:42:04 2020
(r366590)
@@ -772,12 +772,7 @@ rt_stats(void)
xo_emit("{W:rtstat: symbol not in namelist}\n");
return;
}
-   if ((rttaddr = nl[N_RTTRASH].n_value) == 0) {
-   xo_emit("{W:rttrash: symbol not in namelist}\n");
-   return;
-   }
kread(rtsaddr, (char *), sizeof (rtstat));
-   kread(rttaddr, (char *), sizeof (rttrash));
xo_emit("{T:routing}:\n");
 
 #definep(f, m) if (rtstat.f || sflag <= 1) \
@@ -793,7 +788,17 @@ rt_stats(void)
"{N:/destination%s found unreachable}\n");
p(rts_wildcard, "\t{:wildcard-uses/%hu} "
"{N:/use%s of a wildcard route}\n");
+   p(rts_nh_idx_alloc_failure, "\t{:nexthop-index-alloc-failures/%hu} "
+   "{N:/nexthop index alloc failure%s}\n");
+   p(rts_nh_alloc_failure, "\t{:nexthop-alloc-failures/%hu} "
+   "{N:/nexthop allocation failure%s}\n");
 #undef p
+
+   if ((rttaddr = nl[N_RTTRASH].n_value) == 0) {
+   xo_emit("{W:rttrash: symbol not in namelist}\n");
+   return;
+   }
+   kread(rttaddr, (char *), sizeof (rttrash));
 
if (rttrash || sflag <= 1)
xo_emit("\t{:unused-but-not-freed/%u} "
___
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: r365917 - in releng/12.2: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolar...

2020-09-19 Thread Allan Jude
Author: allanjude
Date: Sat Sep 19 20:46:56 2020
New Revision: 365917
URL: https://svnweb.freebsd.org/changeset/base/365917

Log:
  MFS r365689,r365808,r365860
  
  MFOpenZFS: Introduce read/write kstats per dataset
  
  The following patch introduces a few statistics on reads and writes
  grouped by dataset. These statistics are implemented as kstats
  (backed by aggregate sums for performance) and can be retrieved by
  using the dataset objset ID number. The motivation for this change is
  to provide some preliminary analytics on dataset usage/performance.
  
  Reviewed-by: Richard Elling 
  Reviewed-by: Brian Behlendorf 
  Reviewed by: Matthew Ahrens 
  Signed-off-by: Serapheim Dimitropoulos 
  
  openzfs/zfs@a448a2557ec4938ed6944c7766fe0b8e6e5f6456
  
  Also contains parts of:
  MFOpenZFS: Connect dataset_kstats for FreeBSD
  
  Example output:
  kstat.zfs.mypool.dataset.objset-0x10b.nread: 150528
  kstat.zfs.mypool.dataset.objset-0x10b.reads: 48
  kstat.zfs.mypool.dataset.objset-0x10b.nwritten: 134217728
  kstat.zfs.mypool.dataset.objset-0x10b.writes: 1024
  kstat.zfs.mypool.dataset.objset-0x10b.dataset_name: mypool/datasetname
  
  Reviewed-by: Ryan Moeller 
  Reviewed by: Sean Eric Fagan 
  Reviewed-by: Serapheim Dimitropoulos 
  Reviewed-by: Brian Behlendorf 
  Signed-off-by: Allan Jude 
  
  openzfs/zfs@4547fc4e071ceb1818b3a46c3035b923e06e5390
  
  Approved by:  re (gjb)
  Relnotes: yes
  Sponsored by: Klara Inc.

Added:
  releng/12.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dataset_kstats.c
 - copied unchanged from r365689, 
stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dataset_kstats.c
  
releng/12.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dataset_kstats.h
 - copied unchanged from r365689, 
stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dataset_kstats.h
Modified:
  releng/12.2/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  releng/12.2/cddl/contrib/opensolaris/cmd/zpool/zpool.8
  releng/12.2/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
  releng/12.2/sys/cddl/compat/opensolaris/sys/kstat.h
  releng/12.2/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
  releng/12.2/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c
  releng/12.2/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
  releng/12.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  releng/12.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
  releng/12.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  releng/12.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  releng/12.2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
  releng/12.2/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
  releng/12.2/sys/conf/files
  releng/12.2/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg
Directory Properties:
  releng/12.2/   (props changed)

Modified: releng/12.2/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- releng/12.2/cddl/contrib/opensolaris/cmd/zfs/zfs.8  Sat Sep 19 20:18:14 
2020(r365916)
+++ releng/12.2/cddl/contrib/opensolaris/cmd/zfs/zfs.8  Sat Sep 19 20:46:56 
2020(r365917)
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 16, 2019
+.Dd September 12, 2020
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -635,6 +635,16 @@ property can be either
 .Cm yes
 or
 .Cm no .
+.It Sy objsetid
+A unique identifier for this dataset within the pool. Unlike the dataset's
+.Sy guid
+, the
+.Sy objsetid
+of a dataset is not transferred to other pools when the snapshot is copied
+with a send/receive operation.
+The
+.Sy objsetid
+can be reused (for a new datatset) after the dataset is deleted.
 .It Sy origin
 For cloned file systems or volumes, the snapshot from which the clone was
 created. See also the

Modified: releng/12.2/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- releng/12.2/cddl/contrib/opensolaris/cmd/zpool/zpool.8  Sat Sep 19 
20:18:14 2020(r365916)
+++ releng/12.2/cddl/contrib/opensolaris/cmd/zpool/zpool.8  Sat Sep 19 
20:46:56 2020(r365917)
@@ -687,6 +687,15 @@ will decrease while
 increases.
 .It Sy guid
 A unique identifier for the pool.
+.It Sy load_guid
+A unique identifier for the pool.
+Unlike the
+.Sy guid
+property, this identifier is generated every time we load the pool (e.g. does
+not persist across imports/exports) and never changes while the pool is loaded
+(even if a
+.Sy reguid
+operation takes place).
 .It Sy health
 The current health of the pool. Health can be
 .Qq Sy ONLINE ,

Modified: releng/12.2/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
==
--- releng/12.2/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.cSat Sep 
19 20:18:14 2020(r365916)
+++ releng/12.2/sys/cddl/compat/opensolaris/kern/opensolaris_kst

svn commit: r365860 - stable/12/sys/cddl/compat/opensolaris/kern

2020-09-17 Thread Allan Jude
Author: allanjude
Date: Thu Sep 17 21:51:05 2020
New Revision: 365860
URL: https://svnweb.freebsd.org/changeset/base/365860

Log:
  Update naming of per-dataset counters introduced in r365689
  
  Upstream OpenZFS is changing the structure of the sysctl mibs to avoid
  having a / in the element name. Chase this change here to avoid introducing
  a new sysctl that will change named between 12.2 and 13.0
  
  MFC-with: 365689
  Relnotes: yes (fix example)
  Sponsored by: Klara Inc.

Modified:
  stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c

Modified: stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
==
--- stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c  Thu Sep 
17 21:24:11 2020(r365859)
+++ stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c  Thu Sep 
17 21:51:05 2020(r365860)
@@ -55,6 +55,7 @@ kstat_create(char *module, int instance, char *name, c
 {
struct sysctl_oid *root;
kstat_t *ksp;
+   char *pool;
 
KASSERT(instance == 0, ("instance=%d", instance));
KASSERT(type == KSTAT_TYPE_NAMED, ("type=%hhu", type));
@@ -70,9 +71,18 @@ kstat_create(char *module, int instance, char *name, c
ksp->ks_update = kstat_default_update;
 
/*
+* Some kstats use a module name like "zfs/poolname" to distinguish a
+* set of kstats belonging to a specific pool.  Split on '/' to add an
+* extra node for the pool name if needed.
+*/
+   pool = strchr(module, '/');
+   if (pool != NULL)
+   *pool++ = '\0';
+
+   /*
 * Create sysctl tree for those statistics:
 *
-*  kstat
+*  kstat.[.]..
 */
sysctl_ctx_init(>ks_sysctl_ctx);
root = SYSCTL_ADD_NODE(>ks_sysctl_ctx,
@@ -84,11 +94,26 @@ kstat_create(char *module, int instance, char *name, c
free(ksp, M_KSTAT);
return (NULL);
}
+   if (pool != NULL) {
+   root = SYSCTL_ADD_NODE(>ks_sysctl_ctx,
+   SYSCTL_CHILDREN(root), OID_AUTO, pool, CTLFLAG_RW, 0, "");
+   if (root == NULL) {
+   printf("%s: Cannot create kstat.%s.%s tree!\n",
+   __func__, module, pool);
+   sysctl_ctx_free(>ks_sysctl_ctx);
+   free(ksp, M_KSTAT);
+   return (NULL);
+   }
+   }
root = SYSCTL_ADD_NODE(>ks_sysctl_ctx, SYSCTL_CHILDREN(root),
OID_AUTO, class, CTLFLAG_RW, 0, "");
if (root == NULL) {
-   printf("%s: Cannot create kstat.%s.%s tree!\n", __func__,
-   module, class);
+   if (pool != NULL)
+   printf("%s: Cannot create kstat.%s.%s.%s tree!\n",
+   __func__, module, pool, class);
+   else
+   printf("%s: Cannot create kstat.%s.%s tree!\n",
+   __func__, module, class);
sysctl_ctx_free(>ks_sysctl_ctx);
free(ksp, M_KSTAT);
return (NULL);
@@ -96,8 +121,13 @@ kstat_create(char *module, int instance, char *name, c
root = SYSCTL_ADD_NODE(>ks_sysctl_ctx, SYSCTL_CHILDREN(root),
OID_AUTO, name, CTLFLAG_RW, 0, "");
if (root == NULL) {
-   printf("%s: Cannot create kstat.%s.%s.%s tree!\n", __func__,
-   module, class, name);
+   if (pool != NULL)
+   printf("%s: Cannot create kstat.%s.%s.%s.%s "
+   "tree!\n", __func__, module, pool, class,
+   name);
+   else
+   printf("%s: Cannot create kstat.%s.%s.%s "
+   "tree!\n", __func__, module, class, name);
sysctl_ctx_free(>ks_sysctl_ctx);
free(ksp, M_KSTAT);
return (NULL);
___
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: r365808 - stable/12/sys/conf

2020-09-16 Thread Allan Jude
Author: allanjude
Date: Wed Sep 16 20:58:24 2020
New Revision: 365808
URL: https://svnweb.freebsd.org/changeset/base/365808

Log:
  Connect new ZFS source file to the kernel build
  
  This was missed in r365689
  
  This causes compile issues when building ZFS into the kernel
  
  PR:   249311
  MFC-with: r365689
  Sponsored by: Klara Inc.

Modified:
  stable/12/sys/conf/files

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesWed Sep 16 16:58:29 2020(r365807)
+++ stable/12/sys/conf/filesWed Sep 16 20:58:24 2020(r365808)
@@ -163,6 +163,7 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c  
o
 cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c  
optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dataset_kstats.c
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.c
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c   
optional zfs compile-with "${ZFS_C}"
___
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: r365702 - in releng/12.2: sys/dev/virtio/block usr.sbin/bhyve

2020-09-13 Thread Allan Jude
Author: allanjude
Date: Sun Sep 13 23:51:07 2020
New Revision: 365702
URL: https://svnweb.freebsd.org/changeset/base/365702

Log:
  MFC r360229, r363255
  MFS r365614
  
  r360229:
  Add VIRTIO_BLK_T_DISCARD (TRIM) support to the bhyve virtio-blk backend
  
  This will advertise support for TRIM to the guest virtio-blk driver and
  perform the DIOCGDELETE ioctl on the backing storage if it supports it.
  
  Thanks to Jason King and others at Joyent and illumos for expanding on
  my original patch, adding improvements including better error handling
  and making sure to following the virtio spec.
  
  r363255:
  Add VIRTIO_BLK_T_DISCARD support to the virtio-blk driver
  
  If the hypervisor advertises support for the DISCARD command then the
  guest can perform TRIM commands, freeing space on the backing store.
  
  If VIRTIO_BLK_F_DISCARD is enabled, advertise DISKFLAG_CANDELETE
  
  Tested with FreeBSD guests on bhyve and KVM
  
  Approved by:  re (gjb)
  Relnotes: yes
  Sponsored by: Klara Inc.

Modified:
  releng/12.2/sys/dev/virtio/block/virtio_blk.c
  releng/12.2/sys/dev/virtio/block/virtio_blk.h
  releng/12.2/usr.sbin/bhyve/block_if.c
  releng/12.2/usr.sbin/bhyve/pci_virtio_block.c
Directory Properties:
  releng/12.2/   (props changed)

Modified: releng/12.2/sys/dev/virtio/block/virtio_blk.c
==
--- releng/12.2/sys/dev/virtio/block/virtio_blk.c   Sun Sep 13 23:05:19 
2020(r365701)
+++ releng/12.2/sys/dev/virtio/block/virtio_blk.c   Sun Sep 13 23:51:07 
2020(r365702)
@@ -81,6 +81,7 @@ struct vtblk_softc {
 #define VTBLK_FLAG_SUSPEND 0x0008
 #define VTBLK_FLAG_BARRIER 0x0010
 #define VTBLK_FLAG_WC_CONFIG   0x0020
+#define VTBLK_FLAG_DISCARD 0x0040
 
struct virtqueue*vtblk_vq;
struct sglist   *vtblk_sglist;
@@ -112,6 +113,7 @@ static struct virtio_feature_desc vtblk_feature_desc[]
{ VIRTIO_BLK_F_WCE, "WriteCache"},
{ VIRTIO_BLK_F_TOPOLOGY,"Topology"  },
{ VIRTIO_BLK_F_CONFIG_WCE,  "ConfigWCE" },
+   { VIRTIO_BLK_F_DISCARD, "Discard"   },
 
{ 0, NULL }
 };
@@ -210,6 +212,7 @@ TUNABLE_INT("hw.vtblk.writecache_mode", _writeca
  VIRTIO_BLK_F_WCE  | \
  VIRTIO_BLK_F_TOPOLOGY | \
  VIRTIO_BLK_F_CONFIG_WCE   | \
+ VIRTIO_BLK_F_DISCARD  | \
  VIRTIO_RING_F_INDIRECT_DESC)
 
 #define VTBLK_MTX(_sc) &(_sc)->vtblk_mtx
@@ -461,7 +464,7 @@ vtblk_config_change(device_t dev)
vtblk_read_config(sc, );
 
/* Capacity is always in 512-byte units. */
-   capacity = blkcfg.capacity * 512;
+   capacity = blkcfg.capacity * VTBLK_BSIZE;
 
if (sc->vtblk_disk->d_mediasize != capacity)
vtblk_resize_disk(sc, capacity);
@@ -546,11 +549,18 @@ vtblk_strategy(struct bio *bp)
 * be a better way to report our readonly'ness to GEOM above.
 */
if (sc->vtblk_flags & VTBLK_FLAG_READONLY &&
-   (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH)) {
+   (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH ||
+   bp->bio_cmd == BIO_DELETE)) {
vtblk_bio_done(sc, bp, EROFS);
return;
}
 
+   if ((bp->bio_cmd != BIO_READ) && (bp->bio_cmd != BIO_WRITE) &&
+   (bp->bio_cmd != BIO_FLUSH) && (bp->bio_cmd != BIO_DELETE)) {
+   vtblk_bio_done(sc, bp, EOPNOTSUPP);
+   return;
+   }
+
VTBLK_LOCK(sc);
 
if (sc->vtblk_flags & VTBLK_FLAG_DETACH) {
@@ -559,6 +569,13 @@ vtblk_strategy(struct bio *bp)
return;
}
 
+   if ((bp->bio_cmd == BIO_DELETE) &&
+   !(sc->vtblk_flags & VTBLK_FLAG_DISCARD)) {
+   VTBLK_UNLOCK(sc);
+   vtblk_bio_done(sc, bp, EOPNOTSUPP);
+   return;
+   }
+
bioq_insert_tail(>vtblk_bioq, bp);
vtblk_startio(sc);
 
@@ -594,6 +611,8 @@ vtblk_setup_features(struct vtblk_softc *sc)
sc->vtblk_flags |= VTBLK_FLAG_BARRIER;
if (virtio_with_feature(dev, VIRTIO_BLK_F_CONFIG_WCE))
sc->vtblk_flags |= VTBLK_FLAG_WC_CONFIG;
+   if (virtio_with_feature(dev, VIRTIO_BLK_F_DISCARD))
+   sc->vtblk_flags |= VTBLK_FLAG_DISCARD;
 }
 
 static int
@@ -683,12 +702,12 @@ vtblk_alloc_disk(struct vtblk_softc *sc, struct virtio
dp->d_dump = vtblk_dump;
 
/* Capacity is always in 512-byte units. */
-   dp->d_mediasize = blkcfg->capacity * 512;
+   dp->d_mediasize = blkcfg->capacity * VTBLK_BSIZE;
 
if (virtio_with_feature(dev, VIRTIO_BLK_F_BLK_SIZE))
dp->d_sectorsize = blkcfg->blk_size;
else
-   dp->d_sectorsize = 512;
+   dp->d_sectorsize = VTBLK_BSIZE;
 
/*
 * The VirtIO maximum I/O size is given in terms of segments.
@@ -722,6 

svn commit: r365689 - in stable/12: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris...

2020-09-13 Thread Allan Jude
Author: allanjude
Date: Sun Sep 13 16:28:25 2020
New Revision: 365689
URL: https://svnweb.freebsd.org/changeset/base/365689

Log:
  MFOpenZFS: Introduce read/write kstats per dataset
  
  The following patch introduces a few statistics on reads and writes
  grouped by dataset. These statistics are implemented as kstats
  (backed by aggregate sums for performance) and can be retrieved by
  using the dataset objset ID number. The motivation for this change is
  to provide some preliminary analytics on dataset usage/performance.
  
  Reviewed-by: Richard Elling 
  Reviewed-by: Brian Behlendorf 
  Reviewed by: Matthew Ahrens 
  Signed-off-by: Serapheim Dimitropoulos 
  
  openzfs/zfs@a448a2557ec4938ed6944c7766fe0b8e6e5f6456
  
  Also contains parts of:
  MFOpenZFS: Connect dataset_kstats for FreeBSD
  
  Example output:
  kstat.zfs/mypool.dataset.objset-0x10b.nread: 150528
  kstat.zfs/mypool.dataset.objset-0x10b.reads: 48
  kstat.zfs/mypool.dataset.objset-0x10b.nwritten: 134217728
  kstat.zfs/mypool.dataset.objset-0x10b.writes: 1024
  kstat.zfs/mypool.dataset.objset-0x10b.dataset_name: mypool/datasetname
  
  Reviewed-by: Ryan Moeller 
  Reviewed by: Sean Eric Fagan 
  Reviewed-by: Serapheim Dimitropoulos 
  Reviewed-by: Brian Behlendorf 
  Signed-off-by: Allan Jude 
  
  openzfs/zfs@4547fc4e071ceb1818b3a46c3035b923e06e5390
  
  This is a direct commit to stable/12 because they do not exist in
  illumos upstream ZFS and needed to be heavily modified to work in
  stable/12
  
  Relnotes: yes
  Sponsored by: Klara Inc.

Added:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dataset_kstats.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dataset_kstats.h
Modified:
  stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8
  stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
  stable/12/sys/cddl/compat/opensolaris/sys/kstat.h
  stable/12/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
  stable/12/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
  stable/12/tests/sys/cddl/zfs/tests/cli_root/zpool_get/zpool_get.cfg

Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8Sun Sep 13 09:14:32 
2020(r365688)
+++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8Sun Sep 13 16:28:25 
2020(r365689)
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 16, 2019
+.Dd September 12, 2020
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -635,6 +635,16 @@ property can be either
 .Cm yes
 or
 .Cm no .
+.It Sy objsetid
+A unique identifier for this dataset within the pool. Unlike the dataset's
+.Sy guid
+, the
+.Sy objsetid
+of a dataset is not transferred to other pools when the snapshot is copied
+with a send/receive operation.
+The
+.Sy objsetid
+can be reused (for a new datatset) after the dataset is deleted.
 .It Sy origin
 For cloned file systems or volumes, the snapshot from which the clone was
 created. See also the

Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8Sun Sep 13 
09:14:32 2020(r365688)
+++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8Sun Sep 13 
16:28:25 2020(r365689)
@@ -687,6 +687,15 @@ will decrease while
 increases.
 .It Sy guid
 A unique identifier for the pool.
+.It Sy load_guid
+A unique identifier for the pool.
+Unlike the
+.Sy guid
+property, this identifier is generated every time we load the pool (e.g. does
+not persist across imports/exports) and never changes while the pool is loaded
+(even if a
+.Sy reguid
+operation takes place).
 .It Sy health
 The current health of the pool. Health can be
 .Qq Sy ONLINE ,

Modified: stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
==
--- stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c  Sun Sep 
13 09:14:32 2020(r365688)
+++ stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c  Sun Sep 
13 16:28:25 2020(r365689)
@@ -38,6 +38,17 @@ static MALLOC_DEFINE(M_KSTAT, "kstat_data", "Kernel st
 
 SYSCTL_ROOT_NODE(OID_AUTO, kstat, CTLFLAG_RW, 0, "Kernel statistics");
 
+static int
+kstat_default_update(

svn commit: r365614 - in stable/12: sys/dev/virtio/block usr.sbin/bhyve

2020-09-10 Thread Allan Jude
Author: allanjude
Date: Thu Sep 10 21:01:22 2020
New Revision: 365614
URL: https://svnweb.freebsd.org/changeset/base/365614

Log:
  MFC r360229, r363255
  
  r360229:
  Add VIRTIO_BLK_T_DISCARD (TRIM) support to the bhyve virtio-blk backend
  
  This will advertise support for TRIM to the guest virtio-blk driver and
  perform the DIOCGDELETE ioctl on the backing storage if it supports it.
  
  Thanks to Jason King and others at Joyent and illumos for expanding on
  my original patch, adding improvements including better error handling
  and making sure to following the virtio spec.
  
  r363255:
  Add VIRTIO_BLK_T_DISCARD support to the virtio-blk driver
  
  If the hypervisor advertises support for the DISCARD command then the
  guest can perform TRIM commands, freeing space on the backing store.
  
  If VIRTIO_BLK_F_DISCARD is enabled, advertise DISKFLAG_CANDELETE
  
  Tested with FreeBSD guests on bhyve and KVM
  
  Relnotes: yes
  Sponsored by: Klara Inc.

Modified:
  stable/12/sys/dev/virtio/block/virtio_blk.c
  stable/12/sys/dev/virtio/block/virtio_blk.h
  stable/12/usr.sbin/bhyve/block_if.c
  stable/12/usr.sbin/bhyve/pci_virtio_block.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/virtio/block/virtio_blk.c
==
--- stable/12/sys/dev/virtio/block/virtio_blk.c Thu Sep 10 20:54:44 2020
(r365613)
+++ stable/12/sys/dev/virtio/block/virtio_blk.c Thu Sep 10 21:01:22 2020
(r365614)
@@ -81,6 +81,7 @@ struct vtblk_softc {
 #define VTBLK_FLAG_SUSPEND 0x0008
 #define VTBLK_FLAG_BARRIER 0x0010
 #define VTBLK_FLAG_WC_CONFIG   0x0020
+#define VTBLK_FLAG_DISCARD 0x0040
 
struct virtqueue*vtblk_vq;
struct sglist   *vtblk_sglist;
@@ -112,6 +113,7 @@ static struct virtio_feature_desc vtblk_feature_desc[]
{ VIRTIO_BLK_F_WCE, "WriteCache"},
{ VIRTIO_BLK_F_TOPOLOGY,"Topology"  },
{ VIRTIO_BLK_F_CONFIG_WCE,  "ConfigWCE" },
+   { VIRTIO_BLK_F_DISCARD, "Discard"   },
 
{ 0, NULL }
 };
@@ -210,6 +212,7 @@ TUNABLE_INT("hw.vtblk.writecache_mode", _writeca
  VIRTIO_BLK_F_WCE  | \
  VIRTIO_BLK_F_TOPOLOGY | \
  VIRTIO_BLK_F_CONFIG_WCE   | \
+ VIRTIO_BLK_F_DISCARD  | \
  VIRTIO_RING_F_INDIRECT_DESC)
 
 #define VTBLK_MTX(_sc) &(_sc)->vtblk_mtx
@@ -461,7 +464,7 @@ vtblk_config_change(device_t dev)
vtblk_read_config(sc, );
 
/* Capacity is always in 512-byte units. */
-   capacity = blkcfg.capacity * 512;
+   capacity = blkcfg.capacity * VTBLK_BSIZE;
 
if (sc->vtblk_disk->d_mediasize != capacity)
vtblk_resize_disk(sc, capacity);
@@ -546,11 +549,18 @@ vtblk_strategy(struct bio *bp)
 * be a better way to report our readonly'ness to GEOM above.
 */
if (sc->vtblk_flags & VTBLK_FLAG_READONLY &&
-   (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH)) {
+   (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH ||
+   bp->bio_cmd == BIO_DELETE)) {
vtblk_bio_done(sc, bp, EROFS);
return;
}
 
+   if ((bp->bio_cmd != BIO_READ) && (bp->bio_cmd != BIO_WRITE) &&
+   (bp->bio_cmd != BIO_FLUSH) && (bp->bio_cmd != BIO_DELETE)) {
+   vtblk_bio_done(sc, bp, EOPNOTSUPP);
+   return;
+   }
+
VTBLK_LOCK(sc);
 
if (sc->vtblk_flags & VTBLK_FLAG_DETACH) {
@@ -559,6 +569,13 @@ vtblk_strategy(struct bio *bp)
return;
}
 
+   if ((bp->bio_cmd == BIO_DELETE) &&
+   !(sc->vtblk_flags & VTBLK_FLAG_DISCARD)) {
+   VTBLK_UNLOCK(sc);
+   vtblk_bio_done(sc, bp, EOPNOTSUPP);
+   return;
+   }
+
bioq_insert_tail(>vtblk_bioq, bp);
vtblk_startio(sc);
 
@@ -594,6 +611,8 @@ vtblk_setup_features(struct vtblk_softc *sc)
sc->vtblk_flags |= VTBLK_FLAG_BARRIER;
if (virtio_with_feature(dev, VIRTIO_BLK_F_CONFIG_WCE))
sc->vtblk_flags |= VTBLK_FLAG_WC_CONFIG;
+   if (virtio_with_feature(dev, VIRTIO_BLK_F_DISCARD))
+   sc->vtblk_flags |= VTBLK_FLAG_DISCARD;
 }
 
 static int
@@ -683,12 +702,12 @@ vtblk_alloc_disk(struct vtblk_softc *sc, struct virtio
dp->d_dump = vtblk_dump;
 
/* Capacity is always in 512-byte units. */
-   dp->d_mediasize = blkcfg->capacity * 512;
+   dp->d_mediasize = blkcfg->capacity * VTBLK_BSIZE;
 
if (virtio_with_feature(dev, VIRTIO_BLK_F_BLK_SIZE))
dp->d_sectorsize = blkcfg->blk_size;
else
-   dp->d_sectorsize = 512;
+   dp->d_sectorsize = VTBLK_BSIZE;
 
/*
 * The VirtIO maximum I/O size is given in terms of segments.
@@ -722,6 +741,11 @@ vtblk_alloc_disk(struct vtblk_softc *sc, struct virtio
   

svn commit: r363324 - head/usr.bin/at

2020-07-19 Thread Allan Jude
Author: allanjude
Date: Sun Jul 19 14:42:13 2020
New Revision: 363324
URL: https://svnweb.freebsd.org/changeset/base/363324

Log:
  at(1): Markup environment variables with proper macros
  
  Submitted by: debdrup
  Reported by:  0mp
  Reviewed by:  imp
  Sponsored by: Klara Inc.
  Differential Revision:https://reviews.freebsd.org/D25721

Modified:
  head/usr.bin/at/at.man

Modified: head/usr.bin/at/at.man
==
--- head/usr.bin/at/at.man  Sun Jul 19 12:34:19 2020(r363323)
+++ head/usr.bin/at/at.man  Sun Jul 19 14:42:13 2020(r363324)
@@ -216,7 +216,11 @@ might not be optimal for every deployment.
 If a finer granularity is desired, the
 .Pa /etc/cron.d/at
 file can be edited and will be read by the system crontab, from which
-the SHELL and PATH environment variables are inherited. 
+the 
+.Ev SHELL 
+and 
+.Ev PATH
+environment variables are inherited. 
 .Sh OPTIONS
 .Bl -tag -width indent
 .It Fl q Ar queue
___
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: r363286 - head/usr.bin/at

2020-07-17 Thread Allan Jude
Author: allanjude
Date: Fri Jul 17 20:43:00 2020
New Revision: 363286
URL: https://svnweb.freebsd.org/changeset/base/363286

Log:
  at(1): Fix location of at(1) crontab
  
  With r318443, atrun was moved from /etc/crontab to /etc/cron.d/at,
  but the man-page was unfortunately not updated to reflect this.
  
  PR:   248048
  Submitted by: debdrup
  Reported by:  yoitsmeremember+fbsd at gmail.com
  Reviewed by:  Pau Amma 
  Sponsored by: Klara Inc.
  Differential Revision:https://reviews.freebsd.org/D25709

Modified:
  head/usr.bin/at/at.man

Modified: head/usr.bin/at/at.man
==
--- head/usr.bin/at/at.man  Fri Jul 17 19:07:59 2020(r363285)
+++ head/usr.bin/at/at.man  Fri Jul 17 20:43:00 2020(r363286)
@@ -213,9 +213,10 @@ every five minutes.
 This implies that the granularity of
 .Nm
 might not be optimal for every deployment.
-If a finer granularity is needed, the system crontab at
-.Pa /etc/crontab
-needs to be changed.
+If a finer granularity is desired, the
+.Pa /etc/cron.d/at
+file can be edited and will be read by the system crontab, from which
+the SHELL and PATH environment variables are inherited. 
 .Sh OPTIONS
 .Bl -tag -width indent
 .It Fl q Ar queue
___
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: r363255 - head/sys/dev/virtio/block

2020-07-16 Thread Allan Jude
Author: allanjude
Date: Thu Jul 16 16:32:16 2020
New Revision: 363255
URL: https://svnweb.freebsd.org/changeset/base/363255

Log:
  Add VIRTIO_BLK_T_DISCARD support to the virtio-blk driver
  
  If the hypervisor advertises support for the DISCARD command then the
  guest can perform TRIM commands, freeing space on the backing store.
  
  If VIRTIO_BLK_F_DISCARD is enabled, advertise DISKFLAG_CANDELETE
  
  Tested with FreeBSD guests on bhyve and KVM
  
  Reviewed by:  jhb
  Tested by:freqlabs
  MFC after:1 month
  Relnotes: yes
  Sponsored by: Klara Inc.
  Differential Revision:https://reviews.freebsd.org/D21708

Modified:
  head/sys/dev/virtio/block/virtio_blk.c
  head/sys/dev/virtio/block/virtio_blk.h

Modified: head/sys/dev/virtio/block/virtio_blk.c
==
--- head/sys/dev/virtio/block/virtio_blk.c  Thu Jul 16 15:12:52 2020
(r363254)
+++ head/sys/dev/virtio/block/virtio_blk.c  Thu Jul 16 16:32:16 2020
(r363255)
@@ -81,6 +81,7 @@ struct vtblk_softc {
 #define VTBLK_FLAG_SUSPEND 0x0008
 #define VTBLK_FLAG_BARRIER 0x0010
 #define VTBLK_FLAG_WC_CONFIG   0x0020
+#define VTBLK_FLAG_DISCARD 0x0040
 
struct virtqueue*vtblk_vq;
struct sglist   *vtblk_sglist;
@@ -112,6 +113,7 @@ static struct virtio_feature_desc vtblk_feature_desc[]
{ VIRTIO_BLK_F_WCE, "WriteCache"},
{ VIRTIO_BLK_F_TOPOLOGY,"Topology"  },
{ VIRTIO_BLK_F_CONFIG_WCE,  "ConfigWCE" },
+   { VIRTIO_BLK_F_DISCARD, "Discard"   },
 
{ 0, NULL }
 };
@@ -210,6 +212,7 @@ TUNABLE_INT("hw.vtblk.writecache_mode", _writeca
  VIRTIO_BLK_F_WCE  | \
  VIRTIO_BLK_F_TOPOLOGY | \
  VIRTIO_BLK_F_CONFIG_WCE   | \
+ VIRTIO_BLK_F_DISCARD  | \
  VIRTIO_RING_F_INDIRECT_DESC)
 
 #define VTBLK_MTX(_sc) &(_sc)->vtblk_mtx
@@ -459,7 +462,7 @@ vtblk_config_change(device_t dev)
vtblk_read_config(sc, );
 
/* Capacity is always in 512-byte units. */
-   capacity = blkcfg.capacity * 512;
+   capacity = blkcfg.capacity * VTBLK_BSIZE;
 
if (sc->vtblk_disk->d_mediasize != capacity)
vtblk_resize_disk(sc, capacity);
@@ -544,13 +547,14 @@ vtblk_strategy(struct bio *bp)
 * be a better way to report our readonly'ness to GEOM above.
 */
if (sc->vtblk_flags & VTBLK_FLAG_READONLY &&
-   (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH)) {
+   (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH ||
+   bp->bio_cmd == BIO_DELETE)) {
vtblk_bio_done(sc, bp, EROFS);
return;
}
 
if ((bp->bio_cmd != BIO_READ) && (bp->bio_cmd != BIO_WRITE) &&
-   (bp->bio_cmd != BIO_FLUSH)) {
+   (bp->bio_cmd != BIO_FLUSH) && (bp->bio_cmd != BIO_DELETE)) {
vtblk_bio_done(sc, bp, EOPNOTSUPP);
return;
}
@@ -563,6 +567,13 @@ vtblk_strategy(struct bio *bp)
return;
}
 
+   if ((bp->bio_cmd == BIO_DELETE) &&
+   !(sc->vtblk_flags & VTBLK_FLAG_DISCARD)) {
+   VTBLK_UNLOCK(sc);
+   vtblk_bio_done(sc, bp, EOPNOTSUPP);
+   return;
+   }
+
bioq_insert_tail(>vtblk_bioq, bp);
vtblk_startio(sc);
 
@@ -598,6 +609,8 @@ vtblk_setup_features(struct vtblk_softc *sc)
sc->vtblk_flags |= VTBLK_FLAG_BARRIER;
if (virtio_with_feature(dev, VIRTIO_BLK_F_CONFIG_WCE))
sc->vtblk_flags |= VTBLK_FLAG_WC_CONFIG;
+   if (virtio_with_feature(dev, VIRTIO_BLK_F_DISCARD))
+   sc->vtblk_flags |= VTBLK_FLAG_DISCARD;
 }
 
 static int
@@ -687,12 +700,12 @@ vtblk_alloc_disk(struct vtblk_softc *sc, struct virtio
dp->d_dump = vtblk_dump;
 
/* Capacity is always in 512-byte units. */
-   dp->d_mediasize = blkcfg->capacity * 512;
+   dp->d_mediasize = blkcfg->capacity * VTBLK_BSIZE;
 
if (virtio_with_feature(dev, VIRTIO_BLK_F_BLK_SIZE))
dp->d_sectorsize = blkcfg->blk_size;
else
-   dp->d_sectorsize = 512;
+   dp->d_sectorsize = VTBLK_BSIZE;
 
/*
 * The VirtIO maximum I/O size is given in terms of segments.
@@ -726,6 +739,11 @@ vtblk_alloc_disk(struct vtblk_softc *sc, struct virtio
dp->d_stripesize;
}
 
+   if (virtio_with_feature(dev, VIRTIO_BLK_F_DISCARD)) {
+   dp->d_flags |= DISKFLAG_CANDELETE;
+   dp->d_delmaxsize = blkcfg->max_discard_sectors * VTBLK_BSIZE;
+   }
+
if (vtblk_write_cache_enabled(sc, blkcfg) != 0)
sc->vtblk_write_cache = VTBLK_CACHE_WRITEBACK;
else
@@ -876,12 +894,16 @@ vtblk_request_bio(struct vtblk_softc *sc)
break;
case BIO_READ:
req->vbr_hdr.type 

svn commit: r363224 - head/cddl/contrib/opensolaris/cmd/zpool

2020-07-15 Thread Allan Jude
Author: allanjude
Date: Wed Jul 15 14:38:15 2020
New Revision: 363224
URL: https://svnweb.freebsd.org/changeset/base/363224

Log:
  zpool-features(7): Note that the boot loader has support for large_blocks
  
  Since r304321 (-current: Aug 18, 2016) and r328866 (stable/11: Feb 5, 2018)
  the FreeBSD loader has supported reading from datasets with the
  large_blocks feature active.
  
  PR:   247992
  Reported by:  Anton Saietskii 
  MFC after:2 weeks
  Sponsored by: Klara Inc.

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7Wed Jul 15 
14:27:23 2020(r363223)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7Wed Jul 15 
14:38:15 2020(r363224)
@@ -521,10 +521,9 @@ property has been set larger than 128KB, and will retu
 once all filesystems that have ever had their recordsize larger than 128KB
 are destroyed.
 .Pp
-Please note that booting from datasets that have recordsize greater than
-128KB is
-.Em NOT
-supported by the
+Booting from datasets that use the
+.Sy large_block
+feature is supported by the
 .Fx
 boot loader.
 .It Sy large_dnode
___
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: r363223 - head/share/man/man4

2020-07-15 Thread Allan Jude
Author: allanjude
Date: Wed Jul 15 14:27:23 2020
New Revision: 363223
URL: https://svnweb.freebsd.org/changeset/base/363223

Log:
  vlan(4): Minor grammar corrections
  
  Note: date not bumped because "content" was not changed, just inserted some
  missing words.
  
  PR:   248001
  Submitted by: Jose Luis Duran 
  MFC after:2 weeks
  Sponsored by: Klara Inc.

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

Modified: head/share/man/man4/vxlan.4
==
--- head/share/man/man4/vxlan.4 Wed Jul 15 13:43:48 2020(r363222)
+++ head/share/man/man4/vxlan.4 Wed Jul 15 14:27:23 2020(r363223)
@@ -80,7 +80,7 @@ The
 driver creates a pseudo Ethernet network interface
 that supports the usual network
 .Xr ioctl 2 Ns s
-and is thus can be used with
+and thus can be used with
 .Xr ifconfig 8
 like any other Ethernet interface.
 The
@@ -89,7 +89,7 @@ interface encapsulates the Ethernet frame
 by prepending IP/UDP and
 .Nm
 headers.
-Thus, the encapsulated (inner) frame is able to transmitted
+Thus, the encapsulated (inner) frame is able to be transmitted
 over a routed, Layer 3 network to the remote host.
 .Pp
 The
@@ -102,7 +102,7 @@ When in multicast mode,
 the interface joins an IP multicast group,
 and receives packets sent to the group address,
 and transmits packets to either the multicast group address,
-or directly the remote host if there is an appropriate
+or directly to the remote host if there is an appropriate
 forwarding table entry.
 .Pp
 When the
@@ -155,7 +155,7 @@ The maximum number of entries in the table is configur
 .Xr ifconfig 8
 .Cm vxlanmaxaddr
 command.
-Stale entries in the table periodically pruned.
+Stale entries in the table are periodically pruned.
 The timeout is configurable with the
 .Xr ifconfig 8
 .Cm vxlantimeout
___
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: r363169 - head/usr.sbin/periodic/etc/daily

2020-07-13 Thread Allan Jude
Author: allanjude
Date: Tue Jul 14 00:46:20 2020
New Revision: 363169
URL: https://svnweb.freebsd.org/changeset/base/363169

Log:
  Actually install the new 221.backup-gpart periodic script
  
  Submitted by: Rob Fairbanks 
  Reported by:  Michael Butler 
  MFC with: r363110
  Sponsored by: Klara Inc.

Modified:
  head/usr.sbin/periodic/etc/daily/Makefile

Modified: head/usr.sbin/periodic/etc/daily/Makefile
==
--- head/usr.sbin/periodic/etc/daily/Makefile   Mon Jul 13 19:28:10 2020
(r363168)
+++ head/usr.sbin/periodic/etc/daily/Makefile   Tue Jul 14 00:46:20 2020
(r363169)
@@ -10,6 +10,7 @@ CONFS=100.clean-disks \
140.clean-rwho \
200.backup-passwd \
210.backup-aliases \
+   221.backup-gpart \
330.news \
400.status-disks \
401.status-graid \
___
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: r363103 - head/usr.sbin/bsdinstall/scripts

2020-07-13 Thread Allan Jude
On 2020-07-12 13:32, Enji Cooper wrote:
> 
>> On Jul 11, 2020, at 10:20 AM, Allan Jude  wrote:
>>
>> Author: allanjude
>> Date: Sat Jul 11 17:20:17 2020
>> New Revision: 363103
>> URL: https://svnweb.freebsd.org/changeset/base/363103
>>
>> Log:
>>  bsdinstall: only kill the dhclient for the interface we are restarting
>>
>>  PR: 205821
>>  Reported by:mjg
>>  MFC after:  2 weeks
>>  Sponsored by:   Klara Inc.
>>  Event:  July 2020 Bugathon
>>
>> Modified:
>>  head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
> 
> Allan,
>   Thank you so very much for doing this!!! This has been an annoying 
> nitpick of mine with sysinstall/bsdinstall, for many moons :).
>   It looks like equivalent logic doesn’t need to be implemented for IPv6. 
> Yay :).
> Cheers!
> -Enji
> 

Someone else wrote the patch, although I had a similar idea previously.
Mark Johnston came up with the pkill -F part, that made it only kill
dhclient for the correct interface.


-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r363142 - head/libexec/rc/rc.d

2020-07-13 Thread Allan Jude
Author: allanjude
Date: Mon Jul 13 13:44:54 2020
New Revision: 363142
URL: https://svnweb.freebsd.org/changeset/base/363142

Log:
  Remove excess spaces from rc.d scripts
  
  The space between words is already being echoed by the space between quoted 
strings:
  
  % echo 'foo' 'bar'
  foo bar
  
  % echo 'foo' ' baz'
  foo  baz
  
  Found in `ipfw` and `mountlate` messages.
  
  PR:   247948
  Submitted by: Jose Luis Duran 
  MFC after:2 weeks
  Sponsored by: Klara Inc.

Modified:
  head/libexec/rc/rc.d/ipfw
  head/libexec/rc/rc.d/mountlate

Modified: head/libexec/rc/rc.d/ipfw
==
--- head/libexec/rc/rc.d/ipfw   Mon Jul 13 13:35:36 2020(r363141)
+++ head/libexec/rc/rc.d/ipfw   Mon Jul 13 13:44:54 2020(r363142)
@@ -63,7 +63,7 @@ ipfw_start()
echo 'Firewall rules loaded.'
elif [ "`ipfw list 65535`" = "65535 deny ip from any to any" ]; then
echo 'Warning: kernel has firewall functionality, but' \
-   ' firewall rules are not enabled.'
+   'firewall rules are not enabled.'
echo '   All ip services are disabled.'
fi
 

Modified: head/libexec/rc/rc.d/mountlate
==
--- head/libexec/rc/rc.d/mountlate  Mon Jul 13 13:35:36 2020
(r363141)
+++ head/libexec/rc/rc.d/mountlate  Mon Jul 13 13:44:54 2020
(r363142)
@@ -32,7 +32,7 @@ mountlate_start()
;;
*)
echo 'Mounting /etc/fstab filesystems failed,' \
-   ' startup aborted'
+   'startup aborted'
stop_boot true
;;
esac
___
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: r363139 - head/stand/man

2020-07-12 Thread Allan Jude
Author: allanjude
Date: Mon Jul 13 02:09:21 2020
New Revision: 363139
URL: https://svnweb.freebsd.org/changeset/base/363139

Log:
  Loader: explain the syntax of currdev
  
  The origin text was: "Syntax for devices is odd."
  That is not very helpful.
  
  PR:   199103
  Reviewed by:  kevans, tsoome
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon
  Differential Revision:https://reviews.freebsd.org/D25629

Modified:
  head/stand/man/loader.8

Modified: head/stand/man/loader.8
==
--- head/stand/man/loader.8 Mon Jul 13 01:32:37 2020(r363138)
+++ head/stand/man/loader.8 Mon Jul 13 02:09:21 2020(r363139)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 15, 2018
+.Dd July 11, 2020
 .Dt LOADER 8
 .Os
 .Sh NAME
@@ -479,8 +479,14 @@ In that case, the first listed console will become the
 userland output (e.g.\& from
 .Xr init 8 ) .
 .It Va currdev
-Selects the default device.
-Syntax for devices is odd.
+Selects the default device to loader the kernel from.
+The syntax is:
+.Dl Ic loader_device:
+or
+.Dl Ic zfs:dataset:
+Examples:
+.Dl Ic disk0p2:
+.Dl Ic zfs:zroot/ROOT/default:
 .It Va dumpdev
 Sets the device for kernel dumps.
 This can be used to ensure that a device is configured before the corresponding
___
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: r363114 - head/share/man/man5

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 22:14:44 2020
New Revision: 363114
URL: https://svnweb.freebsd.org/changeset/base/363114

Log:
  periodic.conf: correct capitailization in the middle of a sentence
  
  Reported by:  yuripv
  Event:July 2020 Bugathon

Modified:
  head/share/man/man5/periodic.conf.5

Modified: head/share/man/man5/periodic.conf.5
==
--- head/share/man/man5/periodic.conf.5 Sat Jul 11 21:57:43 2020
(r363113)
+++ head/share/man/man5/periodic.conf.5 Sat Jul 11 22:14:44 2020
(r363114)
@@ -256,17 +256,17 @@ as configured in
 .Pq Vt bool
 Set to
 .Dq Li YES
-To create backup of EFI System Partion (ESP).
+to create backup of EFI System Partion (ESP).
 .It Va daily_backup_gpart_enable
 .Pq Vt bool
 Set to
 .Dq Li YES
-To create backups of partition tables, and bootcode partition contents.
+to create backups of partition tables, and bootcode partition contents.
 .It Va daily_backup_gpart_verbose
 .Pq Vt bool
 Set to
 .Dq Li YES
-To be verbose if existing backups for kern.geom.conftxt or the partition 
tables differ
+to be verbose if existing backups for kern.geom.conftxt or the partition 
tables differ
 from the new backups.
 .It Va daily_backup_passwd_enable
 .Pq Vt bool
___
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: r363111 - in head: libexec/getty share/man/man4

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 20:56:57 2020
New Revision: 363111
URL: https://svnweb.freebsd.org/changeset/base/363111

Log:
  Add cross references betwen ttys(5) and related drivers
  
  nmdm(4), ucom(4), and uart(4)
  
  PR:   247638
  Submitted by: Pau Amma 
  Reported by:  0mp
  MFC after:4 weeks
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon

Modified:
  head/libexec/getty/ttys.5
  head/share/man/man4/nmdm.4
  head/share/man/man4/uart.4
  head/share/man/man4/ucom.4

Modified: head/libexec/getty/ttys.5
==
--- head/libexec/getty/ttys.5   Sat Jul 11 20:53:31 2020(r363110)
+++ head/libexec/getty/ttys.5   Sat Jul 11 20:56:57 2020(r363111)
@@ -28,7 +28,7 @@
 .\" from: @(#)ttys.5   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\" "
-.Dd August 3, 2018
+.Dd July 11, 2020
 .Dt TTYS 5
 .Os
 .Sh NAME
@@ -162,6 +162,9 @@ ttyv0   "/usr/local/bin/xterm -display :0"  xterm   
on wind
 .Sh SEE ALSO
 .Xr login 1 ,
 .Xr getttyent 3 ,
+.Xr nmdm 4 ,
+.Xr uart 4 ,
+.Xr ucom 4 ,
 .Xr gettytab 5 ,
 .Xr login.conf 5 ,
 .Xr termcap 5 ,

Modified: head/share/man/man4/nmdm.4
==
--- head/share/man/man4/nmdm.4  Sat Jul 11 20:53:31 2020(r363110)
+++ head/share/man/man4/nmdm.4  Sat Jul 11 20:56:57 2020(r363111)
@@ -21,7 +21,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 23, 2018
+.Dd July 11, 2020
 .Dt NMDM 4
 .Os
 .Sh NAME
@@ -89,7 +89,8 @@ None.
 .Sh SEE ALSO
 .Xr stty 1 ,
 .Xr termios 4 ,
-.Xr tty 4
+.Xr tty 4 ,
+.Xr ttys 5
 .Sh HISTORY
 The
 .Nm

Modified: head/share/man/man4/uart.4
==
--- head/share/man/man4/uart.4  Sat Jul 11 20:53:31 2020(r363110)
+++ head/share/man/man4/uart.4  Sat Jul 11 20:56:57 2020(r363111)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 26, 2017
+.Dd July 11, 2020
 .Dt UART 4
 .Os
 .Sh NAME
@@ -286,8 +286,10 @@ for callout ports
 corresponding callout initial-state and lock-state devices
 .El
 .Sh SEE ALSO
+.Xr cu 1 ,
 .Xr puc 4 ,
-.Xr scc 4
+.Xr scc 4 ,
+.Xr ttys 5
 .\"
 .Sh HISTORY
 The

Modified: head/share/man/man4/ucom.4
==
--- head/share/man/man4/ucom.4  Sat Jul 11 20:53:31 2020(r363110)
+++ head/share/man/man4/ucom.4  Sat Jul 11 20:56:57 2020(r363111)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 25, 2018
+.Dd July 11, 2020
 .Dt UCOM 4
 .Os
 .Sh NAME
@@ -125,6 +125,7 @@ for callout ports
 corresponding callout initial-state and lock-state devices
 .El
 .Sh SEE ALSO
+.Xr cu 1 ,
 .Xr tty 4 ,
 .Xr uark 4 ,
 .Xr ubsa 4 ,
@@ -144,7 +145,8 @@ corresponding callout initial-state and lock-state dev
 .Xr usb 4 ,
 .Xr uslcom 4 ,
 .Xr uvisor 4 ,
-.Xr uvscom 4
+.Xr uvscom 4 ,
+.Xr ttys 5
 .Sh HISTORY
 The
 .Nm
___
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: r363110 - in head: share/man/man5 usr.sbin/periodic usr.sbin/periodic/etc/daily

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 20:53:31 2020
New Revision: 363110
URL: https://svnweb.freebsd.org/changeset/base/363110

Log:
  Add a periodic script to backup the partition table and boot code
  
  Optionally, alert you if the contents change from the previous backup
  
  PR:   86388
  Submitted by: Rob Fairbanks , Miroslav Lachman 
<000.f...@quip.cz> (Original Version)
  MFC after:4 weeks
  Relnotes: yes
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon
  Differential Revision:https://reviews.freebsd.org/D25628

Added:
  head/usr.sbin/periodic/etc/daily/221.backup-gpart   (contents, props changed)
Modified:
  head/share/man/man5/periodic.conf.5
  head/usr.sbin/periodic/periodic.conf

Modified: head/share/man/man5/periodic.conf.5
==
--- head/share/man/man5/periodic.conf.5 Sat Jul 11 19:44:12 2020
(r363109)
+++ head/share/man/man5/periodic.conf.5 Sat Jul 11 20:53:31 2020
(r363110)
@@ -252,6 +252,22 @@ Files will be deleted using the same criteria as
 would normally use when determining whether to believe the cached information,
 as configured in
 .Pa /etc/mail/sendmail.cf .
+.It Va daily_backup_efi_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+To create backup of EFI System Partion (ESP).
+.It Va daily_backup_gpart_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+To create backups of partition tables, and bootcode partition contents.
+.It Va daily_backup_gpart_verbose
+.Pq Vt bool
+Set to
+.Dq Li YES
+To be verbose if existing backups for kern.geom.conftxt or the partition 
tables differ
+from the new backups.
 .It Va daily_backup_passwd_enable
 .Pq Vt bool
 Set to

Added: head/usr.sbin/periodic/etc/daily/221.backup-gpart
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/periodic/etc/daily/221.backup-gpart   Sat Jul 11 20:53:31 
2020(r363110)
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+## $FreeBSD$
+## Created by: Miroslav Lachman <000.f...@quip.cz>
+
+## Backup of disk partitions layout, useful for gpart restore.
+## Data are stored on local filesystem, in /var/backup.
+## It is recommended to copy those files to off-site storage.
+
+
+## If there is a global system configuration file, suck it in.
+##
+if [ -r /etc/defaults/periodic.conf ]
+then
+   . /etc/defaults/periodic.conf
+   source_periodic_confs
+fi
+
+bak_dir=/var/backups
+
+rotate() {
+   base_name=$1
+   show_diff=$2
+   file="$bak_dir/$base_name"
+
+   if [ -f "${file}.bak" ] ; then
+   rc=0
+   if cmp -s "${file}.bak" "${file}.tmp"; then
+   rm "${file}.tmp"
+   else
+   rc=1
+   [ -n "$show_diff" ] && diff "${file}.bak" "${file}.tmp"
+   mv "${file}.bak" "${file}.bak2" || rc=3
+   mv "${file}.tmp" "${file}.bak" || rc=3
+   fi
+   else
+   rc=1
+   mv "${file}.tmp" "${file}.bak" || rc=3
+   [ -n "$show_diff" ] && cat "${file}.bak"
+   fi
+}
+
+case "$daily_backup_gpart_verbose" in
+   [Yy][Ee][Ss]) show="YES"
+esac
+
+case "$daily_backup_gpart_enable" in
+   [Yy][Ee][Ss])
+
+   echo ""
+   echo "Dump of kern.geom.conftxt:";
+   sysctl -n kern.geom.conftxt > "$bak_dir/kern.geom.conftxt.tmp"
+   rotate "kern.geom.conftxt" $show
+
+   gpart_devs=$(gpart show | awk '$1 == "=>" { print $4 }')
+   if [ -n "$daily_backup_gpart_exclude" ]; then
+   gpart_devs=$(echo ${gpart_devs} | grep -E -v 
"${daily_backup_gpart_exclude}")
+   fi
+
+   if [ -z "$gpart_devs"  ]; then
+   echo '$daily_backup_gpart_enable is set but no disk probed by 
kernel.' \
+   "perhaps NFS diskless client."
+   rc=2
+   else
+   echo ""
+   echo "Backup of partitions information for:";
+
+   for d in ${gpart_devs}; do
+   echo "$d"
+   safe_name=$(echo "gpart.${d}" | tr -cs ".[:alnum:]\n" 
"_")
+   gpart backup "$d" > "$bak_dir/$safe_name.tmp"
+   rotate "$safe_name" $show
+   done
+
+   gpart_show=$(gpart show -p)
+   boot_part=$(echo "$gpart_show" | awk '$4 ~ 
/(bios|freebsd)-boot/ { print $3 }')
+   if [ -n "$boot_part" ]; then
+   echo ""
+   echo "Backup of boot partition content:"
+   for b in ${boot_part}; do
+   echo "$b"
+   safe_name=$(echo "boot.${b}" | tr -cs 
".[:alnum:]\n" "_")
+   dd if="/dev/${b}" of="$bak_dir/$safe_name.tmp" 
2> /dev/null
+   rotate "$safe_name"
+   done
+  

svn commit: r363109 - head/usr.sbin/nscd

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 19:44:12 2020
New Revision: 363109
URL: https://svnweb.freebsd.org/changeset/base/363109

Log:
  nscd: does not warn about invalid values what parsing config file
  
  PR:   202135
  Submitted by: am...@amutu.com
  Reported By:  trond.endres...@ximalas.info
  Reviewed by:  markj, freqlabs
  MFC after:4 weeks
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon
  Differential Revision:https://reviews.freebsd.org/D25627

Modified:
  head/usr.sbin/nscd/parser.c

Modified: head/usr.sbin/nscd/parser.c
==
--- head/usr.sbin/nscd/parser.c Sat Jul 11 19:29:24 2020(r363108)
+++ head/usr.sbin/nscd/parser.c Sat Jul 11 19:44:12 2020(r363109)
@@ -375,6 +375,7 @@ parse_config_file(struct configuration *config,
char*fields[128];
int field_count, line_num, value;
int res;
+   int invalid_value;
 
TRACE_IN(parse_config_file);
assert(config != NULL);
@@ -388,6 +389,7 @@ parse_config_file(struct configuration *config,
 
res = 0;
line_num = 0;
+   invalid_value = 0;
memset(buffer, 0, sizeof(buffer));
while ((res == 0) && (fgets(buffer, sizeof(buffer) - 1, fin) != NULL)) {
field_count = strbreak(buffer, fields, sizeof(fields));
@@ -421,12 +423,20 @@ parse_config_file(struct configuration *config,
(strcmp(fields[0], "positive-time-to-live") == 0) &&
(check_cachename(fields[1]) == 0) &&
((value = get_number(fields[2], 0, -1)) != -1)) {
+   if (value <= 0) {
+   invalid_value = 1;
+   break;
+   }
set_positive_time_to_live(config,
fields[1], value);
continue;
} else if ((field_count == 3) &&
(strcmp(fields[0], "positive-confidence-threshold") == 
0) &&
((value = get_number(fields[2], 1, -1)) != -1)) {
+   if (value <= 0) {
+   invalid_value = 1;
+   break;
+   }
set_positive_confidence_threshold(config,
fields[1], value);
continue;
@@ -450,12 +460,20 @@ parse_config_file(struct configuration *config,
(strcmp(fields[0], "negative-time-to-live") == 0) &&
(check_cachename(fields[1]) == 0) &&
((value = get_number(fields[2], 0, -1)) != -1)) {
+   if (value <= 0) {
+   invalid_value = 1;
+   break;
+   }
set_negative_time_to_live(config,
fields[1], value);
continue;
} else if ((field_count == 3) &&
(strcmp(fields[0], "negative-confidence-threshold") == 
0) &&
((value = get_number(fields[2], 1, -1)) != -1)) {
+   if (value <= 0) {
+   invalid_value = 1;
+   break;
+   }
set_negative_confidence_threshold(config,
fields[1], value);
continue;
@@ -473,6 +491,10 @@ parse_config_file(struct configuration *config,
(strcmp(fields[0], "suggested-size") == 0) &&
(check_cachename(fields[1]) == 0) &&
((value = get_number(fields[2], 1, -1)) != -1)) {
+   if (value <= 0) {
+   invalid_value = 1;
+   break;
+   }
set_suggested_size(config, fields[1], value);
continue;
}
@@ -490,6 +512,10 @@ parse_config_file(struct configuration *config,
(strcmp(fields[0], "keep-hot-count") == 0) &&
(check_cachename(fields[1]) == 0) &&
((value = get_number(fields[2], 0, -1)) != -1)) {
+   if (value < 0) {
+   invalid_value = 1;
+   break;
+   }
set_keep_hot_count(config,
 

svn commit: r363108 - head/sbin/reboot

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 19:29:24 2020
New Revision: 363108
URL: https://svnweb.freebsd.org/changeset/base/363108

Log:
  boot(8): fix sorting of cross references
  
  Reported by:  yuripv
  Event:July 2020 Bugathon

Modified:
  head/sbin/reboot/boot_i386.8

Modified: head/sbin/reboot/boot_i386.8
==
--- head/sbin/reboot/boot_i386.8Sat Jul 11 19:18:43 2020
(r363107)
+++ head/sbin/reboot/boot_i386.8Sat Jul 11 19:29:24 2020
(r363108)
@@ -328,6 +328,8 @@ requirement has not been adhered to.
 .Xr boot0cfg 8 ,
 .Xr btxld 8 ,
 .Xr config 8 ,
+.Xr efibootmgr 8 ,
+.Xr efivar 8 ,
 .Xr gpart 8 ,
 .Xr gptboot 8 ,
 .Xr gptzfsboot 8 ,
@@ -336,10 +338,8 @@ requirement has not been adhered to.
 .Xr nextboot 8 ,
 .Xr reboot 8 ,
 .Xr shutdown 8 ,
-.Xr zfsbootcfg 8 ,
-.Xr efibootmgr 8 ,
-.Xr efivar 8 ,
-.Xr uefi 8
+.Xr uefi 8 ,
+.Xr zfsbootcfg 8
 .Sh BUGS
 The bsdlabel format used by this version of
 .Bx
___
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: r363107 - head/sbin/reboot

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 19:18:43 2020
New Revision: 363107
URL: https://svnweb.freebsd.org/changeset/base/363107

Log:
  boot(8): Add additional cross references
  
  Provide hints to direct people towards gptzfsboot, zfsbootcfg, efibootmgr, etc
  
  PR:   199103
  MFC after:2 weeks
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon

Modified:
  head/sbin/reboot/boot_i386.8

Modified: head/sbin/reboot/boot_i386.8
==
--- head/sbin/reboot/boot_i386.8Sat Jul 11 18:27:05 2020
(r363106)
+++ head/sbin/reboot/boot_i386.8Sat Jul 11 19:18:43 2020
(r363107)
@@ -36,7 +36,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 7, 2020
+.Dd July 11, 2020
 .Dt BOOT 8 i386
 .Os
 .Sh NAME
@@ -330,11 +330,15 @@ requirement has not been adhered to.
 .Xr config 8 ,
 .Xr gpart 8 ,
 .Xr gptboot 8 ,
+.Xr gptzfsboot 8 ,
 .Xr halt 8 ,
 .Xr loader 8 ,
 .Xr nextboot 8 ,
 .Xr reboot 8 ,
 .Xr shutdown 8 ,
+.Xr zfsbootcfg 8 ,
+.Xr efibootmgr 8 ,
+.Xr efivar 8 ,
 .Xr uefi 8
 .Sh BUGS
 The bsdlabel format used by this version of
___
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: r363105 - head/usr.sbin/ppp

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 18:24:16 2020
New Revision: 363105
URL: https://svnweb.freebsd.org/changeset/base/363105

Log:
  ppp: Document the fact that ppp_nat is enabled by default
  
  No functional change.
  
  PR:   243062
  Submitted by: Evilham  (original version)
  MFC after:2 weeks
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon
  Differential Revision:https://reviews.freebsd.org/D25623

Modified:
  head/usr.sbin/ppp/ppp.8

Modified: head/usr.sbin/ppp/ppp.8
==
--- head/usr.sbin/ppp/ppp.8 Sat Jul 11 18:04:09 2020(r363104)
+++ head/usr.sbin/ppp/ppp.8 Sat Jul 11 18:24:16 2020(r363105)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 25, 2017
+.Dd July 11, 2020
 .Dt PPP 8
 .Os
 .Sh NAME
@@ -1653,6 +1653,15 @@ Check that IP forwarding is enabled in
 and that other machines have designated the
 .Nm
 host as the gateway for the LAN.
+When starting
+.Nm
+with the provided rc script, the default is to
+enable NAT; see
+.Va ppp_nat
+in
+.Xr rc.conf 5
+and
+.Pa /etc/defaults/rc.conf .
 .Sh PACKET FILTERING
 This implementation supports packet filtering.
 There are four kinds of
___
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: r363104 - head/lib/libc/sys

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 18:04:09 2020
New Revision: 363104
URL: https://svnweb.freebsd.org/changeset/base/363104

Log:
  procctl(2): consistently refer to the last agrument as 'data'
  
  Some older references called it 'arg'
  
  Also fix a syntax error that was underlining an entire sentence.
  
  PR:   247386
  Reported by:  Paul Floyd , PauAmma (research)
  MFC after:2 weeks
  Sponsored by: Klara Inc.

Modified:
  head/lib/libc/sys/procctl.2

Modified: head/lib/libc/sys/procctl.2
==
--- head/lib/libc/sys/procctl.2 Sat Jul 11 17:20:17 2020(r363103)
+++ head/lib/libc/sys/procctl.2 Sat Jul 11 18:04:09 2020(r363104)
@@ -483,7 +483,7 @@ and
 must be the either caller's pid or zero, with no difference in effect.
 The value is cleared for child processes
 and when executing set-user-ID or set-group-ID binaries.
-.Fa arg
+.Fa data
 must point to a value of type
 .Vt int
 indicating the signal
@@ -498,7 +498,7 @@ must be
 and
 .Fa id
 must be the either caller's pid or zero, with no difference in effect.
-.Fa arg
+.Fa data
 must point to a memory location that can hold a value of type
 .Vt int .
 If signal delivery has not been requested, it will contain zero
@@ -596,7 +596,8 @@ privilege might use this option.
 .El
 .It Dv PROC_KPTI_STATUS
 Returns the current KPTI status for the specified process.
-.Fa data must point to the integer variable, which returns the
+.Fa data
+must point to the integer variable, which returns the
 following statuses:
 .Bl -tag -width PROC_KPTI_CTL_DISABLE_ON_EXEC
 .It Dv PROC_KPTI_CTL_ENABLE_ON_EXEC
@@ -624,7 +625,7 @@ will fail if:
 .Bl -tag -width Er
 .It Bq Er EFAULT
 The
-.Fa arg
+.Fa data
 parameter points outside the process's allocated address space.
 .It Bq Er EINVAL
 The
@@ -644,7 +645,7 @@ and
 .Fa id .
 .It Bq Er EINVAL
 An invalid operation or flag was passed in
-.Fa arg
+.Fa data
 for a
 .Dv PROC_SPROTECT
 command.
___
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: r363103 - head/usr.sbin/bsdinstall/scripts

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 17:20:17 2020
New Revision: 363103
URL: https://svnweb.freebsd.org/changeset/base/363103

Log:
  bsdinstall: only kill the dhclient for the interface we are restarting
  
  PR:   205821
  Reported by:  mjg
  MFC after:2 weeks
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon

Modified:
  head/usr.sbin/bsdinstall/scripts/netconfig_ipv4

Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
==
--- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Sat Jul 11 17:10:16 
2020(r363102)
+++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Sat Jul 11 17:20:17 
2020(r363103)
@@ -51,7 +51,7 @@ if [ $? -eq $DIALOG_OK ]; then
if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
ifconfig $INTERFACE up
dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring 
DHCP lease..." 0 0
-   err=$( pkill dhclient; dhclient $INTERFACE 2>&1 )
+   err=$( pkill -F /var/run/dhclient/dhclient.${INTERFACE}.pid; 
dhclient $INTERFACE 2>&1 )
if [ $? -ne 0 ]; then
f_dprintf "%s" "$err"
dialog --backtitle 'FreeBSD Installer' --msgbox "DHCP 
lease acquisition failed." 0 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"


Re: svn commit: r363097 - head/usr.sbin/bsdinstall/scripts

2020-07-11 Thread Allan Jude
On 2020-07-11 11:44, Mateusz Guzik wrote:
> On 7/11/20, Allan Jude  wrote:
>> Author: allanjude
>> Date: Sat Jul 11 15:32:53 2020
>> New Revision: 363097
>> URL: https://svnweb.freebsd.org/changeset/base/363097
>>
>> Log:
>>   bsdinstall: kill dhclient before starting a new instance
>>
>>   PR:205821
>>   Submitted by:  William Orr 
>>   MFC after: 2 weeks
>>   Sponsored by:  Klara Inc.
>>   Event: July 2020 Bugathon
>>   Differential Revision: https://reviews.freebsd.org/D14572
>>
>> Modified:
>>   head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
>>
>> Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
>> ==
>> --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4  Sat Jul 11 14:55:11
>> 2020 (r363096)
>> +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4  Sat Jul 11 15:32:53
>> 2020 (r363097)
>> @@ -51,7 +51,7 @@ if [ $? -eq $DIALOG_OK ]; then
>>  if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
>>  ifconfig $INTERFACE up
>>  dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP
>> lease..." 0 0
>> -err=$( dhclient $INTERFACE 2>&1 )
>> +err=$( pkill dhclient; dhclient $INTERFACE 2>&1 )
>>  if [ $? -ne 0 ]; then
>>  f_dprintf "%s" "$err"
>>  dialog --backtitle 'FreeBSD Installer' --msgbox "DHCP 
>> lease acquisition
>> failed." 0 0
> 
> There can be more than one dhclient running, but this will kill everything.
> 

Good point.

Thanks to markj for the suggested fix, committed as r363103


-- 
Allan Jude
___
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: r363101 - head/usr.sbin/bsdinstall/scripts

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 17:06:48 2020
New Revision: 363101
URL: https://svnweb.freebsd.org/changeset/base/363101

Log:
  bsdinstall: don't fail if fstab is empty
  
  PR:   210865
  Submitted by: Tim Lukasiewicz , 
h-fujish...@sakura.ad.jp (original version)
  Reported by:  h-fujish...@sakura.ad.jp
  Reviewed by:  sef
  MFC after:2 weeks
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon

Modified:
  head/usr.sbin/bsdinstall/scripts/umount

Modified: head/usr.sbin/bsdinstall/scripts/umount
==
--- head/usr.sbin/bsdinstall/scripts/umount Sat Jul 11 16:57:44 2020
(r363100)
+++ head/usr.sbin/bsdinstall/scripts/umount Sat Jul 11 17:06:48 2020
(r363101)
@@ -39,4 +39,6 @@ cat $PATH_FSTAB | awk -v BSDINSTALL_CHROOT=$BSDINSTALL
 }' > $TMP_FSTAB
 
 umount $BSDINSTALL_CHROOT/dev 2>/dev/null
-umount -F $TMP_FSTAB -a 2>/dev/null
+if [ -n "$TMP_FSTAB" ]; then
+   umount -F $TMP_FSTAB -a 2>/dev/null
+fi
___
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: r363100 - head/share/man/man5

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 16:57:44 2020
New Revision: 363100
URL: https://svnweb.freebsd.org/changeset/base/363100

Log:
  defaults/rc.conf: note that the default is ppp_nat="YES"
  
  PR:   243062
  Submitted by: Evilham 
  MFC after:2 weeks
  Sponsored by: Klara Inc.
  Differential Revision:https://reviews.freebsd.org/D25621

Modified:
  head/share/man/man5/rc.conf.5

Modified: head/share/man/man5/rc.conf.5
==
--- head/share/man/man5/rc.conf.5   Sat Jul 11 16:38:46 2020
(r363099)
+++ head/share/man/man5/rc.conf.5   Sat Jul 11 16:57:44 2020
(r363100)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 28, 2020
+.Dd July 11, 2020
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -1955,6 +1955,8 @@ Used in conjunction with
 .Va gateway_enable
 allows hosts on private network addresses access to the Internet using
 this host as a network address translating router.
+Default is
+.Dq Li YES .
 .It Va ppp_ Ns Ao Ar profile Ac Ns _nat
 .Pq Vt str
 Overrides the global
___
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: r363098 - in stable: 11/cddl/contrib/opensolaris/cmd/zfs 11/cddl/contrib/opensolaris/cmd/zpool 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 12/cddl/contrib/opensolaris/cmd/zfs 12/c...

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 15:57:46 2020
New Revision: 363098
URL: https://svnweb.freebsd.org/changeset/base/363098

Log:
  MFC r362396
ZFS: Allow setting checksum=skein on boot pools
  
  PR:   245889
  Reported by:  delphij
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8Sat Jul 11 15:32:53 
2020(r363097)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8Sat Jul 11 15:57:46 
2020(r363098)
@@ -997,9 +997,9 @@ for more information on these algorithms.
 .Pp
 Changing this property affects only newly-written data.
 .Pp
-Salted checksum algorithms
-.Pq Cm edonr , skein
-are currently not supported for any filesystem on the boot pools.
+The salted checksum algorithm
+.Pq Cm edonr
+is currently not supported on FreeBSD.
 .It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle 
| Cm lz4
 Controls the compression algorithm used for this dataset.
 Setting compression to

Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
==
--- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7   Sat Jul 
11 15:32:53 2020(r363097)
+++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7   Sat Jul 
11 15:57:46 2020(r363098)
@@ -608,6 +608,9 @@ and will return to being
 once all filesystems that have ever had their checksum set to
 .Sy skein
 are destroyed.
+Booting off of pools using
+.Sy skein
+is supported.
 .El
 .Sh SEE ALSO
 .Xr zpool 8

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sat Jul 11 15:32:53 2020(r363097)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sat Jul 11 15:57:46 2020(r363098)
@@ -4299,16 +4299,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair,
 
if ((err = spa_open(dsname, , FTAG)) != 0)
return (err);
-   /*
-* Salted checksums are not supported on root pools.
-*/
-   if (spa_bootfs(spa) != 0 &&
-   intval < ZIO_CHECKSUM_FUNCTIONS &&
-   (zio_checksum_table[intval].ci_flags &
-   ZCHECKSUM_FLAG_SALTED)) {
-   spa_close(spa, FTAG);
-   return (SET_ERROR(ERANGE));
-   }
+
if (!spa_feature_is_enabled(spa, feature)) {
spa_close(spa, FTAG);
return (SET_ERROR(ENOTSUP));
___
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: r363098 - in stable: 11/cddl/contrib/opensolaris/cmd/zfs 11/cddl/contrib/opensolaris/cmd/zpool 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 12/cddl/contrib/opensolaris/cmd/zfs 12/c...

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 15:57:46 2020
New Revision: 363098
URL: https://svnweb.freebsd.org/changeset/base/363098

Log:
  MFC r362396
ZFS: Allow setting checksum=skein on boot pools
  
  PR:   245889
  Reported by:  delphij
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon

Modified:
  stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8Sat Jul 11 15:32:53 
2020(r363097)
+++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8Sat Jul 11 15:57:46 
2020(r363098)
@@ -1001,9 +1001,9 @@ for more information on these algorithms.
 .Pp
 Changing this property affects only newly-written data.
 .Pp
-Salted checksum algorithms
-.Pq Cm edonr , skein
-are currently not supported for any filesystem on the boot pools.
+The salted checksum algorithm
+.Pq Cm edonr
+is currently not supported on FreeBSD.
 .It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle 
| Cm lz4
 Controls the compression algorithm used for this dataset.
 Setting compression to

Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
==
--- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7   Sat Jul 
11 15:32:53 2020(r363097)
+++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7   Sat Jul 
11 15:57:46 2020(r363098)
@@ -632,6 +632,9 @@ and will return to being
 once all filesystems that have ever had their checksum set to
 .Sy skein
 are destroyed.
+Booting off of pools using
+.Sy skein
+is supported.
 .It Sy allocation_classes
 .Bl -column "READ\-ONLY COMPATIBLE" "com.intel:allocation_classes"
 .It GUID Ta com.intel:allocation_classes

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sat Jul 11 15:32:53 2020(r363097)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sat Jul 11 15:57:46 2020(r363098)
@@ -4368,16 +4368,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair,
 
if ((err = spa_open(dsname, , FTAG)) != 0)
return (err);
-   /*
-* Salted checksums are not supported on root pools.
-*/
-   if (spa_bootfs(spa) != 0 &&
-   intval < ZIO_CHECKSUM_FUNCTIONS &&
-   (zio_checksum_table[intval].ci_flags &
-   ZCHECKSUM_FLAG_SALTED)) {
-   spa_close(spa, FTAG);
-   return (SET_ERROR(ERANGE));
-   }
+
if (!spa_feature_is_enabled(spa, feature)) {
spa_close(spa, FTAG);
return (SET_ERROR(ENOTSUP));
___
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: r363097 - head/usr.sbin/bsdinstall/scripts

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 15:32:53 2020
New Revision: 363097
URL: https://svnweb.freebsd.org/changeset/base/363097

Log:
  bsdinstall: kill dhclient before starting a new instance
  
  PR:   205821
  Submitted by: William Orr 
  MFC after:2 weeks
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon
  Differential Revision:https://reviews.freebsd.org/D14572

Modified:
  head/usr.sbin/bsdinstall/scripts/netconfig_ipv4

Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
==
--- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Sat Jul 11 14:55:11 
2020(r363096)
+++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Sat Jul 11 15:32:53 
2020(r363097)
@@ -51,7 +51,7 @@ if [ $? -eq $DIALOG_OK ]; then
if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
ifconfig $INTERFACE up
dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring 
DHCP lease..." 0 0
-   err=$( dhclient $INTERFACE 2>&1 )
+   err=$( pkill dhclient; dhclient $INTERFACE 2>&1 )
if [ $? -ne 0 ]; then
f_dprintf "%s" "$err"
dialog --backtitle 'FreeBSD Installer' --msgbox "DHCP 
lease acquisition failed." 0 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: r363096 - stable/12/sbin/md5

2020-07-11 Thread Allan Jude
Author: allanjude
Date: Sat Jul 11 14:55:11 2020
New Revision: 363096
URL: https://svnweb.freebsd.org/changeset/base/363096

Log:
  MFC r346369
Close filedescriptors when done with them.
  
  MFC r362412
fix -c flag to work with input on stdin
  
  PR:   247295
  Sponsored by: Klara Inc.
  Event:July 2020 Bugathon

Modified:
  stable/12/sbin/md5/md5.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/md5/md5.c
==
--- stable/12/sbin/md5/md5.cSat Jul 11 13:56:36 2020(r363095)
+++ stable/12/sbin/md5/md5.cSat Jul 11 14:55:11 2020(r363096)
@@ -52,11 +52,14 @@ __FBSDID("$FreeBSD$");
 #define TEST_BLOCK_COUNT 10
 #define MDTESTCOUNT 8
 
+static int pflag;
 static int qflag;
 static int rflag;
 static int sflag;
+static int skip;
 static char* checkAgainst;
 static int checksFailed;
+static int failed;
 
 typedef void (DIGEST_Init)(void *);
 typedef void (DIGEST_Update)(void *, const unsigned char *, size_t);
@@ -86,10 +89,10 @@ typedef struct Algorithm_t {
 } Algorithm_t;
 
 static void MD5_Update(MD5_CTX *, const unsigned char *, size_t);
-static void MDString(const Algorithm_t *, const char *);
+static void MDOutput(const Algorithm_t *, char *, char **);
 static void MDTimeTrial(const Algorithm_t *);
 static void MDTestSuite(const Algorithm_t *);
-static void MDFilter(const Algorithm_t *, int);
+static char *MDFilter(const Algorithm_t *, char*, int);
 static void usage(const Algorithm_t *);
 
 typedef union {
@@ -170,9 +173,9 @@ main(int argc, char *argv[])
cap_rights_trights;
 #endif
int ch, fd;
-   char   *p;
+   char   *p, *string;
charbuf[HEX_DIGEST_LENGTH];
-   int failed;
+   size_t  len;
unsigneddigest;
const char* progname;
 
@@ -191,13 +194,14 @@ main(int argc, char *argv[])
failed = 0;
checkAgainst = NULL;
checksFailed = 0;
+   skip = 0;
while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1)
switch (ch) {
case 'c':
checkAgainst = optarg;
break;
case 'p':
-   MDFilter([digest], 1);
+   pflag = 1;
break;
case 'q':
qflag = 1;
@@ -207,13 +211,15 @@ main(int argc, char *argv[])
break;
case 's':
sflag = 1;
-   MDString([digest], optarg);
+   string = optarg;
break;
case 't':
MDTimeTrial([digest]);
+   skip = 1;
break;
case 'x':
MDTestSuite([digest]);
+   skip = 1;
break;
default:
usage([digest]);
@@ -247,32 +253,21 @@ main(int argc, char *argv[])
err(1, "capsicum");
 #endif
}
-   if ((p = Algorithm[digest].Fd(fd, buf)) == NULL) {
-   warn("%s", *argv);
-   failed++;
-   } else {
-   if (qflag)
-   printf("%s", p);
-   else if (rflag)
-   printf("%s %s", p, *argv);
-   else
-   printf("%s (%s) = %s",
-   Algorithm[digest].name, *argv, p);
-   if (checkAgainst && strcasecmp(checkAgainst, p) 
!= 0)
-   {
-   checksFailed++;
-   if (!qflag)
-   printf(" [ Failed ]");
-   }
-   printf("\n");
-   }
+   p = Algorithm[digest].Fd(fd, buf);
+   (void)close(fd);
+   MDOutput([digest], p, argv);
} while (*++argv);
-   } else if (!sflag && (optind == 1 || qflag || rflag)) {
+   } else if (!sflag && !skip) {
 #ifdef HAVE_CAPSICUM
if (caph_limit_stdin() < 0 || caph_enter() < 0)
err(1, "capsicum");
 #endif
-   MDFilter([digest], 0);
+   p = MDFilter([digest], (char *), pflag);
+   MDOutput([digest], p, NULL);
+   } else if (sflag) {
+   len = strlen(string);
+   p = Algorithm[digest].Data(string, len, buf);
+   MDOutput([digest], p, );
}
 
if (failed != 0)
@@ -282,30 +277,38 @@ main(int 

svn commit: r362654 - head/sbin/ifconfig

2020-06-26 Thread Allan Jude
Author: allanjude
Date: Fri Jun 26 16:20:34 2020
New Revision: 362654
URL: https://svnweb.freebsd.org/changeset/base/362654

Log:
  ifconfig(8): optimize -f ether:dash mode
  
  Switch to the simplified while loop suggest by Aaron LI
  
  Post commit review via: https://reviews.freebsd.org/rS301185#inline-232
  
  Submitted by: Aaron LI 
  Sponsored by: Klara Inc.

Modified:
  head/sbin/ifconfig/af_link.c

Modified: head/sbin/ifconfig/af_link.c
==
--- head/sbin/ifconfig/af_link.cFri Jun 26 16:16:25 2020
(r362653)
+++ head/sbin/ifconfig/af_link.cFri Jun 26 16:20:34 2020
(r362654)
@@ -74,10 +74,10 @@ link_status(int s __unused, const struct ifaddrs *ifa)
sdl->sdl_type == IFT_BRIDGE) && sdl->sdl_alen == ETHER_ADDR_LEN) {
ether_format = ether_ntoa((struct ether_addr *)LLADDR(sdl));
if (f_ether != NULL && strcmp(f_ether, "dash") == 0) {
-   for (format_char = strchr(ether_format, ':');
-   format_char != NULL;
-   format_char = strchr(ether_format, ':'))
+   while ((format_char = strchr(ether_format, ':')) !=
+   NULL) {
*format_char = '-';
+   }
}
printf("\tether %s\n", ether_format);
} else {
___
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: r362652 - head/sbin/ifconfig

2020-06-26 Thread Allan Jude
Author: allanjude
Date: Fri Jun 26 15:14:03 2020
New Revision: 362652
URL: https://svnweb.freebsd.org/changeset/base/362652

Log:
  ifconfig(8): remove duplicate line from man page
  
  Reported by:  Weitian LI 
  Sponsored by: Klara Inc.

Modified:
  head/sbin/ifconfig/ifconfig.8

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Fri Jun 26 14:18:08 2020
(r362651)
+++ head/sbin/ifconfig/ifconfig.8   Fri Jun 26 15:14:03 2020
(r362652)
@@ -2914,7 +2914,6 @@ The
 flag limits this to interfaces that are down,
 .Fl u
 limits this to interfaces that are up,
-limits this to interfaces that are up,
 .Fl g
 limits this to members of the specified group of interfaces, and
 .Fl G
___
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: r362505 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-06-22 Thread Allan Jude
Author: allanjude
Date: Mon Jun 22 19:03:02 2020
New Revision: 362505
URL: https://svnweb.freebsd.org/changeset/base/362505

Log:
  MFOpenZFS: Add zio_ddt_free()+ddt_phys_decref() error handling
  
  The assumption in zio_ddt_free() is that ddt_phys_select() must
  always find a match.  However, if that fails due to a damaged
  DDT or some other reason the code will NULL dereference in
  ddt_phys_decref().
  
  While this should never happen it has been observed on various
  platforms.  The result is that unless your willing to patch the
  ZFS code the pool is inaccessible.  Therefore, we're choosing
  to more gracefully handle this case rather than leave it fatal.
  
  http://mail.opensolaris.org/pipermail/zfs-discuss/2012-February/050972.html
  
  https://github.com/openzfs/zfs/commit/5dc6af0eec29b119b731c793037fd77214fc9438
  
  Reported by:  Pierre Beyssac
  Obtained from:OpenZFS
  MFC after:2 weeks
  Sponsored by: Klara Inc.

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c   Mon Jun 22 
17:57:49 2020(r362504)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c   Mon Jun 22 
19:03:02 2020(r362505)
@@ -325,8 +325,10 @@ ddt_phys_addref(ddt_phys_t *ddp)
 void
 ddt_phys_decref(ddt_phys_t *ddp)
 {
-   ASSERT((int64_t)ddp->ddp_refcnt > 0);
-   ddp->ddp_refcnt--;
+   if (ddp) {
+   ASSERT((int64_t)ddp->ddp_refcnt > 0);
+   ddp->ddp_refcnt--;
+   }
 }
 
 void

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 22 
17:57:49 2020(r362504)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon Jun 22 
19:03:02 2020(r362505)
@@ -2937,8 +2937,11 @@ zio_ddt_free(zio_t *zio)
 
ddt_enter(ddt);
freedde = dde = ddt_lookup(ddt, bp, B_TRUE);
-   ddp = ddt_phys_select(dde, bp);
-   ddt_phys_decref(ddp);
+   if (dde) {
+   ddp = ddt_phys_select(dde, bp);
+   if (ddp)
+   ddt_phys_decref(ddp);
+   }
ddt_exit(ddt);
 
return (zio);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362412 - head/sbin/md5

2020-06-19 Thread Allan Jude
Author: allanjude
Date: Fri Jun 19 19:16:25 2020
New Revision: 362412
URL: https://svnweb.freebsd.org/changeset/base/362412

Log:
  md5(1): fix -c flag to work with input on stdin
  
  Previously, the -p and -c flags were ignored when reading from stdin
  Additionally, -s and -c can be used together now.
  
  PR:   247295
  Reviewed by:  kevans
  MFC after:2 weeks
  Relnotes: yes
  Sponsored by: Klara Inc.
  Differential Revision:https://reviews.freebsd.org/D25362

Modified:
  head/sbin/md5/md5.c

Modified: head/sbin/md5/md5.c
==
--- head/sbin/md5/md5.c Fri Jun 19 18:54:55 2020(r362411)
+++ head/sbin/md5/md5.c Fri Jun 19 19:16:25 2020(r362412)
@@ -52,11 +52,14 @@ __FBSDID("$FreeBSD$");
 #define TEST_BLOCK_COUNT 10
 #define MDTESTCOUNT 8
 
+static int pflag;
 static int qflag;
 static int rflag;
 static int sflag;
+static int skip;
 static char* checkAgainst;
 static int checksFailed;
+static int failed;
 
 typedef void (DIGEST_Init)(void *);
 typedef void (DIGEST_Update)(void *, const unsigned char *, size_t);
@@ -86,10 +89,10 @@ typedef struct Algorithm_t {
 } Algorithm_t;
 
 static void MD5_Update(MD5_CTX *, const unsigned char *, size_t);
-static void MDString(const Algorithm_t *, const char *);
+static void MDOutput(const Algorithm_t *, char *, char **);
 static void MDTimeTrial(const Algorithm_t *);
 static void MDTestSuite(const Algorithm_t *);
-static void MDFilter(const Algorithm_t *, int);
+static char *MDFilter(const Algorithm_t *, char*, int);
 static void usage(const Algorithm_t *);
 
 typedef union {
@@ -170,9 +173,9 @@ main(int argc, char *argv[])
cap_rights_trights;
 #endif
int ch, fd;
-   char   *p;
+   char   *p, *string;
charbuf[HEX_DIGEST_LENGTH];
-   int failed;
+   size_t  len;
unsigneddigest;
const char* progname;
 
@@ -191,13 +194,14 @@ main(int argc, char *argv[])
failed = 0;
checkAgainst = NULL;
checksFailed = 0;
+   skip = 0;
while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1)
switch (ch) {
case 'c':
checkAgainst = optarg;
break;
case 'p':
-   MDFilter([digest], 1);
+   pflag = 1;
break;
case 'q':
qflag = 1;
@@ -207,13 +211,15 @@ main(int argc, char *argv[])
break;
case 's':
sflag = 1;
-   MDString([digest], optarg);
+   string = optarg;
break;
case 't':
MDTimeTrial([digest]);
+   skip = 1;
break;
case 'x':
MDTestSuite([digest]);
+   skip = 1;
break;
default:
usage([digest]);
@@ -249,32 +255,19 @@ main(int argc, char *argv[])
}
p = Algorithm[digest].Fd(fd, buf);
(void)close(fd);
-   if (p == NULL) {
-   warn("%s", *argv);
-   failed++;
-   } else {
-   if (qflag)
-   printf("%s", p);
-   else if (rflag)
-   printf("%s %s", p, *argv);
-   else
-   printf("%s (%s) = %s",
-   Algorithm[digest].name, *argv, p);
-   if (checkAgainst && strcasecmp(checkAgainst, p) 
!= 0)
-   {
-   checksFailed++;
-   if (!qflag)
-   printf(" [ Failed ]");
-   }
-   printf("\n");
-   }
+   MDOutput([digest], p, argv);
} while (*++argv);
-   } else if (!sflag && (optind == 1 || qflag || rflag)) {
+   } else if (!sflag && !skip) {
 #ifdef HAVE_CAPSICUM
if (caph_limit_stdin() < 0 || caph_enter() < 0)
err(1, "capsicum");
 #endif
-   MDFilter([digest], 0);
+   p = MDFilter([digest], (char *), pflag);
+   MDOutput([digest], p, NULL);
+   } else if (sflag) {
+   len = strlen(string);
+   p = Algorithm[digest].Data(string, len, buf);
+   MDOutput([digest], p, );
}
 
if (failed != 0)
@@ -284,30 +277,38 @@ main(int argc, char *argv[])
 
   

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

2020-06-19 Thread Allan Jude
Author: allanjude
Date: Fri Jun 19 17:59:55 2020
New Revision: 362396
URL: https://svnweb.freebsd.org/changeset/base/362396

Log:
  ZFS: Allow setting checksum=skein on boot pools
  
  PR:   245889
  Reported by:  delphij
  Sponsored by: Klara Inc.

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Jun 19 17:56:05 2020
(r362395)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Jun 19 17:59:55 2020
(r362396)
@@ -1001,9 +1001,9 @@ for more information on these algorithms.
 .Pp
 Changing this property affects only newly-written data.
 .Pp
-Salted checksum algorithms
-.Pq Cm edonr , skein
-are currently not supported for any filesystem on the boot pools.
+The salted checksum algorithm
+.Pq Cm edonr
+is currently not supported on FreeBSD.
 .It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle 
| Cm lz4
 Controls the compression algorithm used for this dataset.
 Setting compression to

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7Fri Jun 19 
17:56:05 2020(r362395)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7Fri Jun 19 
17:59:55 2020(r362396)
@@ -632,6 +632,9 @@ and will return to being
 once all filesystems that have ever had their checksum set to
 .Sy skein
 are destroyed.
+Booting off of pools using
+.Sy skein
+is supported.
 .It Sy allocation_classes
 .Bl -column "READ\-ONLY COMPATIBLE" "com.intel:allocation_classes"
 .It GUID Ta com.intel:allocation_classes

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jun 
19 17:56:05 2020(r362395)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jun 
19 17:59:55 2020(r362396)
@@ -4373,16 +4373,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair,
 
if ((err = spa_open(dsname, , FTAG)) != 0)
return (err);
-   /*
-* Salted checksums are not supported on root pools.
-*/
-   if (spa_bootfs(spa) != 0 &&
-   intval < ZIO_CHECKSUM_FUNCTIONS &&
-   (zio_checksum_table[intval].ci_flags &
-   ZCHECKSUM_FLAG_SALTED)) {
-   spa_close(spa, FTAG);
-   return (SET_ERROR(ERANGE));
-   }
+
if (!spa_feature_is_enabled(spa, feature)) {
spa_close(spa, FTAG);
return (SET_ERROR(ENOTSUP));
___
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: r361870 - in head/sys/geom: . label

2020-06-06 Thread Allan Jude
On 2020-06-06 10:55, Shawn Webb wrote:
> On Sat, Jun 06, 2020 at 02:19:16PM +, Conrad Meyer wrote:
>> Author: cem
>> Date: Sat Jun  6 14:19:16 2020
>> New Revision: 361870
>> URL: https://svnweb.freebsd.org/changeset/base/361870
>>
>> Log:
>>   Revert r361838
> 
> Why?
> 

https://lists.freebsd.org/pipermail/freebsd-current/2020-June/076210.html


-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r360230 - head/usr.sbin/trim

2020-04-23 Thread Allan Jude
Author: allanjude
Date: Thu Apr 23 20:14:59 2020
New Revision: 360230
URL: https://svnweb.freebsd.org/changeset/base/360230

Log:
  trim(8): candelete() returns wrong results because fd is opened O_WRONLY
  
  This was discovered while using trim(8) to test bhyve trim
  
  Reviewed by:  asomers
  Differential Revision:https://reviews.freebsd.org/D24371

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

Modified: head/usr.sbin/trim/trim.c
==
--- head/usr.sbin/trim/trim.c   Thu Apr 23 19:20:58 2020(r360229)
+++ head/usr.sbin/trim/trim.c   Thu Apr 23 20:14:59 2020(r360230)
@@ -220,7 +220,7 @@ trim(const char *path, off_t offset, off_t length, boo
return (0);
}
 
-   fd = opendev(path, O_WRONLY | O_DIRECT);
+   fd = opendev(path, O_RDWR | O_DIRECT);
arg[0] = offset;
arg[1] = length;
 
___
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: r360229 - head/usr.sbin/bhyve

2020-04-23 Thread Allan Jude
Author: allanjude
Date: Thu Apr 23 19:20:58 2020
New Revision: 360229
URL: https://svnweb.freebsd.org/changeset/base/360229

Log:
  Add VIRTIO_BLK_T_DISCARD (TRIM) support to the bhyve virtio-blk backend
  
  This will advertise support for TRIM to the guest virtio-blk driver and
  perform the DIOCGDELETE ioctl on the backing storage if it supports it.
  
  Thanks to Jason King and others at Joyent and illumos for expanding on
  my original patch, adding improvements including better error handling
  and making sure to following the virtio spec.
  
  Submitted by: Jason King  (improvements)
  Reviewed by:  jhb
  Obtained from:illumos-joyent (improvements)
  MFC after:1 month
  Relnotes: yes
  Sponsored by: Klara Inc.
  Differential Revision:https://reviews.freebsd.org/D21707

Modified:
  head/usr.sbin/bhyve/block_if.c
  head/usr.sbin/bhyve/pci_virtio_block.c

Modified: head/usr.sbin/bhyve/block_if.c
==
--- head/usr.sbin/bhyve/block_if.c  Thu Apr 23 19:16:20 2020
(r360228)
+++ head/usr.sbin/bhyve/block_if.c  Thu Apr 23 19:20:58 2020
(r360229)
@@ -3,6 +3,7 @@
  *
  * Copyright (c) 2013  Peter Grehan 
  * All rights reserved.
+ * Copyright 2020 Joyent, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -410,6 +411,8 @@ blockif_open(const char *optstr, const char *ident)
off_t size, psectsz, psectoff;
int extra, fd, i, sectsz;
int nocache, sync, ro, candelete, geom, ssopt, pssopt;
+   int nodelete;
+
 #ifndef WITHOUT_CAPSICUM
cap_rights_t rights;
cap_ioctl_t cmds[] = { DIOCGFLUSH, DIOCGDELETE };
@@ -422,6 +425,7 @@ blockif_open(const char *optstr, const char *ident)
nocache = 0;
sync = 0;
ro = 0;
+   nodelete = 0;
 
/*
 * The first element in the optstring is always a pathname.
@@ -434,6 +438,8 @@ blockif_open(const char *optstr, const char *ident)
continue;
else if (!strcmp(cp, "nocache"))
nocache = 1;
+   else if (!strcmp(cp, "nodelete"))
+   nodelete = 1;
else if (!strcmp(cp, "sync") || !strcmp(cp, "direct"))
sync = 1;
else if (!strcmp(cp, "ro"))
@@ -500,7 +506,7 @@ blockif_open(const char *optstr, const char *ident)
ioctl(fd, DIOCGSTRIPEOFFSET, );
strlcpy(arg.name, "GEOM::candelete", sizeof(arg.name));
arg.len = sizeof(arg.value.i);
-   if (ioctl(fd, DIOCGATTR, ) == 0)
+   if (nodelete == 0 && ioctl(fd, DIOCGATTR, ) == 0)
candelete = arg.value.i;
if (ioctl(fd, DIOCGPROVIDERNAME, name) == 0)
geom = 1;

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==
--- head/usr.sbin/bhyve/pci_virtio_block.c  Thu Apr 23 19:16:20 2020
(r360228)
+++ head/usr.sbin/bhyve/pci_virtio_block.c  Thu Apr 23 19:20:58 2020
(r360229)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2011 NetApp, Inc.
  * All rights reserved.
- * Copyright (c) 2019 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -57,26 +57,37 @@ __FBSDID("$FreeBSD$");
 #include "virtio.h"
 #include "block_if.h"
 
-#define VTBLK_RINGSZ   128
+#defineVTBLK_BSIZE 512
+#defineVTBLK_RINGSZ128
 
 _Static_assert(VTBLK_RINGSZ <= BLOCKIF_RING_MAX, "Each ring entry must be able 
to queue a request");
 
-#define VTBLK_S_OK 0
-#define VTBLK_S_IOERR  1
+#defineVTBLK_S_OK  0
+#defineVTBLK_S_IOERR   1
 #defineVTBLK_S_UNSUPP  2
 
 #defineVTBLK_BLK_ID_BYTES  20 + 1
 
 /* Capability bits */
-#defineVTBLK_F_SEG_MAX (1 << 2)/* Maximum request 
segments */
-#defineVTBLK_F_BLK_SIZE(1 << 6)/* cfg block size valid 
*/
-#defineVTBLK_F_FLUSH   (1 << 9)/* Cache flush support 
*/
-#defineVTBLK_F_TOPOLOGY(1 << 10)   /* Optimal I/O 
alignment */
+#defineVTBLK_F_BARRIER (1 << 0)/* Does host support 
barriers? */
+#defineVTBLK_F_SIZE_MAX(1 << 1)/* Indicates maximum 
segment size */
+#defineVTBLK_F_SEG_MAX (1 << 2)/* Indicates maximum # 
of segments */
+#defineVTBLK_F_GEOMETRY(1 << 4)/* Legacy geometry 
available  */
+#defineVTBLK_F_RO  (1 << 5)/* Disk is read-only */
+#defineVTBLK_F_BLK_SIZE(1 << 6)/* Block size of disk 
is available*/
+#defineVTBLK_F_SCSI

Re: svn commit: r353057 - head/sys/net

2019-10-06 Thread Allan Jude
On 2019-10-04 08:57, Kyle Evans wrote:
> On Thu, Oct 3, 2019 at 12:54 PM Kyle Evans  wrote:
>>
>> Author: kevans
>> Date: Thu Oct  3 17:54:00 2019
>> New Revision: 353057
>> URL: https://svnweb.freebsd.org/changeset/base/353057
>>
>> Log:
>>   if_tuntap: create /dev aliases when a tuntap device gets renamed
>>
>>   Currently, if you do:
>>
>>   $ ifconfig tun0 create
>>   $ ifconfig tun0 name wg0
>>   $ ls -l /dev | egrep 'wg|tun'
>>
>>   You will see tun0, but no wg0. In fact, it's slightly more annoying to make
>>   the association between the new name and the old name in order to open the
>>   device (if it hadn't been opened during the rename).
>>
>>   Register an eventhandler for ifnet_arrival_events and catch interface
>>   renames. We can determine if the ifnet is a tun easily enough from the
>>   if_dname, which matches the cevsw.d_name from the associated tuntap_driver.
>>
>>   Some locking dance is required because renames don't require the device to
>>   be opened, so it could go away in the middle of handling the ioctl, but as
>>   soon as we've verified this isn't the case we can attempt to busy the tun
>>   and either bail out if the tun device is dying, or we can proceed with the
>>   rename.
>>
>>   We only create these aliases on a best-effort basis. Renaming a tun device
>>   to "usbctl", which doesn't exist as an ifnet but does as a /dev, is clearly
>>   not that disastrous, but we can't and won't create a /dev for that.
>>
> 
> It's been brought to my attention that I actually had a PR that I took
> six months ago that this should've belonged to.
> 
> PR: 219746
> 

Thanks for this, I was having similar problems with this trying to use
wireguard inside a VNET jail, so it was even harder to find and destroy
the correct interface.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r352504 - head/sys/vm

2019-09-19 Thread Allan Jude
Author: allanjude
Date: Thu Sep 19 07:28:24 2019
New Revision: 352504
URL: https://svnweb.freebsd.org/changeset/base/352504

Log:
  sys/vm/vm_glue.c: Incorrect function name in panic string
  
  Use __func__ to avoid this issue in the future.
  
  Submitted by: Wuyang Chung 
  Reviewed by:  markj, emaste
  Obtained from:https://github.com/freebsd/freebsd/pull/410

Modified:
  head/sys/vm/vm_glue.c

Modified: head/sys/vm/vm_glue.c
==
--- head/sys/vm/vm_glue.c   Wed Sep 18 23:33:38 2019(r352503)
+++ head/sys/vm/vm_glue.c   Thu Sep 19 07:28:24 2019(r352504)
@@ -320,7 +320,7 @@ vm_thread_stack_create(struct domainset *ds, vm_object
ks = kva_alloc((pages + KSTACK_GUARD_PAGES) * PAGE_SIZE);
 #endif
if (ks == 0) {
-   printf("vm_thread_new: kstack allocation failed\n");
+   printf("%s: kstack allocation failed\n", __func__);
vm_object_deallocate(ksobj);
return (0);
}
@@ -362,7 +362,7 @@ vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t
for (i = 0; i < pages; i++) {
m = vm_page_lookup(ksobj, i);
if (m == NULL)
-   panic("vm_thread_dispose: kstack already missing?");
+   panic("%s: kstack already missing?", __func__);
vm_page_unwire_noq(m);
vm_page_free(m);
}
___
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: r351812 - head/usr.sbin/mpsutil

2019-09-04 Thread Allan Jude
On 2019-09-04 09:50, Alan Somers wrote:
> On Wed, Sep 4, 2019 at 7:47 AM Andriy Gapon  <mailto:a...@freebsd.org>> wrote:
> 
> Author: avg
> Date: Wed Sep  4 13:47:38 2019
> New Revision: 351812
> URL: https://svnweb.freebsd.org/changeset/base/351812
> 
> Log:
>   mpsutil slot set status
> 
>   This code has been written as a proof of concept, but I think that it
>   can be useful in general.  It allows to set the status of an enclosure
>   slot.  Practically, this means controlling whatever slot status
> LEDs the
>   enclosure provides.  At present, the new command does not have sanity
>   checks or any conveniences.  That means that it is possible to
> issue the
>   command for an invalid slot and an enclosure.  But the worst I
> have seen
>   happening is either the command failing or simply being ignored. 
> Also,
>   at the moment, the status has to be specified as a numeric bit mask.
>   The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they
>   are prefixed with MPI2_SEP_REQ_SLOTSTATUS_.  The only way to address a
>   slot is by the enclosure handle and the slot number.  Both are readily
>   available from mpsutil show commands.
> 
>   So, future enhancements could include alternative ways to address
> a slot
>   (e.g., by a disk handle or a disk device name) and human friendly
> names
>   for slot statuses.
> 
>   The new command is useful alternative to 'sas2ircu locate' command.
>   First, sas2ircu is a proprietary blob.  Second, it supports
> setting only
>   locate / identify status bit.
> 
>   Tested on HP H220 running LSI IT firmware 20.x.
> 
>   Reviewed by:  bapt
>   MFC after:    3 weeks
>   Differential Revision:        https://reviews.freebsd.org/D20535
> 
> Added:
>   head/usr.sbin/mpsutil/mps_slot.c   (contents, props changed)
> Modified:
>   head/usr.sbin/mpsutil/Makefile
>   head/usr.sbin/mpsutil/mps_cmd.c
>   head/usr.sbin/mpsutil/mpsutil.h
> 
> 
> Is this redundant with sesutil, or does it work on different kinds of
> enclosures? 

mpsutil's method will work on direct-attach backplanes and enclosures,
where sesutil only works if there is an expander that provides the SES
service.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r345491 - in head/sys: conf fs/tmpfs modules/tmpfs

2019-09-03 Thread Allan Jude
On 2019-03-25 15:17, Cy Schubert wrote:
> In message <3398a21318a4a6715609004d569d20de86f1dc7a.ca...@freebsd.org>
> , Ian Le
> pore writes:
>> On Mon, 2019-03-25 at 05:42 -0700, Cy Schubert wrote:
>>> In message <201903250746.x2p7kkuu019...@repo.freebsd.org>, Allan
>>> Jude 
>>> writes:
>>>> Author: allanjude
>>>> Date: Mon Mar 25 07:46:20 2019
>>>> New Revision: 345491
>>>> URL: https://svnweb.freebsd.org/changeset/base/345491
>>>>
>>>> Log:
>>>>   Make TMPFS_PAGES_MINRESERVED a kernel option
>>>>   
>>>>   TMPFS_PAGES_MINRESERVED controls how much memory is reserved for
>>>> the system
>>>>   and not used by tmpfs.
>>>>   
>>>>   On very small memory systems, the default value may be too high
>>>> and this
>>>>   prevents these small memory systems from using reroot, which is
>>>> required
>>>>   for them to install firmware updates.
>>>>   
>>>>   Submitted by:Hiroki Mori 
>>>>   Reviewed by: mizhka
>>>>   Differential Revision:   https://reviews.freebsd.org/D13583
>>>>
>>>> Modified:
>>>>   head/sys/conf/options
>>>>   head/sys/fs/tmpfs/tmpfs.h
>>>>   head/sys/fs/tmpfs/tmpfs_vfsops.c
>>>>   head/sys/modules/tmpfs/Makefile
>>>>
>>>
>>> Would this be a good candidate for a sysctl or tuneable?
>>>
>>
>> The small-memory embedded systems most affected by this often don't use
>> loader(8) at all, so tunables aren't an option, and sysctl may be too
>> late.  No reason it can't be a tunable as well, but it'll probably need
>> to remain as a compile-time option too.
> 
> Yes, I should have been more clear. I can see using a tuneable on a 2 
> GB or 4 GB Intel pandaboard. (Perfect for a firewall or a UPS 
> management station.)
> 
> 

The default value is 4MB. For any system with more than 32mb of memory,
it shouldn't require tuning, although you may wish to prevent tmpfs from
using all but 4mb of your memory.

I think the only case where you definitely need to override the default,
is when you have so little memory that you can't create a tmpfs image of
your root filesystem to reroot into, as is the case on many tiny router
boards, with 8-32mb of ram, and 4-16mb of flash.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r349235 - head/usr.bin/top

2019-06-20 Thread Allan Jude
Author: allanjude
Date: Thu Jun 20 15:44:43 2019
New Revision: 349235
URL: https://svnweb.freebsd.org/changeset/base/349235

Log:
  top(1): Don't show the swap line when there are no swap devices
  
  Submitted by: antran...@freebsd.am
  Reviewed by:  bapt
  MFC after:1 month
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D18928

Modified:
  head/usr.bin/top/display.c
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Thu Jun 20 14:40:36 2019(r349234)
+++ head/usr.bin/top/display.c  Thu Jun 20 15:44:43 2019(r349235)
@@ -675,6 +675,9 @@ i_swap(int *stats)
 {
 swap_buffer = setup_buffer(swap_buffer, 0);
 
+if (swap_names == NULL)
+   return;
+
 fputs("\nSwap: ", stdout);
 lastline++;
 
@@ -689,6 +692,9 @@ u_swap(int *stats)
 static char *new = NULL;
 
 new = setup_buffer(new, 0);
+
+if (swap_names == NULL)
+   return;
 
 /* format the new line */
 summary_format(new, stats, swap_names);

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Thu Jun 20 14:40:36 2019(r349234)
+++ head/usr.bin/top/machine.c  Thu Jun 20 15:44:43 2019(r349235)
@@ -150,6 +150,7 @@ static const char *swapnames[] = {
 };
 static int swap_stats[nitems(swapnames)];
 
+static int has_swap;
 
 /* these are for keeping track of the proc array */
 
@@ -248,12 +249,12 @@ update_layout(void)
y_mem = 3;
y_arc = 4;
y_carc = 5;
-   y_swap = 4 + arc_enabled + carc_enabled;
-   y_idlecursor = 5 + arc_enabled + carc_enabled;
-   y_message = 5 + arc_enabled + carc_enabled;
-   y_header = 6 + arc_enabled + carc_enabled;
-   y_procs = 7 + arc_enabled + carc_enabled;
-   Header_lines = 7 + arc_enabled + carc_enabled;
+   y_swap = 3 + arc_enabled + carc_enabled + has_swap;
+   y_idlecursor = 4 + arc_enabled + carc_enabled + has_swap;
+   y_message = 4 + arc_enabled + carc_enabled + has_swap;
+   y_header = 5 + arc_enabled + carc_enabled + has_swap;
+   y_procs = 6 + arc_enabled + carc_enabled + has_swap;
+   Header_lines = 6 + arc_enabled + carc_enabled + has_swap;
 
if (pcpu_stats) {
y_mem += ncpus - 1;
@@ -273,7 +274,7 @@ machine_init(struct statics *statics)
 {
int i, j, empty, pagesize;
uint64_t arc_size;
-   int carc_en;
+   int carc_en, nswapdev;
size_t size;
 
size = sizeof(smpmode);
@@ -298,6 +299,11 @@ machine_init(struct statics *statics)
if (kd == NULL)
return (-1);
 
+   size = sizeof(nswapdev);
+   if (sysctlbyname("vm.nswapdev", , , NULL,
+   0) == 0 && nswapdev != 0)
+   has_swap = 1;
+
GETSYSCTL("kern.ccpu", ccpu);
 
/* this is used in calculating WCPU -- calculate it ahead of time */
@@ -332,7 +338,10 @@ machine_init(struct statics *statics)
statics->carc_names = carcnames;
else
statics->carc_names = NULL;
-   statics->swap_names = swapnames;
+   if (has_swap)
+   statics->swap_names = swapnames;
+   else
+   statics->swap_names = NULL;
statics->order_names = ordernames;
 
/* Allocate state for per-CPU stats. */
___
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: r349034 - stable/12/cddl/contrib/opensolaris/cmd/zpool

2019-06-14 Thread Allan Jude
Author: allanjude
Date: Fri Jun 14 15:09:08 2019
New Revision: 349034
URL: https://svnweb.freebsd.org/changeset/base/349034

Log:
  MFC r348714:
  
  zpool.8: the comment property is not read-only
  
  The comment property was listed in the man page twice, once under the list
  of read-only properties, and again (correctly), under the list of user
  editable properties.
  
  PR:   238355
  Reported by:  Michael Zuo 
  Sponsored by: Klara Systems

Modified:
  stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8Fri Jun 14 
10:39:05 2019(r349033)
+++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8Fri Jun 14 
15:09:08 2019(r349034)
@@ -604,10 +604,6 @@ Amount of storage space within the pool that has been 
 .It Sy capacity
 Percentage of pool space used. This property can also be referred to by its
 shortened column name, "cap".
-.It Sy comment
-A text string consisting of printable ASCII characters that will be stored
-such that it is available even if the pool becomes faulted.  An administrator
-can provide additional information about a pool using this property.
 .It Sy dedupratio
 The deduplication ratio specified for a pool, expressed as a multiplier.
 For example, 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: r348726 - stable/11/sys/dev/acpica

2019-06-05 Thread Allan Jude
Author: allanjude
Date: Thu Jun  6 05:10:32 2019
New Revision: 348726
URL: https://svnweb.freebsd.org/changeset/base/348726

Log:
  MFC r348065:
  
  Correct the way remaining battery life is calculated
  
  Previously, if a system had multiple batteries, the remaining life
  percentage was calculated as the average of each battery's percent
  remaining. This results in rather incorrect values when you consider the
  case of the Thinkpad X270 that has a small 3 cell internally battery, and
  a hot-swappable 9 cell battery that is used first. Battery 0 is at 100%,
  but battery 1 is at 10%, you do not infact have 55% of your capacity
  remaining.
  
  The new method calculates the percentage based on remaining capacity
  out of total capacity, giving a much more accurate reading.
  
  PR:   229818
  Submitted by: Keegan Drake H.P. 
  Sponsored by: Klara Systems
  Event:Waterloo Hackathon 2019
  Approved by:  re (gjb)

Modified:
  stable/11/sys/dev/acpica/acpi_battery.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/acpica/acpi_battery.c
==
--- stable/11/sys/dev/acpica/acpi_battery.c Thu Jun  6 05:09:43 2019
(r348725)
+++ stable/11/sys/dev/acpica/acpi_battery.c Thu Jun  6 05:10:32 2019
(r348726)
@@ -119,7 +119,7 @@ int
 acpi_battery_get_battinfo(device_t dev, struct acpi_battinfo *battinfo)
 {
 intbatt_stat, devcount, dev_idx, error, i;
-int total_cap, total_min, valid_rate, valid_units;
+int total_cap, total_lfcap, total_min, valid_rate, valid_units;
 devclass_t batt_dc;
 device_t batt_dev;
 struct acpi_bst *bst;
@@ -152,6 +152,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
  */
 dev_idx = -1;
 batt_stat = valid_rate = valid_units = 0;
+total_cap = total_lfcap = 0;
 for (i = 0; i < devcount; i++) {
/* Default info for every battery is "not present". */
acpi_reset_battinfo([i]);
@@ -213,17 +214,23 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
if (!acpi_battery_bif_valid(bif))
continue;
 
-   /* Calculate percent capacity remaining. */
-   bi[i].cap = (100 * bst[i].cap) / bif->lfcap;
-
/*
 * Some laptops report the "design-capacity" instead of the
 * "real-capacity" when the battery is fully charged.  That breaks
 * the above arithmetic as it needs to be 100% maximum.
 */
-   if (bi[i].cap > 100)
-   bi[i].cap = 100;
+   if (bst[i].cap > bif->lfcap)
+   bst[i].cap = bif->lfcap;
 
+   /* Calculate percent capacity remaining. */
+   bi[i].cap = (100 * bst[i].cap) / bif->lfcap;
+
+   /* If this battery is not present, don't use its capacity. */
+   if (bi[i].cap != -1) {
+   total_cap += bst[i].cap;
+   total_lfcap += bif->lfcap;
+   }
+
/*
 * On systems with more than one battery, they may get used
 * sequentially, thus bst.rate may only signify the one currently
@@ -244,7 +251,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
 }
 
 /* Pass 2:  calculate capacity and remaining time for all batteries. */
-total_cap = total_min = 0;
+total_min = 0;
 for (i = 0; i < devcount; i++) {
/*
 * If any batteries are discharging, use the sum of the bst.rate
@@ -256,10 +263,6 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
else
bi[i].min = 0;
total_min += bi[i].min;
-
-   /* If this battery is not present, don't use its capacity. */
-   if (bi[i].cap != -1)
-   total_cap += bi[i].cap;
 }
 
 /*
@@ -268,7 +271,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
  */
 if (valid_units > 0) {
if (dev == NULL) {
-   battinfo->cap = total_cap / valid_units;
+   battinfo->cap = (total_cap * 100) / total_lfcap;
battinfo->min = total_min;
battinfo->state = batt_stat;
battinfo->rate = valid_rate;
___
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: r348725 - stable/11/cddl/contrib/opensolaris/cmd/zfs

2019-06-05 Thread Allan Jude
Author: allanjude
Date: Thu Jun  6 05:09:43 2019
New Revision: 348725
URL: https://svnweb.freebsd.org/changeset/base/348725

Log:
  MFC r347953:
  
  MFV/ZoL: `zfs userspace` ignored all unresolved UIDs after the first
  
  zfsonlinux/zfs@88cfff182432e4d1c24c877f33b47ee6cf109eee
  
  zfs_main: fix `zfs userspace` squashing unresolved entries
  
  The `zfs userspace` squashes all entries with unresolved numeric
  values into a single output entry due to the comparsion always
  made by the string name which is empty in case of unresolved IDs.
  
  Fix this by falling to a numerical comparison when either one
  of string values is not found. This then compares any numerical
  values after all with a name resolved.
  
  Signed-off-by: Pavel Boldin 
  Signed-off-by: Brian Behlendorf 
  
  Reported by:  clusteradm
  Obtained from:ZFS-on-Linux
  
  Approved by:  re (gjb)

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu Jun  6 
03:31:55 2019(r348724)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu Jun  6 
05:09:43 2019(r348725)
@@ -2361,6 +2361,7 @@ us_compare(const void *larg, const void *rarg, void *u
case ZFS_PROP_NAME:
propname = "name";
if (numname) {
+compare_nums:
(void) nvlist_lookup_uint64(lnvl, propname,
);
(void) nvlist_lookup_uint64(rnvl, propname,
@@ -2368,10 +2369,12 @@ us_compare(const void *larg, const void *rarg, void *u
if (rv64 != lv64)
rc = (rv64 < lv64) ? 1 : -1;
} else {
-   (void) nvlist_lookup_string(lnvl, propname,
-   );
-   (void) nvlist_lookup_string(rnvl, propname,
-   );
+   if ((nvlist_lookup_string(lnvl, propname,
+   ) == ENOENT) ||
+   (nvlist_lookup_string(rnvl, propname,
+   ) == ENOENT)) {
+   goto compare_nums;
+   }
rc = strcmp(lvstr, rvstr);
}
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"


svn commit: r348714 - head/cddl/contrib/opensolaris/cmd/zpool

2019-06-05 Thread Allan Jude
Author: allanjude
Date: Thu Jun  6 01:32:00 2019
New Revision: 348714
URL: https://svnweb.freebsd.org/changeset/base/348714

Log:
  zpool.8: the comment property is not read-only
  
  The comment property was listed in the man page twice, once under the list
  of read-only properties, and again (correctly), under the list of user
  editable properties.
  
  PR:   238355
  Reported by:  Michael Zuo 
  Sponsored by: Klara Systems

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool.8

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jun  6 01:16:04 
2019(r348713)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jun  6 01:32:00 
2019(r348714)
@@ -604,10 +604,6 @@ Amount of storage space within the pool that has been 
 .It Sy capacity
 Percentage of pool space used. This property can also be referred to by its
 shortened column name, "cap".
-.It Sy comment
-A text string consisting of printable ASCII characters that will be stored
-such that it is available even if the pool becomes faulted.  An administrator
-can provide additional information about a pool using this property.
 .It Sy dedupratio
 The deduplication ratio specified for a pool, expressed as a multiplier.
 For example, 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: r348703 - stable/12/sys/dev/acpica

2019-06-05 Thread Allan Jude
Author: allanjude
Date: Wed Jun  5 20:31:09 2019
New Revision: 348703
URL: https://svnweb.freebsd.org/changeset/base/348703

Log:
  MFC r348065:
  
  Correct the way remaining battery life is calculated
  
  Previously, if a system had multiple batteries, the remaining life
  percentage was calculated as the average of each battery's percent
  remaining. This results in rather incorrect values when you consider the
  case of the Thinkpad X270 that has a small 3 cell internally battery, and
  a hot-swappable 9 cell battery that is used first. Battery 0 is at 100%,
  but battery 1 is at 10%, you do not infact have 55% of your capacity
  remaining.
  
  The new method calculates the percentage based on remaining capacity
  out of total capacity, giving a much more accurate reading.
  
  PR:   229818
  Submitted by: Keegan Drake H.P. 
  Sponsored by: Klara Systems
  Event:Waterloo Hackathon 2019

Modified:
  stable/12/sys/dev/acpica/acpi_battery.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/acpica/acpi_battery.c
==
--- stable/12/sys/dev/acpica/acpi_battery.c Wed Jun  5 20:27:26 2019
(r348702)
+++ stable/12/sys/dev/acpica/acpi_battery.c Wed Jun  5 20:31:09 2019
(r348703)
@@ -119,7 +119,7 @@ int
 acpi_battery_get_battinfo(device_t dev, struct acpi_battinfo *battinfo)
 {
 intbatt_stat, devcount, dev_idx, error, i;
-int total_cap, total_min, valid_rate, valid_units;
+int total_cap, total_lfcap, total_min, valid_rate, valid_units;
 devclass_t batt_dc;
 device_t batt_dev;
 struct acpi_bst *bst;
@@ -152,6 +152,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
  */
 dev_idx = -1;
 batt_stat = valid_rate = valid_units = 0;
+total_cap = total_lfcap = 0;
 for (i = 0; i < devcount; i++) {
/* Default info for every battery is "not present". */
acpi_reset_battinfo([i]);
@@ -213,17 +214,23 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
if (!acpi_battery_bif_valid(bif))
continue;
 
-   /* Calculate percent capacity remaining. */
-   bi[i].cap = (100 * bst[i].cap) / bif->lfcap;
-
/*
 * Some laptops report the "design-capacity" instead of the
 * "real-capacity" when the battery is fully charged.  That breaks
 * the above arithmetic as it needs to be 100% maximum.
 */
-   if (bi[i].cap > 100)
-   bi[i].cap = 100;
+   if (bst[i].cap > bif->lfcap)
+   bst[i].cap = bif->lfcap;
 
+   /* Calculate percent capacity remaining. */
+   bi[i].cap = (100 * bst[i].cap) / bif->lfcap;
+
+   /* If this battery is not present, don't use its capacity. */
+   if (bi[i].cap != -1) {
+   total_cap += bst[i].cap;
+   total_lfcap += bif->lfcap;
+   }
+
/*
 * On systems with more than one battery, they may get used
 * sequentially, thus bst.rate may only signify the one currently
@@ -244,7 +251,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
 }
 
 /* Pass 2:  calculate capacity and remaining time for all batteries. */
-total_cap = total_min = 0;
+total_min = 0;
 for (i = 0; i < devcount; i++) {
/*
 * If any batteries are discharging, use the sum of the bst.rate
@@ -256,10 +263,6 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
else
bi[i].min = 0;
total_min += bi[i].min;
-
-   /* If this battery is not present, don't use its capacity. */
-   if (bi[i].cap != -1)
-   total_cap += bi[i].cap;
 }
 
 /*
@@ -268,7 +271,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
  */
 if (valid_units > 0) {
if (dev == NULL) {
-   battinfo->cap = total_cap / valid_units;
+   battinfo->cap = (total_cap * 100) / total_lfcap;
battinfo->min = total_min;
battinfo->state = batt_stat;
battinfo->rate = valid_rate;
___
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: r348702 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-06-05 Thread Allan Jude
Author: allanjude
Date: Wed Jun  5 20:27:26 2019
New Revision: 348702
URL: https://svnweb.freebsd.org/changeset/base/348702

Log:
  MFC r348068, r348071
  
  r348068:
  ZFS: Make deadman tunables no longer read-only
  
  This allows the user to enable, disable, and adjust the I/O deadman at
  runtime. This can be especially useful when a pool is backed by remote
  storage (such as iscsi, ggated, etc).
  
  PR:   221906
  Submitted by: Fabian Keil 
  Obtained from:ElectroBSD
  Sponsored by: Klara Systems
  Event:Waterloo Hackathon 2019
  
  r348071:
  Fix typo in r348068
  
  Sponsored by: Klara Systems

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

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Jun 
 5 20:21:17 2019(r348701)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Jun 
 5 20:27:26 2019(r348702)
@@ -363,13 +363,13 @@ SYSCTL_PROC(_vfs_zfs, OID_AUTO, debugflags,
 CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RWTUN, 0, sizeof(int),
 sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing.");
 
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RDTUN,
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RWTUN,
 _deadman_synctime_ms, 0,
 "Stalled ZFS I/O expiration time in milliseconds");
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RDTUN,
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RWTUN,
 _deadman_checktime_ms, 0,
 "Period of checks for stalled ZFS I/O in milliseconds");
-SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN,
+SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RWTUN,
 _deadman_enabled, 0, "Kernel panic on stalled ZFS I/O");
 SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_asize_inflation, CTLFLAG_RWTUN,
 _asize_inflation, 0, "Worst case inflation factor for single sector 
writes");
___
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: r348699 - head/lib/libmd

2019-06-05 Thread Allan Jude
Author: allanjude
Date: Wed Jun  5 20:18:08 2019
New Revision: 348699
URL: https://svnweb.freebsd.org/changeset/base/348699

Log:
  sha.3: clarify admonition against use in NEW signature schemes
  
  Reported by:  cem, cperciva (grammar)

Modified:
  head/lib/libmd/sha.3

Modified: head/lib/libmd/sha.3
==
--- head/lib/libmd/sha.3Wed Jun  5 20:16:25 2019(r348698)
+++ head/lib/libmd/sha.3Wed Jun  5 20:18:08 2019(r348699)
@@ -195,7 +195,7 @@ The
 .Tn SHA1
 algorithm has been proven to be vulnerable to practical collision
 attacks and should not be relied upon to produce unique outputs,
-.Em nor should they be used as part of a cryptographic signature scheme.
+.Em nor should it be used as part of a new cryptographic signature scheme.
 .Pp
 The
 .Tn IA32
___
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: r348696 - stable/12/cddl/contrib/opensolaris/cmd/zfs

2019-06-05 Thread Allan Jude
Author: allanjude
Date: Wed Jun  5 19:46:35 2019
New Revision: 348696
URL: https://svnweb.freebsd.org/changeset/base/348696

Log:
  MFC r347953:
  
  MFV/ZoL: `zfs userspace` ignored all unresolved UIDs after the first
  
  zfsonlinux/zfs@88cfff182432e4d1c24c877f33b47ee6cf109eee
  
  zfs_main: fix `zfs userspace` squashing unresolved entries
  
  The `zfs userspace` squashes all entries with unresolved numeric
  values into a single output entry due to the comparsion always
  made by the string name which is empty in case of unresolved IDs.
  
  Fix this by falling to a numerical comparison when either one
  of string values is not found. This then compares any numerical
  values after all with a name resolved.
  
  Signed-off-by: Pavel Boldin 
  Signed-off-by: Brian Behlendorf 
  
  Reported by:  clusteradm
  Obtained from:ZFS-on-Linux

Modified:
  stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Wed Jun  5 
19:30:32 2019(r348695)
+++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Wed Jun  5 
19:46:35 2019(r348696)
@@ -2361,6 +2361,7 @@ us_compare(const void *larg, const void *rarg, void *u
case ZFS_PROP_NAME:
propname = "name";
if (numname) {
+compare_nums:
(void) nvlist_lookup_uint64(lnvl, propname,
);
(void) nvlist_lookup_uint64(rnvl, propname,
@@ -2368,10 +2369,12 @@ us_compare(const void *larg, const void *rarg, void *u
if (rv64 != lv64)
rc = (rv64 < lv64) ? 1 : -1;
} else {
-   (void) nvlist_lookup_string(lnvl, propname,
-   );
-   (void) nvlist_lookup_string(rnvl, propname,
-   );
+   if ((nvlist_lookup_string(lnvl, propname,
+   ) == ENOENT) ||
+   (nvlist_lookup_string(rnvl, propname,
+   ) == ENOENT)) {
+   goto compare_nums;
+   }
rc = strcmp(lvstr, rvstr);
}
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"


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

2019-05-29 Thread Allan Jude
Author: allanjude
Date: Wed May 29 20:34:35 2019
New Revision: 348370
URL: https://svnweb.freebsd.org/changeset/base/348370

Log:
  Fix assertion in ZFS TRIM code
  
  Due to an attempt to check two conditions at once in a macro not designed
  as such, the assertion would always evaluate to true.
  
  #define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
  const TYPE __left = (TYPE)(LEFT); \
  const TYPE __right = (TYPE)(RIGHT); \
  if (!(__left OP __right)) \
  assfail3(#LEFT " " #OP " " #RIGHT, \
  (uintmax_t)__left, #OP, (uintmax_t)__right, \
  __FILE__, __LINE__); \
  _NOTE(CONSTCOND) } while (0)
  #define ASSERT3U(x, y, z)   VERIFY3_IMPL(x, y, z, uint64_t)
  
  Mean that we compared:
  left = (type == ZIO_TYPE_FREE || psize)
  OP = "<="
  right = (SPA_MAXBLOCKSIZE)
  
  If the type was not FREE, 0 is less than SPA_MAXBLOCKSIZE (16MB)
  If the type is ZIO_TYPE_FREE, 1 is less than SPA_MAXBLOCKSIZE
  The constraint on psize (physical size of the FREE operation) is never
  checked against SPA_MAXBLOCKSIZE
  
  Reported by:  Ka Ho Ng 
  Reviewed by:  kevans
  MFC after:2 weeks
  Sponsored by: Klara Systems

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Wed May 29 
19:11:09 2019(r348369)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Wed May 29 
20:34:35 2019(r348370)
@@ -643,7 +643,7 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const
 {
zio_t *zio;
 
-   ASSERT3U(type == ZIO_TYPE_FREE || psize, <=, SPA_MAXBLOCKSIZE);
+   IMPLY(type != ZIO_TYPE_FREE, psize <= SPA_MAXBLOCKSIZE);
ASSERT(P2PHASE(psize, SPA_MINBLOCKSIZE) == 0);
ASSERT(P2PHASE(offset, SPA_MINBLOCKSIZE) == 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"


Re: svn commit: r348073 - head/lib/libmd

2019-05-22 Thread Allan Jude
On 2019-05-21 19:03, Rodney W. Grimes wrote:
>> Author: allanjude
>> Date: Tue May 21 22:17:00 2019
>> New Revision: 348073
>> URL: https://svnweb.freebsd.org/changeset/base/348073
>>
>> Log:
>>   Add admonitions against using MD5 and SHA1 to the API man pages
>>
>> Modified:
>>   head/lib/libmd/mdX.3
>>   head/lib/libmd/sha.3
>>
>> Modified: head/lib/libmd/mdX.3
>> ==
>> --- head/lib/libmd/mdX.3 Tue May 21 22:11:53 2019(r348072)
>> +++ head/lib/libmd/mdX.3 Tue May 21 22:17:00 2019(r348073)
>> @@ -208,6 +208,8 @@ This code is derived directly from these implementatio
>>  .Pp
>>  Phk ristede runen.
>>  .Sh BUGS
>> -No method is known to exist which finds two files having the same hash 
>> value,
>> -nor to find a file with a specific hash value.
>> -There is on the other hand no guarantee that such a method does not exist.
>> +The
>> +.Tn MD5
> 
> There needs to be a discussion about .Tn, some people are ripping
> them out of man pages, others are adding them.  mandoc is a semantic
> mark up language, .Tn gives the following word the semantic of being
> a Tradename.
> 
> Yes, I know, mandoc ignroes them BUTT other tools do not, mandoc is
> not the end all in what can process our man pages, groff/troff should
> still be able to produce photo typesetter output and the .Tn's look
> nice when you do that.
> 
> I would like to see that we stop removing them and infact, as this
> man page does, properly recognize trademarks/names in our man pages
> "as is often required by law."
> 
> Now, one final nit, I can neither verify nor deny that "MD5" is
> a tradename.
> 
>> +algorithm has been proven to be vulnerable to practical collision
>> +attacks and should not be relied upon to produce unique outputs,
>> +.Em nor should they be used as part of a cryptographic signature scheme.
>>
>> Modified: head/lib/libmd/sha.3
>> ==
>> --- head/lib/libmd/sha.3 Tue May 21 22:11:53 2019(r348072)
>> +++ head/lib/libmd/sha.3 Tue May 21 22:17:00 2019(r348073)
>> @@ -191,9 +191,11 @@ published
>>  .Tn FIPS
>>  standards.
>>  .Sh BUGS
>> -No method is known to exist which finds two files having the same hash 
>> value,
>> -nor to find a file with a specific hash value.
>> -There is on the other hand no guarantee that such a method does not exist.
>> +The
>> +.Tn SHA1
>> +algorithm has been proven to be vulnerable to practical collision
>> +attacks and should not be relied upon to produce unique outputs,
>> +.Em nor should they be used as part of a cryptographic signature scheme.
>>  .Pp
>>  The
>>  .Tn IA32
>>
>>
> 

I borrowed the message (with .Tn markup) from the md5(1) man page, and
just added it to the library reference man pages since they said 'No
method is known to exist which finds two files having the same hash
value' which has not been true in a while.

I did not spend any effort deciding which markup to use there, as I
don't think MD5 or SHA1 are tradenames, just acronyms.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r348073 - head/lib/libmd

2019-05-21 Thread Allan Jude
Author: allanjude
Date: Tue May 21 22:17:00 2019
New Revision: 348073
URL: https://svnweb.freebsd.org/changeset/base/348073

Log:
  Add admonitions against using MD5 and SHA1 to the API man pages

Modified:
  head/lib/libmd/mdX.3
  head/lib/libmd/sha.3

Modified: head/lib/libmd/mdX.3
==
--- head/lib/libmd/mdX.3Tue May 21 22:11:53 2019(r348072)
+++ head/lib/libmd/mdX.3Tue May 21 22:17:00 2019(r348073)
@@ -208,6 +208,8 @@ This code is derived directly from these implementatio
 .Pp
 Phk ristede runen.
 .Sh BUGS
-No method is known to exist which finds two files having the same hash value,
-nor to find a file with a specific hash value.
-There is on the other hand no guarantee that such a method does not exist.
+The
+.Tn MD5
+algorithm has been proven to be vulnerable to practical collision
+attacks and should not be relied upon to produce unique outputs,
+.Em nor should they be used as part of a cryptographic signature scheme.

Modified: head/lib/libmd/sha.3
==
--- head/lib/libmd/sha.3Tue May 21 22:11:53 2019(r348072)
+++ head/lib/libmd/sha.3Tue May 21 22:17:00 2019(r348073)
@@ -191,9 +191,11 @@ published
 .Tn FIPS
 standards.
 .Sh BUGS
-No method is known to exist which finds two files having the same hash value,
-nor to find a file with a specific hash value.
-There is on the other hand no guarantee that such a method does not exist.
+The
+.Tn SHA1
+algorithm has been proven to be vulnerable to practical collision
+attacks and should not be relied upon to produce unique outputs,
+.Em nor should they be used as part of a cryptographic signature scheme.
 .Pp
 The
 .Tn IA32
___
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: r348072 - head/lib/libmd

2019-05-21 Thread Allan Jude
Author: allanjude
Date: Tue May 21 22:11:53 2019
New Revision: 348072
URL: https://svnweb.freebsd.org/changeset/base/348072

Log:
  Add missing errors section to md[2-5], ripemd160, sha*, and skein* manpages
  
  PR:   148987
  Submitted by: Dan Lukes  (original version)
  MFC after:1 week
  Sponsored by: Klara Systems
  Event:Waterloo Hackathon 2019

Modified:
  head/lib/libmd/mdX.3
  head/lib/libmd/ripemd.3
  head/lib/libmd/sha.3
  head/lib/libmd/sha256.3
  head/lib/libmd/sha512.3
  head/lib/libmd/skein.3

Modified: head/lib/libmd/mdX.3
==
--- head/lib/libmd/mdX.3Tue May 21 21:39:03 2019(r348071)
+++ head/lib/libmd/mdX.3Tue May 21 22:11:53 2019(r348072)
@@ -8,7 +8,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 20, 2018
+.Dd May 21, 2019
 .Dt MDX 3
 .Os
 .Sh NAME
@@ -144,6 +144,26 @@ after use.
 If the
 .Fa buf
 argument is non-null it must point to at least 33 characters of buffer space.
+.Sh ERRORS
+The
+.Fn MDXEnd
+function called with a null buf argument may fail and return NULL if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient storage space is available.
+.El
+.Pp
+The
+.Fn MDXFile
+and
+.Fn MDXFileChunk
+may return NULL when underlying 
+.Xr open 2 ,
+.Xr fstat 2 ,
+.Xr lseek 2 ,
+or
+.Xr MDXEnd 2
+fail.
 .Sh SEE ALSO
 .Xr md4 3 ,
 .Xr md5 3 ,

Modified: head/lib/libmd/ripemd.3
==
--- head/lib/libmd/ripemd.3 Tue May 21 21:39:03 2019(r348071)
+++ head/lib/libmd/ripemd.3 Tue May 21 22:11:53 2019(r348072)
@@ -124,6 +124,26 @@ after use.
 If the
 .Fa buf
 argument is non-null it must point to at least 41 characters of buffer space.
+.Sh ERRORS
+The
+.Fn RIPEMD160_End
+function called with a null buf argument may fail and return NULL if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient storage space is available.
+.El
+.Pp
+The
+.Fn RIPEMD160_File
+and
+.Fn RIPEMD160_FileChunk
+may return NULL when underlying 
+.Xr open 2 ,
+.Xr fstat 2 ,
+.Xr lseek 2 ,
+or
+.Xr RIPEMD160_End 2
+fail.
 .Sh SEE ALSO
 .Xr md4 3 ,
 .Xr md5 3 ,

Modified: head/lib/libmd/sha.3
==
--- head/lib/libmd/sha.3Tue May 21 21:39:03 2019(r348071)
+++ head/lib/libmd/sha.3Tue May 21 22:11:53 2019(r348072)
@@ -9,7 +9,7 @@
 .\"From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
 .\" $FreeBSD$
 .\"
-.Dd July 20, 2018
+.Dd May 21, 2019
 .Dt SHA 3
 .Os
 .Sh NAME
@@ -155,6 +155,26 @@ after use.
 If the
 .Fa buf
 argument is non-null it must point to at least 41 characters of buffer space.
+.Sh ERRORS
+The
+.Fn SHA1_End
+function called with a null buf argument may fail and return NULL if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient storage space is available.
+.El
+.Pp
+The
+.Fn SHA1_File
+and
+.Fn SHA1_FileChunk
+may return NULL when underlying 
+.Xr open 2 ,
+.Xr fstat 2 ,
+.Xr lseek 2 ,
+or
+.Xr SHA1_End 2
+fail.
 .Sh SEE ALSO
 .Xr md4 3 ,
 .Xr md5 3 ,

Modified: head/lib/libmd/sha256.3
==
--- head/lib/libmd/sha256.3 Tue May 21 21:39:03 2019(r348071)
+++ head/lib/libmd/sha256.3 Tue May 21 22:11:53 2019(r348072)
@@ -146,6 +146,26 @@ argument is non-null it must point to at least 65 char
 .Pp
 SHA224 is identical SHA256, except it has slightly different initialization
 vectors, and is truncated to a shorter digest.
+.Sh ERRORS
+The
+.Fn SHA256_End
+function called with a null buf argument may fail and return NULL if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient storage space is available.
+.El
+.Pp
+The
+.Fn SHA256_File
+and
+.Fn SHA256_FileChunk
+may return NULL when underlying 
+.Xr open 2 ,
+.Xr fstat 2 ,
+.Xr lseek 2 ,
+or
+.Xr SHA256_End 2
+fail.
 .Sh SEE ALSO
 .Xr md4 3 ,
 .Xr md5 3 ,

Modified: head/lib/libmd/sha512.3
==
--- head/lib/libmd/sha512.3 Tue May 21 21:39:03 2019(r348071)
+++ head/lib/libmd/sha512.3 Tue May 21 22:11:53 2019(r348072)
@@ -9,7 +9,7 @@
 .\"From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
 .\" $FreeBSD$
 .\"
-.Dd July 20, 2018
+.Dd May 21, 2019
 .Dt SHA512 3
 .Os
 .Sh NAME
@@ -190,6 +190,26 @@ which converts the return value to a 65-character
 (including the terminating '\e0')
 .Tn ASCII
 string which represents the 256 bits in hexadecimal.
+.Sh ERRORS
+The
+.Fn SHA512_End
+function called with a null buf argument may fail and return NULL if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient storage space is available.
+.El
+.Pp
+The
+.Fn SHA512_File
+and
+.Fn SHA512_FileChunk
+may return NULL when underlying 
+.Xr open 2 ,
+.Xr fstat 2 ,
+.Xr lseek 2 ,
+or
+.Xr SHA512_End 2
+fail.
 .Sh SEE ALSO
 .Xr md4 3 ,
 .Xr md5 3 ,

Modified: 

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

2019-05-21 Thread Allan Jude
Author: allanjude
Date: Tue May 21 21:39:03 2019
New Revision: 348071
URL: https://svnweb.freebsd.org/changeset/base/348071

Log:
  Fix typo in r348068

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

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  Tue May 
21 21:35:37 2019(r348070)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Tue May 
21 21:39:03 2019(r348071)
@@ -366,7 +366,7 @@ SYSCTL_PROC(_vfs_zfs, OID_AUTO, debugflags,
 SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RWTUN,
 _deadman_synctime_ms, 0,
 "Stalled ZFS I/O expiration time in milliseconds");
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RwTUN,
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RWTUN,
 _deadman_checktime_ms, 0,
 "Period of checks for stalled ZFS I/O in milliseconds");
 SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RWTUN,
___
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: r348068 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-05-21 Thread Allan Jude
Author: allanjude
Date: Tue May 21 21:26:18 2019
New Revision: 348068
URL: https://svnweb.freebsd.org/changeset/base/348068

Log:
  ZFS: Make deadman tunables no longer read-only
  
  This allows the user to enable, disable, and adjust the I/O deadman at
  runtime. This can be especially useful when a pool is backed by remote
  storage (such as iscsi, ggated, etc).
  
  PR:   221906
  Submitted by: Fabian Keil 
  Obtained from:ElectroBSD
  MFC after:1 week
  Sponsored by: Klara Systems
  Event:Waterloo Hackathon 2019

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

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  Tue May 
21 21:26:14 2019(r348067)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Tue May 
21 21:26:18 2019(r348068)
@@ -363,13 +363,13 @@ SYSCTL_PROC(_vfs_zfs, OID_AUTO, debugflags,
 CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RWTUN, 0, sizeof(int),
 sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing.");
 
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RDTUN,
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime_ms, CTLFLAG_RWTUN,
 _deadman_synctime_ms, 0,
 "Stalled ZFS I/O expiration time in milliseconds");
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RDTUN,
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_checktime_ms, CTLFLAG_RwTUN,
 _deadman_checktime_ms, 0,
 "Period of checks for stalled ZFS I/O in milliseconds");
-SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RDTUN,
+SYSCTL_INT(_vfs_zfs, OID_AUTO, deadman_enabled, CTLFLAG_RWTUN,
 _deadman_enabled, 0, "Kernel panic on stalled ZFS I/O");
 SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_asize_inflation, CTLFLAG_RWTUN,
 _asize_inflation, 0, "Worst case inflation factor for single sector 
writes");
___
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: r348065 - head/sys/dev/acpica

2019-05-21 Thread Allan Jude
Author: allanjude
Date: Tue May 21 21:14:22 2019
New Revision: 348065
URL: https://svnweb.freebsd.org/changeset/base/348065

Log:
  Correct the way remaining battery life is calculated
  
  Previously, if a system had multiple batteries, the remaining life
  percentage was calculated as the average of each battery's percent
  remaining. This results in rather incorrect values when you consider the
  case of the Thinkpad X270 that has a small 3 cell internally battery, and
  a hot-swappable 9 cell battery that is used first. Battery 0 is at 100%,
  but battery 1 is at 10%, you do not infact have 55% of your capacity
  remaining.
  
  The new method calculates the percentage based on remaining capacity
  out of total capacity, giving a much more accurate reading.
  
  PR:   229818
  Submitted by: Keegan Drake H.P. 
  MFC after:2 weeks
  Sponsored by: Klara Systems
  Event:Waterloo Hackathon 2019

Modified:
  head/sys/dev/acpica/acpi_battery.c

Modified: head/sys/dev/acpica/acpi_battery.c
==
--- head/sys/dev/acpica/acpi_battery.c  Tue May 21 20:38:48 2019
(r348064)
+++ head/sys/dev/acpica/acpi_battery.c  Tue May 21 21:14:22 2019
(r348065)
@@ -119,7 +119,7 @@ int
 acpi_battery_get_battinfo(device_t dev, struct acpi_battinfo *battinfo)
 {
 intbatt_stat, devcount, dev_idx, error, i;
-int total_cap, total_min, valid_rate, valid_units;
+int total_cap, total_lfcap, total_min, valid_rate, valid_units;
 devclass_t batt_dc;
 device_t batt_dev;
 struct acpi_bst *bst;
@@ -152,6 +152,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
  */
 dev_idx = -1;
 batt_stat = valid_rate = valid_units = 0;
+total_cap = total_lfcap = 0;
 for (i = 0; i < devcount; i++) {
/* Default info for every battery is "not present". */
acpi_reset_battinfo([i]);
@@ -210,17 +211,23 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
if (!acpi_battery_bif_valid(bif))
continue;
 
-   /* Calculate percent capacity remaining. */
-   bi[i].cap = (100 * bst[i].cap) / bif->lfcap;
-
/*
 * Some laptops report the "design-capacity" instead of the
 * "real-capacity" when the battery is fully charged.  That breaks
 * the above arithmetic as it needs to be 100% maximum.
 */
-   if (bi[i].cap > 100)
-   bi[i].cap = 100;
+   if (bst[i].cap > bif->lfcap)
+   bst[i].cap = bif->lfcap;
 
+   /* Calculate percent capacity remaining. */
+   bi[i].cap = (100 * bst[i].cap) / bif->lfcap;
+
+   /* If this battery is not present, don't use its capacity. */
+   if (bi[i].cap != -1) {
+   total_cap += bst[i].cap;
+   total_lfcap += bif->lfcap;
+   }
+
/*
 * On systems with more than one battery, they may get used
 * sequentially, thus bst.rate may only signify the one currently
@@ -241,7 +248,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
 }
 
 /* Pass 2:  calculate capacity and remaining time for all batteries. */
-total_cap = total_min = 0;
+total_min = 0;
 for (i = 0; i < devcount; i++) {
/*
 * If any batteries are discharging, use the sum of the bst.rate
@@ -253,10 +260,6 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
else
bi[i].min = 0;
total_min += bi[i].min;
-
-   /* If this battery is not present, don't use its capacity. */
-   if (bi[i].cap != -1)
-   total_cap += bi[i].cap;
 }
 
 /*
@@ -265,7 +268,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
  */
 if (valid_units > 0) {
if (dev == NULL) {
-   battinfo->cap = total_cap / valid_units;
+   battinfo->cap = (total_cap * 100) / total_lfcap;
battinfo->min = total_min;
battinfo->state = batt_stat;
battinfo->rate = valid_rate;
___
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: r347953 - head/cddl/contrib/opensolaris/cmd/zfs

2019-05-18 Thread Allan Jude

On 5/18/19 8:37 AM, Alexey Dokuchaev wrote:

On Sat, May 18, 2019 at 12:27:22PM +, Allan Jude wrote:

New Revision: 347953
URL: https://svnweb.freebsd.org/changeset/base/347953

Log:
   MFV/ZoL: `zfs userspace` ignored all unresolved UIDs after the first
   
   zfsonlinux/zfs@88cfff182432e4d1c24c877f33b47ee6cf109eee
   
   zfs_main: fix `zfs userspace` squashing unresolved entries
   
...

@@ -2368,10 +2369,12 @@ us_compare(const void *larg, const void *rarg, void *u
if (rv64 != lv64)
rc = (rv64 < lv64) ? 1 : -1;
} else {
-   (void) nvlist_lookup_string(lnvl, propname,
-   );
-   (void) nvlist_lookup_string(rnvl, propname,
-   );
+   if ((nvlist_lookup_string(lnvl, propname,
+   ) == ENOENT) ||
+   (nvlist_lookup_string(rnvl, propname,
+   ) == ENOENT)) {
+   goto compare_nums;
+   }


Another thing not to like about ZoL: their completely bogus code style
and formatting practices (look at those ") == ENOENT").  If they
are going to listen to us, can we at least try to convince them not to
break existing, much FreeBSD-like formatting?

./danfe



They have strict CI that enforces Solaris cstyle, as that is what the 
code base has always used. No commit is merged until it passes that, and 
many other tests.


--
Allan Jude
___
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: r347953 - head/cddl/contrib/opensolaris/cmd/zfs

2019-05-18 Thread Allan Jude
Author: allanjude
Date: Sat May 18 12:27:22 2019
New Revision: 347953
URL: https://svnweb.freebsd.org/changeset/base/347953

Log:
  MFV/ZoL: `zfs userspace` ignored all unresolved UIDs after the first
  
  zfsonlinux/zfs@88cfff182432e4d1c24c877f33b47ee6cf109eee
  
  zfs_main: fix `zfs userspace` squashing unresolved entries
  
  The `zfs userspace` squashes all entries with unresolved numeric
  values into a single output entry due to the comparsion always
  made by the string name which is empty in case of unresolved IDs.
  
  Fix this by falling to a numerical comparison when either one
  of string values is not found. This then compares any numerical
  values after all with a name resolved.
  
  Signed-off-by: Pavel Boldin 
  Signed-off-by: Brian Behlendorf 
  
  Reported by:  clusteradm
  Obtained from:ZFS-on-Linux
  MFC after:3 days

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cSat May 18 11:14:43 
2019(r347952)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cSat May 18 12:27:22 
2019(r347953)
@@ -2361,6 +2361,7 @@ us_compare(const void *larg, const void *rarg, void *u
case ZFS_PROP_NAME:
propname = "name";
if (numname) {
+compare_nums:
(void) nvlist_lookup_uint64(lnvl, propname,
);
(void) nvlist_lookup_uint64(rnvl, propname,
@@ -2368,10 +2369,12 @@ us_compare(const void *larg, const void *rarg, void *u
if (rv64 != lv64)
rc = (rv64 < lv64) ? 1 : -1;
} else {
-   (void) nvlist_lookup_string(lnvl, propname,
-   );
-   (void) nvlist_lookup_string(rnvl, propname,
-   );
+   if ((nvlist_lookup_string(lnvl, propname,
+   ) == ENOENT) ||
+   (nvlist_lookup_string(rnvl, propname,
+   ) == ENOENT)) {
+   goto compare_nums;
+   }
rc = strcmp(lvstr, rvstr);
}
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: r345491 - in head/sys: conf fs/tmpfs modules/tmpfs

2019-03-28 Thread Allan Jude
On 2019-03-25 15:17, Cy Schubert wrote:
> In message <3398a21318a4a6715609004d569d20de86f1dc7a.ca...@freebsd.org>
> , Ian Le
> pore writes:
>> On Mon, 2019-03-25 at 05:42 -0700, Cy Schubert wrote:
>>> In message <201903250746.x2p7kkuu019...@repo.freebsd.org>, Allan
>>> Jude 
>>> writes:
>>>> Author: allanjude
>>>> Date: Mon Mar 25 07:46:20 2019
>>>> New Revision: 345491
>>>> URL: https://svnweb.freebsd.org/changeset/base/345491
>>>>
>>>> Log:
>>>>   Make TMPFS_PAGES_MINRESERVED a kernel option
>>>>   
>>>>   TMPFS_PAGES_MINRESERVED controls how much memory is reserved for
>>>> the system
>>>>   and not used by tmpfs.
>>>>   
>>>>   On very small memory systems, the default value may be too high
>>>> and this
>>>>   prevents these small memory systems from using reroot, which is
>>>> required
>>>>   for them to install firmware updates.
>>>>   
>>>>   Submitted by:Hiroki Mori 
>>>>   Reviewed by: mizhka
>>>>   Differential Revision:   https://reviews.freebsd.org/D13583
>>>>
>>>> Modified:
>>>>   head/sys/conf/options
>>>>   head/sys/fs/tmpfs/tmpfs.h
>>>>   head/sys/fs/tmpfs/tmpfs_vfsops.c
>>>>   head/sys/modules/tmpfs/Makefile
>>>>
>>>
>>> Would this be a good candidate for a sysctl or tuneable?
>>>
>>
>> The small-memory embedded systems most affected by this often don't use
>> loader(8) at all, so tunables aren't an option, and sysctl may be too
>> late.  No reason it can't be a tunable as well, but it'll probably need
>> to remain as a compile-time option too.
> 
> Yes, I should have been more clear. I can see using a tuneable on a 2 
> GB or 4 GB Intel pandaboard. (Perfect for a firewall or a UPS 
> management station.)
> 
> 

The default value is 4MB. For any system with more than 32mb of memory,
it shouldn't require tuning, although you may wish to prevent tmpfs from
using all but 4mb of your memory.

I think the only case where you definitely need to override the default,
is when you have so little memory that you can't create a tmpfs image of
your root filesystem to reroot into, as is the case on many tiny router
boards, with 8-32mb of ram, and 4-16mb of flash.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r345491 - in head/sys: conf fs/tmpfs modules/tmpfs

2019-03-25 Thread Allan Jude
Author: allanjude
Date: Mon Mar 25 07:46:20 2019
New Revision: 345491
URL: https://svnweb.freebsd.org/changeset/base/345491

Log:
  Make TMPFS_PAGES_MINRESERVED a kernel option
  
  TMPFS_PAGES_MINRESERVED controls how much memory is reserved for the system
  and not used by tmpfs.
  
  On very small memory systems, the default value may be too high and this
  prevents these small memory systems from using reroot, which is required
  for them to install firmware updates.
  
  Submitted by: Hiroki Mori 
  Reviewed by:  mizhka
  Differential Revision:https://reviews.freebsd.org/D13583

Modified:
  head/sys/conf/options
  head/sys/fs/tmpfs/tmpfs.h
  head/sys/fs/tmpfs/tmpfs_vfsops.c
  head/sys/modules/tmpfs/Makefile

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon Mar 25 01:18:26 2019(r345490)
+++ head/sys/conf/options   Mon Mar 25 07:46:20 2019(r345491)
@@ -640,6 +640,9 @@ NFS_MINDIRATTRTIMO  opt_nfs.h
 NFS_MAXDIRATTRTIMO opt_nfs.h
 NFS_DEBUG  opt_nfs.h
 
+# TMPFS options
+TMPFS_PAGES_MINRESERVEDopt_tmpfs.h
+
 # For the Bt848/Bt848A/Bt849/Bt878/Bt879 driver
 OVERRIDE_CARD  opt_bktr.h
 OVERRIDE_TUNER opt_bktr.h

Modified: head/sys/fs/tmpfs/tmpfs.h
==
--- head/sys/fs/tmpfs/tmpfs.h   Mon Mar 25 01:18:26 2019(r345490)
+++ head/sys/fs/tmpfs/tmpfs.h   Mon Mar 25 07:46:20 2019(r345491)
@@ -487,7 +487,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node 
  * Amount of memory pages to reserve for the system (e.g., to not use by
  * tmpfs).
  */
+#if !defined(TMPFS_PAGES_MINRESERVED)
 #define TMPFS_PAGES_MINRESERVED(4 * 1024 * 1024 / PAGE_SIZE)
+#endif
 
 size_t tmpfs_mem_avail(void);
 

Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- head/sys/fs/tmpfs/tmpfs_vfsops.cMon Mar 25 01:18:26 2019
(r345490)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.cMon Mar 25 07:46:20 2019
(r345491)
@@ -42,6 +42,9 @@
  * memory-specific data structures and algorithms to automatically
  * allocate and release resources.
  */
+
+#include "opt_tmpfs.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 

Modified: head/sys/modules/tmpfs/Makefile
==
--- head/sys/modules/tmpfs/Makefile Mon Mar 25 01:18:26 2019
(r345490)
+++ head/sys/modules/tmpfs/Makefile Mon Mar 25 07:46:20 2019
(r345491)
@@ -4,6 +4,6 @@
 
 KMOD=  tmpfs
 SRCS=  vnode_if.h \
-   tmpfs_vnops.c tmpfs_fifoops.c tmpfs_vfsops.c tmpfs_subr.c
+   tmpfs_vnops.c tmpfs_fifoops.c tmpfs_vfsops.c tmpfs_subr.c opt_tmpfs.h
 
 .include 
___
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: r345492 - head/sys/mips/atheros

2019-03-25 Thread Allan Jude
Author: allanjude
Date: Mon Mar 25 07:48:52 2019
New Revision: 345492
URL: https://svnweb.freebsd.org/changeset/base/345492

Log:
  The Atheros AR7241 has 20 GPIO pins
  
  AR724X_GPIO_PINS used for this family is defined as 18
  The datasheet for the AR7241 describes 20 pins, allow all to be used.
  
  Submitted by: Hiroki Mori 
  Reviewed by:  mizhka
  Differential Revision:https://reviews.freebsd.org/D17580

Modified:
  head/sys/mips/atheros/ar71xx_gpio.c
  head/sys/mips/atheros/ar71xx_gpiovar.h

Modified: head/sys/mips/atheros/ar71xx_gpio.c
==
--- head/sys/mips/atheros/ar71xx_gpio.c Mon Mar 25 07:46:20 2019
(r345491)
+++ head/sys/mips/atheros/ar71xx_gpio.c Mon Mar 25 07:48:52 2019
(r345492)
@@ -226,9 +226,11 @@ ar71xx_gpio_pin_max(device_t dev, int *maxpin)
*maxpin = AR91XX_GPIO_PINS - 1;
break;
case AR71XX_SOC_AR7240:
-   case AR71XX_SOC_AR7241:
case AR71XX_SOC_AR7242:
*maxpin = AR724X_GPIO_PINS - 1;
+   break;
+   case AR71XX_SOC_AR7241:
+   *maxpin = AR7241_GPIO_PINS - 1;
break;
case AR71XX_SOC_AR9330:
case AR71XX_SOC_AR9331:

Modified: head/sys/mips/atheros/ar71xx_gpiovar.h
==
--- head/sys/mips/atheros/ar71xx_gpiovar.h  Mon Mar 25 07:46:20 2019
(r345491)
+++ head/sys/mips/atheros/ar71xx_gpiovar.h  Mon Mar 25 07:48:52 2019
(r345492)
@@ -55,6 +55,7 @@
 
 #defineAR71XX_GPIO_PINS12
 #defineAR724X_GPIO_PINS18
+#defineAR7241_GPIO_PINS20
 #defineAR91XX_GPIO_PINS22
 
 struct ar71xx_gpio_softc {
___
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: r345464 - head/sys/dev/cfi

2019-03-24 Thread Allan Jude
Author: allanjude
Date: Sun Mar 24 06:28:25 2019
New Revision: 345464
URL: https://svnweb.freebsd.org/changeset/base/345464

Log:
  Fix AMD type flash write operations, and display chip information at boot
  
  Applies to MX flash chips on AR9132 and RT3050
  
  Submitted by: Hiroki Mori 
  Reviewed by:  imp, sbruno
  Differential Revision:https://reviews.freebsd.org/D14279

Modified:
  head/sys/dev/cfi/cfi_core.c
  head/sys/dev/cfi/cfi_reg.h
  head/sys/dev/cfi/cfi_var.h

Modified: head/sys/dev/cfi/cfi_core.c
==
--- head/sys/dev/cfi/cfi_core.c Sat Mar 23 23:44:40 2019(r345463)
+++ head/sys/dev/cfi/cfi_core.c Sun Mar 24 06:28:25 2019(r345464)
@@ -421,6 +421,16 @@ cfi_attach(device_t dev) 
}
}
 
+   if (sc->sc_cmdset == CFI_VEND_AMD_ECS  ||
+   sc->sc_cmdset == CFI_VEND_AMD_SCS) {
+   cfi_amd_write(sc, 0, AMD_ADDR_START, CFI_AMD_AUTO_SELECT);
+   sc->sc_manid = cfi_read(sc, 0);
+   sc->sc_devid = cfi_read(sc, 2);
+   device_printf(dev, "Manufacturer ID:%x Device ID:%x\n",
+   sc->sc_manid, sc->sc_devid);
+   cfi_write(sc, 0, CFI_BCS_READ_ARRAY2);
+   }
+
u = device_get_unit(dev);
sc->sc_nod = make_dev(_cdevsw, u, UID_ROOT, GID_WHEEL, 0600,
"%s%u", cfi_driver_name, u);
@@ -500,6 +510,37 @@ cfi_detach(device_t dev)
return (0);
 }
 
+static bool
+cfi_check_erase(struct cfi_softc *sc, u_int ofs, u_int sz)
+{
+   bool result;
+   int i;
+   uint32_t val;
+
+   result = FALSE;
+   for (i = 0; i < sz; i += sc->sc_width) {
+   val = cfi_read(sc, ofs + i);
+   switch (sc->sc_width) {
+   case 1:
+   if (val != 0xff)
+   goto out;
+   continue;
+   case 2:
+   if (val != 0x)
+   goto out;
+   continue;
+   case 4:
+   if (val != 0x)
+   goto out;
+   continue;
+   }
+   }
+   result = TRUE;
+
+out:
+   return (result);
+}
+
 static int
 cfi_wait_ready(struct cfi_softc *sc, u_int ofs, sbintime_t start,
 enum cfi_wait_cmd cmd)
@@ -581,10 +622,12 @@ cfi_write_block(struct cfi_softc *sc)
uint32_t*x32;
} ptr, cpyprt;
register_t intr;
-   int error, i, neederase = 0;
+   int error, i, j, neederase = 0;
uint32_t st;
u_int wlen;
sbintime_t start;
+   u_int minsz;
+   uint32_t val;
 
/* Intel flash must be unlocked before modification */
switch (sc->sc_cmdset) {
@@ -615,9 +658,27 @@ cfi_write_block(struct cfi_softc *sc)
break;
case CFI_VEND_AMD_SCS:
case CFI_VEND_AMD_ECS:
+   /* find minimum sector size */
+   minsz = sc->sc_region[0].r_blksz;
+   for (i = 1; i < sc->sc_regions; i++) {
+   if (sc->sc_region[i].r_blksz < minsz)
+   minsz = sc->sc_region[i].r_blksz;
+   }
cfi_amd_write(sc, sc->sc_wrofs, AMD_ADDR_START,
CFI_AMD_ERASE_SECTOR);
-   cfi_amd_write(sc, sc->sc_wrofs, 0, CFI_AMD_BLOCK_ERASE);
+   cfi_amd_write(sc, sc->sc_wrofs, 
+   sc->sc_wrofs >> (ffs(minsz) - 1),
+   CFI_AMD_BLOCK_ERASE);
+   for (i = 0; i < CFI_AMD_MAXCHK; ++i) {
+   if (cfi_check_erase(sc, sc->sc_wrofs,
+   sc->sc_wrbufsz))
+   break;
+   DELAY(10);
+   }
+   if (i == CFI_AMD_MAXCHK) {
+   printf("\nCFI Sector Erase time out error\n");
+   return (ENODEV);
+   }
break;
default:
/* Better safe than sorry... */
@@ -749,10 +810,37 @@ cfi_write_block(struct cfi_softc *sc)

intr_restore(intr);
 
-   error = cfi_wait_ready(sc, sc->sc_wrofs, start,
-  CFI_TIMEOUT_WRITE);
-   if (error)
-   goto out;
+   if (sc->sc_cmdset == CFI_VEND_AMD_ECS  ||
+   sc->sc_cmdset == CFI_VEND_AMD_SCS) {
+   for (j = 0; j < CFI_AMD_MAXCHK; ++j) {
+   switch (sc->sc_width) {
+   case 1:
+   val = *(ptr.x8 + i);
+  

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

2019-01-12 Thread Allan Jude
Author: allanjude
Date: Sat Jan 12 17:52:52 2019
New Revision: 342971
URL: https://svnweb.freebsd.org/changeset/base/342971

Log:
  Add missing documentation for dev.acpi_ibm.0.mic_led added in r335304
  
  PR:   229074
  X-MFC-With:   335304
  Submitted by: Ali Abdallah 

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

Modified: head/share/man/man4/acpi_ibm.4
==
--- head/share/man/man4/acpi_ibm.4  Sat Jan 12 17:00:54 2019
(r342970)
+++ head/share/man/man4/acpi_ibm.4  Sat Jan 12 17:52:52 2019
(r342971)
@@ -273,6 +273,9 @@ Current brightness level of the display.
 Speaker volume.
 .It Va dev.acpi_ibm.0.mute
 Indicates, whether the speakers are muted or not.
+.It Va dev.acpi_ibm.0.mic_mute
+Indicates, whether the microphone led (present on some model) is on or not. 
+Note that this does not mean that the microphone input is muted.
 .It Va dev.acpi_ibm.0.thinklight
 Indicates, whether the ThinkLight keyboard light is activated or not.
 .It Va dev.acpi_ibm.0.bluetooth
@@ -437,6 +440,17 @@ case ${NOTIFY} in
 MESSAGE="volume unmuted"
 fi
 ;;
+   0x1b)
+   LEVEL=`sysctl -n dev.acpi_ibm.0.mic_led`
+   if [ $LEVEL -eq 0 ]; then
+   sysctl dev.acpi_ibm.0.mic_led=1
+   mixer rec 0
+   fi 
+   if [ $LEVEL -eq 1 ]; then 
+   sysctl dev.acpi_ibm.0.mic_led=0
+   mixer rec 30
+   fi
+   ;;
 *)
 ;;
 esac
___
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: r342754 - head/usr.bin/lam

2019-01-03 Thread Allan Jude
Author: allanjude
Date: Fri Jan  4 02:48:43 2019
New Revision: 342754
URL: https://svnweb.freebsd.org/changeset/base/342754

Log:
  The lam(1) man page is unclear about the uppercase versions of the flags
  
  PR:   229571
  Submitted by: Tim Chase 

Modified:
  head/usr.bin/lam/lam.1

Modified: head/usr.bin/lam/lam.1
==
--- head/usr.bin/lam/lam.1  Fri Jan  4 02:21:00 2019(r342753)
+++ head/usr.bin/lam/lam.1  Fri Jan  4 02:48:43 2019(r342754)
@@ -58,14 +58,8 @@ are considered fragments of the single long
 output line into which they are assembled.
 The name `\fB\-\fP' means the standard input, and may be repeated.
 .Pp
-Normally, each option affects only the
-.Ar file
-after it.
-If the option letter is capitalized it affects all subsequent files
-until it appears again uncapitalized.
-The options are described below:
 .Bl -tag -width indent
-.It Fl f Ar min . Ns Ar max
+.It Fl f Ar min . Ns Ar max , Fl F Ar min . Ns Ar max
 Print line fragments according to the format string
 .Ar min . Ns Ar max ,
 where
@@ -78,21 +72,41 @@ If
 begins with a zero, zeros will be added to make up the field width,
 and if it begins with a `\-', the fragment will be left-adjusted
 within the field.
-.It Fl p Ar min . Ns Ar max
+Using
+.Fl f
+applies only to the next file while
+.Fl F
+applies to all subsequent files until it appears again uncapitalized.
+.It Fl p Ar min . Ns Ar max , Fl P Ar min . Ns Ar max
 Like
 .Fl f ,
 but pad this file's field when end-of-file is reached
 and other files are still active.
-.It Fl s Ar sepstring
+Using
+.Fl p
+applies only to the next file while
+.Fl P
+applies to all subsequent files until it appears again uncapitalized.
+.It Fl s Ar sepstring , Fl S Ar sepstring
 Print
 .Ar sepstring
 before printing line fragments from the next file.
 This option may appear after the last file.
-.It Fl t Ar c
+Using
+.Fl s
+applies only to the next file while
+.Fl S
+applies to all subsequent files until it appears again uncapitalized.
+.It Fl t Ar c , Fl T Ar c
 The input line terminator is
 .Ar c
 instead of a newline.
 The newline normally appended to each output line is omitted.
+Using
+.Fl t
+applies only to the next file while
+.Fl T
+applies to all subsequent files until it appears again uncapitalized.
 .El
 .Pp
 To print files simultaneously for easy viewing use
___
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: r341828 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-12-11 Thread Allan Jude
Author: allanjude
Date: Tue Dec 11 19:34:25 2018
New Revision: 341828
URL: https://svnweb.freebsd.org/changeset/base/341828

Log:
  MFC: r339289: Resolve a hang in ZFS during vnode reclaimation
  
This is caused by a deadlock between zil_commit() and zfs_zget()
Add a way for zfs_zget() to break out of the retry loop in the common case
  
  PR:   229614, 231117
  Reported by:  grembo, jhb, Andreas Sommer, others
  Relnotes: yes
  Sponsored by: Klara Systems

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Tue Dec 11 19:32:16 2018(r341827)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Tue Dec 11 19:34:25 2018(r341828)
@@ -1155,15 +1155,27 @@ again:
 */
ASSERT3P(zp, !=, NULL);
ASSERT3U(zp->z_id, ==, obj_num);
-   *zpp = zp;
-   vp = ZTOV(zp);
+   if (zp->z_unlinked) {
+   err = SET_ERROR(ENOENT);
+   } else {
+   vp = ZTOV(zp);
+   /*
+* Don't let the vnode disappear after
+* ZFS_OBJ_HOLD_EXIT.
+*/
+   VN_HOLD(vp);
+   *zpp = zp;
+   err = 0;
+   }
 
-   /* Don't let the vnode disappear after ZFS_OBJ_HOLD_EXIT. */
-   VN_HOLD(vp);
-
sa_buf_rele(db, NULL);
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
 
+   if (err) {
+   getnewvnode_drop_reserve();
+   return (err);
+   }
+
locked = VOP_ISLOCKED(vp);
VI_LOCK(vp);
if ((vp->v_iflag & VI_DOOMED) != 0 &&
@@ -1196,7 +1208,7 @@ again:
}
VI_UNLOCK(vp);
getnewvnode_drop_reserve();
-   return (0);
+   return (err);
}
 
/*
___
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: r340450 - head/sys/sys

2018-11-18 Thread Allan Jude
On 2018-11-15 11:02, Warner Losh wrote:
> Author: imp
> Date: Thu Nov 15 16:02:13 2018
> New Revision: 340450
> URL: https://svnweb.freebsd.org/changeset/base/340450
> 
> Log:
>   When converting ns,us,ms to sbt, return the ceil() of the result
>   rather than the floor(). Returning the floor means that
>   sbttoX(Xtosbt(y)) != y for almost all values of y.  In practice, this
>   results in a difference of at most 1 in the lsb of the sbintime_t.
>   This difference is meaningless for all current users of these
>   functions, but is important for the newly introduced sysctl conversion
>   routines which implicitly rely on the transformation being idempotent.
>   
>   Sponsored by: Netflix, Inc
> 

This seems to break attaching for my mlxen(4), with or without r340451

I don't understand why at this point.

Nov 18 19:28:12 CA-HML3-09 kernel: mlx4_core0:  mem
0xfbe0-0xfbef,0xfa80-0xfaff irq 48 at device 0.0
numa-domain 1 on pci11
Nov 18 19:28:12 CA-HML3-09 kernel: mlx4_core: Initializing mlx4_core
Nov 18 19:29:12 CA-HML3-09 kernel: mlx4_core0: command 0x4 timed out (go
bit not cleared)
Nov 18 19:29:12 CA-HML3-09 kernel: mlx4_core0: device is going to be reset
Nov 18 19:29:12 CA-HML3-09 kernel: mlx4_core0: device was reset successfully
Nov 18 19:29:13 CA-HML3-09 kernel: mlx4_core0: QUERY_FW command failed,
aborting
Nov 18 19:29:13 CA-HML3-09 kernel: mlx4_core0: Failed to init fw, aborting.
Nov 18 19:29:13 CA-HML3-09 kernel: device_attach: mlx4_core0 attach
returned 5

It works fine under r340449:

Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core0:  mem
0xfbe0-0xfbef,0xfa80-0xfaff irq 48 at device 0.0
numa-domain 1 on pci11
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core: Mellanox ConnectX core
driver v3.4.1 (October 2017)
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core: Initializing mlx4_core
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core0: Unable to determine PCI
device chain minimum BW
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en mlx4_core0: Activating port:1
Nov 18 19:46:07 CA-HML3-09 kernel: mlxen0: Ethernet address:
00:02:c9:4d:6a:e8
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlx4_core0: Port 1: Using 32
TX rings
Nov 18 19:46:07 CA-HML3-09 kernel: mlxen0: link state changed to DOWN
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlx4_core0: Port 1: Using 16
RX rings
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Using 32 TX rings
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Using 16 RX rings
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Initializing port
Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Link Down
Nov 18 19:46:07 CA-HML3-09 kernel: mlxen0: link state changed to UP



> Modified:
>   head/sys/sys/time.h
> 
> Modified: head/sys/sys/time.h
> ==
> --- head/sys/sys/time.h   Thu Nov 15 08:43:17 2018(r340449)
> +++ head/sys/sys/time.h   Thu Nov 15 16:02:13 2018(r340450)
> @@ -161,6 +161,10 @@ sbttobt(sbintime_t _sbt)
>   * Decimal<->sbt conversions.  Multiplying or dividing by SBT_1NS results in
>   * large roundoff errors which sbttons() and nstosbt() avoid.  Millisecond 
> and
>   * microsecond functions are also provided for completeness.
> + *
> + * These functions return the smallest sbt larger or equal to the number of
> + * seconds requested so that sbttoX(Xtosbt(y)) == y. The 1 << 32 - 1 term 
> added
> + * transforms the >> 32 from floor() to ceil().
>   */
>  static __inline int64_t
>  sbttons(sbintime_t _sbt)
> @@ -173,7 +177,7 @@ static __inline sbintime_t
>  nstosbt(int64_t _ns)
>  {
>  
> - return ((_ns * (((uint64_t)1 << 63) / 5)) >> 32);
> + return ((_ns * (((uint64_t)1 << 63) / 5) + (1ull << 32) - 1) >> 
> 32);
>  }
>  
>  static __inline int64_t
> @@ -187,7 +191,7 @@ static __inline sbintime_t
>  ustosbt(int64_t _us)
>  {
>  
> - return ((_us * (((uint64_t)1 << 63) / 50)) >> 32);
> + return ((_us * (((uint64_t)1 << 63) / 50) + (1ull << 32) - 1) >> 
> 32);
>  }
>  
>  static __inline int64_t
> @@ -201,7 +205,7 @@ static __inline sbintime_t
>  mstosbt(int64_t _ms)
>  {
>  
> - return ((_ms * (((uint64_t)1 << 63) / 500)) >> 32);
> + return ((_ms * (((uint64_t)1 << 63) / 500) + (1ull << 32) - 1) >> 32);
>  }
>  
>  /*-
> 


-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r339376 - svnadmin/conf

2018-10-15 Thread Allan Jude
Author: allanjude
Date: Tue Oct 16 03:18:57 2018
New Revision: 339376
URL: https://svnweb.freebsd.org/changeset/base/339376

Log:
  Welcome Thomas Munro as a FreeBSD src Committer
  Mentors: mjg, allanjude
  
  Approved by:  core

Modified:
  svnadmin/conf/access
  svnadmin/conf/mentors

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessTue Oct 16 02:30:13 2018(r339375)
+++ svnadmin/conf/accessTue Oct 16 03:18:57 2018(r339376)
@@ -220,6 +220,7 @@ thj
 thomas
 thompsa
 tijl
+tmunro
 trasz
 truckman
 tsoome

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Tue Oct 16 02:30:13 2018(r339375)
+++ svnadmin/conf/mentors   Tue Oct 16 03:18:57 2018(r339376)
@@ -37,6 +37,7 @@ sef   mav
 slavashkib Co-mentor: hselasky
 slmken Co-mentor: scottl, ambrisko
 thjjtl
+tmunro mjg Co-mentor: allanjude
 vmaffione  hrs Co-mentor: gnn
 yuripv kib
 wosch  cem
___
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: r339343 - head/lib/libc/sys

2018-10-12 Thread Allan Jude
Author: allanjude
Date: Sat Oct 13 02:20:16 2018
New Revision: 339343
URL: https://svnweb.freebsd.org/changeset/base/339343

Log:
  Document that sendfile(2) can return ENOTCAPABLE
  
  PR:   232207
  Submitted by: Enji Cooper 
  Approved by:  re (rgrimes)

Modified:
  head/lib/libc/sys/sendfile.2

Modified: head/lib/libc/sys/sendfile.2
==
--- head/lib/libc/sys/sendfile.2Sat Oct 13 00:13:24 2018
(r339342)
+++ head/lib/libc/sys/sendfile.2Sat Oct 13 02:20:16 2018
(r339343)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 17, 2016
+.Dd October 12, 2018
 .Dt SENDFILE 2
 .Os
 .Sh NAME
@@ -336,6 +336,12 @@ is negative.
 .It Bq Er EIO
 An error occurred while reading from
 .Fa fd .
+.It Bq Er ENOTCAPABLE
+The
+.Fa fd
+or the
+.Fa s
+argument has insufficient rights.
 .It Bq Er ENOBUFS
 The system was unable to allocate an internal buffer.
 .It Bq Er ENOTCONN
___
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: r339344 - head/usr.sbin/mfiutil

2018-10-12 Thread Allan Jude
Author: allanjude
Date: Sat Oct 13 02:21:23 2018
New Revision: 339344
URL: https://svnweb.freebsd.org/changeset/base/339344

Log:
  Make `mfiutil show progress` print out the elapsed time estimate in a
  more humanized way
  
  PR:   225993
  Submitted by: Enji Cooper 
  Reviewed by:  jhb (previous version)
  Approved by:  re (rgrimes)

Modified:
  head/usr.sbin/mfiutil/mfi_cmd.c

Modified: head/usr.sbin/mfiutil/mfi_cmd.c
==
--- head/usr.sbin/mfiutil/mfi_cmd.c Sat Oct 13 02:20:16 2018
(r339343)
+++ head/usr.sbin/mfiutil/mfi_cmd.c Sat Oct 13 02:21:23 2018
(r339344)
@@ -31,17 +31,18 @@
  * $FreeBSD$
  */
 
-#include 
-#include 
 #include 
+#include 
 #include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "mfiutil.h"
@@ -311,24 +312,34 @@ mfi_open(int unit, int acs)
return (open(path, acs));
 }
 
+static void
+print_time_humanized(uint seconds)
+{
+
+   if (seconds > 3600) {
+   printf("%u:", seconds / 3600);
+   }
+   if (seconds > 60) {
+   seconds %= 3600;
+   printf("%02u:%02u", seconds / 60, seconds % 60);
+   } else {
+   printf("%us", seconds);
+   }
+}
+
 void
 mfi_display_progress(const char *label, struct mfi_progress *prog)
 {
uint seconds;
 
-   printf("%s: %.2f%% complete, after %ds", label,
-   (float)prog->progress * 100 / 0x, prog->elapsed_seconds);
+   printf("%s: %.2f%% complete after ", label,
+   (float)prog->progress * 100 / 0x);
+   print_time_humanized(prog->elapsed_seconds);
if (prog->progress != 0 && prog->elapsed_seconds > 10) {
printf(" finished in ");
seconds = (0x1 * (uint32_t)prog->elapsed_seconds) /
prog->progress - prog->elapsed_seconds;
-   if (seconds > 3600)
-   printf("%u:", seconds / 3600);
-   if (seconds > 60) {
-   seconds %= 3600;
-   printf("%02u:%02u", seconds / 60, seconds % 60);
-   } else
-   printf("%us", seconds);
+   print_time_humanized(seconds);
}
printf("\n");
 }
___
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: r339299 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-10-10 Thread Allan Jude
Author: allanjude
Date: Wed Oct 10 22:59:15 2018
New Revision: 339299
URL: https://svnweb.freebsd.org/changeset/base/339299

Log:
  Pull in a follow-on commit to resolve a deadlock in ZFS sequential
  resilver (r334844)
  
  MFV/ZoL: Fix deadlock in IO pipeline
  
  commit a76f3d0437e5e974f0f748f8735af3539443b388
  Author: Brian Behlendorf 
  Date:   Fri Mar 16 16:46:06 2018 -0700
  
  Fix deadlock in IO pipeline
  
  In vdev_queue_aggregate() the zio_execute() bypass should not be
  called under the vdev queue lock.  This can result in a deadlock
  as shown in the stack traces below.
  
  Drop the vdev queue lock then walk the parents of the aggregate IO
  to determine the list of component IOs to be bypassed.  This can
  be done safely without holding the io_lock since the new aggregate
  IO has not yet been returned and its parents cannot change.
  
  ---  THREAD 1 ---
  arc_read()
zio_nowait()
  zio_vdev_io_start()
vdev_queue_io() <--- mutex_enter(vq->vq_lock)
  vdev_queue_io_to_issue()
vdev_queue_aggregate()
  zio_execute()
  vdev_queue_io_to_issue()
vdev_queue_aggregate()
  zio_execute()
zio_vdev_io_assess()
  zio_wait_for_children() <- mutex_enter(zio->io_lock)
  
  --- THREAD 2 --- (inverse order)
  arc_read()
zio_change_priority() <- mutex_enter(zio->zio_lock)
  vdev_queue_change_io_priority() <- mutex_enter(vq->vq_lock)
  
  Reviewed-by: Tom Caputi 
  Reviewed-by: Don Brady 
  Signed-off-by: Brian Behlendorf 
  
  Reported by:  ZFS Leadership Meeting
  Reviewed by:  mav
  Approved by:  re (kib)
  Obtained from:ZFS-on-Linux
  MFC after:2 weeks
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D17495

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cWed Oct 
10 22:55:31 2018(r339298)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cWed Oct 
10 22:59:15 2018(r339299)
@@ -670,6 +670,7 @@ static zio_t *
 vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio)
 {
zio_t *first, *last, *aio, *dio, *mandatory, *nio;
+   zio_link_t *zl = NULL;
uint64_t maxgap = 0;
uint64_t size;
boolean_t stretch;
@@ -813,9 +814,18 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio)
 
zio_add_child(dio, aio);
vdev_queue_io_remove(vq, dio);
+   } while (dio != last);
+
+   /*
+* We need to drop the vdev queue's lock to avoid a deadlock that we
+* could encounter since this I/O will complete immediately.
+*/
+   mutex_exit(>vq_lock);
+   while ((dio = zio_walk_parents(aio, )) != NULL) {
zio_vdev_io_bypass(dio);
zio_execute(dio);
-   } while (dio != last);
+   }
+   mutex_enter(>vq_lock);
 
return (aio);
 }
___
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: r339298 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-10-10 Thread Allan Jude
Author: allanjude
Date: Wed Oct 10 22:55:31 2018
New Revision: 339298
URL: https://svnweb.freebsd.org/changeset/base/339298

Log:
  Add missing sysctls for tuning vdev queue depths for new I/O types
  
  This connects new tunables that were added but not exposed in:
  r329502 (zpool remove)
  r337007 (zpool initialize)
  
  Reviewed by:  avg
  Approved by:  re (kib)
  MFC after:2 weeks
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D17494

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cWed Oct 
10 22:51:45 2018(r339297)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cWed Oct 
10 22:55:31 2018(r339298)
@@ -252,6 +252,10 @@ ZFS_VDEV_QUEUE_KNOB_MIN(scrub);
 ZFS_VDEV_QUEUE_KNOB_MAX(scrub);
 ZFS_VDEV_QUEUE_KNOB_MIN(trim);
 ZFS_VDEV_QUEUE_KNOB_MAX(trim);
+ZFS_VDEV_QUEUE_KNOB_MIN(removal);
+ZFS_VDEV_QUEUE_KNOB_MAX(removal);
+ZFS_VDEV_QUEUE_KNOB_MIN(initializing);
+ZFS_VDEV_QUEUE_KNOB_MAX(initializing);
 
 #undef ZFS_VDEV_QUEUE_KNOB
 
___
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: r339289 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-10-10 Thread Allan Jude
Author: allanjude
Date: Wed Oct 10 19:39:47 2018
New Revision: 339289
URL: https://svnweb.freebsd.org/changeset/base/339289

Log:
  Resolve a hang in ZFS during vnode reclaimation
  
  This is caused by a deadlock between zil_commit() and zfs_zget()
  
  Add a way for zfs_zget() to break out of the retry loop in the common case
  
  PR:   229614
  Reported by:  grembo, Andreas Sommer, many others
  Tested by:Andreas Sommer, Vicki Pfau
  Reviewed by:  avg (no objection)
  Approved by:  re (gjb)
  MFC after:2 months
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D17460

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Oct 
10 16:34:53 2018(r339288)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Oct 
10 19:39:47 2018(r339289)
@@ -1165,15 +1165,27 @@ again:
 */
ASSERT3P(zp, !=, NULL);
ASSERT3U(zp->z_id, ==, obj_num);
-   *zpp = zp;
-   vp = ZTOV(zp);
+   if (zp->z_unlinked) {
+   err = SET_ERROR(ENOENT);
+   } else {
+   vp = ZTOV(zp);
+   /*
+* Don't let the vnode disappear after
+* ZFS_OBJ_HOLD_EXIT.
+*/
+   VN_HOLD(vp);
+   *zpp = zp;
+   err = 0;
+   }
 
-   /* Don't let the vnode disappear after ZFS_OBJ_HOLD_EXIT. */
-   VN_HOLD(vp);
-
sa_buf_rele(db, NULL);
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
 
+   if (err) {
+   getnewvnode_drop_reserve();
+   return (err);
+   }
+
locked = VOP_ISLOCKED(vp);
VI_LOCK(vp);
if ((vp->v_iflag & VI_DOOMED) != 0 &&
@@ -1206,7 +1218,7 @@ again:
}
VI_UNLOCK(vp);
getnewvnode_drop_reserve();
-   return (0);
+   return (err);
}
 
/*
___
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: r339224 - head/usr.bin/truss

2018-10-07 Thread Allan Jude
Author: allanjude
Date: Sun Oct  7 19:50:44 2018
New Revision: 339224
URL: https://svnweb.freebsd.org/changeset/base/339224

Log:
  Teach truss how to display shm_open(2), shm_unlink(2)
  
  Submitted by: Thomas Munro 
  Reviewed by:  tuexen, kib
  Approved by:  re (rgrimes)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D17457

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Sun Oct  7 15:54:13 2018
(r339223)
+++ head/usr.bin/truss/syscalls.c   Sun Oct  7 19:50:44 2018
(r339224)
@@ -461,6 +461,10 @@ static struct syscall decoded_syscalls[] = {
{ .name = "setsockopt", .ret_type = 1, .nargs = 5,
  .args = { { Int, 0 }, { Sockoptlevel, 1 }, { Sockoptname, 2 },
{ Ptr | IN, 3 }, { Socklent, 4 } } },
+   { .name = "shm_open", .ret_type = 1, .nargs = 3,
+ .args = { { Name | IN, 0 }, { Open, 1 }, { Octal, 2 } } },
+   { .name = "shm_unlink", .ret_type = 1, .nargs = 1,
+ .args = { { Name | IN, 0 } } },
{ .name = "shutdown", .ret_type = 1, .nargs = 2,
  .args = { { Int, 0 }, { Shutdown, 1 } } },
{ .name = "sigaction", .ret_type = 1, .nargs = 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: r339026 - head/sys/dev/usb/net

2018-09-30 Thread Allan Jude
Author: allanjude
Date: Sun Sep 30 21:23:31 2018
New Revision: 339026
URL: https://svnweb.freebsd.org/changeset/base/339026

Log:
  Use PNP metadata to allow devmatch to autoload ure(4)
  
  Reviewed by:  manu imp
  Approved by:  re (kib)
  X-MFC-with:   devmatch
  Sponsored by: Klara Systems

Modified:
  head/sys/dev/usb/net/if_ure.c

Modified: head/sys/dev/usb/net/if_ure.c
==
--- head/sys/dev/usb/net/if_ure.c   Sun Sep 30 16:57:30 2018
(r339025)
+++ head/sys/dev/usb/net/if_ure.c   Sun Sep 30 21:23:31 2018
(r339026)
@@ -169,6 +169,7 @@ MODULE_DEPEND(ure, usb, 1, 1, 1);
 MODULE_DEPEND(ure, ether, 1, 1, 1);
 MODULE_DEPEND(ure, miibus, 1, 1, 1);
 MODULE_VERSION(ure, 1);
+USB_PNP_HOST_INFO(ure_devs);
 
 static const struct usb_ether_methods ure_ue_methods = {
.ue_attach_post = ure_attach_post,
___
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: r339009 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-09-28 Thread Allan Jude
Author: allanjude
Date: Sat Sep 29 01:26:07 2018
New Revision: 339009
URL: https://svnweb.freebsd.org/changeset/base/339009

Log:
  Avoid panic when adjusting priority of a read in the face of an IO error
  
  PR:   231516
  Reported by:  sbruno
  Approved by:  re (rgrimes)
  Obtained from:ZFS-on-Linux
  X-MFC-with:   334844
  Sponsored by: Klara Systems
  
  MFV/ZoL:  Fix zio->io_priority failed (7 < 6) assert
  
  commit c26cf0966d131b722c32f8ccecfe5791a789d975
  Author: Tony Hutter 
  Date:   Tue May 29 18:13:48 2018 -0700
  
Fix zio->io_priority failed (7 < 6) assert
  
This fixes an assert in vdev_queue_change_io_priority():
  
  VERIFY3(zio->io_priority < ZIO_PRIORITY_NUM_QUEUEABLE) failed (7 < 6)
  PANIC at vdev_queue.c:832:vdev_queue_change_io_priority()
  
Reviewed-by: Tom Caputi 
Reviewed-by: George Melikov 
Reviewed-by: Brian Behlendorf 
Signed-off-by: Tony Hutter 

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cSat Sep 
29 00:44:23 2018(r339008)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.cSat Sep 
29 01:26:07 2018(r339009)
@@ -958,6 +958,15 @@ vdev_queue_change_io_priority(zio_t *zio, zio_priority
vdev_queue_t *vq = >io_vd->vdev_queue;
avl_tree_t *tree;
 
+   /*
+* ZIO_PRIORITY_NOW is used by the vdev cache code and the aggregate zio
+* code to issue IOs without adding them to the vdev queue. In this
+* case, the zio is already going to be issued as quickly as possible
+* and so it doesn't need any reprioitization to help.
+*/
+   if (zio->io_priority == ZIO_PRIORITY_NOW)
+   return;
+
ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
ASSERT3U(priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
 
___
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: r338282 - head/usr.sbin/bsdinstall/scripts

2018-08-23 Thread Allan Jude
Author: allanjude
Date: Thu Aug 23 22:50:11 2018
New Revision: 338282
URL: https://svnweb.freebsd.org/changeset/base/338282

Log:
  bsdinstall/zfsboot: Enable new UEFI+GELI support
  
  After r336252 it is no longer necessary to have a separate bootpool when
  booting from an encrypted disk with UEFI.
  
  This change also switches the EFI System Partition contents from
  the 800 KB boot1.efifat to a new 200 MB filesystem created with newfs_msdos
  and uses loader.efi directly, instead of boot1.efi.
  
  PR:   228916
  Reviewed by:  dteske
  MFC after:1 month
  Relnotes: yes
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D12315

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootThu Aug 23 22:35:14 2018
(r338281)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootThu Aug 23 22:50:11 2018
(r338282)
@@ -185,9 +185,11 @@ FSTAB_FMT="%s\t\t%s\t%s\t%s\t\t%s\t%s\n"
 #
 # Command strings for various tasks
 #
+COPY='cp "%s" "%s"'
 CHMOD_MODE='chmod %s "%s"'
 DD_WITH_OPTIONS='dd if="%s" of="%s" %s'
 ECHO_APPEND='echo "%s" >> "%s"'
+ECHO_OVERWRITE='echo "%s" > "%s"'
 GELI_ATTACH='geli attach -j - -k "%s" "%s"'
 GELI_ATTACH_NOKEY='geli attach -j - "%s"'
 GELI_DETACH_F='geli detach -f "%s"'
@@ -211,6 +213,7 @@ KLDLOAD='kldload %s'
 LN_SF='ln -sf "%s" "%s"'
 MKDIR_P='mkdir -p "%s"'
 MOUNT_TYPE='mount -t %s "%s" "%s"'
+NEWFS_ESP='newfs_msdos -F %s -L "%s" "%s"'
 PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\""
 PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"'
 SHELL_TRUNCATE=':> "%s"'
@@ -841,18 +844,34 @@ zfs_create_diskpart()
# 2. Add small freebsd-boot and/or efi partition
#
if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o "$ZFSBOOT_BOOT_TYPE" = 
"BIOS+UEFI" ]; then
-   #
-   # Enable boot pool if encryption is desired
-   #
-   [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1
-
f_eval_catch $funcname gpart \
 "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \
-"$align_small" efiboot$index efi 200M 
$disk ||
+"$align_small" efiboot$index efi 200M \
+$disk ||
 return $FAILURE
-   f_eval_catch $funcname gpart "$GPART_BOOTCODE_PARTONLY" 
\
-/boot/boot1.efifat 1 $disk ||
-return $FAILURE
+
+   f_eval_catch $funcname mkdir "$MKDIR_P" \
+"$BSDINSTALL_TMPETC/esp" || return $FAILURE
+   f_eval_catch $funcname newfs_msdos "$NEWFS_ESP" "16" \
+"EFISYS" "/dev/${disk}p1" ||
+return $FAILURE
+   f_eval_catch $funcname mount "$MOUNT_TYPE" "msdosfs" \
+"/dev/${disk}p1" \
+"$BSDINSTALL_TMPETC/esp" ||
+return $FAILURE
+   f_eval_catch $funcname mkdir "$MKDIR_P" \
+"$BSDINSTALL_TMPETC/esp/efi/boot" ||
+return $FAILURE
+   f_eval_catch $funcname cp "$COPY" "/boot/loader.efi" \
+
"$BSDINSTALL_TMPETC/esp/efi/boot/$ZFSBOOT_ESP_NAME" ||
+return $FAILURE
+   f_eval_catch $funcname echo "$ECHO_OVERWRITE" \
+"$ZFSBOOT_ESP_NAME" \
+
"$BSDINSTALL_TMPETC/esp/efi/boot/startup.nsh" ||
+return $FAILURE
+   f_eval_catch $funcname umount "$UMOUNT" \
+"$BSDINSTALL_TMPETC/esp" ||
+return $FAILURE
fi
 
if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o "$ZFSBOOT_BOOT_TYPE" = 
"BIOS+UEFI" ]; then
@@ -1574,6 +1593,20 @@ arm64)
: ${ZFSBOOT_PARTITION_SCHEME:=GPT}
fi
;;
+esac
+
+#
+# The EFI loader installed in the ESP (EFI System Partition) must
+# have the expected name in order to load correctly.
+#
+[ "$ZFSBOOT_ESP_NAME" ] || case "${UNAME_m:-$( uname -m )}" in
+   arm64) ZFSBOOT_ESP_NAME=BOOTaa64.efi ;;
+   arm) ZFSBOOT_ESP_NAME=BOOTarm.efi ;;
+   i386) ZFSBOOT_ESP_NAME=BOOTia32.efi ;;
+   amd64) ZFSBOOT_ESP_NAME=BOOTx64.efi ;;
+   *)
+   f_dprintf "Unsupported architecture: %s" $UNAME_m
+   f_die
 esac
 
 #

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

2018-07-23 Thread Allan Jude
Author: allanjude
Date: Tue Jul 24 04:38:11 2018
New Revision: 336660
URL: https://svnweb.freebsd.org/changeset/base/336660

Log:
  ZFS: Reserve DMU_BACKUP_FEATURE flags for Native Encryption and ZSTD

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Mon Jul 
23 23:04:43 2018(r336659)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Tue Jul 
24 04:38:11 2018(r336660)
@@ -94,6 +94,8 @@ typedef enum drr_headertype {
 /* flag #21 is reserved for a Delphix feature */
 #defineDMU_BACKUP_FEATURE_COMPRESSED   (1 << 22)
 /* flag #23 is reserved for the large dnode feature */
+/* flag #24 is reserved for the raw send (encryption) feature */
+/* flag #25 is reserved for the ZSTD compression feature */
 
 /*
  * Mask of all supported backup features
___
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: r336451 - in head/sys/dev/mlx5: . mlx5_core mlx5_en

2018-07-19 Thread Allan Jude
On 2018-07-19 18:55, Ian Lepore wrote:
> On Wed, 2018-07-18 at 10:12 +, Hans Petter Selasky wrote:
>> Author: hselasky
>> Date: Wed Jul 18 10:12:53 2018
>> New Revision: 336451
>> URL: https://svnweb.freebsd.org/changeset/base/336451
>>
>> Log:
>>   Update version information for the mlx5 and mlx5en(4) modules.
>>   
>>   While at it bump some copyright dates.
>>   
>>   MFC after: 1 week
>>   Sponsored by:  Mellanox Technologies
> 
> After this recent set of commits, the sparc64, powerpc64, and armv4
> LINT kernels are failing to build. The problems are all some combo of
> missing fcmpset functions, or missing 64-bit atomic functions. I'm not
> sure this driver is useful on any of those platforms, but I guess it
> has always built fine in the past.
> 
> -- Ian
> 

I think you have the wrong commit. This commit only changes some static
strings, and copyright comments.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r335963 - in head: etc share/mk tools/build/mk tools/build/options

2018-07-04 Thread Allan Jude
On 2018-07-04 19:44, Ed Maste wrote:
> On 4 July 2018 at 13:18, Sean Bruno  wrote:
>> Author: sbruno
>> Date: Wed Jul  4 17:18:35 2018
>> New Revision: 335963
>> URL: https://svnweb.freebsd.org/changeset/base/335963
>>
>> Log:
>>   WITHOUT_SERVICESDB:
>>
>>   Add src.conf knob to disable the installation of /var/db/services.db
>>
>>   Default to leaving services.db in place, but allow the removal of the
>>   file and its creation with a src.conf knob.
>>
>>   This file ends up being 2MB in size.  For small systems this is a waste
>>   of space but its a tradeoff.
> 
> I'm happy to have this knob, but we ought to also see if we can reduce
> the size of services.db - it seems quite silly for it to be 2MB.
> 

I have somewhere a revival of bapt@'s old patch to use NetBSD's cdb to
make much smaller .db files.

Here is bapt@'s original work: https://people.freebsd.org/~bapt/cdbrw.diff

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r335883 - head/stand/common

2018-07-02 Thread Allan Jude
Author: allanjude
Date: Tue Jul  3 05:53:27 2018
New Revision: 335883
URL: https://svnweb.freebsd.org/changeset/base/335883

Log:
  stand/common/disk.c: dev->d_offset still needs to be set to 0
  
  With r335868, I thought this was no longer necessary. I was wrong.
  
  Reported by:  ian
  Sponsored by: Klara Systems

Modified:
  head/stand/common/disk.c

Modified: head/stand/common/disk.c
==
--- head/stand/common/disk.cTue Jul  3 04:02:40 2018(r335882)
+++ head/stand/common/disk.cTue Jul  3 05:53:27 2018(r335883)
@@ -244,6 +244,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
partdev.d_slice = -1;
partdev.d_partition = -1;
 
+   dev->d_offset = 0;
table = NULL;
slice = dev->d_slice;
partition = dev->d_partition;
___
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: r335868 - head/stand/common

2018-07-02 Thread Allan Jude
Author: allanjude
Date: Mon Jul  2 18:19:08 2018
New Revision: 335868
URL: https://svnweb.freebsd.org/changeset/base/335868

Log:
  stand/common/disk.c: Read partition table relative to the start of the disk
  
  If a disk is of an oddball size, like the 200mb + 512b used in rootgen.sh,
  when disk_open() is called on a GELI encrypted partition, attempts to read
  the partition table fail, as they pass through the decryption process which
  turns the already plaintext data into jibberish.
  
  When reading the partition table, always pass a slice and partition setting
  of -1, and an offset of 0. Setting the slice to -1 prevents a false
  positive when checking the slice against the cache of GELI encrypted
  slices.
  
  Reviewed by:  imp, ian
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D15847

Modified:
  head/stand/common/disk.c

Modified: head/stand/common/disk.c
==
--- head/stand/common/disk.cMon Jul  2 17:54:33 2018(r335867)
+++ head/stand/common/disk.cMon Jul  2 18:19:08 2018(r335868)
@@ -219,20 +219,13 @@ disk_ioctl(struct disk_devdesc *dev, u_long cmd, void 
 int
 disk_open(struct disk_devdesc *dev, uint64_t mediasize, u_int sectorsize)
 {
+   struct disk_devdesc partdev;
struct open_disk *od;
struct ptable *table;
struct ptable_entry part;
int rc, slice, partition;
 
rc = 0;
-   /*
-* While we are reading disk metadata, make sure we do it relative
-* to the start of the disk
-*/
-   dev->d_offset = 0;
-   table = NULL;
-   slice = dev->d_slice;
-   partition = dev->d_partition;
od = (struct open_disk *)malloc(sizeof(struct open_disk));
if (od == NULL) {
DEBUG("no memory");
@@ -242,11 +235,24 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
od->entrysize = 0;
od->mediasize = mediasize;
od->sectorsize = sectorsize;
+   /*
+* While we are reading disk metadata, make sure we do it relative
+* to the start of the disk
+*/
+   memcpy(, dev, sizeof(partdev));
+   partdev.d_offset = 0;
+   partdev.d_slice = -1;
+   partdev.d_partition = -1;
+
+   table = NULL;
+   slice = dev->d_slice;
+   partition = dev->d_partition;
+
DEBUG("%s unit %d, slice %d, partition %d => %p",
disk_fmtdev(dev), dev->dd.d_unit, dev->d_slice, dev->d_partition, 
od);
 
/* Determine disk layout. */
-   od->table = ptable_open(dev, mediasize / sectorsize, sectorsize,
+   od->table = ptable_open(, mediasize / sectorsize, sectorsize,
ptblread);
if (od->table == NULL) {
DEBUG("Can't read partition table");
___
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: r335276 - in head/stand/i386: gptboot zfsboot

2018-06-19 Thread Allan Jude
On 2018-06-17 07:32, Eugene Grosbein wrote:
> 17.06.2018 10:18, Allan Jude wrote:
> 
>> Author: allanjude
>> Date: Sun Jun 17 03:18:56 2018
>> New Revision: 335276
>> URL: https://svnweb.freebsd.org/changeset/base/335276
>>
>> Log:
>>   gptboot, zfsboot, gptzfsboot: Enable the video and serial consoles early
>>   
>>   Normally the serial console is not enabled until /boot.config is read and
>>   we know how the serial console should be configured.  Initialize the
>>   consoles early in 'dual' mode (serial & keyboard) with a default serial
>>   rate of 115200. Then serial is re-initialized once the disk is decrypted
>>   and the /boot.config file can be read.
>>   
>>   This allows the GELIBoot passphrase to be provided via the serial console.
>>   
>>   PR:221526
>>   Requested by:  many
>>   Reviewed by:   imp
>>   Sponsored by:  Klara Systems
>>   Differential Revision: https://reviews.freebsd.org/D15862
> 
> I had several cases when booting FreeBSD/amd64 with motherboard having no 
> serial ports
> hang hard early at boot unless I rebuilt boot media configuring it to NOT try 
> accessing
> missing serial ports. I even could reproduce that with VirtualBox machine 
> configured
> with no serial ports (not same as existing bug inactive serial port).
> 
> Should there be some way to disable this serial ports configuration at 
> compile time?
> 
> 
> 

I think what we'll do it compile it both ways, and use the non-serial
one by default, because it is safer. Then you can just use
'gptboot-serial' if you want serial support.

This will likely make Warner a bit sad, since we are just finally
getting around to reducing the number of different bootcode files.

-- 
Allan Jude
___
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: r335276 - in head/stand/i386: gptboot zfsboot

2018-06-19 Thread Allan Jude
On 2018-06-19 16:30, O. Hartmann wrote:
> Am Sun, 17 Jun 2018 03:18:57 + (UTC)
> Allan Jude  schrieb:
> 
>> Author: allanjude
>> Date: Sun Jun 17 03:18:56 2018
>> New Revision: 335276
>> URL: https://svnweb.freebsd.org/changeset/base/335276
> 
>> Log:
>>   gptboot, zfsboot, gptzfsboot: Enable the video and serial consoles early
> 
>>   Normally the serial console is not enabled until /boot.config is read and
>>   we know how the serial console should be configured.  Initialize the
>>   consoles early in 'dual' mode (serial & keyboard) with a default serial
>>   rate of 115200. Then serial is re-initialized once the disk is decrypted
>>   and the /boot.config file can be read.
> 
>>   This allows the GELIBoot passphrase to be provided via the serial console.
> 
>>   PR:221526
>>   Requested by:  many
>>   Reviewed by:   imp
>>   Sponsored by:  Klara Systems
>>   Differential Revision: https://reviews.freebsd.org/D15862
> 
>> Modified:
>>   head/stand/i386/gptboot/gptboot.c
>>   head/stand/i386/zfsboot/zfsboot.c
> 
> 
> This commit breaks booting off GPT partition (using NanoBSD, as Iposted 
> mistakenly to
> commit r335254, see there).
> Having CURRENT applied to a SD card for usage on a PCEngines APU 2C4, the 
> boot process
> dies immediately showing "Booting from harddisk". r335275 boots well.
> 
> 

I have reverted this commit in r335398.

As I mentioned in that commit, it will likely come back as an optional
feature in the near future.


-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


svn commit: r335398 - in head/stand/i386: gptboot zfsboot

2018-06-19 Thread Allan Jude
Author: allanjude
Date: Wed Jun 20 00:14:54 2018
New Revision: 335398
URL: https://svnweb.freebsd.org/changeset/base/335398

Log:
  Revert r335276
  
  This was causing issues for people booting.
  I will likely bring this back as an optional feature, similar to
  boot0sio, like gptboot-serial or something.
  
  PR:   221526
  Reported by:  O. Hartmann , Thomas Laus 


Modified:
  head/stand/i386/gptboot/gptboot.c
  head/stand/i386/zfsboot/zfsboot.c

Modified: head/stand/i386/gptboot/gptboot.c
==
--- head/stand/i386/gptboot/gptboot.c   Wed Jun 20 00:13:09 2018
(r335397)
+++ head/stand/i386/gptboot/gptboot.c   Wed Jun 20 00:14:54 2018
(r335398)
@@ -285,16 +285,6 @@ main(void)
bootinfo.bi_memsizes_valid++;
bootinfo.bi_bios_dev = dsk.drive;
 
-   /*
-* Initialize the serial console early with a modern default of 115200.
-* Later, we'll read PATH_DOTCONFIG and reconfigure serial according
-* to the configuration provided.
-*/
-   opts = OPT_SET(RBX_DUAL);
-   ioctrl = (IO_SERIAL|IO_KEYBOARD);
-   if (sio_init(115200) != 0)
-   ioctrl &= ~IO_SERIAL;
-
 #ifdef LOADER_GELI_SUPPORT
geli_init();
 #endif

Modified: head/stand/i386/zfsboot/zfsboot.c
==
--- head/stand/i386/zfsboot/zfsboot.c   Wed Jun 20 00:13:09 2018
(r335397)
+++ head/stand/i386/zfsboot/zfsboot.c   Wed Jun 20 00:14:54 2018
(r335398)
@@ -693,16 +693,6 @@ main(void)
 }
 setheap(heap_next, heap_end);
 
-/*
- * Initialize the serial console early with a modern default of 115200.
- * Later, we'll read PATH_DOTCONFIG and reconfigure serial according
- * to the configuration provided.
- */
-opts = OPT_SET(RBX_DUAL);
-ioctrl = (IO_SERIAL|IO_KEYBOARD);
-if (sio_init(115200) != 0)
-   ioctrl &= ~IO_SERIAL;
-
 dsk = malloc(sizeof(struct dsk));
 dsk->drive = *(uint8_t *)PTOV(ARGS);
 dsk->type = dsk->drive & DRV_HARD ? TYPE_AD : TYPE_FD;
___
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: r335298 - head/stand/common

2018-06-17 Thread Allan Jude
Author: allanjude
Date: Sun Jun 17 19:31:35 2018
New Revision: 335298
URL: https://svnweb.freebsd.org/changeset/base/335298

Log:
  stand/common/disk.c: Update debug printf
  
  This was missed in r330809 because it is compiled out by default
  
  Sponsored by: Klara Systems

Modified:
  head/stand/common/disk.c

Modified: head/stand/common/disk.c
==
--- head/stand/common/disk.cSun Jun 17 19:24:40 2018(r335297)
+++ head/stand/common/disk.cSun Jun 17 19:31:35 2018(r335298)
@@ -243,7 +243,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
od->mediasize = mediasize;
od->sectorsize = sectorsize;
DEBUG("%s unit %d, slice %d, partition %d => %p",
-   disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition, od);
+   disk_fmtdev(dev), dev->dd.d_unit, dev->d_slice, dev->d_partition, 
od);
 
/* Determine disk layout. */
od->table = ptable_open(dev, mediasize / sectorsize, sectorsize,
___
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: r335279 - head/tools/boot

2018-06-16 Thread Allan Jude
Author: allanjude
Date: Sun Jun 17 05:55:31 2018
New Revision: 335279
URL: https://svnweb.freebsd.org/changeset/base/335279

Log:
  rootgen.sh: complete all profiles except GELI+MBR (not supported)
  
  This extends the test suite to generate images for every combination of:
  amd64: mbr/gpt geli/nogeli ufs/zfs legacy/uefi/both
  
  Except for mbr+geli, which is not currently possible.
  
  Reviewed by:  imp (previous version)
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D15846

Modified:
  head/tools/boot/install-boot.sh
  head/tools/boot/rootgen.sh

Modified: head/tools/boot/install-boot.sh
==
--- head/tools/boot/install-boot.sh Sun Jun 17 05:14:50 2018
(r335278)
+++ head/tools/boot/install-boot.sh Sun Jun 17 05:55:31 2018
(r335279)
@@ -27,7 +27,7 @@ find-part() {
 gpart show $dev | tail +2 | awk '$4 == "'$part'" { print $3; }'
 }
 
-boot_nogeli_gpt_zfs_legacy() {
+boot_nogeli_gpt_ufs_legacy() {
 dev=$1
 dst=$2
 
@@ -35,20 +35,34 @@ boot_nogeli_gpt_zfs_legacy() {
 if [ -z "$idx" ] ; then
die "No freebsd-boot partition found"
 fi
-doit gpart bootcode -b ${gpt0} -p ${gptzfs2} -i $idx $dev
-exit 0
+doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
 }
 
-boot_nogeli_gpt_ufs_legacy() {
+boot_nogeli_gpt_ufs_uefi() {
 dev=$1
 dst=$2
 
+idx=$(find-part $dev "efi")
+if [ -z "$idx" ] ; then
+   die "No ESP partition found"
+fi
+doit gpart bootcode -p ${efi2} -i $idx $dev
+}
+
+boot_nogeli_gpt_ufs_both() {
+boot_nogeli_gpt_ufs_legacy $1 $2 $3
+boot_nogeli_gpt_ufs_uefi $1 $2 $3
+}
+
+boot_nogeli_gpt_zfs_legacy() {
+dev=$1
+dst=$2
+
 idx=$(find-part $dev "freebsd-boot")
 if [ -z "$idx" ] ; then
die "No freebsd-boot partition found"
 fi
-doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
-exit 0
+doit gpart bootcode -b ${gpt0} -p ${gptzfs2} -i $idx $dev
 }
 
 boot_nogeli_gpt_zfs_uefi() {
@@ -57,64 +71,132 @@ boot_nogeli_gpt_zfs_uefi() {
 
 idx=$(find-part $dev "efi")
 if [ -z "$idx" ] ; then
-   die "No efi ESP partition found"
+   die "No ESP partition found"
 fi
 doit gpart bootcode -p ${efi2} -i $idx $dev
-exit 0
 }
 
 boot_nogeli_gpt_zfs_both() {
+boot_nogeli_gpt_zfs_legacy $1 $2 $3
+boot_nogeli_gpt_zfs_uefi $1 $2 $3
+}
+
+boot_nogeli_mbr_ufs_legacy() {
 dev=$1
 dst=$2
 
-# XXX: Should this be copy/pasted, or should it call both _uefi and _legacy
-idx=$(find-part $dev "efi")
-if [ -z "$idx" ] ; then
-   die "No efi ESP partition found"
+doit gpart bootcode -b ${mbr0} ${dev}
+s=$(find-part $dev "freebsd")
+if [ -z "$s" ] ; then
+   die "No freebsd slice found"
 fi
-doit gpart bootcode -p ${efi2} -i $idx $dev
+doit gpart bootcode -p ${mbr2} ${dev}s${s}
+}
 
-idx=$(find-part $dev "freebsd-boot")
-if [ -z "$idx" ] ; then
-   die "No freebsd-boot partition found"
+boot_nogeli_mbr_ufs_uefi() {
+dev=$1
+dst=$2
+
+s=$(find-part ${dev} "!239")
+if [ -z "$s" ] ; then
+   die "No ESP slice found"
 fi
-doit gpart bootcode -b ${gpt0} -p ${gptzfs2} -i $idx $dev
-exit 0
+doit gpart bootcode -p ${efi2} -i ${s} ${dev}
 }
 
+boot_nogeli_mbr_ufs_both() {
+boot_nogeli_mbr_ufs_legacy $1 $2 $3
+boot_nogeli_mbr_ufs_uefi $1 $2 $3
+}
+
 boot_nogeli_mbr_zfs_legacy() {
 dev=$1
 dst=$2
 
 # search to find the BSD slice
-s=$(findpart $dev "freebsd-zfs")
+s=$(find-part $dev "freebsd")
 if [ -z "$s" ] ; then
+   die "No BSD slice found"
+fi
+idx=$(find-part ${dev}s${s} "freebsd-zfs")
+if [ -z "$idx" ] ; then
die "No freebsd-zfs slice found"
 fi
 # search to find the freebsd-zfs partition within the slice
 # Or just assume it is 'a' because it has to be since it fails otherwise
+doit gpart bootcode -b ${dst}/boot/mbr ${dev}
 dd if=${dst}/boot/zfsboot of=/tmp/zfsboot1 count=1
-doit gpart bootcode -b /tmp/zfsboo1 ${dev}s${s}# Put boot1 into the 
start of part
+doit gpart bootcode -b /tmp/zfsboot1 ${dev}s${s}   # Put boot1 into the 
start of part
 sysctl kern.geom.debugflags=0x10   # Put boot2 into ZFS boot slot
-doit dd if=${dst}/boot/zfsboot of=/dev/${dev}s${s} iseek=1 seek=1024
+doit dd if=${dst}/boot/zfsboot of=/dev/${dev}s${s}a skip=1 seek=1024
 sysctl kern.geom.debugflags=0x0
-
-exit 0
 }
 
-boot_nogeli_mbr_ufs_legacy() {
+boot_nogeli_mbr_zfs_uefi() {
 dev=$1
 dst=$2
 
-doit gpart bootcode -b ${mbr0} ${dev}
-s=$(findpart $dev "freebsd-ufs")
+s=$(find-part $dev "!239")
 if [ -z "$s" ] ; then
-   die "No freebsd-ufs slice found"
+   die "No ESP slice found"
 fi
-doit gpart bootcode -p ${mbr2} ${dev}s${s}
-exit 0
+doit gpart bootcode -p ${efi2} -i ${s} ${dev}
 }
 

svn commit: r335276 - in head/stand/i386: gptboot zfsboot

2018-06-16 Thread Allan Jude
Author: allanjude
Date: Sun Jun 17 03:18:56 2018
New Revision: 335276
URL: https://svnweb.freebsd.org/changeset/base/335276

Log:
  gptboot, zfsboot, gptzfsboot: Enable the video and serial consoles early
  
  Normally the serial console is not enabled until /boot.config is read and
  we know how the serial console should be configured.  Initialize the
  consoles early in 'dual' mode (serial & keyboard) with a default serial
  rate of 115200. Then serial is re-initialized once the disk is decrypted
  and the /boot.config file can be read.
  
  This allows the GELIBoot passphrase to be provided via the serial console.
  
  PR:   221526
  Requested by: many
  Reviewed by:  imp
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D15862

Modified:
  head/stand/i386/gptboot/gptboot.c
  head/stand/i386/zfsboot/zfsboot.c

Modified: head/stand/i386/gptboot/gptboot.c
==
--- head/stand/i386/gptboot/gptboot.c   Sun Jun 17 03:10:25 2018
(r335275)
+++ head/stand/i386/gptboot/gptboot.c   Sun Jun 17 03:18:56 2018
(r335276)
@@ -285,6 +285,16 @@ main(void)
bootinfo.bi_memsizes_valid++;
bootinfo.bi_bios_dev = dsk.drive;
 
+   /*
+* Initialize the serial console early with a modern default of 115200.
+* Later, we'll read PATH_DOTCONFIG and reconfigure serial according
+* to the configuration provided.
+*/
+   opts = OPT_SET(RBX_DUAL);
+   ioctrl = (IO_SERIAL|IO_KEYBOARD);
+   if (sio_init(115200) != 0)
+   ioctrl &= ~IO_SERIAL;
+
 #ifdef LOADER_GELI_SUPPORT
geli_init();
 #endif

Modified: head/stand/i386/zfsboot/zfsboot.c
==
--- head/stand/i386/zfsboot/zfsboot.c   Sun Jun 17 03:10:25 2018
(r335275)
+++ head/stand/i386/zfsboot/zfsboot.c   Sun Jun 17 03:18:56 2018
(r335276)
@@ -693,6 +693,16 @@ main(void)
 }
 setheap(heap_next, heap_end);
 
+/*
+ * Initialize the serial console early with a modern default of 115200.
+ * Later, we'll read PATH_DOTCONFIG and reconfigure serial according
+ * to the configuration provided.
+ */
+opts = OPT_SET(RBX_DUAL);
+ioctrl = (IO_SERIAL|IO_KEYBOARD);
+if (sio_init(115200) != 0)
+   ioctrl &= ~IO_SERIAL;
+
 dsk = malloc(sizeof(struct dsk));
 dsk->drive = *(uint8_t *)PTOV(ARGS);
 dsk->type = dsk->drive & DRV_HARD ? TYPE_AD : TYPE_FD;
___
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: r335259 - head/tools/boot

2018-06-16 Thread Allan Jude
Author: allanjude
Date: Sat Jun 16 17:45:44 2018
New Revision: 335259
URL: https://svnweb.freebsd.org/changeset/base/335259

Log:
  rootgen.sh: Don't copy various bits of the bootcode from the running system
  
  We want to use the versions of the bootcode we just built, rather than
  ones from whatever happens to be in /boot on the test machine
  
  These were incorrectly added by me in r334888

Modified:
  head/tools/boot/rootgen.sh

Modified: head/tools/boot/rootgen.sh
==
--- head/tools/boot/rootgen.sh  Sat Jun 16 17:11:23 2018(r335258)
+++ head/tools/boot/rootgen.sh  Sat Jun 16 17:45:44 2018(r335259)
@@ -389,16 +389,8 @@ DESTDIR=${OBJDIR}/boot-tree
 rm -rf ${DESTDIR}
 mkdir -p ${DESTDIR}/boot/defaults
 mkdir -p ${DESTDIR}/boot/kernel
-cp /boot/boot0 ${DESTDIR}/boot
-cp /boot/boot0sio ${DESTDIR}/boot
-cp /boot/pmbr ${DESTDIR}/boot
-cp /boot/boot ${DESTDIR}/boot
 # XXX boot1 exists only on sparc64
 cp /boot/boot1 ${DESTDIR}/boot
-cp /boot/boot1.efifat ${DESTDIR}/boot
-cp /boot/gptboot ${DESTDIR}/boot
-cp /boot/gptzfsboot ${DESTDIR}/boot
-cp /boot/loader ${DESTDIR}/boot
 cp /boot/kernel/kernel ${DESTDIR}/boot/kernel
 echo -h -D -S115200 > ${DESTDIR}/boot.config
 # XXX
___
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: r335254 - in head/stand/i386: libi386 zfsboot

2018-06-16 Thread Allan Jude
Author: allanjude
Date: Sat Jun 16 15:16:02 2018
New Revision: 335254
URL: https://svnweb.freebsd.org/changeset/base/335254

Log:
  Avoid reading past the end of the disk in zfsboot.c and biosdisk.c
  
  The GELI boot code rounds reads up to 4k, since the encrypted sectors are
  4k, and must be decrypted as a unit. With oddball sized disks (almost
  always virtual), this can lead to reading past the end of the disk.
  
  Reviewed by:  imp, tsoome
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D15844

Modified:
  head/stand/i386/libi386/biosdisk.c
  head/stand/i386/zfsboot/zfsboot.c

Modified: head/stand/i386/libi386/biosdisk.c
==
--- head/stand/i386/libi386/biosdisk.c  Sat Jun 16 15:05:05 2018
(r335253)
+++ head/stand/i386/libi386/biosdisk.c  Sat Jun 16 15:16:02 2018
(r335254)
@@ -882,6 +882,12 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int bl
}
}
 
+   if (alignlba + alignblks > BD(dev).bd_sectors) {
+   DEBUG("Shorted read at %llu from %d to %llu blocks",
+   alignlba, alignblks, BD(dev).bd_sectors - alignlba);
+   alignblks = BD(dev).bd_sectors - alignlba;
+   }
+
err = bd_io(dev, alignlba, alignblks, tmpbuf, 0);
if (err)
return (err);

Modified: head/stand/i386/zfsboot/zfsboot.c
==
--- head/stand/i386/zfsboot/zfsboot.c   Sat Jun 16 15:05:05 2018
(r335253)
+++ head/stand/i386/zfsboot/zfsboot.c   Sat Jun 16 15:16:02 2018
(r335254)
@@ -209,6 +209,12 @@ vdev_read(void *xvdev, void *priv, off_t off, void *bu
alignnb = roundup2(nb * DEV_BSIZE + diff, DEV_GELIBOOT_BSIZE)
/ DEV_BSIZE;
 
+   if (dsk->size > 0 && alignlba + alignnb > dsk->size + 
dsk->start) {
+   printf("Shortening read at %lld from %d to %lld\n", 
alignlba,
+   alignnb, (dsk->size + dsk->start) - alignlba);
+   alignnb = (dsk->size + dsk->start) - alignlba;
+   }
+
if (drvread(dsk, dmadat->rdbuf, alignlba, alignnb))
return -1;
 #ifdef LOADER_GELI_SUPPORT
@@ -694,7 +700,7 @@ main(void)
 dsk->slice = *(uint8_t *)PTOV(ARGS + 1) + 1;
 dsk->part = 0;
 dsk->start = 0;
-dsk->size = 0;
+dsk->size = drvsize_ext(dsk);
 
 bootinfo.bi_version = BOOTINFO_VERSION;
 bootinfo.bi_size = sizeof(bootinfo);
@@ -745,7 +751,7 @@ main(void)
dsk->slice = 0;
dsk->part = 0;
dsk->start = 0;
-   dsk->size = 0;
+   dsk->size = drvsize_ext(dsk);
probe_drive(dsk);
 }
 
___
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: r335248 - head/stand/i386/libi386

2018-06-16 Thread Allan Jude
Author: allanjude
Date: Sat Jun 16 06:23:07 2018
New Revision: 335248
URL: https://svnweb.freebsd.org/changeset/base/335248

Log:
  biosdisk.c: fix type in debug printf
  
  Sponsored by: Klara Systems

Modified:
  head/stand/i386/libi386/biosdisk.c

Modified: head/stand/i386/libi386/biosdisk.c
==
--- head/stand/i386/libi386/biosdisk.c  Sat Jun 16 05:58:33 2018
(r335247)
+++ head/stand/i386/libi386/biosdisk.c  Sat Jun 16 06:23:07 2018
(r335248)
@@ -635,7 +635,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
 #endif
break;
 case F_WRITE :
-   DEBUG("write %d from %d to %p", blks, dblk, buf);
+   DEBUG("write %d from %lld to %p", blks, dblk, buf);
 
if (blks && bd_write(dev, dblk, blks, buf)) {
DEBUG("write error");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335247 - head/stand/i386/libi386

2018-06-15 Thread Allan Jude
Author: allanjude
Date: Sat Jun 16 05:58:33 2018
New Revision: 335247
URL: https://svnweb.freebsd.org/changeset/base/335247

Log:
  biosdisk.c: add missing \n to error message
  
  Sponsored by: Klara Systems

Modified:
  head/stand/i386/libi386/biosdisk.c

Modified: head/stand/i386/libi386/biosdisk.c
==
--- head/stand/i386/libi386/biosdisk.c  Sat Jun 16 04:50:40 2018
(r335246)
+++ head/stand/i386/libi386/biosdisk.c  Sat Jun 16 05:58:33 2018
(r335247)
@@ -619,7 +619,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
if (blks && (rc = bd_read(dev, dblk, blks, buf))) {
/* Filter out floppy controller errors */
if (BD(dev).bd_flags != BD_FLOPPY || rc != 0x20) {
-   printf("read %d from %lld to %p, error: 0x%x", blks, dblk,
+   printf("read %d from %lld to %p, error: 0x%x\n", blks, dblk,
buf, rc);
}
return (EIO);
___
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"


  1   2   3   4   5   >