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

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 04:16:46 2018
New Revision: 332554
URL: https://svnweb.freebsd.org/changeset/base/332554

Log:
  MFC r331950: 9434 Speculative prefetch is blocked by device removal code.
  
  Device removal code does not set spa_indirect_vdevs_loaded for pools
  that never experienced device removal.  At least one visual consequence
  of it is completely blocked speculative prefetcher.  This patch sets
  the variable in such situations.

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

Modified: 
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c 
Mon Apr 16 04:16:10 2018(r332553)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c 
Mon Apr 16 04:16:46 2018(r332554)
@@ -368,6 +368,7 @@ spa_remove_init(spa_t *spa)
spa->spa_removing_phys.sr_state = DSS_NONE;
spa->spa_removing_phys.sr_removing_vdev = -1;
spa->spa_removing_phys.sr_prev_indirect_vdev = -1;
+   spa->spa_indirect_vdevs_loaded = B_TRUE;
return (0);
} else if (error != 0) {
return (error);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332553 - in stable/11: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 04:16:10 2018
New Revision: 332553
URL: https://svnweb.freebsd.org/changeset/base/332553

Log:
  MFC r331713: MFV r331712:
  9280 Assertion failure while running removal_with_ganging test with 4K devices
  
  illumos/illumos-gate@243952c7eeef020886e3e2e3df99a513df40584a
  
  Reviewed by: George Wilson 
  Reviewed by: John Kennedy 
  Approved by: Garrett D'Amore 
  Author: Matt Ahrens 

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

Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.cMon Apr 16 
04:15:25 2018(r332552)
+++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.cMon Apr 16 
04:16:10 2018(r332553)
@@ -164,7 +164,7 @@ typedef struct ztest_shared_opts {
int zo_init;
uint64_t zo_time;
uint64_t zo_maxloops;
-   uint64_t zo_metaslab_gang_bang;
+   uint64_t zo_metaslab_force_ganging;
 } ztest_shared_opts_t;
 
 static const ztest_shared_opts_t ztest_opts_defaults = {
@@ -186,10 +186,10 @@ static const ztest_shared_opts_t ztest_opts_defaults =
.zo_init = 1,
.zo_time = 300, /* 5 minutes */
.zo_maxloops = 50,  /* max loops during spa_freeze() */
-   .zo_metaslab_gang_bang = 32 << 10
+   .zo_metaslab_force_ganging = 32 << 10
 };
 
-extern uint64_t metaslab_gang_bang;
+extern uint64_t metaslab_force_ganging;
 extern uint64_t metaslab_df_alloc_threshold;
 extern uint64_t zfs_deadman_synctime_ms;
 extern int metaslab_preload_limit;
@@ -567,12 +567,12 @@ usage(boolean_t requested)
const ztest_shared_opts_t *zo = _opts_defaults;
 
char nice_vdev_size[NN_NUMBUF_SZ];
-   char nice_gang_bang[NN_NUMBUF_SZ];
+   char nice_force_ganging[NN_NUMBUF_SZ];
FILE *fp = requested ? stdout : stderr;
 
nicenum(zo->zo_vdev_size, nice_vdev_size, sizeof (nice_vdev_size));
-   nicenum(zo->zo_metaslab_gang_bang, nice_gang_bang,
-   sizeof (nice_gang_bang));
+   nicenum(zo->zo_metaslab_force_ganging, nice_force_ganging,
+   sizeof (nice_force_ganging));
 
(void) fprintf(fp, "Usage: %s\n"
"\t[-v vdevs (default: %llu)]\n"
@@ -607,7 +607,7 @@ usage(boolean_t requested)
zo->zo_raidz_parity,/* -R */
zo->zo_datasets,/* -d */
zo->zo_threads, /* -t */
-   nice_gang_bang, /* -g */
+   nice_force_ganging, /* -g */
zo->zo_init,/* -i */
(u_longlong_t)zo->zo_killrate,  /* -k */
zo->zo_pool,/* -p */
@@ -676,8 +676,8 @@ process_options(int argc, char **argv)
zo->zo_threads = MAX(1, value);
break;
case 'g':
-   zo->zo_metaslab_gang_bang = MAX(SPA_MINBLOCKSIZE << 1,
-   value);
+   zo->zo_metaslab_force_ganging =
+   MAX(SPA_MINBLOCKSIZE << 1, value);
break;
case 'i':
zo->zo_init = value;
@@ -6425,7 +6425,7 @@ main(int argc, char **argv)
zs = ztest_shared;
 
if (fd_data_str) {
-   metaslab_gang_bang = ztest_opts.zo_metaslab_gang_bang;
+   metaslab_force_ganging = ztest_opts.zo_metaslab_force_ganging;
metaslab_df_alloc_threshold =
zs->zs_metaslab_df_alloc_threshold;
 

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Mon Apr 
16 04:15:25 2018(r332552)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Mon Apr 
16 04:16:10 2018(r332553)
@@ -44,9 +44,9 @@ SYSCTL_NODE(_vfs_zfs, OID_AUTO, metaslab, CTLFLAG_RW, 
((flags) & (METASLAB_GANG_CHILD | METASLAB_GANG_HEADER))
 
 uint64_t metaslab_aliquot = 512ULL << 10;
-uint64_t metaslab_gang_bang = SPA_MAXBLOCKSIZE + 1;/* force gang blocks */
-SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, gang_bang, CTLFLAG_RWTUN,
-_gang_bang, 0,
+uint64_t metaslab_force_ganging = SPA_MAXBLOCKSIZE + 1;/* force gang 
blocks */
+SYSCTL_QUAD(_vfs_zfs_metaslab, OID_AUTO, force_ganging, CTLFLAG_RWTUN,
+_force_ganging, 0,
 "Force gang block allocation for blocks larger than or equal to this 
value");
 
 /*

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

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 04:15:25 2018
New Revision: 332552
URL: https://svnweb.freebsd.org/changeset/base/332552

Log:
  MFC r331711: MFV 331710:
  9188 increase size of dbuf cache to reduce indirect block decompression
  
  illumos/illumos-gate@268bbb2a2fa79c36d4695d13a595ba50a7754b76
  
  With compressed ARC (6950) we use up to 25% of our CPU to decompress indirect
  blocks, under a workload of random cached reads. To reduce this decompression
  cost, we would like to increase the size of the dbuf cache so that more
  indirect blocks can be stored uncompressed.
  
  If we are caching entire large files of recordsize=8K, the indirect blocks
  use 1/64th as much memory as the data blocks (assuming they have the same
  compression ratio). We suggest making the dbuf cache be 1/32nd of all memory,
  so that in this scenario we should be able to keep all the indirect blocks
  decompressed in the dbuf cache. (We want it to be more than the 1/64th that
  the indirect blocks would use because we need to cache other stuff in the
  dbuf cache as well.)
  
  In real world workloads, this won't help as dramatically as the example
  above, but we think it's still worth it because the risk of decreasing
  performance is low. The potential negative performance impact is that we
  will be slightly reducing the size of the ARC (by ~3%).
  
  Reviewed by: Dan Kimmel 
  Reviewed by: Prashanth Sreenivasa 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Sanjay Nadkarni 
  Reviewed by: Allan Jude 
  Reviewed by: Igor Kozhukhov 
  Approved by: Garrett D'Amore 
  Author: George Wilson 

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Apr 
16 04:14:42 2018(r332551)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Apr 
16 04:15:25 2018(r332552)
@@ -85,10 +85,10 @@ static boolean_t dbuf_evict_thread_exit;
  */
 static multilist_t *dbuf_cache;
 static refcount_t dbuf_cache_size;
-uint64_t dbuf_cache_max_bytes = 100 * 1024 * 1024;
+uint64_t dbuf_cache_max_bytes = 0;
 
-/* Cap the size of the dbuf cache to log2 fraction of arc size. */
-int dbuf_cache_max_shift = 5;
+/* Set the default size of the dbuf cache to log2 fraction of arc size. */
+int dbuf_cache_shift = 5;
 
 /*
  * The dbuf cache uses a three-stage eviction policy:
@@ -138,8 +138,8 @@ uint_t dbuf_cache_lowater_pct = 10;
 SYSCTL_DECL(_vfs_zfs);
 SYSCTL_QUAD(_vfs_zfs, OID_AUTO, dbuf_cache_max_bytes, CTLFLAG_RWTUN,
 _cache_max_bytes, 0, "dbuf cache size in bytes");
-SYSCTL_INT(_vfs_zfs, OID_AUTO, dbuf_cache_max_shift, CTLFLAG_RDTUN,
-_cache_max_shift, 0, "dbuf size as log2 fraction of ARC");
+SYSCTL_INT(_vfs_zfs, OID_AUTO, dbuf_cache_shift, CTLFLAG_RDTUN,
+_cache_shift, 0, "dbuf cache size as log2 fraction of ARC");
 SYSCTL_UINT(_vfs_zfs, OID_AUTO, dbuf_cache_hiwater_pct, CTLFLAG_RWTUN,
 _cache_hiwater_pct, 0, "max percents above the dbuf cache size");
 SYSCTL_UINT(_vfs_zfs, OID_AUTO, dbuf_cache_lowater_pct, CTLFLAG_RWTUN,
@@ -610,11 +610,15 @@ retry:
mutex_init(>hash_mutexes[i], NULL, MUTEX_DEFAULT, NULL);
 
/*
-* Setup the parameters for the dbuf cache. We cap the size of the
-* dbuf cache to 1/32nd (default) of the size of the ARC.
+* Setup the parameters for the dbuf cache. We set the size of the
+* dbuf cache to 1/32nd (default) of the size of the ARC. If the value
+* has been set in /etc/system and it's not greater than the size of
+* the ARC, then we honor that value.
 */
-   dbuf_cache_max_bytes = MIN(dbuf_cache_max_bytes,
-   arc_max_bytes() >> dbuf_cache_max_shift);
+   if (dbuf_cache_max_bytes == 0 ||
+   dbuf_cache_max_bytes >= arc_max_bytes())  {
+   dbuf_cache_max_bytes = arc_max_bytes() >> dbuf_cache_shift;
+   }
 
/*
 * All entries are queued via taskq_dispatch_ent(), so min/maxalloc
___
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: r332551 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 04:14:42 2018
New Revision: 332551
URL: https://svnweb.freebsd.org/changeset/base/332551

Log:
  MFC r331709: MFV r331708:
  9321 arc_loan_compressed_buf() can increment arc_loaned_bytes by the wrong 
value
  
  illumos/illumos-gate@9be12bd737714550277bd02b0c693db560976990
  
  arc_loan_compressed_buf() increments arc_loaned_bytes by psize unconditionally
  In the case of zfs_compressed_arc_enabled=0, when the buf is returned via
  arc_return_buf(), if ARC_BUF_COMPRESSED(buf) is false, then arc_loaned_bytes
  is decremented by lsize, not psize.
  
  Switch to using arc_buf_size(buf), instead of psize, which will return
  psize or lsize, depending on the result of ARC_BUF_COMPRESSED(buf).
  
  Reviewed by: Matt Ahrens 
  Reviewed by: George Wilson 
  Approved by: Garrett D'Amore 
  Author: Allan Jude 

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Mon Apr 
16 04:14:03 2018(r332550)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Mon Apr 
16 04:14:42 2018(r332551)
@@ -2877,7 +2877,7 @@ arc_loan_buf(spa_t *spa, boolean_t is_metadata, int si
arc_buf_t *buf = arc_alloc_buf(spa, arc_onloan_tag,
is_metadata ? ARC_BUFC_METADATA : ARC_BUFC_DATA, size);
 
-   arc_loaned_bytes_update(size);
+   arc_loaned_bytes_update(arc_buf_size(buf));
 
return (buf);
 }
@@ -2889,7 +2889,7 @@ arc_loan_compressed_buf(spa_t *spa, uint64_t psize, ui
arc_buf_t *buf = arc_alloc_compressed_buf(spa, arc_onloan_tag,
psize, lsize, compression_type);
 
-   arc_loaned_bytes_update(psize);
+   arc_loaned_bytes_update(arc_buf_size(buf));
 
return (buf);
 }
___
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: r332550 - in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/c...

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 04:14:03 2018
New Revision: 332550
URL: https://svnweb.freebsd.org/changeset/base/332550

Log:
  MFC r331707: MFV r331706:
  9235 rename zpool_rewind_policy_t to zpool_load_policy_t
  
  illumos/illumos-gate@5dafeea3ebd2dd77affc802bcb90f63faf01589f
  
  We want to be able to pass various settings during import/open of a pool,
  which are not only related to rewind. Instead of adding a new policy and
  duplicate a bunch of code, we should just rename rewind_policy to a more
  generic term like load_policy.
  
  For instance, we'd like to set spa->spa_import_flags from the nvlist,
  rather from a flags parameter passed to spa_import as in some cases we want
  those flags not only for the import case, but also for the open case. One
  such flag could be ZFS_IMPORT_MISSING_LOG (as used in zdb) which would
  allow zfs to open a pool when logs are missing.
  
  Reviewed by: Matt Ahrens 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Pavel Zakharov 

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Apr 16 04:13:19 
2018(r332549)
+++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Apr 16 04:14:03 
2018(r332550)
@@ -5222,8 +5222,8 @@ main(int argc, char **argv)
(dump_opt['X'] ? ZPOOL_EXTREME_REWIND : 0);
 
if (nvlist_alloc(, NV_UNIQUE_NAME_TYPE, 0) != 0 ||
-   nvlist_add_uint64(policy, ZPOOL_REWIND_REQUEST_TXG, max_txg) != 0 ||
-   nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind) != 0)
+   nvlist_add_uint64(policy, ZPOOL_LOAD_REQUEST_TXG, max_txg) != 0 ||
+   nvlist_add_uint32(policy, ZPOOL_LOAD_REWIND_POLICY, rewind) != 0)
fatal("internal error: %s", strerror(ENOMEM));
 
error = 0;
@@ -5240,7 +5240,7 @@ main(int argc, char **argv)
}
 
if (nvlist_add_nvlist(cfg,
-   ZPOOL_REWIND_POLICY, policy) != 0) {
+   ZPOOL_LOAD_POLICY, policy) != 0) {
fatal("can't open '%s': %s",
target, strerror(ENOMEM));
}

Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Mon Apr 16 
04:13:19 2018(r332549)
+++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Mon Apr 16 
04:14:03 2018(r332550)
@@ -2357,8 +2357,9 @@ zpool_do_import(int argc, char **argv)
 
/* In the future, we can capture further policy and include it here */
if (nvlist_alloc(, NV_UNIQUE_NAME, 0) != 0 ||
-   nvlist_add_uint64(policy, ZPOOL_REWIND_REQUEST_TXG, txg) != 0 ||
-   nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0)
+   nvlist_add_uint64(policy, ZPOOL_LOAD_REQUEST_TXG, txg) != 0 ||
+   nvlist_add_uint32(policy, ZPOOL_LOAD_REWIND_POLICY,
+   rewind_policy) != 0)
goto error;
 
if (searchdirs == NULL) {
@@ -2483,7 +2484,7 @@ zpool_do_import(int argc, char **argv)
if (do_destroyed && pool_state != POOL_STATE_DESTROYED)
continue;
 
-   verify(nvlist_add_nvlist(config, ZPOOL_REWIND_POLICY,
+   verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY,
policy) == 0);
 
if (argc == 0) {
@@ -3971,8 +3972,10 @@ zpool_do_clear(int argc, char **argv)
 
/* In future, further rewind policy choices can be passed along here */
if (nvlist_alloc(, NV_UNIQUE_NAME, 0) != 0 ||
-   nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0)
+   nvlist_add_uint32(policy, ZPOOL_LOAD_REWIND_POLICY,
+   rewind_policy) != 0) {
return (1);
+   }
 
pool = argv[0];
device = argc == 2 ? argv[1] : NULL;

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h

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

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 04:13:19 2018
New Revision: 332549
URL: https://svnweb.freebsd.org/changeset/base/332549

Log:
  MFC r331705: MFV 331704:
  9191 dump vdev tree to zfs_dbgmsg when spa load fails due to missing log 
devices
  
  illumos/illumos-gate@ccef24b493bcbd146fcd6d894cae081470b6
  
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Matt Ahrens 
  Approved by: Robert Mustacchi 
  Author: Pavel Zakharov 

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 04:11:48 2018(r332548)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 04:13:19 2018(r332549)
@@ -1887,6 +1887,7 @@ spa_check_for_missing_logs(spa_t *spa)
 
if (idx > 0) {
spa_load_failed(spa, "some log devices are missing");
+   vdev_dbgmsg_print_tree(rvd, 2);
return (SET_ERROR(ENXIO));
}
} else {
@@ -1898,6 +1899,7 @@ spa_check_for_missing_logs(spa_t *spa)
spa_set_log_state(spa, SPA_LOG_CLEAR);
spa_load_note(spa, "some log devices are "
"missing, ZIL is dropped.");
+   vdev_dbgmsg_print_tree(rvd, 2);
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: r332548 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 04:11:48 2018
New Revision: 332548
URL: https://svnweb.freebsd.org/changeset/base/332548

Log:
  MFC r331703: MFV 331702:
  9187 racing condition between vdev label and spa_last_synced_txg in 
vdev_validate
  
  illumos/illumos-gate@d1de72cfa29ab77ff80e2bb0e668a6afa5bccaf0
  
  ztest failed with uncorrectable IO error despite having the fix for #7163.
  Both sides of the mirror have CANT_OPEN_BAD_LABEL, which also distinguishes
  it from that issue.
  
  Definitely seems like a racing condition between the vdev_validate and 
spa_sync:
  1. Thread A (spa_sync): vdev label is updated to latest txg
  2. Thread B (vdev_validate): vdev label's txg is compared to 
spa_last_synced_txg and is ahead.
  3. Thread A (spa_sync): spa_last_synced_txg is updated to latest txg.
  
  Solution: do not check txg in vdev_validate unless config lock is held.
  
  Reviewed by: George Wilson 
  Reviewed by: Matt Ahrens 
  Approved by: Robert Mustacchi 
  Author: Pavel Zakharov 

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Apr 
16 04:10:56 2018(r332547)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Apr 
16 04:11:48 2018(r332548)
@@ -1696,8 +1696,11 @@ vdev_validate(vdev_t *vd)
/*
 * If we are performing an extreme rewind, we allow for a label that
 * was modified at a point after the current txg.
+* If config lock is not held do not check for the txg. spa_sync could
+* be updating the vdev's label before updating spa_last_synced_txg.
 */
-   if (spa->spa_extreme_rewind || spa_last_synced_txg(spa) == 0)
+   if (spa->spa_extreme_rewind || spa_last_synced_txg(spa) == 0 ||
+   spa_config_held(spa, SCL_CONFIG, RW_WRITER) != SCL_CONFIG)
txg = UINT64_MAX;
else
txg = spa_last_synced_txg(spa);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332547 - in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/op...

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 04:10:56 2018
New Revision: 332547
URL: https://svnweb.freebsd.org/changeset/base/332547

Log:
  MFC r331701: MFV r331695, 331700: 9166 zfs storage pool checkpoint
  
  illumos/illumos-gate@8671400134a11c848244896ca51a7db4d0f69da4
  
  The idea of Storage Pool Checkpoint (aka zpool checkpoint) deals with
  exactly that.  It can be thought of as a “pool-wide snapshot” (or a
  variation of extreme rewind that doesn’t corrupt your data).  It remembers
  the entire state of the pool at the point that it was taken and the user
  can revert back to it later or discard it.  Its generic use case is an
  administrator that is about to perform a set of destructive actions to ZFS
  as part of a critical procedure.  She takes a checkpoint of the pool before
  performing the actions, then rewinds back to it if one of them fails or puts
  the pool into an unexpected state.  Otherwise, she discards it.  With the
  assumption that no one else is making modifications to ZFS, she basically
  wraps all these actions into a “high-level transaction”.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: John Kennedy 
  Reviewed by: Dan Kimmel 
  Approved by: Richard Lowe 
  Author: Serapheim Dimitropoulos 

Added:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c
 - copied unchanged from r331701, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h
 - copied unchanged from r331701, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h
Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.8
  stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool.8
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  

svn commit: r332546 - head/sys/powerpc/mpc85xx

2018-04-15 Thread Justin Hibbits
Author: jhibbits
Date: Mon Apr 16 04:02:53 2018
New Revision: 332546
URL: https://svnweb.freebsd.org/changeset/base/332546

Log:
  Use a resource hint instead of environment variable for DIU mode
  
  This makes it more consistent with FreeBSD norms, rather than using Linux's
  norms.  Now, instead of needing an environment variable
  
video-mode=fslfb:1280x1024@60
  
  Now one would use a hint:
  
hint.fb.0.mode=1280x1024@60

Modified:
  head/sys/powerpc/mpc85xx/fsl_diu.c

Modified: head/sys/powerpc/mpc85xx/fsl_diu.c
==
--- head/sys/powerpc/mpc85xx/fsl_diu.c  Mon Apr 16 03:58:08 2018
(r332545)
+++ head/sys/powerpc/mpc85xx/fsl_diu.c  Mon Apr 16 04:02:53 2018
(r332546)
@@ -363,12 +363,9 @@ diu_attach(device_t dev)
 
/* TODO: Eventually, allow EDID to be dynamically provided. */
if (OF_getprop_alloc(node, "edid", _cells) <= 0) {
-   /*
-* u-boot uses the environment variable name 'video-mode', so
-* just use the same name here.  Should allow another variable
-* that better fits our design model, but this is fine.
-*/
-   if ((vm_name = kern_getenv("video-mode")) == NULL) {
+   /* Get a resource hint: hint.fb.N.mode */
+   if (resource_string_value(device_get_name(dev),
+   device_get_unit(dev), "mode", _name) != 0) {
device_printf(dev,
"No EDID data and no video-mode env set\n");
return (ENXIO);
@@ -383,7 +380,7 @@ diu_attach(device_t dev)
videomode = edid.edid_preferred_mode;
} else {
/* Parse video-mode kenv variable. */
-   if ((err = sscanf(vm_name, "fslfb:%dx%d@%d", , , )) != 3) 
{
+   if ((err = sscanf(vm_name, "%dx%d@%d", , , )) != 3) {
device_printf(dev,
"Cannot parse video mode: %s\n", vm_name);
return (ENXIO);
___
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: r332545 - in stable/11/cddl/contrib/opensolaris/cmd: zdb ztest

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:58:08 2018
New Revision: 332545
URL: https://svnweb.freebsd.org/changeset/base/332545

Log:
  MFC r331699: Partial MFV r329753:
  8809 libzpool should leverage work done in libfakekernel
  
  illumos/illumos-gate@f06dce2c1f0f3af78581e7574f65bfba843ddb6e
  
  Reviewed by: Sebastien Roy 
  Reviewed by: Prakash Surya 
  Reviewed by: Gordon Ross 
  Approved by: Richard Lowe 
  Author: Andrew Stormont 
  
  We do not have libfakekernel, but need to reduce code divergence.

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

Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Apr 16 03:56:10 
2018(r332544)
+++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Apr 16 03:58:08 
2018(r332545)
@@ -24,6 +24,7 @@
  * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2017 Nexenta Systems, Inc.
+ * Copyright 2017 RackTop Systems.
  */
 
 #include 
@@ -88,12 +89,14 @@ extern boolean_t zfs_recover;
 extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
 extern int zfs_vdev_async_read_max_active;
 extern boolean_t spa_load_verify_dryrun;
+extern int aok;
 #else
 int reference_tracking_enable;
 boolean_t zfs_recover;
 uint64_t zfs_arc_max, zfs_arc_meta_limit;
 int zfs_vdev_async_read_max_active;
 boolean_t spa_load_verify_dryrun;
+int aok;
 #endif
 
 static const char cmdname[] = "zdb";

Modified: stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.cMon Apr 16 
03:56:10 2018(r332544)
+++ stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.cMon Apr 16 
03:58:08 2018(r332545)
@@ -26,6 +26,7 @@
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2017 Joyent, Inc.
+ * Copyright 2017 RackTop Systems.
  */
 
 /*
@@ -247,8 +248,8 @@ typedef enum {
 typedef struct rll {
void*rll_writer;
int rll_readers;
-   mutex_t rll_lock;
-   cond_t  rll_cv;
+   kmutex_trll_lock;
+   kcondvar_t  rll_cv;
 } rll_t;
 
 typedef struct rl {
@@ -282,11 +283,11 @@ typedef struct ztest_od {
 typedef struct ztest_ds {
ztest_shared_ds_t *zd_shared;
objset_t*zd_os;
-   rwlock_tzd_zilog_lock;
+   krwlock_t   zd_zilog_lock;
zilog_t *zd_zilog;
ztest_od_t  *zd_od; /* debugging aid */
charzd_name[ZFS_MAX_DATASET_NAME_LEN];
-   mutex_t zd_dirobj_lock;
+   kmutex_tzd_dirobj_lock;
rll_t   zd_object_lock[ZTEST_OBJECT_LOCKS];
rll_t   zd_range_lock[ZTEST_RANGE_LOCKS];
 } ztest_ds_t;
@@ -397,7 +398,7 @@ ztest_info_t ztest_info[] = {
  * The callbacks are ordered by txg number.
  */
 typedef struct ztest_cb_list {
-   mutex_t zcl_callbacks_lock;
+   kmutex_t zcl_callbacks_lock;
list_t  zcl_callbacks;
 } ztest_cb_list_t;
 
@@ -432,7 +433,7 @@ ztest_shared_t *ztest_shared;
 static spa_t *ztest_spa = NULL;
 static ztest_ds_t *ztest_ds;
 
-static mutex_t ztest_vdev_lock;
+static kmutex_t ztest_vdev_lock;
 
 /*
  * The ztest_name_lock protects the pool and dataset namespace used by
@@ -440,7 +441,7 @@ static mutex_t ztest_vdev_lock;
  * this lock as writer. Grabbing the lock as reader will ensure that the
  * namespace does not change while the lock is held.
  */
-static rwlock_t ztest_name_lock;
+static krwlock_t ztest_name_lock;
 
 static boolean_t ztest_dump_core = B_TRUE;
 static boolean_t ztest_exiting;
@@ -1096,8 +1097,8 @@ ztest_rll_init(rll_t *rll)
 {
rll->rll_writer = NULL;
rll->rll_readers = 0;
-   VERIFY(_mutex_init(>rll_lock, USYNC_THREAD, NULL) == 0);
-   VERIFY(cond_init(>rll_cv, USYNC_THREAD, NULL) == 0);
+   mutex_init(>rll_lock, NULL, USYNC_THREAD, NULL);
+   cv_init(>rll_cv, NULL, USYNC_THREAD, NULL);
 }
 
 static void
@@ -1105,32 +1106,32 @@ ztest_rll_destroy(rll_t *rll)
 {
ASSERT(rll->rll_writer == NULL);
ASSERT(rll->rll_readers == 0);
-   VERIFY(_mutex_destroy(>rll_lock) == 0);
-   VERIFY(cond_destroy(>rll_cv) == 0);
+   mutex_destroy(>rll_lock);
+   cv_destroy(>rll_cv);
 }
 
 static void
 ztest_rll_lock(rll_t *rll, rl_type_t type)
 {
-   VERIFY(mutex_lock(>rll_lock) == 0);
+   mutex_enter(>rll_lock);
 
if (type == RL_READER) {
while (rll->rll_writer != NULL)
-

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

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:56:10 2018
New Revision: 332544
URL: https://svnweb.freebsd.org/changeset/base/332544

Log:
  MFC r331420 (by avg): zfs: fix mismatch between format specifier and type
  
  vdev_dbgmsg_print_tree printed vdev_id of uint64_t type with %u format
  specifier.  That caused subsequent parameters to be incorrectly read
  from the stack and lead to a crash when a wrong value was interpreted as
  a string pointer.
  
  This should be upstreamed.

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Apr 
16 03:55:14 2018(r332543)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Apr 
16 03:56:10 2018(r332544)
@@ -237,7 +237,7 @@ vdev_dbgmsg_print_tree(vdev_t *vd, int indent)
}
 
zfs_dbgmsg("%*svdev %u: %s%s, guid: %llu, path: %s, %s", indent,
-   "", vd->vdev_id, vd->vdev_ops->vdev_op_type,
+   "", (int)vd->vdev_id, vd->vdev_ops->vdev_op_type,
vd->vdev_islog ? " (log)" : "",
(u_longlong_t)vd->vdev_guid,
vd->vdev_path ? vd->vdev_path : "N/A", state);
___
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: r332543 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:55:14 2018
New Revision: 332543
URL: https://svnweb.freebsd.org/changeset/base/332543

Log:
  MFC r331414: Reduce struct aggsum_bucket padding to fit into one cache line.

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h   
Mon Apr 16 03:54:35 2018(r332542)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h   
Mon Apr 16 03:55:14 2018(r332543)
@@ -29,7 +29,7 @@ typedef struct aggsum_bucket {
kmutex_t asc_lock;
int64_t asc_delta;
uint64_t asc_borrowed;
-   uint64_t asc_pad[4]; /* pad out to cache line (64 bytes) */
+   uint64_t asc_pad[2]; /* pad out to cache line (64 bytes) */
 } aggsum_bucket_t __aligned(CACHE_LINE_SIZE);
 
 /*
___
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: r332542 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:54:35 2018
New Revision: 332542
URL: https://svnweb.freebsd.org/changeset/base/332542

Log:
  MFC r331408: MFV r331407: 9213 zfs: sytem typo
  
  illumos/illumos-gate@edc8ef7d921c96b23969898aeb766cb24960bda7
  
  Reviewed by: C Fraire 
  Reviewed by: Andy Fiddaman 
  Approved by: Joshua M. Clulow 
  Author: Toomas Soome 

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.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   Mon Apr 16 
03:53:34 2018(r332541)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Mon Apr 16 
03:54:35 2018(r332542)
@@ -2215,7 +2215,7 @@ zfs_do_upgrade(int argc, char **argv)
if (cb.cb_numfailed != 0)
ret = 1;
} else {
-   /* List old-version filesytems */
+   /* List old-version filesystems */
boolean_t found;
(void) printf(gettext("This system is currently running "
"ZFS filesystem version %llu.\n\n"), ZPL_VERSION);

Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Mon Apr 16 
03:53:34 2018(r332541)
+++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Mon Apr 16 
03:54:35 2018(r332542)
@@ -1852,7 +1852,7 @@ show_import(nvlist_t *config)
 
case ZPOOL_STATUS_UNSUP_FEAT_READ:
(void) printf(gettext("status: The pool uses the following "
-   "feature(s) not supported on this sytem:\n"));
+   "feature(s) not supported on this system:\n"));
zpool_print_unsup_feat(config);
break;
 

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c  Mon Apr 
16 03:53:34 2018(r332541)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c  Mon Apr 
16 03:54:35 2018(r332542)
@@ -2369,7 +2369,7 @@ slow:
 /*
  * Determine whether Access should be granted/denied.
  *
- * The least priv subsytem is always consulted as a basic privilege
+ * The least priv subsystem is always consulted as a basic privilege
  * can define any form of access.
  */
 int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:53:34 2018
New Revision: 332541
URL: https://svnweb.freebsd.org/changeset/base/332541

Log:
  MFC r331406: MFV r331405: 9084 spa_*_ashift must ignore spare devices
  
  illumos/illumos-gate@b037f3dbd69cef4a7ffd576ad33e07bfaf0b1e84
  
  Reviewed by: Prashanth Sreenivasa 
  Reviewed by: George Wilson 
  Approved by: Dan McDonald 
  Author: Prakash Surya 

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Apr 
16 03:52:54 2018(r332540)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Apr 
16 03:53:34 2018(r332541)
@@ -1589,14 +1589,6 @@ vdev_open(vdev_t *vd)
return (error);
}
 
-   if (vd->vdev_top == vd && vd->vdev_ashift != 0 &&
-   !vd->vdev_isl2cache && !vd->vdev_islog) {
-   if (vd->vdev_ashift > spa->spa_max_ashift)
-   spa->spa_max_ashift = vd->vdev_ashift;
-   if (vd->vdev_ashift < spa->spa_min_ashift)
-   spa->spa_min_ashift = vd->vdev_ashift;
-   }
-
/*
 * Track the min and max ashift values for normal data devices.
 */
___
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: r332540 - in stable/11: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensola...

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:52:54 2018
New Revision: 332540
URL: https://svnweb.freebsd.org/changeset/base/332540

Log:
  MFC r331404: MFV r331400:
  8484 Implement aggregate sum and use for arc counters
  
  In pursuit of improving performance on multi-core systems, we should
  implements fanned out counters and use them to improve the performance of
  some of the arc statistics. These stats are updated extremely frequently,
  and can consume a significant amount of CPU time.
  
  Reviewed by: Pavel Zakharov 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Paul Dagnelie 

Added:
  
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash
 - copied unchanged from r331404, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash
  
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip
 - copied unchanged from r331404, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash.descrip
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c
 - copied unchanged from r331404, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/aggsum.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c
 - copied unchanged from r331404, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h
 - copied unchanged from r331404, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/aggsum.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/cityhash.h
 - copied unchanged from r331404, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/cityhash.h
Modified:
  stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
  stable/11/sys/conf/files
Directory Properties:
  stable/11/   (props changed)

Modified: 
stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
==
--- stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
Mon Apr 16 03:49:27 2018(r332539)
+++ stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
Mon Apr 16 03:52:54 2018(r332540)
@@ -559,6 +559,7 @@ extern void delay(clock_t ticks);
} while (0);
 
 #definemax_ncpus   64
+#defineboot_ncpus  (sysconf(_SC_NPROCESSORS_ONLN))
 
 #defineminclsyspri 60
 #definemaxclsyspri 99

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.filesMon Apr 
16 03:49:27 2018(r332539)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.filesMon Apr 
16 03:52:54 2018(r332540)
@@ -63,12 +63,14 @@ LUA_OBJS += \
 
 ZFS_COMMON_OBJS += \
abd.o   \
+   aggsum.o\
arc.o   \
bplist.o\
blkptr.o\
bpobj.o \
bptree.o\
bqueue.o\
+   cityhash.o  \
dbuf.o  \
ddt.o   \
ddt_zap.o   \

Copied: 
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash
 (from r331404, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash
 Mon Apr 16 03:52:54 2018(r332540, copy of r331404, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.cityhash)
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Google, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE 

svn commit: r332539 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:49:27 2018
New Revision: 332539
URL: https://svnweb.freebsd.org/changeset/base/332539

Log:
  MFC r329808: MFV r329807:
  8940 Sending an intra-pool resumable send stream may result in EXDEV
  
  illumos/illumos-gate@544132fce3fa6583f01318f9559adc46614343a7
  
  "zfs send -t " for an incremental send should be able to resume
  successfully when sending to the same pool: a subtle issue in
  zfs_iter_children() doesn't currently allow this.
  
  Because resuming from a token requires "guid" -> "dataset" mapping
  (guid_to_name()), we have to walk the whole hierarchy to find the right
  snapshots to send.
  When resuming an incremental send both source and destination live in the
  same pool and have the same guid: this is where zfs_iter_children() gets
  confused and picks up the wrong snapshot, so we end up trying to send an
  incremental "destination@snap1 -> source@snap2" stream instead of
  "source@snap1 -> source@snap2": this fails with an "Invalid cross-device
  link" (EXDEV) error.
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: Matthew Ahrens 
  Approved by: Hans Rosenfeld 
  Author: loli10K 

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c  Mon Apr 
16 03:48:37 2018(r332538)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c  Mon Apr 
16 03:49:27 2018(r332539)
@@ -424,16 +424,20 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *sp
 
 /*
  * Iterate over all children, snapshots and filesystems
+ * Process snapshots before filesystems because they are nearer the input
+ * handle: this is extremely important when used with zfs_iter_f functions
+ * looking for data, following the logic that we would like to find it as soon
+ * and as close as possible.
  */
 int
 zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, void *data)
 {
int ret;
 
-   if ((ret = zfs_iter_filesystems(zhp, func, data)) != 0)
+   if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data)) != 0)
return (ret);
 
-   return (zfs_iter_snapshots(zhp, B_FALSE, func, data));
+   return (zfs_iter_filesystems(zhp, func, data));
 }
 
 

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Mon Apr 16 03:48:37 2018(r332538)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Mon Apr 16 03:49:27 2018(r332539)
@@ -1585,6 +1585,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla
int error = 0;
char name[ZFS_MAX_DATASET_NAME_LEN];
enum lzc_send_flags lzc_flags = 0;
+   FILE *fout = (flags->verbose && flags->dryrun) ? stdout : stderr;
 
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"cannot resume send"));
@@ -1599,9 +1600,9 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla
return (zfs_error(hdl, EZFS_FAULT, errbuf));
}
if (flags->verbose) {
-   (void) fprintf(stderr, dgettext(TEXT_DOMAIN,
+   (void) fprintf(fout, dgettext(TEXT_DOMAIN,
"resume token contents:\n"));
-   nvlist_print(stderr, resume_nvl);
+   nvlist_print(fout, resume_nvl);
}
 
if (nvlist_lookup_string(resume_nvl, "toname", ) != 0 ||
@@ -1658,7 +1659,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla
lzc_flags, );
if (error == 0)
size = MAX(0, (int64_t)(size - bytes));
-   send_print_verbose(stderr, zhp->zfs_name, fromname,
+   send_print_verbose(fout, zhp->zfs_name, fromname,
size, flags->parsable);
}
 
___
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: r332538 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:48:37 2018
New Revision: 332538
URL: https://svnweb.freebsd.org/changeset/base/332538

Log:
  MFC r329805: MFV r329803:
  9080 recursive enter of vdev_indirect_rwlock from vdev_indirect_remap()
  
  illumos/illumos-gate@bdfded42e66b9fc1395ff2401aa2952f7c44ae34
  
  A scenario came up where a callback executed by vdev_indirect_remap() on a 
vdev, calls
  vdev_indirect_remap() on the same vdev and tries to reacquire 
vdev_indirect_rwlock that
  was already acquired from the first call to vdev_indirect_remap(). The 
specific scenario,
  is that we want to remap a block pointer that is snapshoted but its dataset's 
remap_deadlist
  is not cached. So in order to add it we issue a read through a 
vdev_indirect_remap() on the
  same vdev, which brings up the aforementioned issue.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: George Wilson 
  Approved by: Hans Rosenfeld 
  Author: Serapheim Dimitropoulos 

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

Modified: 
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
Mon Apr 16 03:47:53 2018(r332537)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
Mon Apr 16 03:48:37 2018(r332538)
@@ -14,7 +14,7 @@
  */
 
 /*
- * Copyright (c) 2014, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2014, 2017 by Delphix. All rights reserved.
  */
 
 #include 
@@ -854,6 +854,57 @@ rs_alloc(vdev_t *vd, uint64_t offset, uint64_t asize, 
 }
 
 /*
+ * Given an indirect vdev and an extent on that vdev, it duplicates the
+ * physical entries of the indirect mapping that correspond to the extent
+ * to a new array and returns a pointer to it. In addition, copied_entries
+ * is populated with the number of mapping entries that were duplicated.
+ *
+ * Note that the function assumes that the caller holds vdev_indirect_rwlock.
+ * This ensures that the mapping won't change due to condensing as we
+ * copy over its contents.
+ *
+ * Finally, since we are doing an allocation, it is up to the caller to
+ * free the array allocated in this function.
+ */
+vdev_indirect_mapping_entry_phys_t *
+vdev_indirect_mapping_duplicate_adjacent_entries(vdev_t *vd, uint64_t offset,
+uint64_t asize, uint64_t *copied_entries)
+{
+   vdev_indirect_mapping_entry_phys_t *duplicate_mappings = NULL;
+   vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping;
+   uint64_t entries = 0;
+
+   ASSERT(RW_READ_HELD(>vdev_indirect_rwlock));
+
+   vdev_indirect_mapping_entry_phys_t *first_mapping =
+   vdev_indirect_mapping_entry_for_offset(vim, offset);
+   ASSERT3P(first_mapping, !=, NULL);
+
+   vdev_indirect_mapping_entry_phys_t *m = first_mapping;
+   while (asize > 0) {
+   uint64_t size = DVA_GET_ASIZE(>vimep_dst);
+
+   ASSERT3U(offset, >=, DVA_MAPPING_GET_SRC_OFFSET(m));
+   ASSERT3U(offset, <, DVA_MAPPING_GET_SRC_OFFSET(m) + size);
+
+   uint64_t inner_offset = offset - DVA_MAPPING_GET_SRC_OFFSET(m);
+   uint64_t inner_size = MIN(asize, size - inner_offset);
+
+   offset += inner_size;
+   asize -= inner_size;
+   entries++;
+   m++;
+   }
+
+   size_t copy_length = entries * sizeof (*first_mapping);
+   duplicate_mappings = kmem_alloc(copy_length, KM_SLEEP);
+   bcopy(first_mapping, duplicate_mappings, copy_length);
+   *copied_entries = entries;
+
+   return (duplicate_mappings);
+}
+
+/*
  * Goes through the relevant indirect mappings until it hits a concrete vdev
  * and issues the callback. On the way to the concrete vdev, if any other
  * indirect vdevs are encountered, then the callback will also be called on
@@ -893,24 +944,42 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6
for (remap_segment_t *rs = rs_alloc(vd, offset, asize, 0);
rs != NULL; rs = list_remove_head()) {
vdev_t *v = rs->rs_vd;
+   uint64_t num_entries = 0;
 
+   ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0);
+   ASSERT(rs->rs_asize > 0);
+
/*
-* Note: this can be called from open context
-* (eg. zio_read()), so we need the rwlock to prevent
-* the mapping from being changed by condensing.
+* Note: As this function can be called from open context
+* (e.g. zio_read()), we need the following rwlock to
+* prevent the mapping from being changed by condensing.
+*
+* So we grab 

svn commit: r332537 - in stable/11/sys: cddl/contrib/opensolaris/uts/common cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/uts/common/fs/zfs/sys conf

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:47:53 2018
New Revision: 332537
URL: https://svnweb.freebsd.org/changeset/base/332537

Log:
  MFC r329802: MFV r329799, r329800:
  9079 race condition in starting and ending condesing thread for indirect vdevs
  
  illumos/illumos-gate@667ec66f1b4f491d5e839644e0912cad1c9e7122
  
  The timeline of the race condition is the following:
  [1] Thread A is about to finish condesing the first vdev in 
spa_condense_indirect_thread(),
  so it calls the spa_condense_indirect_complete_sync() sync task which sets the
  spa_condensing_indirect field to NULL. Waiting for the sync task to finish, 
thread A
  sleeps until the txg is done. When this happens, thread A will acquire 
spa_async_lock
  and set spa_condense_thread to NULL.
  [2] While thread A waits for the txg to finish, thread B which is running 
spa_sync() checks
  whether it should condense the second vdev in vdev_indirect_should_condense() 
by checking
  the spa_condensing_indirect field which was set to NULL by 
spa_condense_indirect_thread()
  from thread A. So it goes on and tries to spawn a new condensing thread in
  spa_condense_indirect_start_sync() and the aforementioned assertions fails 
because thread A
  has not set spa_condense_thread to NULL (which is basically the last thing it 
does before
  returning).
  
  The main issue here is that we rely on both spa_condensing_indirect and 
spa_condense_thread to
  signify whether a condensing thread is running. Ideally we would only use one 
throughout the
  codebase. In addition, for managing spa_condense_thread we currently use 
spa_async_lock which
  basically tights condensing to scrubing when it comes to pausing and resuming 
those actions
  during spa export.
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Pavel Zakharov 
  Approved by: Hans Rosenfeld 
  Author: Serapheim Dimitropoulos 

Added:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h
 - copied unchanged from r329802, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c
 - copied unchanged from r329802, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c
Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
  stable/11/sys/conf/files
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.filesMon Apr 
16 03:45:39 2018(r332536)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.filesMon Apr 
16 03:47:53 2018(r332537)
@@ -148,7 +148,8 @@ ZFS_COMMON_OBJS +=  \
zio_compress.o  \
zio_inject.o\
zle.o   \
-   zrlock.o
+   zrlock.o\
+   zthr.o
 
 ZFS_SHARED_OBJS += \
zfeature_common.o   \

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 03:45:39 2018(r332536)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 03:47:53 2018(r332537)
@@ -1411,6 +1411,12 @@ spa_unload(spa_t *spa)
spa->spa_vdev_removal = NULL;
}
 
+   if (spa->spa_condense_zthr != NULL) {
+   ASSERT(!zthr_isrunning(spa->spa_condense_zthr));
+   zthr_destroy(spa->spa_condense_zthr);
+   spa->spa_condense_zthr = NULL;
+   }
+
spa_condense_fini(spa);
 
bpobj_close(>spa_deferred_bpobj);
@@ -2167,6 +2173,16 @@ spa_vdev_err(vdev_t *vdev, vdev_aux_t aux, int err)
return (SET_ERROR(err));
 }
 
+static void
+spa_spawn_aux_threads(spa_t *spa)
+{
+   ASSERT(spa_writeable(spa));
+
+   ASSERT(MUTEX_HELD(_namespace_lock));
+
+   spa_start_indirect_condensing_thread(spa);
+}
+
 /*
  * Fix up config after a partly-completed split.  This is done with the
  * ZPOOL_CONFIG_SPLIT nvlist.  Both the splitting pool and the split-off
@@ -3574,18 +3590,6 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char
ASSERT(spa->spa_load_state != SPA_LOAD_TRYIMPORT);
 
/*
-* We must check this before we start the sync thread, because
-* we only want to start a condense thread for condense
-   

svn commit: r332536 - in stable/11: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/...

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:45:39 2018
New Revision: 332536
URL: https://svnweb.freebsd.org/changeset/base/332536

Log:
  MFC r329798: MFV r329793, r329795:
  9075 Improve ZFS pool import/load process and corrupted pool recovery
  
  illumos/illumos-gate@6f7938128a2c5e23f4b970ea101137eadd1470a1
  
  Some work has been done lately to improve the debugability of the ZFS pool
  load (and import) process. This includes:
  
  https://www.illumos.org/issues/7638: Refactor spa_load_impl into several 
functions
  https://www.illumos.org/issues/8961: SPA load/import should tell us why it 
failed
  https://www.illumos.org/issues/7277: zdb should be able to print zfs_dbgmsg's
  
  To iterate on top of that, there's a few changes that were made to make the
  import process more resilient and crash free. One of the first tasks during 
the
  pool load process is to parse a config provided from userland that describes
  what devices the pool is composed of. A vdev tree is generated from that 
config,
  and then all the vdevs are opened.
  
  The Meta Object Set (MOS) of the pool is accessed, and several metadata 
objects
  that are necessary to load the pool are read. The exact configuration of the
  pool is also stored inside the MOS. Since the configuration provided from
  userland is external and might not accurately describe the vdev tree
  of the pool at the txg that is being loaded, it cannot be relied upon to 
safely
  operate the pool. For that reason, the configuration in the MOS is read early
  on. In the past, the two configurations were compared together and if there 
was
  a mismatch then the load process was aborted and an error was returned.
  
  The latter was a good way to ensure a pool does not get corrupted, however it
  made the pool load process needlessly fragile in cases where the vdev
  configuration changed or the userland configuration was outdated. Since the 
MOS
  is stored in 3 copies, the configuration provided by userland doesn't have to 
be
  perfect in order to read its contents. Hence, a new approach has been adopted:
  The pool is first opened with the untrusted userland configuration just so 
that
  the real configuration can be read from the MOS. The trusted MOS configuration
  is then used to generate a new vdev tree and the pool is re-opened.
  
  When the pool is opened with an untrusted configuration, writes are disabled
  to avoid accidentally damaging it. During reads, some sanity checks are
  performed on block pointers to see if each DVA points to a known vdev;
  when the configuration is untrusted, instead of panicking the system if those
  checks fail we simply avoid issuing reads to the invalid DVAs.
  
  This new two-step pool load process now allows rewinding pools accross
  vdev tree changes such as device replacement, addition, etc. Loading a pool
  from an external config file in a clustering environment also becomes much
  safer now since the pool will import even if the config is outdated and 
didn't,
  for instance, register a recent device addition.
  
  With this code in place, it became relatively easy to implement a
  long-sought-after feature: the ability to import a pool with missing top level
  (i.e. non-redundant) devices. Note that since this almost guarantees some loss
  Of data, this feature is for now restricted to a read-only import.
  
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Andrew Stormont 
  Approved by: Hans Rosenfeld 
  Author: Pavel Zakharov 

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/11/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
  stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
Directory Properties:
  stable/11/   

svn commit: r332535 - in stable/11: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:44:13 2018
New Revision: 332535
URL: https://svnweb.freebsd.org/changeset/base/332535

Log:
  MFC r329783: 8942 zfs promote .../%recv should be an error
  
  illumos/illumos-gate@add927f8c8d101e16c23eb9cd270be4fd7edf7d5
  
  Reported on the ZFSonLinux https://github.com/zfsonlinux/zfs/issues/4843,
  fixed by https://github.com/zfsonlinux/zfs/pull/6339:
  
  If we are in the middle of an incremental zfs receive, the child .../%recv
  will exist. If you concurrently run zfs promote .../%recv, it will "work",
  but then zfs gets confused. For example, there's no obvious way to destroy
  the containing filesystem (because it is now a clone of its invisible child).
  
  Attempting to do this promote should be an error. We could fix this by
  having zfs_ioc_promote() check if zc_name contains a %, similar to
  zfs_ioc_rename().
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: loli10K 

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

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Mon Apr 16 03:43:29 2018(r332534)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Mon Apr 16 03:44:13 2018(r332535)
@@ -3786,6 +3786,9 @@ zfs_promote(zfs_handle_t *zhp)
return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
}
 
+   if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE))
+   return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
+
ret = lzc_promote(zhp->zfs_name, snapname, sizeof (snapname));
 
if (ret != 0) {
@@ -4155,6 +4158,10 @@ zfs_rename(zfs_handle_t *zhp, const char *source, cons
(void) strlcat(zhp->zfs_name, source, sizeof(zhp->zfs_name));
zhp->zfs_type = ZFS_TYPE_SNAPSHOT;
}
+
+   /* make sure source name is valid */
+   if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE))
+   return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
 
/*
 * Make sure the target name is valid

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
Mon Apr 16 03:43:29 2018(r332534)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Mon Apr 16 03:44:13 2018(r332535)
@@ -3920,9 +3920,12 @@ zfs_ioc_rename(zfs_cmd_t *zc)
allow_mounted = (zc->zc_cookie & 2) != 0;
 #endif
 
+   /* "zfs rename" from and to ...%recv datasets should both fail */
+   zc->zc_name[sizeof (zc->zc_name) - 1] = '\0';
zc->zc_value[sizeof (zc->zc_value) - 1] = '\0';
-   if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
-   strchr(zc->zc_value, '%'))
+   if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 ||
+   dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
+   strchr(zc->zc_name, '%') || strchr(zc->zc_value, '%'))
return (SET_ERROR(EINVAL));
 
at = strchr(zc->zc_name, '@');
@@ -4973,6 +4976,11 @@ zfs_ioc_promote(zfs_cmd_t *zc)
char origin[ZFS_MAX_DATASET_NAME_LEN];
char *cp;
int error;
+
+   zc->zc_name[sizeof (zc->zc_name) - 1] = '\0';
+   if (dataset_namecheck(zc->zc_name, NULL, NULL) != 0 ||
+   strchr(zc->zc_name, '%'))
+   return (SET_ERROR(EINVAL));
 
error = dsl_pool_hold(zc->zc_name, FTAG, );
if (error != 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: r332534 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:43:29 2018
New Revision: 332534
URL: https://svnweb.freebsd.org/changeset/base/332534

Log:
  MFC r329777: MFV r329776:
  8477 Assertion failed in vdev_state_dirty(): spa_writeable(spa)
  
  illumos/illumos-gate@f4c1745bd6c9829a05ecec15759ede7757100ab5
  
  Illumos 4080 allows "zpool clear" to work on readonly pools: i don't think
  this is the intended behaviour, we shouldn't be allowed to clear readonly
  pools. Probably.
  
  A fix is already in the ZFS on Linux repository to addess this issue:
  
https://github.com/zfsonlinux/zfs/commit/92e43c17188d47f47b69318e4884096dec380e36
  
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: loli10K 

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

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
Mon Apr 16 03:42:47 2018(r332533)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Mon Apr 16 03:43:29 2018(r332534)
@@ -6150,7 +6150,7 @@ zfs_ioctl_init(void)
zfs_secpolicy_config, B_TRUE, POOL_CHECK_NONE);
 
zfs_ioctl_register_pool(ZFS_IOC_CLEAR, zfs_ioc_clear,
-   zfs_secpolicy_config, B_TRUE, POOL_CHECK_NONE);
+   zfs_secpolicy_config, B_TRUE, POOL_CHECK_READONLY);
zfs_ioctl_register_pool(ZFS_IOC_POOL_REOPEN, zfs_ioc_pool_reopen,
zfs_secpolicy_config, B_TRUE, POOL_CHECK_SUSPENDED);
 
___
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: r332533 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:42:47 2018
New Revision: 332533
URL: https://svnweb.freebsd.org/changeset/base/332533

Log:
  MFC r329775: MFV r329774:
  8408 dsl_props_set_sync_impl() does not handle nested nvlists correctly
  
  illumos/illumos-gate@85723e5eec42f46dbfdb4c09b9e1ed66501d1ccf
  
  When iterating over the input nvlist in dsl_props_set_sync_impl() when we
  don't preserve the nvpair name before looking up ZPROP_VALUE, so when we
  later go to process it nvpair_name() is always "value" instead of the actual
  property name.
  
  This results in a couple of bugs in the recv code:
  
   - received properties are not restored correctly when failing to receive
 an incremental send stream
   - received properties are not completely replaced by the new ones when
 successfully receiving an incremental send stream
  
  This was discovered on ZFS on Linux (fixed in
  
https://github.com/zfsonlinux/zfs/commit/5f1346c29997dd4e02acf4c19c875d5484f33b1e)
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: loli10K 

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Mon Apr 
16 03:42:06 2018(r332532)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Mon Apr 
16 03:42:47 2018(r332533)
@@ -856,11 +856,15 @@ dsl_props_set_sync_impl(dsl_dataset_t *ds, zprop_sourc
 
while ((elem = nvlist_next_nvpair(props, elem)) != NULL) {
nvpair_t *pair = elem;
+   const char *name = nvpair_name(pair);
 
if (nvpair_type(pair) == DATA_TYPE_NVLIST) {
/*
-* dsl_prop_get_all_impl() returns properties in this
-* format.
+* This usually happens when we reuse the nvlist_t data
+* returned by the counterpart dsl_prop_get_all_impl().
+* For instance we do this to restore the original
+* received properties when an error occurs in the
+* zfs_ioc_recv() codepath.
 */
nvlist_t *attrs = fnvpair_value_nvlist(pair);
pair = fnvlist_lookup_nvpair(attrs, ZPROP_VALUE);
@@ -868,14 +872,14 @@ dsl_props_set_sync_impl(dsl_dataset_t *ds, zprop_sourc
 
if (nvpair_type(pair) == DATA_TYPE_STRING) {
const char *value = fnvpair_value_string(pair);
-   dsl_prop_set_sync_impl(ds, nvpair_name(pair),
+   dsl_prop_set_sync_impl(ds, name,
source, 1, strlen(value) + 1, value, tx);
} else if (nvpair_type(pair) == DATA_TYPE_UINT64) {
uint64_t intval = fnvpair_value_uint64(pair);
-   dsl_prop_set_sync_impl(ds, nvpair_name(pair),
+   dsl_prop_set_sync_impl(ds, name,
source, sizeof (intval), 1, , tx);
} else if (nvpair_type(pair) == DATA_TYPE_BOOLEAN) {
-   dsl_prop_set_sync_impl(ds, nvpair_name(pair),
+   dsl_prop_set_sync_impl(ds, name,
source, 0, 0, NULL, tx);
} else {
panic("invalid nvpair type");
___
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: r332532 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:42:06 2018
New Revision: 332532
URL: https://svnweb.freebsd.org/changeset/base/332532

Log:
  MFC r329771: MFV r329770: 9035 zfs: this statement may fall through
  
  illumos/illumos-gate@46ac8fdfc5a1f9d8240c79a6ae5b2889cbe83553
  
  Reviewed by: Yuri Pankov 
  Reviewed by: Andy Fiddaman 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Toomas Soome 

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lgc.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/llex.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ltable.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lgc.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lgc.c  Mon Apr 
16 03:41:21 2018(r332531)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lgc.c  Mon Apr 
16 03:42:06 2018(r332532)
@@ -677,7 +677,7 @@ static void freeobj (lua_State *L, GCObject *o) {
 case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break;
 case LUA_TSHRSTR:
   G(L)->strt.nuse--;
-  /* go through */
+  /* FALLTHROUGH */
 case LUA_TLNGSTR: {
   luaM_freemem(L, o, sizestring(gco2ts(o)));
   break;

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/llex.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/llex.c Mon Apr 
16 03:41:21 2018(r332531)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/llex.c Mon Apr 
16 03:42:06 2018(r332532)
@@ -475,6 +475,7 @@ static int llex (LexState *ls, SemInfo *seminfo) {
 else if (!lisdigit(ls->current)) return '.';
 /* else go through */
   }
+  /* FALLTHROUGH */
   case '0': case '1': case '2': case '3': case '4':
   case '5': case '6': case '7': case '8': case '9': {
 read_numeral(ls, seminfo);

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c  
Mon Apr 16 03:41:21 2018(r332531)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/lstrlib.c  
Mon Apr 16 03:42:06 2018(r332532)
@@ -519,7 +519,7 @@ static const char *match (MatchState *ms, const char *
 }
 case '+':  /* 1 or more repetitions */
   s++;  /* 1 match already done */
-  /* go through */
+  /* FALLTHROUGH */
 case '*':  /* 0 or more repetitions */
   s = max_expand(ms, s, p, ep);
   break;

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ltable.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ltable.c   
Mon Apr 16 03:41:21 2018(r332531)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua/ltable.c   
Mon Apr 16 03:42:06 2018(r332532)
@@ -490,6 +490,7 @@ const TValue *luaH_get (Table *t, const TValue *key) {
 return luaH_getint(t, k);  /* use specialized version */
   /* else go through */
 }
+/* FALLTHROUGH */
 default: {
   Node *n = mainposition(t, key);
   do {  /* check whether `key' is somewhere in the chain */
___
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: r332531 - in stable/11: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:41:21 2018
New Revision: 332531
URL: https://svnweb.freebsd.org/changeset/base/332531

Log:
  MFC r329769: MFV r329766: 8962 zdb should work on non-idle pools
  
  illumos/illumos-gate@e144c4e6c90e7d4dccaad6db660ee42b6e7ba04f
  
  Currently `zdb` consistently fails to examine non-idle pools as it fails
  during the `spa_load()` process. The main problem seems to be that
  `spa_load_verify()` fails as can be seen below:
  
  $ sudo zdb -d -G dcenter
  zdb: can't open 'dcenter': I/O error
  
  ZFS_DBGMSG(zdb):
  spa_open_common: opening dcenter
  spa_load(dcenter): LOADING
  disk vdev '/dev/dsk/c4t11d0s0': best uberblock found for spa dcenter. txg 
40824950
  spa_load(dcenter): using uberblock with txg=40824950
  spa_load(dcenter): UNLOADING
  spa_load(dcenter): RELOADING
  spa_load(dcenter): LOADING
  disk vdev '/dev/dsk/c3t10d0s0': best uberblock found for spa dcenter. txg 
40824952
  spa_load(dcenter): using uberblock with txg=40824952
  spa_load(dcenter): FAILED: spa_load_verify failed [error=5]
  spa_load(dcenter): UNLOADING
  
  This change makes `spa_load_verify()` a dryrun when ran from `zdb`. This is
  done by creating a global flag in zfs and then setting it in `zdb`.
  
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Andy Stormont 
  Approved by: Dan McDonald 
  Author: Pavel Zakharov 

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

Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Apr 16 03:40:12 
2018(r332530)
+++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Apr 16 03:41:21 
2018(r332531)
@@ -87,11 +87,13 @@ extern int reference_tracking_enable;
 extern boolean_t zfs_recover;
 extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
 extern int zfs_vdev_async_read_max_active;
+extern boolean_t spa_load_verify_dryrun;
 #else
 int reference_tracking_enable;
 boolean_t zfs_recover;
 uint64_t zfs_arc_max, zfs_arc_meta_limit;
 int zfs_vdev_async_read_max_active;
+boolean_t spa_load_verify_dryrun;
 #endif
 
 static const char cmdname[] = "zdb";
@@ -4577,6 +4579,12 @@ main(int argc, char **argv)
 * Disable reference tracking for better performance.
 */
reference_tracking_enable = B_FALSE;
+
+   /*
+* Do not fail spa_load when spa_load_verify fails. This is needed
+* to load non-idle pools.
+*/
+   spa_load_verify_dryrun = B_TRUE;
 
kernel_init(FREAD);
g_zfs = libzfs_init();

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 03:40:12 2018(r332530)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 03:41:21 2018(r332531)
@@ -181,6 +181,12 @@ boolean_t  spa_create_process = B_TRUE;/* no process =
 extern int zfs_sync_pass_deferred_free;
 
 /*
+ * Report any spa_load_verify errors found, but do not fail spa_load.
+ * This is used by zdb to analyze non-idle pools.
+ */
+boolean_t  spa_load_verify_dryrun = B_FALSE;
+
+/*
  * This (illegal) pool name is used when temporarily importing a spa_t in order
  * to get the vdev stats associated with the imported devices.
  */
@@ -2088,8 +2094,15 @@ spa_load_verify(spa_t *spa)
spa->spa_load_meta_errors = sle.sle_meta_count;
spa->spa_load_data_errors = sle.sle_data_count;
 
-   if (!error && sle.sle_meta_count <= policy.zrp_maxmeta &&
-   sle.sle_data_count <= policy.zrp_maxdata) {
+   if (sle.sle_meta_count != 0 || sle.sle_data_count != 0) {
+   spa_load_note(spa, "spa_load_verify found %llu metadata errors "
+   "and %llu data errors", (u_longlong_t)sle.sle_meta_count,
+   (u_longlong_t)sle.sle_data_count);
+   }
+
+   if (spa_load_verify_dryrun ||
+   (!error && sle.sle_meta_count <= policy.zrp_maxmeta &&
+   sle.sle_data_count <= policy.zrp_maxdata)) {
int64_t loss = 0;
 
verify_ok = B_TRUE;
@@ -2106,6 +2119,9 @@ spa_load_verify(spa_t *spa)
} else {
spa->spa_load_max_txg = spa->spa_uberblock.ub_txg;
}
+
+   if (spa_load_verify_dryrun)
+   return (0);
 
if (error) {
if (error != ENXIO && error != EIO)
___
svn-src-all@freebsd.org mailing list

svn commit: r332530 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:40:12 2018
New Revision: 332530
URL: https://svnweb.freebsd.org/changeset/base/332530

Log:
  MFC r329765: MFV r329762: 8961 SPA load/import should tell us why it failed
  
  illumos/illumos-gate@3ee8c80c747c4aa3f83351a6920f30c411236e1b
  
  When we fail to open or import a storage pool, we typically don't get any
  additional diagnostic information, just "no pool found" or "can not import".
  
  While there may be no additional user-consumable information, we should at
  least make this situation easier to debug/diagnose for developers and support.
  For example, we could start by using `zfs_dbgmsg()` to log each thing that we
  try when importing, and which things failed. E.g. "tried uberblock of txg X
  from label Y of device Z". Also, we could log each of the stages that we go
  through in `spa_load_impl()`.
  
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Andrew Stormont 
  Approved by: Dan McDonald 
  Author: Pavel Zakharov 

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 03:39:24 2018(r332529)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 03:40:12 2018(r332530)
@@ -1296,6 +1296,8 @@ spa_unload(spa_t *spa)
 
ASSERT(MUTEX_HELD(_namespace_lock));
 
+   spa_load_note(spa, "UNLOADING");
+
/*
 * Stop TRIM thread.
 */
@@ -2069,6 +2071,13 @@ spa_load_verify(spa_t *spa)
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE);
 
if (spa_load_verify_metadata) {
+   if (spa->spa_extreme_rewind) {
+   spa_load_note(spa, "performing a complete scan of the "
+   "pool since extreme rewind is on. This may take "
+   "a very long time.\n  (spa_load_verify_data=%u, "
+   "spa_load_verify_metadata=%u)",
+   spa_load_verify_data, spa_load_verify_metadata);
+   }
error = traverse_pool(spa, spa->spa_verify_min_txg,
TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA,
spa_load_verify_cb, rio);
@@ -2121,10 +2130,17 @@ spa_prop_find(spa_t *spa, zpool_prop_t prop, uint64_t 
  * Find a value in the pool directory object.
  */
 static int
-spa_dir_prop(spa_t *spa, const char *name, uint64_t *val)
+spa_dir_prop(spa_t *spa, const char *name, uint64_t *val, boolean_t log_enoent)
 {
-   return (zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
-   name, sizeof (uint64_t), 1, val));
+   int error = zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
+   name, sizeof (uint64_t), 1, val);
+
+   if (error != 0 && (error != ENOENT || log_enoent)) {
+   spa_load_failed(spa, "couldn't get '%s' value in MOS directory "
+   "[error=%d]", name, error);
+   }
+
+   return (error);
 }
 
 static int
@@ -2316,19 +2332,18 @@ vdev_count_verify_zaps(vdev_t *vd)
 
 static int
 spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
-spa_load_state_t state, spa_import_type_t type)
+spa_import_type_t type)
 {
int error = 0;
nvlist_t *nvtree = NULL;
int parse;
vdev_t *rvd;
 
-   ASSERT(MUTEX_HELD(_namespace_lock));
-
-   spa->spa_load_state = state;
-
-   if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, ))
+   if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, )) {
+   spa_load_failed(spa, "invalid config provided: '%s' missing",
+   ZPOOL_CONFIG_VDEV_TREE);
return (SET_ERROR(EINVAL));
+   }
 
parse = (type == SPA_IMPORT_EXISTING ?
VDEV_ALLOC_LOAD : VDEV_ALLOC_SPLIT);
@@ -2353,8 +2368,11 @@ spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nv
error = spa_config_parse(spa, , nvtree, NULL, 0, parse);
spa_config_exit(spa, SCL_ALL, FTAG);
 
-   if (error != 0)
+   if (error != 0) {
+   spa_load_failed(spa, "unable to parse config [error=%d]",

svn commit: r332528 - in stable/11: cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:38:37 2018
New Revision: 332528
URL: https://svnweb.freebsd.org/changeset/base/332528

Log:
  MFC r329759:
  9018 Replace kmem_cache_reap_now() with kmem_cache_reap_soon()
  
  illumos/illumos-gate@36a64e62848b51ac5a9a5216e894ec723cfef14e
  
  To prevent kmem_cache reaping from blocking other system resources, turn
  kmem_cache_reap_now() (which blocks) into kmem_cache_reap_soon(). Callers
  to kmem_cache_reap_soon() should use kmem_cache_reap_active(), which
  exploits #9017's new taskq_empty().
  
  Reviewed by: Bryan Cantrill 
  Reviewed by: Dan McDonald 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Yuri Pankov 
  Author: Tim Kordas 
  
  FreeBSD does not use taskqueue for kmem caches reaping, so this change
  is less dramatic then it is on Illumos, just limiting reaping to 1 time
  per second.  It may possibly be improved later, if needed.

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
  stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
  stable/11/sys/cddl/compat/opensolaris/sys/kmem.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/11/   (props changed)

Modified: 
stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
==
--- stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
Mon Apr 16 03:35:43 2018(r332527)
+++ stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
Mon Apr 16 03:38:37 2018(r332528)
@@ -364,7 +364,8 @@ extern void cv_broadcast(kcondvar_t *cv);
 #definekmem_cache_alloc(_c, _f) umem_cache_alloc(_c, _f)
 #definekmem_cache_free(_c, _b) umem_cache_free(_c, _b)
 #definekmem_debugging()0
-#definekmem_cache_reap_now(_c) /* nothing */
+#definekmem_cache_reap_active()(B_FALSE)
+#definekmem_cache_reap_soon(_c)/* nothing */
 #definekmem_cache_set_move(_c, _cb)/* nothing */
 #definePOINTER_INVALIDATE(_pp) /* nothing */
 #definePOINTER_IS_VALID(_p)0

Modified: stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
==
--- stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c   Mon Apr 
16 03:35:43 2018(r332527)
+++ stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c   Mon Apr 
16 03:38:37 2018(r332528)
@@ -212,9 +212,30 @@ kmem_cache_free(kmem_cache_t *cache, void *buf)
 #endif
 }
 
+/*
+ * Allow our caller to determine if there are running reaps.
+ *
+ * This call is very conservative and may return B_TRUE even when
+ * reaping activity isn't active. If it returns B_FALSE, then reaping
+ * activity is definitely inactive.
+ */
+boolean_t
+kmem_cache_reap_active(void)
+{
+
+   return (B_FALSE);
+}
+
+/*
+ * Reap (almost) everything soon.
+ *
+ * Note: this does not wait for the reap-tasks to complete. Caller
+ * should use kmem_cache_reap_active() (above) and/or moderation to
+ * avoid scheduling too many reap-tasks.
+ */
 #ifdef _KERNEL
 void
-kmem_cache_reap_now(kmem_cache_t *cache)
+kmem_cache_reap_soon(kmem_cache_t *cache)
 {
 #ifndef KMEM_DEBUG
zone_drain(cache->kc_zone);
@@ -228,7 +249,7 @@ kmem_reap(void)
 }
 #else
 void
-kmem_cache_reap_now(kmem_cache_t *cache __unused)
+kmem_cache_reap_soon(kmem_cache_t *cache __unused)
 {
 }
 

Modified: stable/11/sys/cddl/compat/opensolaris/sys/kmem.h
==
--- stable/11/sys/cddl/compat/opensolaris/sys/kmem.hMon Apr 16 03:35:43 
2018(r332527)
+++ stable/11/sys/cddl/compat/opensolaris/sys/kmem.hMon Apr 16 03:38:37 
2018(r332528)
@@ -73,7 +73,8 @@ kmem_cache_t *kmem_cache_create(char *name, size_t buf
 void kmem_cache_destroy(kmem_cache_t *cache);
 void *kmem_cache_alloc(kmem_cache_t *cache, int flags);
 void kmem_cache_free(kmem_cache_t *cache, void *buf);
-void kmem_cache_reap_now(kmem_cache_t *cache);
+boolean_t kmem_cache_reap_active(void);
+void kmem_cache_reap_soon(kmem_cache_t *);
 void kmem_reap(void);
 int kmem_debugging(void);
 void *calloc(size_t n, size_t s);

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Mon Apr 
16 03:35:43 2018(r332527)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Mon Apr 
16 03:38:37 2018(r332528)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright 

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

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:39:24 2018
New Revision: 332529
URL: https://svnweb.freebsd.org/changeset/base/332529

Log:
  MFC r329761: MFV r329760: 7638 Refactor spa_load_impl into several functions
  
  illumos/illumos-gate@1fd3785ff6601d3e391378c2dcbf4c5f27e1fe32
  
  spa_load_impl has grown out of proportions.  It is currently over 700
  lines long and makes it very hard to follow or debug the import process
  even for experienced ZFS developers.  The objective is to split it up
  in a series of well commented functions.
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Andrew Stormont 
  Approved by: Dan McDonald 
  Author: Pavel Zakharov 

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 03:38:37 2018(r332528)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 03:39:24 2018(r332529)
@@ -2218,7 +2218,7 @@ spa_try_repair(spa_t *spa, nvlist_t *config)
 
 static int
 spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type,
-boolean_t mosconfig)
+boolean_t trust_config)
 {
nvlist_t *config = spa->spa_config;
char *ereport = FM_EREPORT_ZFS_POOL;
@@ -2262,7 +2262,7 @@ spa_load(spa_t *spa, spa_load_state_t state, spa_impor
 
gethrestime(>spa_loaded_ts);
error = spa_load_impl(spa, pool_guid, config, state, type,
-   mosconfig, );
+   trust_config, );
}
 
/*
@@ -2314,38 +2314,20 @@ vdev_count_verify_zaps(vdev_t *vd)
return (total);
 }
 
-/*
- * Load an existing storage pool, using the pool's builtin spa_config as a
- * source of configuration information.
- */
 static int
-spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
-spa_load_state_t state, spa_import_type_t type, boolean_t trust_config,
-char **ereport)
+spa_ld_parse_config(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
+spa_load_state_t state, spa_import_type_t type)
 {
int error = 0;
-   nvlist_t *nvroot = NULL;
-   nvlist_t *label;
-   vdev_t *rvd;
-   uberblock_t *ub = >spa_uberblock;
-   uint64_t children, config_cache_txg = spa->spa_config_txg;
-   int orig_mode = spa->spa_mode;
+   nvlist_t *nvtree = NULL;
int parse;
-   uint64_t obj;
-   boolean_t missing_feat_write = B_FALSE;
+   vdev_t *rvd;
 
-   /*
-* If this is an untrusted config, access the pool in read-only mode.
-* This prevents things like resilvering recently removed devices.
-*/
-   if (!trust_config)
-   spa->spa_mode = FREAD;
-
ASSERT(MUTEX_HELD(_namespace_lock));
 
spa->spa_load_state = state;
 
-   if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, ))
+   if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, ))
return (SET_ERROR(EINVAL));
 
parse = (type == SPA_IMPORT_EXISTING ?
@@ -2368,7 +2350,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t
 * configuration requires knowing the version number.
 */
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
-   error = spa_config_parse(spa, , nvroot, NULL, 0, parse);
+   error = spa_config_parse(spa, , nvtree, NULL, 0, parse);
spa_config_exit(spa, SCL_ALL, FTAG);
 
if (error != 0)
@@ -2382,22 +2364,35 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t
ASSERT(spa_guid(spa) == pool_guid);
}
 
-   /*
-* Try to open all vdevs, loading each label in the process.
-*/
+   return (0);
+}
+
+static int
+spa_ld_open_vdevs(spa_t *spa)
+{
+   int error = 0;
+
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
-   error = vdev_open(rvd);
+   error = vdev_open(spa->spa_root_vdev);
spa_config_exit(spa, SCL_ALL, FTAG);
-   if (error != 0)
-   return (error);
 
+   return (error);
+}
+
+static int
+spa_ld_validate_vdevs(spa_t *spa, spa_import_type_t type,
+boolean_t trust_config)
+{
+   int error = 0;
+   vdev_t *rvd = spa->spa_root_vdev;
+
/*
 * We need to validate the vdev labels against the configuration that
-* we have in hand, which is dependent on the setting of mosconfig. If
-* mosconfig is true then we're validating the vdev labels based on
-* that config.  Otherwise, we're validating against the cached config
-* (zpool.cache) that was read when we loaded the zfs module, 

svn commit: r332527 - head/usr.sbin/daemon

2018-04-15 Thread Ian Lepore
Author: ian
Date: Mon Apr 16 03:35:43 2018
New Revision: 332527
URL: https://svnweb.freebsd.org/changeset/base/332527

Log:
  Fix cut-and-pasted line to have the right option letter.
  
  Reported by:  0mp@
  Pointy hat:   ian@

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

Modified: head/usr.sbin/daemon/daemon.8
==
--- head/usr.sbin/daemon/daemon.8   Mon Apr 16 03:35:18 2018
(r332526)
+++ head/usr.sbin/daemon/daemon.8   Mon Apr 16 03:35:43 2018
(r332527)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 14, 2018
+.Dd April 15, 2018
 .Dt DAEMON 8
 .Os
 .Sh NAME
@@ -44,7 +44,7 @@
 .Op Fl s Ar syslog_priority
 .Op Fl T Ar syslog_tag
 .Op Fl l Ar syslog_facility
-.Op Fl T Ar restart_delay_seconds
+.Op Fl R Ar restart_delay_seconds
 .Ar command arguments ...
 .Sh DESCRIPTION
 The
___
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: r332526 - in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys sys/fm

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:35:18 2018
New Revision: 332526
URL: https://svnweb.freebsd.org/changeset/base/332526

Log:
  MFC r329755: MFV r329753:
  8809 libzpool should leverage work done in libfakekernel
  
  illumos/illumos-gate@f06dce2c1f0f3af78581e7574f65bfba843ddb6e
  
  Reviewed by: Sebastien Roy 
  Reviewed by: Prakash Surya 
  Reviewed by: Gordon Ross 
  Approved by: Richard Lowe 
  Author: Andrew Stormont 

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/cpupart.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.cMon Apr 
16 03:32:41 2018(r332525)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.cMon Apr 
16 03:35:18 2018(r332526)
@@ -23,6 +23,7 @@
  * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2017 RackTop Systems.
  */
 
 #include 
@@ -66,7 +67,9 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, default_ibs, CTLFLAG_RW
 _default_ibs, 0, "Default dnode indirect block shift");
 
 #ifdef illumos
+#ifdef _KERNEL
 static kmem_cbrc_t dnode_move(void *, void *, size_t, void *);
+#endif /* _KERNEL */
 #endif
 
 static int
@@ -222,7 +225,9 @@ dnode_init(void)
dnode_cache = kmem_cache_create("dnode_t",
sizeof (dnode_t),
0, dnode_cons, dnode_dest, NULL, NULL, NULL, 0);
+#ifdef _KERNEL
kmem_cache_set_move(dnode_cache, dnode_move);
+#endif /* _KERNEL */
 }
 
 void
@@ -414,7 +419,9 @@ dnode_create(objset_t *os, dnode_phys_t *dnp, dmu_buf_
dnode_t *dn;
 
dn = kmem_cache_alloc(dnode_cache, KM_SLEEP);
+#ifdef _KERNEL
ASSERT(!POINTER_IS_VALID(dn->dn_objset));
+#endif /* _KERNEL */
dn->dn_moved = 0;
 
/*
@@ -706,6 +713,7 @@ static struct {
 } dnode_move_stats;
 #endif /* DNODE_STATS */
 
+#ifdef _KERNEL
 static void
 dnode_move_impl(dnode_t *odn, dnode_t *ndn)
 {
@@ -843,7 +851,6 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn)
 }
 
 #ifdef illumos
-#ifdef _KERNEL
 /*ARGSUSED*/
 static kmem_cbrc_t
 dnode_move(void *buf, void *newbuf, size_t size, void *arg)
@@ -984,8 +991,8 @@ dnode_move(void *buf, void *newbuf, size_t size, void 
 
return (KMEM_CBRC_YES);
 }
-#endif /* _KERNEL */
 #endif /* illumos */
+#endif /* _KERNEL */
 
 void
 dnode_special_close(dnode_handle_t *dnh)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Mon Apr 16 
03:32:41 2018(r332525)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Mon Apr 16 
03:35:18 2018(r332526)
@@ -23,6 +23,7 @@
  *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ * Copyright 2017 RackTop Systems.
  */
 
 #ifndef _SYS_ACL_H
@@ -130,7 +131,7 @@ typedef struct acl_info acl_t;
 #defineACL_FLAGS_ALL   
(ACL_AUTO_INHERIT|ACL_PROTECTED| \
 ACL_DEFAULTED)
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
 
 /*
  * These are only applicable in a CIFS context.

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h  Mon Apr 
16 03:32:41 2018(r332525)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/bitmap.h  Mon Apr 
16 03:35:18 2018(r332526)
@@ -26,6 +26,7 @@
 
 /*
  * Copyright (c) 2014 by Delphix. All rights reserved.
+ * Copyright 2017 RackTop Systems.
  */
 
 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT */
@@ -134,7 +135,7 @@ extern "C" {
 #defineBIT_ONLYONESET(u) \
u) == 0) ? 0 : ((u) & ((u) - 1)) == 0))
 
-#if defined(_KERNEL) && !defined(_ASM)
+#if (defined(_KERNEL) || defined(_FAKE_KERNEL)) && !defined(_ASM)
 #include 
 
 /*
@@ -188,7 +189,7 @@ extern int  odd_parity(ulong_t);
  */
 #defineBITX(u, h, l)   (((u) >> (l)) & ((1LU << ((h) - (l) + 1LU)) - 
1LU))
 
-#endif /* _KERNEL && !_ASM */
+#endif /* (_KERNEL || _FAKE_KERNEL) && !_ASM */
 
 

svn commit: r332525 - in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/...

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:32:41 2018
New Revision: 332525
URL: https://svnweb.freebsd.org/changeset/base/332525

Log:
  MFC r329732: MFV r329502: 7614 zfs device evacuation/removal
  
  illumos/illumos-gate@5cabbc6b49070407fb9610cfe73d4c0e0dea3e77
  
  https://www.illumos.org/issues/7614:
  This project allows top-level vdevs to be removed from the storage pool with
  “zpool remove”, reducing the total amount of storage in the pool. This
  operation copies all allocated regions of the device to be removed onto other
  devices, recording the mapping from old to new location. After the removal is
  complete, read and free operations to the removed (now “indirect”) vdev must
  be remapped and performed at the new location on disk. The indirect mapping
  table is kept in memory whenever the pool is loaded, so there is minimal
  performance overhead when doing operations on the indirect vdev.
  
  The size of the in-memory mapping table will be reduced when its entries
  become “obsolete” because they are no longer used by any block pointers in
  the pool. An entry becomes obsolete when all the blocks that use it are
  freed. An entry can also become obsolete when all the snapshots that
  reference it are deleted, and the block pointers that reference it have been
  “remapped” in all filesystems/zvols (and clones). Whenever an indirect block
  is written, all the block pointers in it will be “remapped” to their new
  (concrete) locations if possible. This process can be accelerated by using
  the “zfs remap” command to proactively rewrite all indirect blocks that
  reference indirect (removed) vdevs.
  
  Note that when a device is removed, we do not verify the checksum of the data
  that is copied. This makes the process much faster, but if it were used on
  redundant vdevs (i.e. mirror or raidz vdevs), it would be possible to copy
  the wrong data, when we have the correct data on e.g. the other side of the
  mirror. Therefore, mirror and raidz devices can not be removed.
  
  Reviewed by: Alex Reece 
  Reviewed by: George Wilson 
  Reviewed by: John Kennedy 
  Reviewed by: Prakash Surya 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Richard Laager 
  Reviewed by: Tim Chase 
  Approved by: Garrett D'Amore 
  Author: Prashanth Sreenivasa 

Added:
  
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_births.h
 - copied unchanged from r329732, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_births.h
  
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_mapping.h
 - copied unchanged from r329732, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_indirect_mapping.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h
 - copied unchanged from r329732, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_removal.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
 - copied unchanged from r329732, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
  
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_births.c
 - copied unchanged from r329732, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_births.c
  
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_mapping.c
 - copied unchanged from r329732, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_mapping.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c
 - copied unchanged from r329732, 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c
Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.h
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  

svn commit: r332524 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 03:14:54 2018
New Revision: 332524
URL: https://svnweb.freebsd.org/changeset/base/332524

Log:
  MFC r307317: MFV r307313:
  5120 zfs should allow large block/gzip/raidz boot pool (loader project)
  
  Reviewed by: George Wilson 
  Reviewed by: Yuri Pankov 
  Reviewed by: Andrew Stormont 
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Toomas Soome 
  
  openzfs/openzfs@c8811bd3e2427dddbac6c05a59cfe117d8fea370
  
  FreeBSD still does not support booting from gzip-compressed datasets,
  so keep one chunk of this commit out.

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 00:54:58 2018(r332523)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Mon Apr 
16 03:14:54 2018(r332524)
@@ -27,6 +27,7 @@
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  * Copyright 2013 Saso Kiselkov. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Toomas Soome 
  * Copyright 2017 Joyent, Inc.
  * Copyright (c) 2017 Datto Inc.
  * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
@@ -539,12 +540,6 @@ spa_prop_validate(spa_t *spa, nvlist_t *props)
zfs_prop_to_name(ZFS_PROP_COMPRESSION),
)) == 0 &&
!BOOTFS_COMPRESS_VALID(propval)) {
-   error = SET_ERROR(ENOTSUP);
-   } else if ((error =
-   dsl_prop_get_int_ds(dmu_objset_ds(os),
-   zfs_prop_to_name(ZFS_PROP_RECORDSIZE),
-   )) == 0 &&
-   propval > SPA_OLD_MAXBLOCKSIZE) {
error = SET_ERROR(ENOTSUP);
} else {
objnum = dmu_objset_id(os);

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h  Mon Apr 
16 00:54:58 2018(r332523)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h  Mon Apr 
16 03:14:54 2018(r332524)
@@ -24,6 +24,7 @@
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+ * Copyright 2016 Toomas Soome 
  */
 
 #ifndef _ZIO_H

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Apr 
16 00:54:58 2018(r332523)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Apr 
16 03:14:54 2018(r332524)
@@ -25,6 +25,7 @@
  * Copyright 2017 Nexenta Systems, Inc.
  * Copyright 2013 Martin Matuska . All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Toomas Soome 
  * Copyright 2017 Joyent, Inc.
  */
 
@@ -3491,16 +3492,10 @@ vdev_set_state(vdev_t *vd, boolean_t isopen, vdev_stat
 
 /*
  * Check the vdev configuration to ensure that it's capable of supporting
- * a root pool.
+ * a root pool. We do not support partial configuration.
+ * In addition, only a single top-level vdev is allowed.
  *
- * On Solaris, we do not support RAID-Z or partial configuration.  In
- * addition, only a single top-level vdev is allowed and none of the
- * leaves can be wholedisks.
- *
- * For FreeBSD, we can boot from any configuration. There is a
- * limitation that the boot filesystem must be either uncompressed or
- * compresses with lzjb compression but I'm not sure how to enforce
- * that here.
+ * FreeBSD does not have above limitations.
  */
 boolean_t
 vdev_is_bootable(vdev_t *vd)
@@ -3512,8 +3507,7 @@ vdev_is_bootable(vdev_t *vd)
if (strcmp(vdev_type, VDEV_TYPE_ROOT) == 0 &&
vd->vdev_children > 1) {
return (B_FALSE);
-   } else if (strcmp(vdev_type, VDEV_TYPE_RAIDZ) == 0 ||

Re: svn commit: r331722 - in stable/11: bin/cat bin/chflags bin/chmod bin/cp bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/hostname bin/kill bin/ln bin/ls bin/mkdir bin/mv bin/pax bin/ps b

2018-04-15 Thread Kyle Evans
On Sun, Apr 15, 2018 at 8:40 PM, Rodney W. Grimes
 wrote:
>> On Sun, Apr 15, 2018 at 7:28 PM, Rodney W. Grimes
>>  wrote:
>> >> On Wed, 2018-03-28 at 20:17 -0700, Rodney W. Grimes wrote:
>> >> > -- Start of PGP signed section.
>> >> > >
>> >> > > On Thu, Mar 29, 2018 at 02:51:04AM +, Eitan Adler wrote:
>> >> > > >
>> >> > > > Author: eadler
>> >> > > > Date: Thu Mar 29 02:50:57 2018
>> >> > > > New Revision: 331722
>> >> > > > URL: https://svnweb.freebsd.org/changeset/base/331722
>> >> > > >
>> >> > > > Log:
>> >> > > > ? Revert r330897:
>> >> > > > ??
>> >> > > > ? This was intended to be a non-functional change. It wasn't. The 
>> >> > > > commit
>> >> > > > ? message was thus wrong. In addition it broke arm, and merged 
>> >> > > > crypto
>> >> > > > ? related code.
>> >> > > > ??
>> >> > > > ? Revert with prejudice.
>> >> > > > ??
>> >> > > > ? This revert skips files touched in r316370 since that commit was 
>> >> > > > since
>> >> > > > ? MFCed.
>> >> > Um, not sure that was the right way to revert :-(.
>> >> >
>> >> > >
>> >> > > >
>> >> > > > ? This revert also skips files that require $FreeBSD$ property
>> >> > > > ? changes.
>> >> > And more doubts that this is right to skip anything.
>> >> >
>> >> > >
>> >> > > >
>> >> > > > ? Thank you to those who helped me get out of this mess including 
>> >> > > > but not
>> >> > > > ? limited to gonzo, kevans, rgrimes.
>> >> > > > ??
>> >> > > > ? Requested by: gjb (re)
>> >> > > >
>> >> > > I did *not* request this, especially not on re@'s behalf.??I provided
>> >> > > input on what I felt was the correct way to proceed in this situation,
>> >> > > where a number of commits that were not related to the intent were
>> >> > > included.??There is a difference.
>> >> > I tried to get this slowed down until we could get to a concenses,
>> >> > I think our mess is as big now as it was before.
>> >> >
>> >>
>> >> Or bigger. I've just discovered this commit reverted stuff that wasn't
>> >> part of the bad original MFC commit. Things I MFC'd to 11 before this
>> >> revert are now missing changes and the symptoms don't show up until a
>> >> module fails to load due to missing symbols.
>> >>
>> >> I guess every change on the stable-11 branch between r330897 and
>> >> r331722 needs to be audited to see if MFC'd or changed code has been
>> >> unintentionally reverted.
>> >>
>> >> Here's the example I've just run across...
>> >>
>> >> r330897 merged this:
>> >>
>> >> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=302408=330897
>> >>
>> >> Then I did some MFCing, then r331722 "reverted" this:
>> >>
>> >> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=331506=331722
>
> I have confirmed this in a first pass audit, there are changes to ofw_spibus.c
> that are not in the original r330897 commit, but are in the r331722 commit.
>
>> > *sigh*  Ok, I can at least do an audit of the r331722
>> > that was suppose to be a revert and see what else I find.
>> >
>> > I'll start on this tomarrow and get the first pass audit out fairly early
>> > in the morning my time (PST)
>> >
>> > Do we revert the attempted revert, then properly revert the original?
>>
>> I support this effort, as long as we either still don't revert
>> anything touching the files that gonzo went through the trouble of
>> getting back into shape or we also revert gonzo's follow-up MFCs and
>> re-MFC those bits in particular for him. eadler's original commit had
>> included an impartial MFC of some of gonzo's commits (somehow?), hence
>> the follow-up that completed the MFC.
>
> Can you help to identify what part or even just file paths, that gonzo is
> depending on having been merged by r330897, that would help me greatly.

Those touched in r316370:

sys/arm/arm/pl190.c
sys/arm/conf/VERSATILEPB
sys/arm/versatile/*

> Right now I have the 80k line diffs down to the 8k or so "extra stuff",
> that should of not been commited in the first diff to try and audit
> against the second diff.
>

Excellent! Thanks for doing this. =)
___
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: r331722 - in stable/11: bin/cat bin/chflags bin/chmod bin/cp bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/hostname bin/kill bin/ln bin/ls bin/mkdir bin/mv bin/pax bin/ps b

2018-04-15 Thread Rodney W. Grimes
> On Sun, Apr 15, 2018 at 7:28 PM, Rodney W. Grimes
>  wrote:
> >> On Wed, 2018-03-28 at 20:17 -0700, Rodney W. Grimes wrote:
> >> > -- Start of PGP signed section.
> >> > >
> >> > > On Thu, Mar 29, 2018 at 02:51:04AM +, Eitan Adler wrote:
> >> > > >
> >> > > > Author: eadler
> >> > > > Date: Thu Mar 29 02:50:57 2018
> >> > > > New Revision: 331722
> >> > > > URL: https://svnweb.freebsd.org/changeset/base/331722
> >> > > >
> >> > > > Log:
> >> > > > ? Revert r330897:
> >> > > > ??
> >> > > > ? This was intended to be a non-functional change. It wasn't. The 
> >> > > > commit
> >> > > > ? message was thus wrong. In addition it broke arm, and merged crypto
> >> > > > ? related code.
> >> > > > ??
> >> > > > ? Revert with prejudice.
> >> > > > ??
> >> > > > ? This revert skips files touched in r316370 since that commit was 
> >> > > > since
> >> > > > ? MFCed.
> >> > Um, not sure that was the right way to revert :-(.
> >> >
> >> > >
> >> > > >
> >> > > > ? This revert also skips files that require $FreeBSD$ property
> >> > > > ? changes.
> >> > And more doubts that this is right to skip anything.
> >> >
> >> > >
> >> > > >
> >> > > > ? Thank you to those who helped me get out of this mess including 
> >> > > > but not
> >> > > > ? limited to gonzo, kevans, rgrimes.
> >> > > > ??
> >> > > > ? Requested by: gjb (re)
> >> > > >
> >> > > I did *not* request this, especially not on re@'s behalf.??I provided
> >> > > input on what I felt was the correct way to proceed in this situation,
> >> > > where a number of commits that were not related to the intent were
> >> > > included.??There is a difference.
> >> > I tried to get this slowed down until we could get to a concenses,
> >> > I think our mess is as big now as it was before.
> >> >
> >>
> >> Or bigger. I've just discovered this commit reverted stuff that wasn't
> >> part of the bad original MFC commit. Things I MFC'd to 11 before this
> >> revert are now missing changes and the symptoms don't show up until a
> >> module fails to load due to missing symbols.
> >>
> >> I guess every change on the stable-11 branch between r330897 and
> >> r331722 needs to be audited to see if MFC'd or changed code has been
> >> unintentionally reverted.
> >>
> >> Here's the example I've just run across...
> >>
> >> r330897 merged this:
> >>
> >> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=302408=330897
> >>
> >> Then I did some MFCing, then r331722 "reverted" this:
> >>
> >> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=331506=331722

I have confirmed this in a first pass audit, there are changes to ofw_spibus.c
that are not in the original r330897 commit, but are in the r331722 commit.  

> > *sigh*  Ok, I can at least do an audit of the r331722
> > that was suppose to be a revert and see what else I find.
> >
> > I'll start on this tomarrow and get the first pass audit out fairly early
> > in the morning my time (PST)
> >
> > Do we revert the attempted revert, then properly revert the original?
> 
> I support this effort, as long as we either still don't revert
> anything touching the files that gonzo went through the trouble of
> getting back into shape or we also revert gonzo's follow-up MFCs and
> re-MFC those bits in particular for him. eadler's original commit had
> included an impartial MFC of some of gonzo's commits (somehow?), hence
> the follow-up that completed the MFC.

Can you help to identify what part or even just file paths, that gonzo is
depending on having been merged by r330897, that would help me greatly.

Right now I have the 80k line diffs down to the 8k or so "extra stuff",
that should of not been commited in the first diff to try and audit
against the second diff.

The merginfo looks correct:
Index: stable/11
===
--- stable/11   (revision 330896)
+++ stable/11   (revision 330897)

Property changes on: stable/11
___
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /head:r325966,326022-326025,326027,326192-326193,326219,326255-326261


Index: stable/11
===
--- stable/11   (revision 331721)
+++ stable/11   (revision 331722)

Property changes on: stable/11
___
Modified: svn:mergeinfo
## -0,1 +0,0 ##
   Reverse-merged 
/head:r325966,326022-326025,326027,326192-326193,326219,326255-326261


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


Re: svn commit: r331722 - in stable/11: bin/cat bin/chflags bin/chmod bin/cp bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/hostname bin/kill bin/ln bin/ls bin/mkdir bin/mv bin/pax bin/ps b

2018-04-15 Thread Rodney W. Grimes
> On 15 April 2018 at 17:53, Kyle Evans  wrote:
> > On Sun, Apr 15, 2018 at 7:28 PM, Rodney W. Grimes
> >  wrote:
> >>> On Wed, 2018-03-28 at 20:17 -0700, Rodney W. Grimes wrote:
> >>> > -- Start of PGP signed section.
> >>> > >
> >>> > > On Thu, Mar 29, 2018 at 02:51:04AM +, Eitan Adler wrote:
> >>> > > >
> >>> > > > Author: eadler
> >>> > > > Date: Thu Mar 29 02:50:57 2018
> >>> > > > New Revision: 331722
> >>> > > > URL: https://svnweb.freebsd.org/changeset/base/331722
> >>> > > >
> >>> > > > Log:
> >>> > > > ? Revert r330897:
> >>> > > > ??
> >>> > > > ? This was intended to be a non-functional change. It wasn't. The 
> >>> > > > commit
> >>> > > > ? message was thus wrong. In addition it broke arm, and merged 
> >>> > > > crypto
> >>> > > > ? related code.
> >>> > > > ??
> >>> > > > ? Revert with prejudice.
> >>> > > > ??
> >>> > > > ? This revert skips files touched in r316370 since that commit was 
> >>> > > > since
> >>> > > > ? MFCed.
> >>> > Um, not sure that was the right way to revert :-(.
> >>> >
> >>> > >
> >>> > > >
> >>> > > > ? This revert also skips files that require $FreeBSD$ property
> >>> > > > ? changes.
> >>> > And more doubts that this is right to skip anything.
> >>> >
> >>> > >
> >>> > > >
> >>> > > > ? Thank you to those who helped me get out of this mess including 
> >>> > > > but not
> >>> > > > ? limited to gonzo, kevans, rgrimes.
> >>> > > > ??
> >>> > > > ? Requested by: gjb (re)
> >>> > > >
> >>> > > I did *not* request this, especially not on re@'s behalf.??I provided
> >>> > > input on what I felt was the correct way to proceed in this situation,
> >>> > > where a number of commits that were not related to the intent were
> >>> > > included.??There is a difference.
> >>> > I tried to get this slowed down until we could get to a concenses,
> >>> > I think our mess is as big now as it was before.
> >>> >
> >>>
> >>> Or bigger. I've just discovered this commit reverted stuff that wasn't
> >>> part of the bad original MFC commit. Things I MFC'd to 11 before this
> >>> revert are now missing changes and the symptoms don't show up until a
> >>> module fails to load due to missing symbols.
> >>>
> >>> I guess every change on the stable-11 branch between r330897 and
> >>> r331722 needs to be audited to see if MFC'd or changed code has been
> >>> unintentionally reverted.
> >>>
> >>> Here's the example I've just run across...
> >>>
> >>> r330897 merged this:
> >>>
> >>> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=302408=330897
> >>>
> >>> Then I did some MFCing, then r331722 "reverted" this:
> >>>
> >>> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=331506=331722
> >>
> >> *sigh*  Ok, I can at least do an audit of the r331722
> >> that was suppose to be a revert and see what else I find.
> >>
> >> I'll start on this tomarrow and get the first pass audit out fairly early
> >> in the morning my time (PST)
> >>
> >> Do we revert the attempted revert, then properly revert the original?
> 
> I am beyond confused. How did
> svn merge -c-r330897 .
> fail?

What was the state of .?

> 
> At this point I am scared of touching subversion as I have no idea how
> what I do will interact with the repository, mergeinfo, etc.

svn diff tells you what it is going to do, and you can get the
merginfo off the end of a huge diff with tail.

Right now, pleaes do not do anything with this issue until an agreed
on cource of remidiation is determined.  Last time you jumped the gun
before we had concluded discussions.


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


Re: svn commit: r331722 - in stable/11: bin/cat bin/chflags bin/chmod bin/cp bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/hostname bin/kill bin/ln bin/ls bin/mkdir bin/mv bin/pax bin/ps b

2018-04-15 Thread Eitan Adler
On 15 April 2018 at 17:53, Kyle Evans  wrote:
> On Sun, Apr 15, 2018 at 7:28 PM, Rodney W. Grimes
>  wrote:
>>> On Wed, 2018-03-28 at 20:17 -0700, Rodney W. Grimes wrote:
>>> > -- Start of PGP signed section.
>>> > >
>>> > > On Thu, Mar 29, 2018 at 02:51:04AM +, Eitan Adler wrote:
>>> > > >
>>> > > > Author: eadler
>>> > > > Date: Thu Mar 29 02:50:57 2018
>>> > > > New Revision: 331722
>>> > > > URL: https://svnweb.freebsd.org/changeset/base/331722
>>> > > >
>>> > > > Log:
>>> > > > ? Revert r330897:
>>> > > > ??
>>> > > > ? This was intended to be a non-functional change. It wasn't. The 
>>> > > > commit
>>> > > > ? message was thus wrong. In addition it broke arm, and merged crypto
>>> > > > ? related code.
>>> > > > ??
>>> > > > ? Revert with prejudice.
>>> > > > ??
>>> > > > ? This revert skips files touched in r316370 since that commit was 
>>> > > > since
>>> > > > ? MFCed.
>>> > Um, not sure that was the right way to revert :-(.
>>> >
>>> > >
>>> > > >
>>> > > > ? This revert also skips files that require $FreeBSD$ property
>>> > > > ? changes.
>>> > And more doubts that this is right to skip anything.
>>> >
>>> > >
>>> > > >
>>> > > > ? Thank you to those who helped me get out of this mess including but 
>>> > > > not
>>> > > > ? limited to gonzo, kevans, rgrimes.
>>> > > > ??
>>> > > > ? Requested by: gjb (re)
>>> > > >
>>> > > I did *not* request this, especially not on re@'s behalf.??I provided
>>> > > input on what I felt was the correct way to proceed in this situation,
>>> > > where a number of commits that were not related to the intent were
>>> > > included.??There is a difference.
>>> > I tried to get this slowed down until we could get to a concenses,
>>> > I think our mess is as big now as it was before.
>>> >
>>>
>>> Or bigger. I've just discovered this commit reverted stuff that wasn't
>>> part of the bad original MFC commit. Things I MFC'd to 11 before this
>>> revert are now missing changes and the symptoms don't show up until a
>>> module fails to load due to missing symbols.
>>>
>>> I guess every change on the stable-11 branch between r330897 and
>>> r331722 needs to be audited to see if MFC'd or changed code has been
>>> unintentionally reverted.
>>>
>>> Here's the example I've just run across...
>>>
>>> r330897 merged this:
>>>
>>> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=302408=330897
>>>
>>> Then I did some MFCing, then r331722 "reverted" this:
>>>
>>> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=331506=331722
>>
>> *sigh*  Ok, I can at least do an audit of the r331722
>> that was suppose to be a revert and see what else I find.
>>
>> I'll start on this tomarrow and get the first pass audit out fairly early
>> in the morning my time (PST)
>>
>> Do we revert the attempted revert, then properly revert the original?

I am beyond confused. How did
svn merge -c-r330897 .
fail?

At this point I am scared of touching subversion as I have no idea how
what I do will interact with the repository, mergeinfo, etc.





-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
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: r332523 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 00:54:58 2018
New Revision: 332523
URL: https://svnweb.freebsd.org/changeset/base/332523

Log:
  9433 Fix ARC hit rate
  
  When the compressed ARC feature was added in commit d3c2ae1
  the method of reference counting in the ARC was modified.  As
  part of this accounting change the arc_buf_add_ref() function
  was removed entirely.
  
  This would have be fine but the arc_buf_add_ref() function
  served a second undocumented purpose of updating the ARC access
  information when taking a hold on a dbuf.  Without this logic
  in place a cached dbuf would not migrate its associated
  arc_buf_hdr_t to the MFU list.  This would negatively impact
  the ARC hit rate, particularly on systems with a small ARC.
  
  This change reinstates the missing call to arc_access() from
  dbuf_hold() by implementing a new arc_buf_access() function.
  
  Reviewed-by: Giuseppe Di Natale 
  Reviewed-by: Tony Hutter 
  Reviewed-by: Tim Chase 
  Reviewed by: George Wilson 
  Reviewed-by: George Melikov 
  Signed-off-by: Brian Behlendorf 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Mon Apr 16 
00:42:45 2018(r332522)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Mon Apr 16 
00:54:58 2018(r332523)
@@ -540,8 +540,13 @@ typedef struct arc_stats {
 */
kstat_named_t arcstat_mutex_miss;
/*
+* Number of buffers skipped when updating the access state due to the
+* header having already been released after acquiring the hash lock.
+*/
+   kstat_named_t arcstat_access_skip;
+   /*
 * Number of buffers skipped because they have I/O in progress, are
-* indrect prefetch buffers that have not lived long enough, or are
+* indirect prefetch buffers that have not lived long enough, or are
 * not from the spa we're trying to evict from.
 */
kstat_named_t arcstat_evict_skip;
@@ -796,6 +801,7 @@ static arc_stats_t arc_stats = {
{ "allocated",  KSTAT_DATA_UINT64 },
{ "deleted",KSTAT_DATA_UINT64 },
{ "mutex_miss", KSTAT_DATA_UINT64 },
+   { "access_skip",KSTAT_DATA_UINT64 },
{ "evict_skip", KSTAT_DATA_UINT64 },
{ "evict_not_enough",   KSTAT_DATA_UINT64 },
{ "evict_l2_cached",KSTAT_DATA_UINT64 },
@@ -5063,6 +5069,51 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock)
} else {
ASSERT(!"invalid arc state");
}
+}
+
+/*
+ * This routine is called by dbuf_hold() to update the arc_access() state
+ * which otherwise would be skipped for entries in the dbuf cache.
+ */
+void
+arc_buf_access(arc_buf_t *buf)
+{
+   mutex_enter(>b_evict_lock);
+   arc_buf_hdr_t *hdr = buf->b_hdr;
+
+   /*
+* Avoid taking the hash_lock when possible as an optimization.
+* The header must be checked again under the hash_lock in order
+* to handle the case where it is concurrently being released.
+*/
+   if (hdr->b_l1hdr.b_state == arc_anon || HDR_EMPTY(hdr)) {
+   mutex_exit(>b_evict_lock);
+   ARCSTAT_BUMP(arcstat_access_skip);
+   return;
+   }
+
+   kmutex_t *hash_lock = HDR_LOCK(hdr);
+   mutex_enter(hash_lock);
+
+   if (hdr->b_l1hdr.b_state == arc_anon || HDR_EMPTY(hdr)) {
+   mutex_exit(hash_lock);
+   mutex_exit(>b_evict_lock);
+   ARCSTAT_BUMP(arcstat_access_skip);
+   return;
+   }
+
+   mutex_exit(>b_evict_lock);
+
+   ASSERT(hdr->b_l1hdr.b_state == arc_mru ||
+   hdr->b_l1hdr.b_state == arc_mfu);
+
+   DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr);
+   arc_access(hdr, hash_lock);
+   mutex_exit(hash_lock);
+
+   ARCSTAT_BUMP(arcstat_hits);
+   ARCSTAT_CONDSTAT(!HDR_PREFETCH(hdr),
+   demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data, metadata, hits);
 }
 
 /* a generic arc_done_func_t which you can use */

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Mon Apr 16 
00:42:45 2018(r332522)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Mon Apr 16 
00:54:58 2018(r332523)
@@ -2579,8 +2579,10 @@ top:
return (SET_ERROR(ENOENT));
}
 
-  

Re: svn commit: r331722 - in stable/11: bin/cat bin/chflags bin/chmod bin/cp bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/hostname bin/kill bin/ln bin/ls bin/mkdir bin/mv bin/pax bin/ps b

2018-04-15 Thread Kyle Evans
On Sun, Apr 15, 2018 at 7:28 PM, Rodney W. Grimes
 wrote:
>> On Wed, 2018-03-28 at 20:17 -0700, Rodney W. Grimes wrote:
>> > -- Start of PGP signed section.
>> > >
>> > > On Thu, Mar 29, 2018 at 02:51:04AM +, Eitan Adler wrote:
>> > > >
>> > > > Author: eadler
>> > > > Date: Thu Mar 29 02:50:57 2018
>> > > > New Revision: 331722
>> > > > URL: https://svnweb.freebsd.org/changeset/base/331722
>> > > >
>> > > > Log:
>> > > > ? Revert r330897:
>> > > > ??
>> > > > ? This was intended to be a non-functional change. It wasn't. The 
>> > > > commit
>> > > > ? message was thus wrong. In addition it broke arm, and merged crypto
>> > > > ? related code.
>> > > > ??
>> > > > ? Revert with prejudice.
>> > > > ??
>> > > > ? This revert skips files touched in r316370 since that commit was 
>> > > > since
>> > > > ? MFCed.
>> > Um, not sure that was the right way to revert :-(.
>> >
>> > >
>> > > >
>> > > > ? This revert also skips files that require $FreeBSD$ property
>> > > > ? changes.
>> > And more doubts that this is right to skip anything.
>> >
>> > >
>> > > >
>> > > > ? Thank you to those who helped me get out of this mess including but 
>> > > > not
>> > > > ? limited to gonzo, kevans, rgrimes.
>> > > > ??
>> > > > ? Requested by: gjb (re)
>> > > >
>> > > I did *not* request this, especially not on re@'s behalf.??I provided
>> > > input on what I felt was the correct way to proceed in this situation,
>> > > where a number of commits that were not related to the intent were
>> > > included.??There is a difference.
>> > I tried to get this slowed down until we could get to a concenses,
>> > I think our mess is as big now as it was before.
>> >
>>
>> Or bigger. I've just discovered this commit reverted stuff that wasn't
>> part of the bad original MFC commit. Things I MFC'd to 11 before this
>> revert are now missing changes and the symptoms don't show up until a
>> module fails to load due to missing symbols.
>>
>> I guess every change on the stable-11 branch between r330897 and
>> r331722 needs to be audited to see if MFC'd or changed code has been
>> unintentionally reverted.
>>
>> Here's the example I've just run across...
>>
>> r330897 merged this:
>>
>> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=302408=330897
>>
>> Then I did some MFCing, then r331722 "reverted" this:
>>
>> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=331506=331722
>
> *sigh*  Ok, I can at least do an audit of the r331722
> that was suppose to be a revert and see what else I find.
>
> I'll start on this tomarrow and get the first pass audit out fairly early
> in the morning my time (PST)
>
> Do we revert the attempted revert, then properly revert the original?

I support this effort, as long as we either still don't revert
anything touching the files that gonzo went through the trouble of
getting back into shape or we also revert gonzo's follow-up MFCs and
re-MFC those bits in particular for him. eadler's original commit had
included an impartial MFC of some of gonzo's commits (somehow?), hence
the follow-up that completed the MFC.
___
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: r332522 - in stable/11: sbin/geom/class/eli sys/geom/eli

2018-04-15 Thread Kyle Evans
Author: kevans
Date: Mon Apr 16 00:42:45 2018
New Revision: 332522
URL: https://svnweb.freebsd.org/changeset/base/332522

Log:
  MFC r308137, r316312, r332361
  
  r308137:
  Fix alignment issues on MIPS: align the pointers properly.
  
  All the 5520 GEOM_ELI tests passed successfully on MIPS64EB.
  
  r316312:
  sys/geom/eli: Switch bzero() to explicit_bzero() for sensitive data
  
  In GELI, anywhere we are zeroing out possibly sensitive data, like
  the metadata struct, the metadata sector (both contain the encrypted
  master key), the user key, or the master key, use explicit_bzero.
  
  Didn't touch the bzero() used to initialize structs.
  
  r332361:
  Introduce dry run option for attaching the device.
  This will allow us to verify if passphrase and key is valid without
  decrypting whole device.

Modified:
  stable/11/sbin/geom/class/eli/geom_eli.c
  stable/11/sys/geom/eli/g_eli.h
  stable/11/sys/geom/eli/g_eli_integrity.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/geom/class/eli/geom_eli.c
==
--- stable/11/sbin/geom/class/eli/geom_eli.cMon Apr 16 00:29:07 2018
(r332521)
+++ stable/11/sbin/geom/class/eli/geom_eli.cMon Apr 16 00:42:45 2018
(r332522)
@@ -672,7 +672,7 @@ static void
 eli_init(struct gctl_req *req)
 {
struct g_eli_metadata md;
-   unsigned char sector[sizeof(struct g_eli_metadata)];
+   unsigned char sector[sizeof(struct g_eli_metadata)] __aligned(4);
unsigned char key[G_ELI_USERKEYLEN];
char backfile[MAXPATHLEN];
const char *str, *prov;

Modified: stable/11/sys/geom/eli/g_eli.h
==
--- stable/11/sys/geom/eli/g_eli.h  Mon Apr 16 00:29:07 2018
(r332521)
+++ stable/11/sys/geom/eli/g_eli.h  Mon Apr 16 00:42:45 2018
(r332522)
@@ -296,6 +296,7 @@ eli_metadata_encode_v1v2v3v4v5v6v7(struct g_eli_metada
 static __inline void
 eli_metadata_encode(struct g_eli_metadata *md, u_char *data)
 {
+   uint32_t hash[4];
MD5_CTX ctx;
u_char *p;
 
@@ -327,12 +328,14 @@ eli_metadata_encode(struct g_eli_metadata *md, u_char 
}
MD5Init();
MD5Update(, data, p - data);
-   MD5Final(md->md_hash, );
+   MD5Final((void *)hash, );
+   bcopy(hash, md->md_hash, sizeof(md->md_hash));
bcopy(md->md_hash, p, sizeof(md->md_hash));
 }
 static __inline int
 eli_metadata_decode_v0(const u_char *data, struct g_eli_metadata *md)
 {
+   uint32_t hash[4];
MD5_CTX ctx;
const u_char *p;
 
@@ -348,7 +351,8 @@ eli_metadata_decode_v0(const u_char *data, struct g_el
bcopy(p, md->md_mkeys, sizeof(md->md_mkeys)); p += sizeof(md->md_mkeys);
MD5Init();
MD5Update(, data, p - data);
-   MD5Final(md->md_hash, );
+   MD5Final((void *)hash, );
+   bcopy(hash, md->md_hash, sizeof(md->md_hash));
if (bcmp(md->md_hash, p, 16) != 0)
return (EINVAL);
return (0);
@@ -357,6 +361,7 @@ eli_metadata_decode_v0(const u_char *data, struct g_el
 static __inline int
 eli_metadata_decode_v1v2v3v4v5v6v7(const u_char *data, struct g_eli_metadata 
*md)
 {
+   uint32_t hash[4];
MD5_CTX ctx;
const u_char *p;
 
@@ -373,7 +378,8 @@ eli_metadata_decode_v1v2v3v4v5v6v7(const u_char *data,
bcopy(p, md->md_mkeys, sizeof(md->md_mkeys)); p += sizeof(md->md_mkeys);
MD5Init();
MD5Update(, data, p - data);
-   MD5Final(md->md_hash, );
+   MD5Final((void *)hash, );
+   bcopy(hash, md->md_hash, sizeof(md->md_hash));
if (bcmp(md->md_hash, p, 16) != 0)
return (EINVAL);
return (0);

Modified: stable/11/sys/geom/eli/g_eli_integrity.c
==
--- stable/11/sys/geom/eli/g_eli_integrity.cMon Apr 16 00:29:07 2018
(r332521)
+++ stable/11/sys/geom/eli/g_eli_integrity.cMon Apr 16 00:42:45 2018
(r332522)
@@ -444,12 +444,17 @@ g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp
size += sizeof(*crde) * nsec;
size += sizeof(*crda) * nsec;
size += G_ELI_AUTH_SECKEYLEN * nsec;
+   size += sizeof(uintptr_t);  /* Space for alignment. */
data = malloc(size, M_ELI, M_WAITOK);
bp->bio_driver2 = data;
p = data + encr_secsize * nsec;
}
bp->bio_inbed = 0;
bp->bio_children = nsec;
+
+#if defined(__mips_n64) || defined(__mips_o64)
+   p = (char *)roundup((uintptr_t)p, sizeof(uintptr_t));
+#endif
 
for (i = 1; i <= nsec; i++, dstoff += encr_secsize) {
crp = (struct cryptop *)p;  p += sizeof(*crp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all

Re: svn commit: r331722 - in stable/11: bin/cat bin/chflags bin/chmod bin/cp bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/hostname bin/kill bin/ln bin/ls bin/mkdir bin/mv bin/pax bin/ps b

2018-04-15 Thread Rodney W. Grimes
> On Wed, 2018-03-28 at 20:17 -0700, Rodney W. Grimes wrote:
> > -- Start of PGP signed section.
> > > 
> > > On Thu, Mar 29, 2018 at 02:51:04AM +, Eitan Adler wrote:
> > > > 
> > > > Author: eadler
> > > > Date: Thu Mar 29 02:50:57 2018
> > > > New Revision: 331722
> > > > URL: https://svnweb.freebsd.org/changeset/base/331722
> > > > 
> > > > Log:
> > > > ? Revert r330897:
> > > > ??
> > > > ? This was intended to be a non-functional change. It wasn't. The commit
> > > > ? message was thus wrong. In addition it broke arm, and merged crypto
> > > > ? related code.
> > > > ??
> > > > ? Revert with prejudice.
> > > > ??
> > > > ? This revert skips files touched in r316370 since that commit was since
> > > > ? MFCed.
> > Um, not sure that was the right way to revert :-(.
> > 
> > > 
> > > > 
> > > > ? This revert also skips files that require $FreeBSD$ property
> > > > ? changes.
> > And more doubts that this is right to skip anything.
> > 
> > > 
> > > > 
> > > > ? Thank you to those who helped me get out of this mess including but 
> > > > not
> > > > ? limited to gonzo, kevans, rgrimes.
> > > > ??
> > > > ? Requested by: gjb (re)
> > > > 
> > > I did *not* request this, especially not on re@'s behalf.??I provided
> > > input on what I felt was the correct way to proceed in this situation,
> > > where a number of commits that were not related to the intent were
> > > included.??There is a difference.
> > I tried to get this slowed down until we could get to a concenses,
> > I think our mess is as big now as it was before.
> > 
> 
> Or bigger. I've just discovered this commit reverted stuff that wasn't
> part of the bad original MFC commit. Things I MFC'd to 11 before this
> revert are now missing changes and the symptoms don't show up until a
> module fails to load due to missing symbols.
> 
> I guess every change on the stable-11 branch between r330897 and
> r331722 needs to be audited to see if MFC'd or changed code has been
> unintentionally reverted.
> 
> Here's the example I've just run across...
> 
> r330897 merged this:
> 
> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=302408=330897
> 
> Then I did some MFCing, then r331722 "reverted" this:
> 
> https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=331506=331722

*sigh*  Ok, I can at least do an audit of the r331722
that was suppose to be a revert and see what else I find.

I'll start on this tomarrow and get the first pass audit out fairly early
in the morning my time (PST)

Do we revert the attempted revert, then properly revert the original?

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


svn commit: r332521 - stable/11/sys/geom/part

2018-04-15 Thread Kyle Evans
Author: kevans
Date: Mon Apr 16 00:29:07 2018
New Revision: 332521
URL: https://svnweb.freebsd.org/changeset/base/332521

Log:
  MFC r323108, r323125, r326047-r326049
  
  r323108:
  Add efimedia attribute for all GPT partitions.
  
  r323125:
  The hard drive media device path contains the size of the partition,
  not its end. This makes the GEOM efimedia attribute match the
  FreeBSD:Boot1Device environment variable now.
  
  r326047:
  Implement efi media tagging for MBR partitioning types.
  
  r326048:
  Remove trailing whitespace (one I just introduced and a bunch of
  others in the same directory).
  
  r326049:
  While the EFI spec allows numbers to be in many forms, libefivar
  produces hex numbers for the dsn. Since that come is from EDK2, change
  this for symmetry, by generating the dsn as a hex number.
  
  [Missed as part of the efivar/efibootmgr MFCs]
  
  Reported by:  Oliver Pinter 

Modified:
  stable/11/sys/geom/part/g_part.c
  stable/11/sys/geom/part/g_part_apm.c
  stable/11/sys/geom/part/g_part_bsd.c
  stable/11/sys/geom/part/g_part_bsd64.c
  stable/11/sys/geom/part/g_part_ebr.c
  stable/11/sys/geom/part/g_part_gpt.c
  stable/11/sys/geom/part/g_part_mbr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/part/g_part.c
==
--- stable/11/sys/geom/part/g_part.cMon Apr 16 00:18:57 2018
(r332520)
+++ stable/11/sys/geom/part/g_part.cMon Apr 16 00:29:07 2018
(r332521)
@@ -1363,7 +1363,7 @@ g_part_ctl_resize(struct gctl_req *req, struct g_part_
/* Deny shrinking of an opened partition. */
gctl_error(req, "%d", EBUSY);
return (EBUSY);
-   } 
+   }
}
 
error = G_PART_RESIZE(table, entry, gpp);

Modified: stable/11/sys/geom/part/g_part_apm.c
==
--- stable/11/sys/geom/part/g_part_apm.cMon Apr 16 00:18:57 2018
(r332520)
+++ stable/11/sys/geom/part/g_part_apm.cMon Apr 16 00:29:07 2018
(r332521)
@@ -207,7 +207,7 @@ apm_read_ent(struct g_consumer *cp, uint32_t blk, stru
 }
 
 static int
-g_part_apm_add(struct g_part_table *basetable, struct g_part_entry *baseentry, 
+g_part_apm_add(struct g_part_table *basetable, struct g_part_entry *baseentry,
 struct g_part_parms *gpp)
 {
struct g_part_apm_entry *entry;

Modified: stable/11/sys/geom/part/g_part_bsd.c
==
--- stable/11/sys/geom/part/g_part_bsd.cMon Apr 16 00:18:57 2018
(r332520)
+++ stable/11/sys/geom/part/g_part_bsd.cMon Apr 16 00:29:07 2018
(r332521)
@@ -72,7 +72,7 @@ static int g_part_bsd_destroy(struct g_part_table *, s
 static void g_part_bsd_dumpconf(struct g_part_table *, struct g_part_entry *,
 struct sbuf *, const char *);
 static int g_part_bsd_dumpto(struct g_part_table *, struct g_part_entry *);
-static int g_part_bsd_modify(struct g_part_table *, struct g_part_entry *,  
+static int g_part_bsd_modify(struct g_part_table *, struct g_part_entry *,
 struct g_part_parms *);
 static const char *g_part_bsd_name(struct g_part_table *, struct g_part_entry 
*,
 char *, size_t);
@@ -256,7 +256,7 @@ g_part_bsd_destroy(struct g_part_table *basetable, str
 }
 
 static void
-g_part_bsd_dumpconf(struct g_part_table *table, struct g_part_entry 
*baseentry, 
+g_part_bsd_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
 struct sbuf *sb, const char *indent)
 {
struct g_part_bsd_entry *entry;
@@ -275,7 +275,7 @@ g_part_bsd_dumpconf(struct g_part_table *table, struct
 }
 
 static int
-g_part_bsd_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)  
+g_part_bsd_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
 {
struct g_part_bsd_entry *entry;
 
@@ -471,7 +471,7 @@ g_part_bsd_read(struct g_part_table *basetable, struct
 }
 
 static const char *
-g_part_bsd_type(struct g_part_table *basetable, struct g_part_entry 
*baseentry, 
+g_part_bsd_type(struct g_part_table *basetable, struct g_part_entry *baseentry,
 char *buf, size_t bufsz)
 {
struct g_part_bsd_entry *entry;

Modified: stable/11/sys/geom/part/g_part_bsd64.c
==
--- stable/11/sys/geom/part/g_part_bsd64.c  Mon Apr 16 00:18:57 2018
(r332520)
+++ stable/11/sys/geom/part/g_part_bsd64.c  Mon Apr 16 00:29:07 2018
(r332521)
@@ -127,7 +127,7 @@ static int g_part_bsd64_destroy(struct g_part_table *,
 static void g_part_bsd64_dumpconf(struct g_part_table *, struct g_part_entry *,
 struct sbuf *, const char *);
 static int g_part_bsd64_dumpto(struct g_part_table *, struct g_part_entry *);
-static int 

svn commit: r332520 - in stable/11: share/man/man4 sys/conf sys/geom

2018-04-15 Thread Kyle Evans
Author: kevans
Date: Mon Apr 16 00:18:57 2018
New Revision: 332520
URL: https://svnweb.freebsd.org/changeset/base/332520

Log:
  geom_aes: Provide some deprecation notices
  
  This is a direct commit to stable/11, due to having already been removed in
  head.

Modified:
  stable/11/share/man/man4/geom.4
  stable/11/sys/conf/NOTES
  stable/11/sys/geom/geom_aes.c

Modified: stable/11/share/man/man4/geom.4
==
--- stable/11/share/man/man4/geom.4 Mon Apr 16 00:12:03 2018
(r332519)
+++ stable/11/share/man/man4/geom.4 Mon Apr 16 00:18:57 2018
(r332520)
@@ -41,7 +41,6 @@
 .Nm GEOM
 .Nd "modular disk I/O request transformation framework"
 .Sh SYNOPSIS
-.Cd options GEOM_AES
 .Cd options GEOM_BDE
 .Cd options GEOM_CACHE
 .Cd options GEOM_CONCAT
@@ -450,6 +449,7 @@ Dump contents of gctl requests.
 .Pp
 The following options have been deprecated and will be removed in
 .Fx 12 :
+.Cd GEOM_AES ,
 .Cd GEOM_BSD ,
 .Cd GEOM_FOX ,
 .Cd GEOM_MBR ,

Modified: stable/11/sys/conf/NOTES
==
--- stable/11/sys/conf/NOTESMon Apr 16 00:12:03 2018(r332519)
+++ stable/11/sys/conf/NOTESMon Apr 16 00:18:57 2018(r332520)
@@ -145,7 +145,7 @@ options INCLUDE_CONFIG_FILE # Include this file i
 optionsBOOTVERBOSE=1
 optionsBOOTHOWTO=RB_MULTIPLE
 
-optionsGEOM_AES# Don't use, use GEOM_BDE
+optionsGEOM_AES# Don't use, use GEOM_BDE (obsolete, 
gone in 12)
 optionsGEOM_BDE# Disk encryption.
 optionsGEOM_BSD# BSD disklabels (obsolete, gone in 12)
 optionsGEOM_CACHE  # Disk cache.

Modified: stable/11/sys/geom/geom_aes.c
==
--- stable/11/sys/geom/geom_aes.c   Mon Apr 16 00:12:03 2018
(r332519)
+++ stable/11/sys/geom/geom_aes.c   Mon Apr 16 00:18:57 2018
(r332520)
@@ -67,6 +67,7 @@ static const u_char *aes_magic = "<>
 static const u_char *aes_magic_random = "<>";
 static const u_char *aes_magic_test = "<>";
 
+static int g_aes_once;
 
 struct g_aes_softc {
enum {
@@ -352,8 +353,14 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp,
if (buf)
g_free(buf);
g_access(cp, -1, 0, 0);
-   if (gp->softc != NULL) 
+   if (gp->softc != NULL) {
+   if (!g_aes_once) {
+   g_aes_once = 1;
+   printf("WARNING: geom_aes (geom %s) is deprecated.",
+   gp->name);
+   }
return (gp);
+   }
g_detach(cp);
g_destroy_consumer(cp);
g_destroy_geom(gp);
___
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: r331722 - in stable/11: bin/cat bin/chflags bin/chmod bin/cp bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/hostname bin/kill bin/ln bin/ls bin/mkdir bin/mv bin/pax bin/ps b

2018-04-15 Thread Ian Lepore
On Wed, 2018-03-28 at 20:17 -0700, Rodney W. Grimes wrote:
> -- Start of PGP signed section.
> > 
> > On Thu, Mar 29, 2018 at 02:51:04AM +, Eitan Adler wrote:
> > > 
> > > Author: eadler
> > > Date: Thu Mar 29 02:50:57 2018
> > > New Revision: 331722
> > > URL: https://svnweb.freebsd.org/changeset/base/331722
> > > 
> > > Log:
> > >   Revert r330897:
> > >   
> > >   This was intended to be a non-functional change. It wasn't. The commit
> > >   message was thus wrong. In addition it broke arm, and merged crypto
> > >   related code.
> > >   
> > >   Revert with prejudice.
> > >   
> > >   This revert skips files touched in r316370 since that commit was since
> > >   MFCed.
> Um, not sure that was the right way to revert :-(.
> 
> > 
> > > 
> > >   This revert also skips files that require $FreeBSD$ property
> > >   changes.
> And more doubts that this is right to skip anything.
> 
> > 
> > > 
> > >   Thank you to those who helped me get out of this mess including but not
> > >   limited to gonzo, kevans, rgrimes.
> > >   
> > >   Requested by: gjb (re)
> > > 
> > I did *not* request this, especially not on re@'s behalf.  I provided
> > input on what I felt was the correct way to proceed in this situation,
> > where a number of commits that were not related to the intent were
> > included.  There is a difference.
> I tried to get this slowed down until we could get to a concenses,
> I think our mess is as big now as it was before.
> 

Or bigger. I've just discovered this commit reverted stuff that wasn't
part of the bad original MFC commit. Things I MFC'd to 11 before this
revert are now missing changes and the symptoms don't show up until a
module fails to load due to missing symbols.

I guess every change on the stable-11 branch between r330897 and
r331722 needs to be audited to see if MFC'd or changed code has been
unintentionally reverted.

Here's the example I've just run across...

r330897 merged this:

https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=302408=330897

Then I did some MFCing, then r331722 "reverted" this:

https://svnweb.freebsd.org/base/stable/11/sys/dev/spibus/ofw_spibus.c?r1=331506=331722

-- Ian

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


svn commit: r332519 - in stable/11: share/man/man4 sys/conf sys/geom

2018-04-15 Thread Kyle Evans
Author: kevans
Date: Mon Apr 16 00:12:03 2018
New Revision: 332519
URL: https://svnweb.freebsd.org/changeset/base/332519

Log:
  MFC r322318-r322319
  
  r322318:
  Mark geom classes as deprecated.
  
  geom_bsd, geom_mbr and geom_sunlabel have been obsolete since Marcel
  Moolenaar's geom_part was in FreeBSD 7. They haven't been in GENERIC
  since FreeBSD 8. Add warning when used.
  
  geom_vol_ffs has been obsolete since ufs support to geom_label was
  committed in FreeBSD 5. It hasn't been in GENERIC since FreeBSD 5.
  Add warning when used.
  
  geom_fox has been obsolete since gmultipath was committed in FreeBSD 7.
  (no warning added, since this is a very obscure class).
  
  These will all be removed in FreeBSD 12.
  
  r322319:
  Also provide a warning for geom_fox.

Modified:
  stable/11/share/man/man4/geom.4
  stable/11/share/man/man4/geom_fox.4
  stable/11/sys/conf/NOTES
  stable/11/sys/geom/geom_bsd.c
  stable/11/sys/geom/geom_fox.c
  stable/11/sys/geom/geom_mbr.c
  stable/11/sys/geom/geom_sunlabel.c
  stable/11/sys/geom/geom_vol_ffs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/geom.4
==
--- stable/11/share/man/man4/geom.4 Sun Apr 15 21:46:08 2018
(r332518)
+++ stable/11/share/man/man4/geom.4 Mon Apr 16 00:12:03 2018
(r332519)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 20, 2017
+.Dd August 9, 2017
 .Dt GEOM 4
 .Os
 .Sh NAME
@@ -43,17 +43,14 @@
 .Sh SYNOPSIS
 .Cd options GEOM_AES
 .Cd options GEOM_BDE
-.Cd options GEOM_BSD
 .Cd options GEOM_CACHE
 .Cd options GEOM_CONCAT
 .Cd options GEOM_ELI
-.Cd options GEOM_FOX
 .Cd options GEOM_GATE
 .Cd options GEOM_JOURNAL
 .Cd options GEOM_LABEL
 .Cd options GEOM_LINUX_LVM
 .Cd options GEOM_MAP
-.Cd options GEOM_MBR
 .Cd options GEOM_MIRROR
 .Cd options GEOM_MOUNTVER
 .Cd options GEOM_MULTIPATH
@@ -73,10 +70,8 @@
 .Cd options GEOM_RAID3
 .Cd options GEOM_SHSEC
 .Cd options GEOM_STRIPE
-.Cd options GEOM_SUNLABEL
 .Cd options GEOM_UZIP
 .Cd options GEOM_VIRSTOR
-.Cd options GEOM_VOL
 .Cd options GEOM_ZERO
 .Sh DESCRIPTION
 The
@@ -451,6 +446,24 @@ This is unused at this time.
 .It 0x80 Pq Dv G_F_CTLDUMP
 Dump contents of gctl requests.
 .El
+.Sh OBSOLETE OPTIONS
+.Pp
+The following options have been deprecated and will be removed in
+.Fx 12 :
+.Cd GEOM_BSD ,
+.Cd GEOM_FOX ,
+.Cd GEOM_MBR ,
+.Cd GEOM_SUNLABEL ,
+and
+.Cd GEOM_VOL .
+.Pp
+Use
+.Cd GEOM_PART_BSD ,
+.Cd GEOM_MULTIPATH ,
+.Cd GEOM_PART_MBR ,
+.Cd GEOM_PART_VTOC8 ,
+.Cd GEOM_LABEL
+options, respectively, instead.
 .Sh SEE ALSO
 .Xr libgeom 3 ,
 .Xr DECLARE_GEOM_CLASS 9 ,

Modified: stable/11/share/man/man4/geom_fox.4
==
--- stable/11/share/man/man4/geom_fox.4 Sun Apr 15 21:46:08 2018
(r332518)
+++ stable/11/share/man/man4/geom_fox.4 Mon Apr 16 00:12:03 2018
(r332519)
@@ -51,6 +51,8 @@ This driver is obsolete.
 Users are advised to use
 .Xr gmultipath 8
 instead.
+This driver will be removed in
+.Fx 12 .
 .Ef
 .Pp
 The intent of the

Modified: stable/11/sys/conf/NOTES
==
--- stable/11/sys/conf/NOTESSun Apr 15 21:46:08 2018(r332518)
+++ stable/11/sys/conf/NOTESMon Apr 16 00:12:03 2018(r332519)
@@ -147,17 +147,17 @@ options   BOOTHOWTO=RB_MULTIPLE
 
 optionsGEOM_AES# Don't use, use GEOM_BDE
 optionsGEOM_BDE# Disk encryption.
-optionsGEOM_BSD# BSD disklabels
+optionsGEOM_BSD# BSD disklabels (obsolete, gone in 12)
 optionsGEOM_CACHE  # Disk cache.
 optionsGEOM_CONCAT # Disk concatenation.
 optionsGEOM_ELI# Disk encryption.
-optionsGEOM_FOX# Redundant path mitigation
+optionsGEOM_FOX# Redundant path mitigation (obsolete, 
gone in 12)
 optionsGEOM_GATE   # Userland services.
 optionsGEOM_JOURNAL# Journaling.
 optionsGEOM_LABEL  # Providers labelization.
 optionsGEOM_LINUX_LVM  # Linux LVM2 volumes
 optionsGEOM_MAP# Map based partitioning
-optionsGEOM_MBR# DOS/MBR partitioning
+optionsGEOM_MBR# DOS/MBR partitioning (obsolete, gone 
in 12)
 optionsGEOM_MIRROR # Disk mirroring.
 optionsGEOM_MULTIPATH  # Disk multipath
 optionsGEOM_NOP# Test class.
@@ -176,11 +176,11 @@ options   GEOM_RAID   # Soft RAID 
functionality.
 optionsGEOM_RAID3  # RAID3 functionality.
 optionsGEOM_SHSEC  # Shared secret.
 optionsGEOM_STRIPE # Disk striping.
-optionsGEOM_SUNLABEL   # 

svn commit: r332518 - head/usr.sbin/daemon

2018-04-15 Thread Ian Lepore
Author: ian
Date: Sun Apr 15 21:46:08 2018
New Revision: 332518
URL: https://svnweb.freebsd.org/changeset/base/332518

Log:
  Add an option to daemon(8) to specify a delay between restarts of a
  supervised program.  The existing -r option has a hard-coded delay of one
  second.  This change adds a -R option which takes a delay in seconds.  This
  can be used to prevent log spam and rapid restarts, similar to init(8)'s
  behavior of adding a delay between rapid restarts when it's supervising a
  program.

Modified:
  head/usr.sbin/daemon/daemon.8
  head/usr.sbin/daemon/daemon.c

Modified: head/usr.sbin/daemon/daemon.8
==
--- head/usr.sbin/daemon/daemon.8   Sun Apr 15 20:29:37 2018
(r332517)
+++ head/usr.sbin/daemon/daemon.8   Sun Apr 15 21:46:08 2018
(r332518)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 22, 2016
+.Dd April 14, 2018
 .Dt DAEMON 8
 .Os
 .Sh NAME
@@ -44,6 +44,7 @@
 .Op Fl s Ar syslog_priority
 .Op Fl T Ar syslog_tag
 .Op Fl l Ar syslog_facility
+.Op Fl T Ar restart_delay_seconds
 .Ar command arguments ...
 .Sh DESCRIPTION
 The
@@ -114,7 +115,11 @@ regardless of whether the
 .Fl u
 option is used or not.
 .It Fl r
-Supervise and restart the program if it has been terminated.
+Supervise and restart the program after a one-second delay if it has
+been terminated.
+.It Fl R restart_delay_seconds
+Supervise and restart the program after the specified delay
+if it has been terminated.
 .It Fl t Ar title
 Set the title for the daemon process.
 The default is the daemonized invocation.

Modified: head/usr.sbin/daemon/daemon.c
==
--- head/usr.sbin/daemon/daemon.c   Sun Apr 15 20:29:37 2018
(r332517)
+++ head/usr.sbin/daemon/daemon.c   Sun Apr 15 21:46:08 2018
(r332518)
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
dosyslog = 0;
outfn = NULL;
title = NULL;
-   while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:T:")) != -1) {
+   while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:R:T:")) != -1) {
switch (ch) {
case 'c':
nochdir = 0;
@@ -130,6 +130,11 @@ main(int argc, char *argv[])
case 'r':
restart = 1;
break;
+   case 'R':
+   restart = strtol(optarg, , 0);
+   if (p == optarg || restart < 1)
+   errx(6, "invalid restart delay");
+   break;
case 's':
logpri = get_log_mapping(optarg, prioritynames);
if (logpri == -1)
@@ -359,7 +364,7 @@ restart:
goto exit;
}
if (restart && !terminate) {
-   daemon_sleep(1, 0);
+   daemon_sleep(restart, 0);
close(pfd[0]);
pfd[0] = -1;
goto restart;
@@ -558,7 +563,7 @@ usage(void)
"usage: daemon [-cfrS] [-p child_pidfile] [-P supervisor_pidfile]\n"
"  [-u user] [-o output_file] [-t title]\n"
"  [-l syslog_facility] [-s syslog_priority]\n"
-   "  [-T syslog_tag] [-m output_mask]\n"
+   "  [-T syslog_tag] [-m output_mask] [-R 
restart_delay_secs]\n"
"command arguments ...\n");
exit(1);
 }
___
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: r332517 - stable/11/usr.sbin/bhyvectl

2018-04-15 Thread Peter Grehan
Author: grehan
Date: Sun Apr 15 20:29:37 2018
New Revision: 332517
URL: https://svnweb.freebsd.org/changeset/base/332517

Log:
  MFC r330764
Add CR2 get/set support.

Modified:
  stable/11/usr.sbin/bhyvectl/bhyvectl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyvectl/bhyvectl.c
==
--- stable/11/usr.sbin/bhyvectl/bhyvectl.c  Sun Apr 15 20:20:08 2018
(r332516)
+++ stable/11/usr.sbin/bhyvectl/bhyvectl.c  Sun Apr 15 20:29:37 2018
(r332517)
@@ -109,6 +109,8 @@ usage(bool cpu_intel)
"   [--desc-access=]\n"
"   [--set-cr0=]\n"
"   [--get-cr0]\n"
+   "   [--set-cr2=]\n"
+   "   [--get-cr2]\n"
"   [--set-cr3=]\n"
"   [--get-cr3]\n"
"   [--set-cr4=]\n"
@@ -254,7 +256,8 @@ static int create, destroy, get_memmap, get_memseg;
 static int get_intinfo;
 static int get_active_cpus, get_suspended_cpus;
 static uint64_t memsize;
-static int set_cr0, get_cr0, set_cr3, get_cr3, set_cr4, get_cr4;
+static int set_cr0, get_cr0, set_cr2, get_cr2, set_cr3, get_cr3;
+static int set_cr4, get_cr4;
 static int set_efer, get_efer;
 static int set_dr0, get_dr0;
 static int set_dr1, get_dr1;
@@ -551,6 +554,7 @@ enum {
SET_MEM,
SET_EFER,
SET_CR0,
+   SET_CR2,
SET_CR3,
SET_CR4,
SET_DR0,
@@ -662,7 +666,7 @@ cpu_vendor_intel(void)
 static int
 get_all_registers(struct vmctx *ctx, int vcpu)
 {
-   uint64_t cr0, cr3, cr4, dr0, dr1, dr2, dr3, dr6, dr7;
+   uint64_t cr0, cr2, cr3, cr4, dr0, dr1, dr2, dr3, dr6, dr7;
uint64_t rsp, rip, rflags, efer;
uint64_t rax, rbx, rcx, rdx, rsi, rdi, rbp;
uint64_t r8, r9, r10, r11, r12, r13, r14, r15;
@@ -680,6 +684,12 @@ get_all_registers(struct vmctx *ctx, int vcpu)
printf("cr0[%d]\t\t0x%016lx\n", vcpu, cr0);
}
 
+   if (!error && (get_cr2 || get_all)) {
+   error = vm_get_register(ctx, vcpu, VM_REG_GUEST_CR2, );
+   if (error == 0)
+   printf("cr2[%d]\t\t0x%016lx\n", vcpu, cr2);
+   }
+
if (!error && (get_cr3 || get_all)) {
error = vm_get_register(ctx, vcpu, VM_REG_GUEST_CR3, );
if (error == 0)
@@ -1322,6 +1332,7 @@ setup_options(bool cpu_intel)
{ "set-mem",REQ_ARG,0,  SET_MEM },
{ "set-efer",   REQ_ARG,0,  SET_EFER },
{ "set-cr0",REQ_ARG,0,  SET_CR0 },
+   { "set-cr2",REQ_ARG,0,  SET_CR2 },
{ "set-cr3",REQ_ARG,0,  SET_CR3 },
{ "set-cr4",REQ_ARG,0,  SET_CR4 },
{ "set-dr0",REQ_ARG,0,  SET_DR0 },
@@ -1384,6 +1395,7 @@ setup_options(bool cpu_intel)
{ "get-memseg", NO_ARG, _memseg,1 },
{ "get-efer",   NO_ARG, _efer,  1 },
{ "get-cr0",NO_ARG, _cr0,   1 },
+   { "get-cr2",NO_ARG, _cr2,   1 },
{ "get-cr3",NO_ARG, _cr3,   1 },
{ "get-cr4",NO_ARG, _cr4,   1 },
{ "get-dr0",NO_ARG, _dr0,   1 },
@@ -1668,7 +1680,7 @@ main(int argc, char *argv[])
int error, ch, vcpu, ptenum;
vm_paddr_t gpa_pmap;
struct vm_exit vmexit;
-   uint64_t rax, cr0, cr3, cr4, dr0, dr1, dr2, dr3, dr6, dr7;
+   uint64_t rax, cr0, cr2, cr3, cr4, dr0, dr1, dr2, dr3, dr6, dr7;
uint64_t rsp, rip, rflags, efer, pat;
uint64_t eptp, bm, addr, u64, pteval[4], *pte, info[2];
struct vmctx *ctx;
@@ -1708,6 +1720,10 @@ main(int argc, char *argv[])
cr0 = strtoul(optarg, NULL, 0);
set_cr0 = 1;
break;
+   case SET_CR2:
+   cr2 = strtoul(optarg, NULL, 0);
+   set_cr2 = 1;
+   break;
case SET_CR3:
cr3 = strtoul(optarg, NULL, 0);
set_cr3 = 1;
@@ -1870,6 +1886,9 @@ main(int argc, char *argv[])
 
if (!error && set_cr0)
error = vm_set_register(ctx, vcpu, VM_REG_GUEST_CR0, cr0);
+
+   if (!error && set_cr2)
+   error = vm_set_register(ctx, vcpu, VM_REG_GUEST_CR2, cr2);
 
if (!error && set_cr3)
error = vm_set_register(ctx, vcpu, VM_REG_GUEST_CR3, cr3);
___
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: r332516 - stable/11/sys/amd64/vmm

2018-04-15 Thread Peter Grehan
Author: grehan
Date: Sun Apr 15 20:20:08 2018
New Revision: 332516
URL: https://svnweb.freebsd.org/changeset/base/332516

Log:
  MFC r325261
Emulate the "OR reg, r/m" instruction (opcode 0BH).
  
This is needed for the HDA emulation with FreeBSD guests.

Modified:
  stable/11/sys/amd64/vmm/vmm_instruction_emul.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/vmm/vmm_instruction_emul.c
==
--- stable/11/sys/amd64/vmm/vmm_instruction_emul.c  Sun Apr 15 19:23:37 
2018(r332515)
+++ stable/11/sys/amd64/vmm/vmm_instruction_emul.c  Sun Apr 15 20:20:08 
2018(r332516)
@@ -109,6 +109,10 @@ static const struct vie_op one_byte_opcodes[256] = {
.op_byte = 0x0F,
.op_type = VIE_OP_TYPE_TWO_BYTE
},
+   [0x0B] = {
+   .op_byte = 0x0B,
+   .op_type = VIE_OP_TYPE_OR,
+   },
[0x2B] = {
.op_byte = 0x2B,
.op_type = VIE_OP_TYPE_SUB,
@@ -992,12 +996,38 @@ emulate_or(void *vm, int vcpuid, uint64_t gpa, struct 
mem_region_read_t memread, mem_region_write_t memwrite, void *arg)
 {
int error, size;
-   uint64_t val1, result, rflags, rflags2;
+   enum vm_reg_name reg;
+   uint64_t result, rflags, rflags2, val1, val2;
 
size = vie->opsize;
error = EINVAL;
 
switch (vie->op.op_byte) {
+   case 0x0B:
+   /*
+* OR reg (ModRM:reg) and mem (ModRM:r/m) and store the
+* result in reg.
+*
+* 0b/r or r16, r/m16
+* 0b/r or r32, r/m32
+* REX.W + 0b/r or r64, r/m64
+*/
+
+   /* get the first operand */
+   reg = gpr_map[vie->reg];
+   error = vie_read_register(vm, vcpuid, reg, );
+   if (error)
+   break;
+   
+   /* get the second operand */
+   error = memread(vm, vcpuid, gpa, , size, arg);
+   if (error)
+   break;
+
+   /* perform the operation and write the result */
+   result = val1 | val2;
+   error = vie_update_register(vm, vcpuid, reg, result, size);
+   break;
case 0x81:
case 0x83:
/*
___
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: r332515 - head/usr.sbin/cxgbetool

2018-04-15 Thread Navdeep Parhar
Author: np
Date: Sun Apr 15 19:23:37 2018
New Revision: 332515
URL: https://svnweb.freebsd.org/changeset/base/332515

Log:
  Fix typo in cxgbetool.8.

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

Modified: head/usr.sbin/cxgbetool/cxgbetool.8
==
--- head/usr.sbin/cxgbetool/cxgbetool.8 Sun Apr 15 15:23:47 2018
(r332514)
+++ head/usr.sbin/cxgbetool/cxgbetool.8 Sun Apr 15 19:23:37 2018
(r332515)
@@ -562,7 +562,7 @@ Class Rate Limiting.
 .It Sy cl-wrr
 Class Weighted Round Robin.
 .Pp
-.It Sy cl-wrr
+.It Sy ch-rl
 Channel Rate Limiting.
 .El
 .It Sy mode Ar scheduler-mode
___
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: r332512 - head/sys/conf

2018-04-15 Thread Brooks Davis
On Sun, Apr 15, 2018 at 07:28:29PM +0200, Dimitry Andric wrote:
> On 15 Apr 2018, at 17:37, Brooks Davis  wrote:
> > 
> > On Sun, Apr 15, 2018 at 10:33:18AM -0500, Benjamin Kaduk wrote:
> >> On Sun, Apr 15, 2018 at 10:13 AM, Brooks Davis  wrote:
> >> 
> >>> On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
>  Author: brooks
>  Date: Sun Apr 15 15:06:07 2018
>  New Revision: 332512
>  URL: https://svnweb.freebsd.org/changeset/base/332512
>  
>  Log:
>   Remove device cm which was removed in r332490.
> >>> 
> >>> I'm quite confused by the fact that tinderbox didn't trip on this when I
> >>> ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?
> >>> 
> >> 
> >> Given that they would leave around the old object files needed to resolve
> >> stale
> >> references to removed driver components, it seems likely.
> > 
> > The thing is, config should have failed and it always runs in
> > -DNO_CLEAN buildkernel.  I expected the same to hold for tinderbox, but
> > apparently not.
> 
> But were any of the LINT files updated?  I guess not, if you didn't
> remove anything from NOTES.  I think it is likely that config will *not*
> be run again if the LINT files are older than their respective targets?

NOTES was updated because I did remove device arcnet, I just somehow
failed to find the cm(4) entries.  I'll just try to remember to do
-DNO_CLEAN kernel builds for future removals.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r332512 - head/sys/conf

2018-04-15 Thread Dimitry Andric
On 15 Apr 2018, at 17:37, Brooks Davis  wrote:
> 
> On Sun, Apr 15, 2018 at 10:33:18AM -0500, Benjamin Kaduk wrote:
>> On Sun, Apr 15, 2018 at 10:13 AM, Brooks Davis  wrote:
>> 
>>> On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
 Author: brooks
 Date: Sun Apr 15 15:06:07 2018
 New Revision: 332512
 URL: https://svnweb.freebsd.org/changeset/base/332512
 
 Log:
  Remove device cm which was removed in r332490.
>>> 
>>> I'm quite confused by the fact that tinderbox didn't trip on this when I
>>> ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?
>>> 
>> 
>> Given that they would leave around the old object files needed to resolve
>> stale
>> references to removed driver components, it seems likely.
> 
> The thing is, config should have failed and it always runs in
> -DNO_CLEAN buildkernel.  I expected the same to hold for tinderbox, but
> apparently not.

But were any of the LINT files updated?  I guess not, if you didn't
remove anything from NOTES.  I think it is likely that config will *not*
be run again if the LINT files are older than their respective targets?

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r332512 - head/sys/conf

2018-04-15 Thread Brooks Davis
On Sun, Apr 15, 2018 at 10:33:18AM -0500, Benjamin Kaduk wrote:
> On Sun, Apr 15, 2018 at 10:13 AM, Brooks Davis  wrote:
> 
> > On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
> > > Author: brooks
> > > Date: Sun Apr 15 15:06:07 2018
> > > New Revision: 332512
> > > URL: https://svnweb.freebsd.org/changeset/base/332512
> > >
> > > Log:
> > >   Remove device cm which was removed in r332490.
> >
> > I'm quite confused by the fact that tinderbox didn't trip on this when I
> > ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?
> >
> 
> Given that they would leave around the old object files needed to resolve
> stale
> references to removed driver components, it seems likely.

The thing is, config should have failed and it always runs in
-DNO_CLEAN buildkernel.  I expected the same to hold for tinderbox, but
apparently not.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r332512 - head/sys/conf

2018-04-15 Thread Benjamin Kaduk
On Sun, Apr 15, 2018 at 10:13 AM, Brooks Davis  wrote:

> On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
> > Author: brooks
> > Date: Sun Apr 15 15:06:07 2018
> > New Revision: 332512
> > URL: https://svnweb.freebsd.org/changeset/base/332512
> >
> > Log:
> >   Remove device cm which was removed in r332490.
>
> I'm quite confused by the fact that tinderbox didn't trip on this when I
> ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?
>

Given that they would leave around the old object files needed to resolve
stale
references to removed driver components, it seems likely.

-Ben
___
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: r332513 - in stable/11: share/man/man9 sys/net sys/netinet sys/netinet6 sys/netpfil/pf

2018-04-15 Thread Kristof Provost
Author: kp
Date: Sun Apr 15 15:22:28 2018
New Revision: 332513
URL: https://svnweb.freebsd.org/changeset/base/332513

Log:
  MFC r331436:
  
  netpfil: Introduce PFIL_FWD flag
  
  Forwarded packets passed through PFIL_OUT, which made it difficult for
  firewalls to figure out if they were forwarding or producing packets. This in
  turn is an issue for pf for IPv6 fragment handling: it needs to call
  ip6_output() or ip6_forward() to handle the fragments. Figuring out which was
  difficult (and until now, incorrect).
  Having pfil distinguish the two removes an ugly piece of code from pf.
  
  Introduce a new variant of the netpfil callbacks with a flags variable, which
  has PFIL_FWD set for forwarded packets. This allows pf to reliably work out if
  a packet is forwarded.

Modified:
  stable/11/share/man/man9/pfil.9
  stable/11/sys/net/if_bridge.c
  stable/11/sys/net/if_enc.c
  stable/11/sys/net/if_ethersubr.c
  stable/11/sys/net/pfil.c
  stable/11/sys/net/pfil.h
  stable/11/sys/net/pfvar.h
  stable/11/sys/netinet/ip_fastfwd.c
  stable/11/sys/netinet/ip_input.c
  stable/11/sys/netinet/ip_output.c
  stable/11/sys/netinet6/ip6_fastfwd.c
  stable/11/sys/netinet6/ip6_forward.c
  stable/11/sys/netinet6/ip6_input.c
  stable/11/sys/netinet6/ip6_output.c
  stable/11/sys/netpfil/pf/pf.c
  stable/11/sys/netpfil/pf/pf.h
  stable/11/sys/netpfil/pf/pf_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/pfil.9
==
--- stable/11/share/man/man9/pfil.9 Sun Apr 15 15:06:07 2018
(r332512)
+++ stable/11/share/man/man9/pfil.9 Sun Apr 15 15:22:28 2018
(r332513)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 23, 2013
+.Dd April 15, 2018
 .Dt PFIL 9
 .Os
 .Sh NAME
@@ -37,7 +37,9 @@
 .Nm pfil_head_unregister ,
 .Nm pfil_head_get ,
 .Nm pfil_add_hook ,
+.Nm pfil_add_hook_flags ,
 .Nm pfil_remove_hook ,
+.Nm pfil_remove_hook_flags ,
 .Nm pfil_run_hooks ,
 .Nm pfil_rlock ,
 .Nm pfil_runlock ,
@@ -51,6 +53,8 @@
 .In net/pfil.h
 .Bd -literal
 typedef int (*pfil_func_t)(void *arg, struct mbuf **mp, struct ifnet *, int 
dir, struct inpcb);
+.Bd -literal
+typedef int (*pfil_func_flags_t)(void *arg, struct mbuf **mp, struct ifnet *, 
int dir, int flags, struct inpcb);
 .Ft int
 .Fn pfil_head_register "struct pfil_head *head"
 .Ft int
@@ -58,11 +62,15 @@ typedef int (*pfil_func_t)(void *arg, struct mbuf **mp
 .Ft "struct pfil_head *"
 .Fn pfil_head_get "int af" "u_long dlt"
 .Ft void
-.Fn pfil_add_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *"
+.Fn pfil_add_hook "pfil_func_t" "void *arg" "struct pfil_head *"
 .Ft void
-.Fn pfil_remove_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *"
+.Fn pfil_add_hook_flags "pfil_func_flags_t" "void *arg" "int flags" "struct 
pfil_head *"
 .Ft int
-.Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet 
*" "int dir" "struct inpcb *"
+.Fn pfil_remove_hook "pfil_func_t" "void *arg" "struct pfil_head *"
+.Ft int
+.Fn pfil_remove_hook_flags "pfil_func_flags_t" "void *arg" "int flags" "struct 
pfil_head *"
+.Ft int
+.Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet 
*" "int dir" "int flags" "struct inpcb *"
 .Ft void
 .Fn pfil_rlock "struct pfil_head *" "struct rm_priotracker *"
 .Ft void
@@ -116,6 +124,7 @@ with the
 and
 .Fn pfil_remove_hook
 functions, respectively.
+.I
 The head is looked up using the
 .Fn pfil_head_get
 function, which takes the key and data link type that the packet filter
@@ -135,6 +144,10 @@ interface that the packet is traversing, and the direc
 or
 .Dv PFIL_OUT )
 that the packet is traveling.
+The
+.Vt flags
+argument will indicate if an outgoing packet is simply being forwarded with the
+value PFIL_FWD.
 The filter may change which mbuf the
 .Vt "mbuf\ **"
 argument references.

Modified: stable/11/sys/net/if_bridge.c
==
--- stable/11/sys/net/if_bridge.c   Sun Apr 15 15:06:07 2018
(r332512)
+++ stable/11/sys/net/if_bridge.c   Sun Apr 15 15:22:28 2018
(r332513)
@@ -3170,7 +3170,8 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru
if (PFIL_HOOKED(_link_pfil_hook) && V_pfil_ipfw != 0 &&
dir == PFIL_OUT && ifp != NULL) {
 
-   error = pfil_run_hooks(_link_pfil_hook, mp, ifp, dir, NULL);
+   error = pfil_run_hooks(_link_pfil_hook, mp, ifp, dir, 0,
+   NULL);
 
if (*mp == NULL || error != 0) /* packet consumed by filter */
return (error);
@@ -3222,21 +3223,21 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru
 */
if (V_pfil_bridge && dir == PFIL_OUT && bifp != NULL)
error = pfil_run_hooks(_inet_pfil_hook, mp, bifp,
-   dir, NULL);
+   

svn commit: r332514 - head

2018-04-15 Thread Brooks Davis
Author: brooks
Date: Sun Apr 15 15:23:47 2018
New Revision: 332514
URL: https://svnweb.freebsd.org/changeset/base/332514

Log:
  Manpages are .gz files.
  
  Reported by:  trasz

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sun Apr 15 15:22:28 2018(r332513)
+++ head/ObsoleteFiles.inc  Sun Apr 15 15:23:47 2018(r332514)
@@ -40,7 +40,7 @@
 
 # 20180413: remove Arcnet support
 OLD_FILES+=usr/include/net/if_arc.h
-OLD_FILES+=usr/share/man/man4/cm.4
+OLD_FILES+=usr/share/man/man4/cm.4.gz
 # 20180409: remove FDDI support
 OLD_FILES+=usr/include/net/fddi.h
 OLD_FILES+=usr/share/man/man4/fpa.4.gz
___
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: r332493 - stable/11/sys/net

2018-04-15 Thread Brooks Davis
On Sat, Apr 14, 2018 at 08:54:15AM -0400, Ed Maste wrote:
> On 14 April 2018 at 07:31, Magnus Ringman  wrote:
> > Hi Brooks, this MFC missed your r331077
> > (https://reviews.freebsd.org/D14706) thus stable buildkernel currently
> > breaks on missing those two macros.
> 
> Thanks for identifying the missing commit Magnus. I've now merged it in 
> r332502.
> 

Sorry for the breakage and thanks for fixing this!

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r332512 - head/sys/conf

2018-04-15 Thread Brooks Davis
On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
> Author: brooks
> Date: Sun Apr 15 15:06:07 2018
> New Revision: 332512
> URL: https://svnweb.freebsd.org/changeset/base/332512
> 
> Log:
>   Remove device cm which was removed in r332490.

I'm quite confused by the fact that tinderbox didn't trip on this when I
ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?

-- Brooks


signature.asc
Description: PGP signature


svn commit: r332512 - head/sys/conf

2018-04-15 Thread Brooks Davis
Author: brooks
Date: Sun Apr 15 15:06:07 2018
New Revision: 332512
URL: https://svnweb.freebsd.org/changeset/base/332512

Log:
  Remove device cm which was removed in r332490.

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Sun Apr 15 08:44:26 2018(r332511)
+++ head/sys/conf/NOTES Sun Apr 15 15:06:07 2018(r332512)
@@ -2066,11 +2066,6 @@ device   xmphy   # XaQti XMAC II
 
 # Order for ISA devices is important here
 
-device cm
-hint.cm.0.at="isa"
-hint.cm.0.port="0x2e0"
-hint.cm.0.irq="9"
-hint.cm.0.maddr="0xdc000"
 device ep
 device ex
 device fe
___
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"


Financial Market Investor

2018-04-15 Thread Digital Asset Holdings, LLC
Digital Asset Holdings, LLC is an Investment Banking firm, business developer, 
Head of Global credit portfolio, Credit Policy and Strategy. We are in search 
of an eligible business partner with credible business goals and perceptible 
business plan to invest Fifty Million United States Dollars; our mission is to 
promote trade association of public trust and confidence in the financial 
markets we need an associate with good accountability and experienced training 
to handle the amount mentioned for proper investment to generate good 
profitable return. 

 Kindly get back to us to discuss the details of this proposed business 
partnership.
  
Thank you  
 
 Digital Asset Holdings, LLC
96 Spring Street, 7th & 8th Floors
New York, NY 10012
USA
___
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: r332511 - head/usr.sbin/syslogd

2018-04-15 Thread Ed Schouten
Author: ed
Date: Sun Apr 15 08:44:26 2018
New Revision: 332511
URL: https://svnweb.freebsd.org/changeset/base/332511

Log:
  Use proper alphabetic sorting of options.

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

Modified: head/usr.sbin/syslogd/syslogd.8
==
--- head/usr.sbin/syslogd/syslogd.8 Sun Apr 15 08:34:16 2018
(r332510)
+++ head/usr.sbin/syslogd/syslogd.8 Sun Apr 15 08:44:26 2018
(r332511)
@@ -28,7 +28,7 @@
 .\" @(#)syslogd.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd April 9, 2018
+.Dd April 15, 2018
 .Dt SYSLOGD 8
 .Os
 .Sh NAME
@@ -243,20 +243,6 @@ Usually the
 .Dq kern
 facility is reserved for messages read directly from
 .Pa /dev/klog .
-.It Fl O Ar format
-Select the output format of generated log messages.
-The values
-.Ar bsd
-and
-.Ar rfc3164
-are used to generate RFC 3164 log messages.
-The values
-.Ar syslog
-and
-.Ar rfc5424
-are used to generate RFC 5424 log messages,
-having RFC 3339 timestamps with microsecond precision.
-The default is to generate RFC 3164 log messages.
 .It Fl m Ar mark_interval
 Select the number of minutes between
 .Dq mark
@@ -274,6 +260,20 @@ This option inherits
 .Fl s .
 .It Fl n
 Disable DNS query for every request.
+.It Fl O Ar format
+Select the output format of generated log messages.
+The values
+.Ar bsd
+and
+.Ar rfc3164
+are used to generate RFC 3164 log messages.
+The values
+.Ar syslog
+and
+.Ar rfc5424
+are used to generate RFC 5424 log messages,
+having RFC 3339 timestamps with microsecond precision.
+The default is to generate RFC 3164 log messages.
 .It Fl o
 Prefix kernel messages with the full kernel boot file as determined by
 .Xr getbootfile 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: r332510 - in head: usr.bin/wall usr.sbin/syslogd

2018-04-15 Thread Ed Schouten
Author: ed
Date: Sun Apr 15 08:34:16 2018
New Revision: 332510
URL: https://svnweb.freebsd.org/changeset/base/332510

Log:
  Add RFC 5424 syslog message output to syslogd.
  
  - Move all of the code responsible for transmitting log messages into a
separate function, fprintlog_write().
  - Instead of manually modifying a list of iovecs, add a structure
iovlist with some helper functions.
  - Alter the F_FORW (UDP message forwarding) case to also use iovecs like
the other cases. Use sendmsg() instead of sendto().
  - In the case of F_FORW, truncate the message to a size dependent on the
address family (AF_INET, AF_INET6), as proposed by RFC 5426.
  - Move all traditional message formatting into fprintlog_bsd(). Get rid
of some of the string copying and snprintf()'ing. Simply emit more
iovecs to get the job done.
  - Increase ttymsg()'s limit of 7 iovecs to 32. Add a definition for this
limit, so it can be reused by iovlist.
  - Add fprintlog_rfc5424() to emit RFC 5424 formatted log entries.
  - Add a "-O" command line option to enable RFC 5424 formatting. It would
have been nicer if we supported "-o rfc5424", just like on NetBSD.
Unfortunately, the "-o" flag is already used for a different purpose
on FreeBSD.
  - Don't truncate hostnames in the RFC 5424 case, as suggested by that
specific RFC.
  
  For people interested in using this, this feature can be enabled by
  adding the following line to /etc/rc.conf:
  
syslogd_flags="-s -O rfc5424"
  
  Differential Revision:https://reviews.freebsd.org/D15011

Modified:
  head/usr.bin/wall/ttymsg.c
  head/usr.bin/wall/ttymsg.h
  head/usr.sbin/syslogd/syslogd.8
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.bin/wall/ttymsg.c
==
--- head/usr.bin/wall/ttymsg.c  Sat Apr 14 22:14:18 2018(r332509)
+++ head/usr.bin/wall/ttymsg.c  Sun Apr 15 08:34:16 2018(r332510)
@@ -61,7 +61,7 @@ static const char sccsid[] = "@(#)ttymsg.c8.2 (Berkel
 const char *
 ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout)
 {
-   struct iovec localiov[7];
+   struct iovec localiov[TTYMSG_IOV_MAX];
ssize_t left, wret;
int cnt, fd;
char device[MAXNAMLEN] = _PATH_DEV;

Modified: head/usr.bin/wall/ttymsg.h
==
--- head/usr.bin/wall/ttymsg.h  Sat Apr 14 22:14:18 2018(r332509)
+++ head/usr.bin/wall/ttymsg.h  Sun Apr 15 08:34:16 2018(r332510)
@@ -1,3 +1,5 @@
 /* $FreeBSD$ */
 
+#defineTTYMSG_IOV_MAX  32
+
 const char *ttymsg(struct iovec *, int, const char *, int);

Modified: head/usr.sbin/syslogd/syslogd.8
==
--- head/usr.sbin/syslogd/syslogd.8 Sat Apr 14 22:14:18 2018
(r332509)
+++ head/usr.sbin/syslogd/syslogd.8 Sun Apr 15 08:34:16 2018
(r332510)
@@ -28,7 +28,7 @@
 .\" @(#)syslogd.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd November 28, 2017
+.Dd April 9, 2018
 .Dt SYSLOGD 8
 .Os
 .Sh NAME
@@ -42,6 +42,7 @@
 .Op Fl f Ar config_file
 .Op Fl l Oo Ar mode Ns \&: Oc Ns Ar path
 .Op Fl m Ar mark_interval
+.Op Fl O Ar format
 .Op Fl P Ar pid_file
 .Op Fl p Ar log_socket
 .Op Fl S Ar logpriv_socket
@@ -242,6 +243,20 @@ Usually the
 .Dq kern
 facility is reserved for messages read directly from
 .Pa /dev/klog .
+.It Fl O Ar format
+Select the output format of generated log messages.
+The values
+.Ar bsd
+and
+.Ar rfc3164
+are used to generate RFC 3164 log messages.
+The values
+.Ar syslog
+and
+.Ar rfc5424
+are used to generate RFC 5424 log messages,
+having RFC 3339 timestamps with microsecond precision.
+The default is to generate RFC 3164 log messages.
 .It Fl m Ar mark_interval
 Select the number of minutes between
 .Dq mark

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Sat Apr 14 22:14:18 2018
(r332509)
+++ head/usr.sbin/syslogd/syslogd.c Sun Apr 15 08:34:16 2018
(r332510)
@@ -136,6 +136,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -367,9 +368,12 @@ static int KeepKernFac;/* Keep remotely logged kernel
 static int needdofsync = 0; /* Are any file(s) waiting to be fsynced? */
 static struct pidfh *pfh;
 static int sigpipe[2]; /* Pipe to catch a signal during select(). */
+static boolRFC3164OutputFormat = true; /* Use legacy format by default. */
 
 static volatile sig_atomic_t MarkSet, WantDie, WantInitialize, WantReapchild;
 
+struct iovlist;
+
 static int allowaddr(char *);
 static int addfile(struct filed *);
 static int addpeer(struct peer *);
@@ -386,6 +390,7 @@ static void dofsync(void);
 static voiddomark(int);
 static voidfprintlog_first(struct