svn commit: r307129 - stable/10/sys/cam/scsi

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:50:47 2016
New Revision: 307129
URL: https://svnweb.freebsd.org/changeset/base/307129

Log:
  MFC 306699: Do not retry on some security sense codes.

Modified:
  stable/10/sys/cam/scsi/scsi_all.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_all.c
==
--- stable/10/sys/cam/scsi/scsi_all.c   Wed Oct 12 05:50:13 2016
(r307128)
+++ stable/10/sys/cam/scsi/scsi_all.c   Wed Oct 12 05:50:47 2016
(r307129)
@@ -3191,10 +3191,10 @@ static struct asc_table_entry asc_table[
{ SST(0x74, 0x6F, SS_RDEF,  /* XXX TBD */
"External data encryption control error") },
/* DT   R M E  V  */
-   { SST(0x74, 0x71, SS_RDEF,  /* XXX TBD */
+   { SST(0x74, 0x71, SS_FATAL | EACCES,
"Logical unit access not authorized") },
/* D  */
-   { SST(0x74, 0x79, SS_RDEF,  /* XXX TBD */
+   { SST(0x74, 0x79, SS_FATAL | EACCES,
"Security conflict in translated device") }
 };
 
___
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: r307128 - stable/11/sys/cam/scsi

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:50:13 2016
New Revision: 307128
URL: https://svnweb.freebsd.org/changeset/base/307128

Log:
  MFC 306699: Do not retry on some security sense codes.

Modified:
  stable/11/sys/cam/scsi/scsi_all.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_all.c
==
--- stable/11/sys/cam/scsi/scsi_all.c   Wed Oct 12 05:47:06 2016
(r307127)
+++ stable/11/sys/cam/scsi/scsi_all.c   Wed Oct 12 05:50:13 2016
(r307128)
@@ -3192,10 +3192,10 @@ static struct asc_table_entry asc_table[
{ SST(0x74, 0x6F, SS_RDEF,  /* XXX TBD */
"External data encryption control error") },
/* DT   R M E  V  */
-   { SST(0x74, 0x71, SS_RDEF,  /* XXX TBD */
+   { SST(0x74, 0x71, SS_FATAL | EACCES,
"Logical unit access not authorized") },
/* D  */
-   { SST(0x74, 0x79, SS_RDEF,  /* XXX TBD */
+   { SST(0x74, 0x79, SS_FATAL | EACCES,
"Security conflict in translated device") }
 };
 
___
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: r307127 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:47:06 2016
New Revision: 307127
URL: https://svnweb.freebsd.org/changeset/base/307127

Log:
  MFC r305224: MFV r304158:
  7136 ESC_VDEV_REMOVE_AUX ought to always include vdev information
  
  7115 6922 generates ESC_ZFS_VDEV_REMOVE_AUX a bit too often
  
  illumos/illumos-gate@b72b6bb10ad55121a1b352c6f68ebdc8e20c9086
  
https://github.com/illumos/illumos-gate/commit/b72b6bb10ad55121a1b352c6f68ebdc8e
  20c9086
  
  https://www.illumos.org/issues/7136
6922 added ESC_ZFS_VDEV_REMOVE_AUX and ESC_ZFS_VDEV_REMOVE_DEV sysevents
whenever an aux device gets removed from a pool. However, those sysevents 
will
be created without the vdev_guid and vdev_path fields. It would be better to
always populate those fields.
  
  https://www.illumos.org/issues/7115
The addition of spa_event_notify in vdev removal code (see #6922) causes 
event
  s
to be generated even if the spare failed to be removed with EBUSY.
  
  Reviewed by: George Wilson 
  Reviewed by: Josef 'Jeff' Sipek 
  Approved by: Robert Mustacchi 
  Author: Alan Somers 

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

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Wed Oct 
12 05:46:21 2016(r307126)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Wed Oct 
12 05:47:06 2016(r307127)
@@ -152,6 +152,8 @@ const zio_taskq_info_t zio_taskqs[ZIO_TY
{ ZTI_ONE,  ZTI_NULL,   ZTI_ONE,ZTI_NULL }, /* IOCTL */
 };
 
+static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, const char *name);
+static void spa_event_post(sysevent_t *ev);
 static void spa_sync_version(void *arg, dmu_tx_t *tx);
 static void spa_sync_props(void *arg, dmu_tx_t *tx);
 static boolean_t spa_has_active_shared_spare(spa_t *spa);
@@ -5645,6 +5647,7 @@ int
 spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
 {
vdev_t *vd;
+   sysevent_t *ev = NULL;
metaslab_group_t *mg;
nvlist_t **spares, **l2cache, *nv;
uint64_t txg = 0;
@@ -5668,6 +5671,9 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
 * in this pool.
 */
if (vd == NULL || unspare) {
+   if (vd == NULL)
+   vd = spa_lookup_by_guid(spa, guid, B_TRUE);
+   ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
spa_vdev_remove_aux(spa->spa_spares.sav_config,
ZPOOL_CONFIG_SPARES, spares, nspares, nv);
spa_load_spares(spa);
@@ -5675,7 +5681,6 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
} else {
error = SET_ERROR(EBUSY);
}
-   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (spa->spa_l2cache.sav_vdevs != NULL &&
nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, , ) == 0 &&
@@ -5683,11 +5688,12 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
/*
 * Cache devices can always be removed.
 */
+   vd = spa_lookup_by_guid(spa, guid, B_TRUE);
+   ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
spa_vdev_remove_aux(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
spa_load_l2cache(spa);
spa->spa_l2cache.sav_sync = B_TRUE;
-   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (vd != NULL && vd->vdev_islog) {
ASSERT(!locked);
ASSERT(vd == vd->vdev_top);
@@ -5724,9 +5730,9 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
/*
 * Clean up the vdev namespace.
 */
+   ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
spa_vdev_remove_from_namespace(spa, vd);
 
-   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
} else if (vd != NULL) {
/*
 * Normal vdevs cannot be removed (yet).
@@ -5742,6 +5748,9 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
if (!locked)
error = spa_vdev_exit(spa, NULL, txg, error);
 
+   if (ev)
+   spa_event_post(ev);
+
return (error);
 }
 
@@ -7019,24 +7028,17 @@ spa_has_active_shared_spare(spa_t *spa)
return (B_FALSE);
 }
 
-/*
- * Post a sysevent corresponding to the given event.  The 'name' must be one of
- * the event definitions in sys/sysevent/eventdefs.h.  The payload will be
- * filled in from the spa and 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:46:21 2016
New Revision: 307126
URL: https://svnweb.freebsd.org/changeset/base/307126

Log:
  MFC r305222: MFV r302993: 7104 increase indirect block size
  
  illumos/illumos-gate@4b5c8e93cab28d3c65ba9d407fd8f46e3be1db1c
  
https://github.com/illumos/illumos-gate/commit/4b5c8e93cab28d3c65ba9d407fd8f46e3
  be1db1c
  
  https://www.illumos.org/issues/7104
The current default indirect block size is 16KB. We can improve
performance by increasing it to 128KB. This is especially helpful for
any workload that needs to read most of the metadata, e.g.
scrub/resilver, file deletion, filesystem deletion, and zfs send.
We also need to fix a few space estimation errors to make the tests
pass.
  
  Reviewed by: George Wilson 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Dan McDonald 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

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

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c   
Wed Oct 12 05:45:40 2016(r307125)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c   
Wed Oct 12 05:46:21 2016(r307126)
@@ -791,11 +791,17 @@ dmu_objset_create_impl(spa_t *spa, dsl_d
 
/*
 * Determine the number of levels necessary for the meta-dnode
-* to contain DN_MAX_OBJECT dnodes.
+* to contain DN_MAX_OBJECT dnodes.  Note that in order to
+* ensure that we do not overflow 64 bits, there has to be
+* a nlevels that gives us a number of blocks > DN_MAX_OBJECT
+* but < 2^64.  Therefore,
+* (mdn->dn_indblkshift - SPA_BLKPTRSHIFT) (10) must be
+* less than (64 - log2(DN_MAX_OBJECT)) (16).
 */
-   while ((uint64_t)mdn->dn_nblkptr << (mdn->dn_datablkshift +
+   while ((uint64_t)mdn->dn_nblkptr <<
+   (mdn->dn_datablkshift - DNODE_SHIFT +
(levels - 1) * (mdn->dn_indblkshift - SPA_BLKPTRSHIFT)) <
-   DN_MAX_OBJECT * sizeof (dnode_phys_t))
+   DN_MAX_OBJECT)
levels++;
 
mdn->dn_next_nlevels[tx->tx_txg & TXG_MASK] =

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Oct 
12 05:45:40 2016(r307125)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Oct 
12 05:46:21 2016(r307126)
@@ -411,12 +411,20 @@ zfs_deadman_init()
  * it is possible to run the pool completely out of space, causing it to
  * be permanently read-only.
  *
+ * Note that on very small pools, the slop space will be larger than
+ * 3.2%, in an effort to have it be at least spa_min_slop (128MB),
+ * but we never allow it to be more than half the pool size.
+ *
  * See also the comments in zfs_space_check_t.
  */
 int spa_slop_shift = 5;
 SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_slop_shift, CTLFLAG_RWTUN,
 _slop_shift, 0,
 "Shift value of reserved space (1/(2^spa_slop_shift)).");
+uint64_t spa_min_slop = 128 * 1024 * 1024;
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, spa_min_slop, CTLFLAG_RWTUN,
+_min_slop, 0,
+"Minimal value of reserved space");
 
 /*
  * ==
@@ -1723,14 +1731,16 @@ spa_get_asize(spa_t *spa, uint64_t lsize
 
 /*
  * Return the amount of slop space in bytes.  It is 1/32 of the pool (3.2%),
- * or at least 32MB.
+ * or at least 128MB, unless that would cause it to be more than half the
+ * pool size.
  *
  * See the comment above spa_slop_shift for details.
  */
 uint64_t
-spa_get_slop_space(spa_t *spa) {
+spa_get_slop_space(spa_t *spa)
+{
uint64_t space = spa_get_dspace(spa);
-   return (MAX(space >> spa_slop_shift, SPA_MINDEVSIZE >> 1));
+   return (MAX(space >> spa_slop_shift, MIN(space >> 1, spa_min_slop)));
 }
 
 uint64_t

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
Wed Oct 12 05:45:40 2016(r307125)
+++ 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:45:40 2016
New Revision: 307125
URL: https://svnweb.freebsd.org/changeset/base/307125

Log:
  MFC r305221: MFV r302992:
  7071 lzc_snapshot does not fill in errlist on ENOENT
  
  illumos/illumos-gate@25f7d993adbfb3452ac4625b3791670746d35ae3
  
https://github.com/illumos/illumos-gate/commit/25f7d993adbfb3452ac4625b379167074
  6d35ae3
  
  https://www.illumos.org/issues/7071
upstream
DLPX-40482 lzc_snapshot does not fill in errlist on ENOENT
  
  Reviewed by: Igor Kozhukhov 
  Reviewed by: George Wilson 
  Reviewed by: Dan Kimmel 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

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

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Wed Oct 12 05:44:54 2016(r307124)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Wed Oct 12 05:45:40 2016(r307125)
@@ -499,6 +499,14 @@ zfs_secpolicy_write_perms(const char *na
dsl_dataset_t *ds;
dsl_pool_t *dp;
 
+   /*
+* First do a quick check for root in the global zone, which
+* is allowed to do all write_perms.  This ensures that zfs_ioc_*
+* will get to handle nonexistent datasets.
+*/
+   if (INGLOBALZONE(curthread) && secpolicy_zfs(cr) == 0)
+   return (0);
+
error = dsl_pool_hold(name, FTAG, );
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: r307124 - in stable/10: cddl/contrib/opensolaris/lib/libnvpair sys/cddl/contrib/opensolaris/common/nvpair

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:44:54 2016
New Revision: 307124
URL: https://svnweb.freebsd.org/changeset/base/307124

Log:
  MFC r305211: MFV r302662: 6447 handful of nvpair cleanups
  
  illumos/illumos-gate@759e89be359f2af635e4122d147df56bce948773
  
https://github.com/illumos/illumos-gate/commit/759e89be359f2af635e4122d147df56bc
  e948773
  
  https://www.illumos.org/issues/6447
I got a patch from someone who uses nvpair code outside of illumos. It 
fixes a
couple of gcc warnings/bugs for him.
   1. silence uninitialized use warnings
   2. add parentheses around assignment used as truth value
   3. fix printf format specifier (ll is for integers only)
   4. strstr, strspn, strcspn, and strcmp are declared in string.h, not
  strings.h.
   5. avoid scanning integer into boolean variable
  
  Reviewed by: Josef 'Jeff' Sipek 
  Reviewed by: Andy Stormont 
  Reviewed by: Garrett D'Amore 
  Approved by: Robert Mustacchi 
  Author: Steve Dougherty 

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
  stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.cWed Oct 
12 05:44:12 2016(r307123)
+++ stable/10/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.cWed Oct 
12 05:44:54 2016(r307124)
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include "libnvpair.h"
@@ -1228,7 +1228,8 @@ nvpair_value_match_regex(nvpair_t *nvp, 
break;
}
case DATA_TYPE_BOOLEAN_VALUE: {
-   boolean_t val, val_arg;
+   int32_t val_arg;
+   boolean_t val;
 
/* scanf boolean_t from value and check for match */
sr = sscanf(value, "%"SCNi32, _arg);
@@ -1239,7 +1240,8 @@ nvpair_value_match_regex(nvpair_t *nvp, 
break;
}
case DATA_TYPE_BOOLEAN_ARRAY: {
-   boolean_t *val_array, val_arg;
+   boolean_t *val_array;
+   int32_t val_arg;
 
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi32, _arg);

Modified: 
stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
==
--- stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c   
Wed Oct 12 05:44:12 2016(r307123)
+++ stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c   
Wed Oct 12 05:44:54 2016(r307124)
@@ -1629,6 +1629,8 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nv
if ((nvl == NULL) || (name == NULL))
return (EINVAL);
 
+   sepp = NULL;
+   idx = 0;
/* step through components of name */
for (np = name; np && *np; np = sepp) {
/* ensure unique names */
@@ -2386,7 +2388,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp,
 */
nv_priv_init(, nva, 0);
 
-   if (err = nvlist_size(nvl, _size, encoding))
+   if ((err = nvlist_size(nvl, _size, encoding)))
return (err);
 
if ((buf = nv_mem_zalloc(, alloc_size)) == NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:44:12 2016
New Revision: 307123
URL: https://svnweb.freebsd.org/changeset/base/307123

Log:
  MFC r305210: MFV r302661:
  7082 bptree_iterate() passes wrong args to zfs_dbgmsg()
  
  illumos/illumos-gate@10e67aa0db0823d5464aafdd681f3c966155c68e
  
https://github.com/illumos/illumos-gate/commit/10e67aa0db0823d5464aafdd681f3c966
  155c68e
  
  https://www.illumos.org/issues/7082
upstream
DLPX-40542 bptree_iterate() passes wrong args to zfs_dbgmsg()
  
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

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

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c   Wed Oct 
12 05:43:25 2016(r307122)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c   Wed Oct 
12 05:44:12 2016(r307123)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
 
@@ -220,9 +220,10 @@ bptree_iterate(objset_t *os, uint64_t ob
 
if (zfs_free_leak_on_eio)
flags |= TRAVERSE_HARD;
-   zfs_dbgmsg("bptree index %d: traversing from min_txg=%lld "
+   zfs_dbgmsg("bptree index %lld: traversing from min_txg=%lld "
"bookmark %lld/%lld/%lld/%lld",
-   i, (longlong_t)bte.be_birth_txg,
+   (longlong_t)i,
+   (longlong_t)bte.be_birth_txg,
(longlong_t)bte.be_zb.zb_objset,
(longlong_t)bte.be_zb.zb_object,
(longlong_t)bte.be_zb.zb_level,
___
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: r307122 - in stable/10: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/...

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:43:25 2016
New Revision: 307122
URL: https://svnweb.freebsd.org/changeset/base/307122

Log:
  MFC r305209: MFV r302660: 6314 buffer overflow in dsl_dataset_name
  
  illumos/illumos-gate@9adfa60d484ce2435f5af77cc99dcd4e692b6660
  
https://github.com/illumos/illumos-gate/commit/9adfa60d484ce2435f5af77cc99dcd4e6
  92b6660
  
  https://www.illumos.org/issues/6314
Callers of dsl_dataset_name pass a buffer of size ZFS_MAXNAMELEN, but
dsl_dataset_name copies the datasets' name PLUS the snapshot name to it,
resulting in a max of 2 * ZFS_MAXNAMELEN + '@'.
  
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/10/cddl/contrib/opensolaris/cmd/zhack/zhack.c
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
  stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.cWed Oct 12 05:42:00 
2016(r307121)
+++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.cWed Oct 12 05:43:25 
2016(r307122)
@@ -60,7 +60,6 @@
 #include 
 #include 
 #include 
-#undef ZFS_MAXNAMELEN
 #undef verify
 #include 
 
@@ -1946,7 +1945,7 @@ dump_dir(objset_t *os)
uint64_t refdbytes, usedobjs, scratch;
char numbuf[32];
char blkbuf[BP_SPRINTF_LEN + 20];
-   char osname[MAXNAMELEN];
+   char osname[ZFS_MAX_DATASET_NAME_LEN];
char *type = "UNKNOWN";
int verbosity = dump_opt['d'];
int print_header = 1;
@@ -3483,7 +3482,7 @@ find_zpool(char **target, nvlist_t **con
nvlist_t *match = NULL;
char *name = NULL;
char *sepp = NULL;
-   char sep;
+   char sep = '\0';
int count = 0;
importargs_t args = { 0 };
 

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Wed Oct 12 
05:42:00 2016(r307121)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Wed Oct 12 
05:43:25 2016(r307122)
@@ -1509,7 +1509,7 @@ get_callback(zfs_handle_t *zhp, void *da

svn commit: r307121 - in stable/10/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:42:00 2016
New Revision: 307121
URL: https://svnweb.freebsd.org/changeset/base/307121

Log:
  MFC r305206: MFV r302658:
  6872 zfs libraries should not allow uninitialized variables
  
  illumos/illumos-gate@f83b46baf98d276f5f84fa84c8b461f412ac1f5e
  
https://github.com/illumos/illumos-gate/commit/f83b46baf98d276f5f84fa84c8b461f41
  2ac1f5e
  
  https://www.illumos.org/issues/6872
We compile the zfs libraries with -Wno-uninitialized. We should remove
this. Change makefiles, fix new warnings, fix pbchk errors.
  
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Yuri Pankov 
  Approved by: Robert Mustacchi 
  Author: Paul Dagnelie 

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c   Wed Oct 12 
05:41:10 2016(r307120)
+++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c   Wed Oct 12 
05:42:00 2016(r307121)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
  * Copyright 2016 Igor Kozhukhov .
  */
 
@@ -597,7 +597,6 @@ get_replication(nvlist_t *nvroot, boolea
verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
, ) == 0);
 
-   lastrep.zprl_type = NULL;
for (t = 0; t < toplevels; t++) {
uint64_t is_log = B_FALSE;
 

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Oct 12 05:41:10 2016(r307120)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Oct 12 05:42:00 2016(r307121)
@@ -1564,7 +1564,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvl
libzfs_handle_t *hdl = zhp->zfs_hdl;
nvlist_t *nvl;
int nvl_len;
-   int added_resv;
+   int added_resv = 0;
 
(void) snprintf(errbuf, sizeof (errbuf),
dgettext(TEXT_DOMAIN, "cannot set property for '%s'"),
@@ -3195,7 +3195,7 @@ zfs_create_ancestors(libzfs_handle_t *hd
 {
int prefix;
char *path_copy;
-   int rc;
+   int rc = 0;
 
if (check_parents(hdl, path, NULL, B_TRUE, ) != 0)
return (-1);
@@ -3837,7 +3837,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_hand
rollback_data_t cb = { 0 };
int err;
boolean_t restore_resv = 0;
-   uint64_t old_volsize, new_volsize;
+   uint64_t old_volsize = 0, new_volsize;
zfs_prop_t resv_prop;
 
assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM ||
@@ -4054,6 +4054,7 @@ zfs_rename(zfs_handle_t *zhp, const char
"child dataset with inherited mountpoint is used "
"in a non-global zone"));
(void) zfs_error(hdl, EZFS_ZONED, errbuf);
+   ret = -1;
goto error;
}
 

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Wed Oct 12 05:41:10 2016(r307120)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Wed Oct 12 05:42:00 2016(r307121)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
  * Copyright 2015 RackTop Systems.
  * Copyright 2016 Nexenta Systems, Inc.
  */
@@ -440,12 +440,12 @@ get_configs(libzfs_handle_t *hdl, pool_l
pool_entry_t *pe;
vdev_entry_t *ve;
config_entry_t *ce;
-   nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot;
+   nvlist_t *ret = NULL, *config = NULL, *tmp = NULL, *nvtop, *nvroot;
nvlist_t **spares, **l2cache;
uint_t i, nspares, nl2cache;
boolean_t config_seen;
uint64_t best_txg;
-   char *name, *hostname;
+   char *name, *hostname = NULL;
uint64_t 

svn commit: r307120 - in stable/10/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:41:10 2016
New Revision: 307120
URL: https://svnweb.freebsd.org/changeset/base/307120

Log:
  MFC r305205: MFV r302657:
  4521 zfstest is trying to execute evil "zfs unmount -a"
  
  illumos/illumos-gate@8808ac5dae118369991f158b6ab736cb2691ecde
  
https://github.com/illumos/illumos-gate/commit/8808ac5dae118369991f158b6ab736cb2
  691ecde
  
  https://www.illumos.org/issues/4521
zfstest is trying to execute evil "zfs unmount -a", which fails 
(fortunately,
as it would otherwise leave me with my ~ missing):
03:44:11.86 cannot unmount '/export/home/yuri': Device busy cannot unmount 
'/
export/home': Device busy
03:44:11.86 ERROR: /usr/sbin/zfs unmount -a exited 1
This affects, at least, zfs_mount_009_neg and zfs_mount_all_001_pos, both
failing on that step. The pool containing the /export/home hierarchy is
included in KEEP variable, but it doesn't seem to affect anything here.
  
  Reviewed by: Andriy Gapon 
  Reviewed by: Dan McDonald 
  Reviewed by: Matthew Ahrens 
  Reviewed by: John Kennedy 
  Approved by: Robert Mustacchi 
  Author: Yuri Pankov 

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Wed Oct 12 
05:39:29 2016(r307119)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Wed Oct 12 
05:41:10 2016(r307120)
@@ -27,9 +27,9 @@
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright (c) 2012 Martin Matuska . All rights reserved.
  * Copyright (c) 2013 Steven Hartland.  All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2016 Igor Kozhukhov .
+ * Copyright 2016 Nexenta Systems, Inc.
  */
 
 #include 
@@ -6469,6 +6469,15 @@ unshare_unmount(int op, int argc, char *
continue;
}
 
+   /*
+* Ignore datasets that are excluded/restricted by
+* parent pool name.
+*/
+   if (zpool_skip_pool(zfs_get_pool_name(zhp))) {
+   zfs_close(zhp);
+   continue;
+   }
+
switch (op) {
case OP_SHARE:
verify(zfs_prop_get(zhp, ZFS_PROP_SHARENFS,

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Wed Oct 
12 05:39:29 2016(r307119)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Wed Oct 
12 05:41:10 2016(r307120)
@@ -26,8 +26,8 @@
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 Martin Matuska . All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Nexenta Systems, Inc.
  */
 
 #ifndef_LIBZFS_H
@@ -221,6 +221,7 @@ extern void zpool_free_handles(libzfs_ha
  */
 typedef int (*zpool_iter_f)(zpool_handle_t *, void *);
 extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *);
+extern boolean_t zpool_skip_pool(const char *);
 
 /*
  * Functions to create and destroy pools
@@ -411,6 +412,7 @@ extern void zfs_close(zfs_handle_t *);
 extern zfs_type_t zfs_get_type(const zfs_handle_t *);
 extern const char *zfs_get_name(const zfs_handle_t *);
 extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *);
+extern const char *zfs_get_pool_name(const zfs_handle_t *);
 
 /*
  * Property management functions.  Some functions are shared with the kernel,

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
Wed Oct 12 05:39:29 2016(r307119)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
Wed Oct 12 05:41:10 2016(r307120)
@@ -27,6 +27,7 @@
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 

svn commit: r307119 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:39:29 2016
New Revision: 307119
URL: https://svnweb.freebsd.org/changeset/base/307119

Log:
  MFC r305203: MFV r302655: 6873 zfs_destroy_snaps_nvl leaks errlist
  
  illumos/illumos-gate@4cde22c2ffb907ca39d2ebd512812f7e5168
  
https://github.com/illumos/illumos-gate/commit/4cde22c2ffb907ca39d2ebd512812
  f7e5168
  
  https://www.illumos.org/issues/6873
lzc_destroy_snaps() returns an nvlist in errlist.
zfs_destroy_snaps_nvl() should nvlist_free() it before returning.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Approved by: Dan McDonald 
  Author: Chris Williamson 

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

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Oct 12 05:38:44 2016(r307118)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Oct 12 05:39:29 2016(r307119)
@@ -3449,12 +3449,14 @@ int
 zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
 {
int ret;
-   nvlist_t *errlist;
+   nvlist_t *errlist = NULL;
 
ret = lzc_destroy_snaps(snaps, defer, );
 
-   if (ret == 0)
+   if (ret == 0) {
+   nvlist_free(errlist);
return (0);
+   }
 
if (nvlist_empty(errlist)) {
char errbuf[1024];
@@ -3482,6 +3484,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *h
}
}
 
+   nvlist_free(errlist);
return (ret);
 }
 
___
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: r307118 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:38:44 2016
New Revision: 307118
URL: https://svnweb.freebsd.org/changeset/base/307118

Log:
  MFC r305202: MFV r302654:
  6879 incorrect endianness swap for drr_spill.drr_length in libzfs_sendrecv.c
  
  illumos/illumos-gate@20fea7a47472aceb64d3ed48cc2a3ea268bc4795
  
https://github.com/illumos/illumos-gate/commit/20fea7a47472aceb64d3ed48cc2a3ea26
  8bc4795
  
  https://www.illumos.org/issues/6879
In libzfs_sendrecv, there's a typo:
case DRR_SPILL:
if (byteswap) {
drr->drr_u.drr_write.drr_length =
BSWAP_64(drr->drr_u.drr_spill.drr_length);
}
Instead of drr_write.drr_length, we should be assigning the result of the
byteswap to drr_spill.drr_length.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Approved by: Robert Mustacchi 
  Author: Dan Kimmel 

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

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Oct 12 05:37:54 2016(r307117)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Oct 12 05:38:44 2016(r307118)
@@ -2968,7 +2968,7 @@ recv_skip(libzfs_handle_t *hdl, int fd, 
break;
case DRR_SPILL:
if (byteswap) {
-   drr->drr_u.drr_write.drr_length =
+   drr->drr_u.drr_spill.drr_length =
BSWAP_64(drr->drr_u.drr_spill.drr_length);
}
(void) recv_read(hdl, fd, 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: r307117 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:37:54 2016
New Revision: 307117
URL: https://svnweb.freebsd.org/changeset/base/307117

Log:
  MFC r305201: MFV r302653:
  6111 zfs send should ignore datasets created after the ending snapshot
  
  illumos/illumos-gate@4a20c933b148de8a1c1d3538391c64284e636653
  
https://github.com/illumos/illumos-gate/commit/4a20c933b148de8a1c1d3538391c64284
  e636653
  
  https://www.illumos.org/issues/6111
If you create a zfs child folder, zfs send returns an error when a recursive
incremental send is done between two snapshots made prior to the folder
creation.
The problem can be reproduced with the following steps.
root@zfs:/# zfs create pool/test
root@zfs:/# zfs snapshot pool/test@snap1
root@zfs:/# zfs snapshot pool/test@snap2
root@zfs:/# zfs create pool/test/child
root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap2 > /dev/null
WARNING: could not send pool/test/child@snap2: does not exist
WARNING: could not send pool/test/child@snap2: does not exist
root@zfs:/# echo $?
1
root@zfs:/# zfs snapshot -r pool/test@snap3
root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap3 > /dev/null
root@zfs:/# echo $?
0
root@zfs:/# zfs send -R -I pool/test@snap2 pool/test@snap3 > /dev/null
root@zfs:/# echo $?
0
Since pool/test/child was created after snap2, zfs send should not expect 
snap2
to be in pool/test/child when doing a recursive send. It should examine the
compare the creation time of the snapshot and each child folder to decide if
the folder will be sent. The next incremental send between snap2 and snap3
would properly create the child folder and snap3 which first appears in the
child folder.
The problem is identical if '-i' is used instead of '-I'.
  
  Reviewed by: Alex Aizman alex.aiz...@nexenta.com
  Reviewed by: Alek Pinchuk alek.pinc...@nexenta.com
  Reviewed by: Roman Strashkin roman.strash...@nexenta.com
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Approved by: Garrett D'Amore 
  Author: Alex Deiter 

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

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Oct 12 05:36:55 2016(r307116)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Oct 12 05:37:54 2016(r307117)
@@ -580,13 +580,30 @@ fsavl_create(nvlist_t *fss)
  * Routines for dealing with the giant nvlist of fs-nvlists, etc.
  */
 typedef struct send_data {
+   /*
+* assigned inside every recursive call,
+* restored from *_save on return:
+*
+* guid of fromsnap snapshot in parent dataset
+* txg of fromsnap snapshot in current dataset
+* txg of tosnap snapshot in current dataset
+*/
+
uint64_t parent_fromsnap_guid;
+   uint64_t fromsnap_txg;
+   uint64_t tosnap_txg;
+
+   /* the nvlists get accumulated during depth-first traversal */
nvlist_t *parent_snaps;
nvlist_t *fss;
nvlist_t *snapprops;
+
+   /* send-receive configuration, does not change during traversal */
+   const char *fsname;
const char *fromsnap;
const char *tosnap;
boolean_t recursive;
+   boolean_t verbose;
 
/*
 * The header nvlist is of the following format:
@@ -619,11 +636,23 @@ send_iterate_snap(zfs_handle_t *zhp, voi
 {
send_data_t *sd = arg;
uint64_t guid = zhp->zfs_dmustats.dds_guid;
+   uint64_t txg = zhp->zfs_dmustats.dds_creation_txg;
char *snapname;
nvlist_t *nv;
 
snapname = strrchr(zhp->zfs_name, '@')+1;
 
+   if (sd->tosnap_txg != 0 && txg > sd->tosnap_txg) {
+   if (sd->verbose) {
+   (void) fprintf(stderr, dgettext(TEXT_DOMAIN,
+   "skipping snapshot %s because it was created "
+   "after the destination snapshot (%s)\n"),
+   zhp->zfs_name, sd->tosnap);
+   }
+   zfs_close(zhp);
+   return (0);
+   }
+
VERIFY(0 == nvlist_add_uint64(sd->parent_snaps, snapname, guid));
/*
 * NB: if there is no fromsnap here (it's a newly created fs in
@@ -717,6 +746,31 @@ send_iterate_prop(zfs_handle_t *zhp, nvl
 }
 
 /*
+ * returns snapshot creation txg
+ * and returns 0 if the snapshot does not exist
+ */
+static uint64_t
+get_snap_txg(libzfs_handle_t *hdl, const char *fs, const char *snap)
+{
+   char name[ZFS_MAXNAMELEN];
+   uint64_t txg = 0;
+
+   if (fs == NULL || fs[0] == '\0' || snap == NULL || 

svn commit: r307116 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:36:55 2016
New Revision: 307116
URL: https://svnweb.freebsd.org/changeset/base/307116

Log:
  MFC r305194: MFV r302642:
  6876 Stack corruption after importing a pool with a too-long name
  
  illumos/illumos-gate@c971037baa5d64dfecf6d87ed602fc3116ebec41
  
https://github.com/illumos/illumos-gate/commit/c971037baa5d64dfecf6d87ed602fc3116ebec41
  
  https://www.illumos.org/issues/6876
Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for
trouble. We should check every dataset on import, using a 1024 byte buffer 
and
checking each time to see if the dataset's new name is longer than 256 
bytes.
  
  Reviewed by: Prakash Surya 
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Yuri Pankov 
  Approved by: Richard Lowe 
  Author: Paul Dagnelie 

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c  Wed Oct 
12 05:35:57 2016(r307115)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c  Wed Oct 
12 05:36:55 2016(r307116)
@@ -1799,7 +1799,12 @@ zpool_import_props(libzfs_handle_t *hdl,
case EEXIST:
(void) zpool_standard_error(hdl, error, desc);
break;
-
+   case ENAMETOOLONG:
+   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+   "new name of at least one dataset is longer than "
+   "the maximum allowable length"));
+   (void) zfs_error(hdl, EZFS_NAMETOOLONG, desc);
+   break;
default:
(void) zpool_standard_error(hdl, error, desc);
zpool_explain_recover(hdl,
___
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: r307115 - head/sys/arm/broadcom/bcm2835

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 05:35:57 2016
New Revision: 307115
URL: https://svnweb.freebsd.org/changeset/base/307115

Log:
  Fix typo in comment
  
  Spotted by: loos

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed Oct 12 05:28:24 
2016(r307114)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed Oct 12 05:35:57 
2016(r307115)
@@ -676,7 +676,7 @@ bcm_gpio_get_reserved_pins(struct bcm_gp
phandle_t gpio, node, reserved;
ssize_t len;
 
-   /* Get read-only pins if they're porvided */
+   /* Get read-only pins if they're provided */
gpio = ofw_bus_get_node(sc->sc_dev);
if (bcm_gpio_get_ro_pins(sc, gpio, "broadcom,read-only",
"read-only") != 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: r307114 - in stable/10/sys: conf dev/hyperv/vmbus modules/hyperv/vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 05:28:24 2016
New Revision: 307114
URL: https://svnweb.freebsd.org/changeset/base/307114

Log:
  MFC 303379
  
  hyperv/vmbus: Rename cleaned up bufring code
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7318

Added:
  stable/10/sys/dev/hyperv/vmbus/vmbus_br.c
 - copied, changed from r303379, head/sys/dev/hyperv/vmbus/vmbus_br.c
Deleted:
  stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c
Modified:
  stable/10/sys/conf/files.amd64
  stable/10/sys/conf/files.i386
  stable/10/sys/modules/hyperv/vmbus/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files.amd64
==
--- stable/10/sys/conf/files.amd64  Wed Oct 12 05:20:06 2016
(r307113)
+++ stable/10/sys/conf/files.amd64  Wed Oct 12 05:28:24 2016
(r307114)
@@ -271,10 +271,10 @@ dev/hyperv/utilities/hv_kvp.c 
optiona
 dev/hyperv/utilities/hv_shutdown.c optionalhyperv
 dev/hyperv/utilities/hv_timesync.c optionalhyperv
 dev/hyperv/utilities/hv_util.c optionalhyperv
-dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv
+dev/hyperv/vmbus/vmbus_br.coptionalhyperv
 dev/hyperv/vmbus/vmbus_chan.c  optionalhyperv
 dev/hyperv/vmbus/vmbus_et.coptionalhyperv
 dev/hyperv/vmbus/vmbus_if.moptionalhyperv

Modified: stable/10/sys/conf/files.i386
==
--- stable/10/sys/conf/files.i386   Wed Oct 12 05:20:06 2016
(r307113)
+++ stable/10/sys/conf/files.i386   Wed Oct 12 05:28:24 2016
(r307114)
@@ -248,10 +248,10 @@ dev/hyperv/utilities/hv_kvp.c 
optiona
 dev/hyperv/utilities/hv_shutdown.c optionalhyperv
 dev/hyperv/utilities/hv_timesync.c optionalhyperv
 dev/hyperv/utilities/hv_util.c optionalhyperv
-dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv
+dev/hyperv/vmbus/vmbus_br.coptionalhyperv
 dev/hyperv/vmbus/vmbus_chan.c  optionalhyperv
 dev/hyperv/vmbus/vmbus_et.coptionalhyperv
 dev/hyperv/vmbus/vmbus_if.moptionalhyperv

Copied and modified: stable/10/sys/dev/hyperv/vmbus/vmbus_br.c (from r303379, 
head/sys/dev/hyperv/vmbus/vmbus_br.c)
==
--- head/sys/dev/hyperv/vmbus/vmbus_br.cWed Jul 27 09:27:08 2016
(r303379, copy source)
+++ stable/10/sys/dev/hyperv/vmbus/vmbus_br.c   Wed Oct 12 05:28:24 2016
(r307114)
@@ -26,6 +26,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include 
+__FBSDID("$FreeBSD$");
+
 #include 
 #include 
 #include 

Modified: stable/10/sys/modules/hyperv/vmbus/Makefile
==
--- stable/10/sys/modules/hyperv/vmbus/Makefile Wed Oct 12 05:20:06 2016
(r307113)
+++ stable/10/sys/modules/hyperv/vmbus/Makefile Wed Oct 12 05:28:24 2016
(r307114)
@@ -4,11 +4,11 @@
${.CURDIR}/../../../dev/hyperv/vmbus/${MACHINE_CPUARCH}
 
 KMOD=  hv_vmbus
-SRCS=  hv_ring_buffer.c \
-   hyperv.c \
+SRCS=  hyperv.c \
hyperv_busdma.c \
hyperv_machdep.c \
vmbus.c \
+   vmbus_br.c \
vmbus_chan.c \
vmbus_et.c
 SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h vmbus_if.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:20:06 2016
New Revision: 307113
URL: https://svnweb.freebsd.org/changeset/base/307113

Log:
  MFC r305224: MFV r304158:
  7136 ESC_VDEV_REMOVE_AUX ought to always include vdev information
  
  7115 6922 generates ESC_ZFS_VDEV_REMOVE_AUX a bit too often
  
  illumos/illumos-gate@b72b6bb10ad55121a1b352c6f68ebdc8e20c9086
  
https://github.com/illumos/illumos-gate/commit/b72b6bb10ad55121a1b352c6f68ebdc8e
  20c9086
  
  https://www.illumos.org/issues/7136
6922 added ESC_ZFS_VDEV_REMOVE_AUX and ESC_ZFS_VDEV_REMOVE_DEV sysevents
whenever an aux device gets removed from a pool. However, those sysevents 
will
be created without the vdev_guid and vdev_path fields. It would be better to
always populate those fields.
  
  https://www.illumos.org/issues/7115
The addition of spa_event_notify in vdev removal code (see #6922) causes 
event
  s
to be generated even if the spare failed to be removed with EBUSY.
  
  Reviewed by: George Wilson 
  Reviewed by: Josef 'Jeff' Sipek 
  Approved by: Robert Mustacchi 
  Author: Alan Somers 

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  Wed Oct 
12 05:19:08 2016(r307112)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Wed Oct 
12 05:20:06 2016(r307113)
@@ -151,6 +151,8 @@ const zio_taskq_info_t zio_taskqs[ZIO_TY
{ ZTI_ONE,  ZTI_NULL,   ZTI_ONE,ZTI_NULL }, /* IOCTL */
 };
 
+static sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, const char *name);
+static void spa_event_post(sysevent_t *ev);
 static void spa_sync_version(void *arg, dmu_tx_t *tx);
 static void spa_sync_props(void *arg, dmu_tx_t *tx);
 static boolean_t spa_has_active_shared_spare(spa_t *spa);
@@ -5738,6 +5740,7 @@ int
 spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
 {
vdev_t *vd;
+   sysevent_t *ev = NULL;
metaslab_group_t *mg;
nvlist_t **spares, **l2cache, *nv;
uint64_t txg = 0;
@@ -5761,6 +5764,9 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
 * in this pool.
 */
if (vd == NULL || unspare) {
+   if (vd == NULL)
+   vd = spa_lookup_by_guid(spa, guid, B_TRUE);
+   ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
spa_vdev_remove_aux(spa->spa_spares.sav_config,
ZPOOL_CONFIG_SPARES, spares, nspares, nv);
spa_load_spares(spa);
@@ -5768,7 +5774,6 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
} else {
error = SET_ERROR(EBUSY);
}
-   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (spa->spa_l2cache.sav_vdevs != NULL &&
nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, , ) == 0 &&
@@ -5776,11 +5781,12 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
/*
 * Cache devices can always be removed.
 */
+   vd = spa_lookup_by_guid(spa, guid, B_TRUE);
+   ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
spa_vdev_remove_aux(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
spa_load_l2cache(spa);
spa->spa_l2cache.sav_sync = B_TRUE;
-   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (vd != NULL && vd->vdev_islog) {
ASSERT(!locked);
ASSERT(vd == vd->vdev_top);
@@ -5817,9 +5823,9 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
/*
 * Clean up the vdev namespace.
 */
+   ev = spa_event_create(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
spa_vdev_remove_from_namespace(spa, vd);
 
-   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
} else if (vd != NULL) {
/*
 * Normal vdevs cannot be removed (yet).
@@ -5835,6 +5841,9 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
if (!locked)
error = spa_vdev_exit(spa, NULL, txg, error);
 
+   if (ev)
+   spa_event_post(ev);
+
return (error);
 }
 
@@ -7229,24 +7238,17 @@ spa_has_active_shared_spare(spa_t *spa)
return (B_FALSE);
 }
 
-/*
- * Post a sysevent corresponding to the given event.  The 'name' must be one of
- * the event definitions in sys/sysevent/eventdefs.h.  The payload will be
- * filled in from the spa and 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:19:08 2016
New Revision: 307112
URL: https://svnweb.freebsd.org/changeset/base/307112

Log:
  MFC r305222: MFV r302993: 7104 increase indirect block size
  
  illumos/illumos-gate@4b5c8e93cab28d3c65ba9d407fd8f46e3be1db1c
  
https://github.com/illumos/illumos-gate/commit/4b5c8e93cab28d3c65ba9d407fd8f46e3
  be1db1c
  
  https://www.illumos.org/issues/7104
The current default indirect block size is 16KB. We can improve
performance by increasing it to 128KB. This is especially helpful for
any workload that needs to read most of the metadata, e.g.
scrub/resilver, file deletion, filesystem deletion, and zfs send.
We also need to fix a few space estimation errors to make the tests
pass.
  
  Reviewed by: George Wilson 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Dan McDonald 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.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/dnode.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c   
Wed Oct 12 05:17:17 2016(r307111)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c   
Wed Oct 12 05:19:08 2016(r307112)
@@ -791,11 +791,17 @@ dmu_objset_create_impl(spa_t *spa, dsl_d
 
/*
 * Determine the number of levels necessary for the meta-dnode
-* to contain DN_MAX_OBJECT dnodes.
+* to contain DN_MAX_OBJECT dnodes.  Note that in order to
+* ensure that we do not overflow 64 bits, there has to be
+* a nlevels that gives us a number of blocks > DN_MAX_OBJECT
+* but < 2^64.  Therefore,
+* (mdn->dn_indblkshift - SPA_BLKPTRSHIFT) (10) must be
+* less than (64 - log2(DN_MAX_OBJECT)) (16).
 */
-   while ((uint64_t)mdn->dn_nblkptr << (mdn->dn_datablkshift +
+   while ((uint64_t)mdn->dn_nblkptr <<
+   (mdn->dn_datablkshift - DNODE_SHIFT +
(levels - 1) * (mdn->dn_indblkshift - SPA_BLKPTRSHIFT)) <
-   DN_MAX_OBJECT * sizeof (dnode_phys_t))
+   DN_MAX_OBJECT)
levels++;
 
mdn->dn_next_nlevels[tx->tx_txg & TXG_MASK] =

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Oct 
12 05:17:17 2016(r307111)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Wed Oct 
12 05:19:08 2016(r307112)
@@ -411,12 +411,20 @@ zfs_deadman_init()
  * it is possible to run the pool completely out of space, causing it to
  * be permanently read-only.
  *
+ * Note that on very small pools, the slop space will be larger than
+ * 3.2%, in an effort to have it be at least spa_min_slop (128MB),
+ * but we never allow it to be more than half the pool size.
+ *
  * See also the comments in zfs_space_check_t.
  */
 int spa_slop_shift = 5;
 SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_slop_shift, CTLFLAG_RWTUN,
 _slop_shift, 0,
 "Shift value of reserved space (1/(2^spa_slop_shift)).");
+uint64_t spa_min_slop = 128 * 1024 * 1024;
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, spa_min_slop, CTLFLAG_RWTUN,
+_min_slop, 0,
+"Minimal value of reserved space");
 
 /*
  * ==
@@ -1723,14 +1731,16 @@ spa_get_asize(spa_t *spa, uint64_t lsize
 
 /*
  * Return the amount of slop space in bytes.  It is 1/32 of the pool (3.2%),
- * or at least 32MB.
+ * or at least 128MB, unless that would cause it to be more than half the
+ * pool size.
  *
  * See the comment above spa_slop_shift for details.
  */
 uint64_t
-spa_get_slop_space(spa_t *spa) {
+spa_get_slop_space(spa_t *spa)
+{
uint64_t space = spa_get_dspace(spa);
-   return (MAX(space >> spa_slop_shift, SPA_MINDEVSIZE >> 1));
+   return (MAX(space >> spa_slop_shift, MIN(space >> 1, spa_min_slop)));
 }
 
 uint64_t

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
Wed Oct 12 05:17:17 2016(r307111)
+++ 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:17:17 2016
New Revision: 307111
URL: https://svnweb.freebsd.org/changeset/base/307111

Log:
  MFC r305221: MFV r302992: 7071 lzc_snapshot does not fill in errlist on ENOENT
  
  illumos/illumos-gate@25f7d993adbfb3452ac4625b3791670746d35ae3
  
https://github.com/illumos/illumos-gate/commit/25f7d993adbfb3452ac4625b379167074
  6d35ae3
  
  https://www.illumos.org/issues/7071
upstream
DLPX-40482 lzc_snapshot does not fill in errlist on ENOENT
  
  Reviewed by: Igor Kozhukhov 
  Reviewed by: George Wilson 
  Reviewed by: Dan Kimmel 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

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
Wed Oct 12 05:16:33 2016(r307110)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Wed Oct 12 05:17:17 2016(r307111)
@@ -500,6 +500,14 @@ zfs_secpolicy_write_perms(const char *na
dsl_dataset_t *ds;
dsl_pool_t *dp;
 
+   /*
+* First do a quick check for root in the global zone, which
+* is allowed to do all write_perms.  This ensures that zfs_ioc_*
+* will get to handle nonexistent datasets.
+*/
+   if (INGLOBALZONE(curthread) && secpolicy_zfs(cr) == 0)
+   return (0);
+
error = dsl_pool_hold(name, FTAG, );
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: r307110 - in stable/11: cddl/contrib/opensolaris/lib/libnvpair sys/cddl/contrib/opensolaris/common/nvpair

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:16:33 2016
New Revision: 307110
URL: https://svnweb.freebsd.org/changeset/base/307110

Log:
  MFC r305211: MFV r302662: 6447 handful of nvpair cleanups
  
  illumos/illumos-gate@759e89be359f2af635e4122d147df56bce948773
  
https://github.com/illumos/illumos-gate/commit/759e89be359f2af635e4122d147df56bc
  e948773
  
  https://www.illumos.org/issues/6447
I got a patch from someone who uses nvpair code outside of illumos. It 
fixes a
couple of gcc warnings/bugs for him.
   1. silence uninitialized use warnings
   2. add parentheses around assignment used as truth value
   3. fix printf format specifier (ll is for integers only)
   4. strstr, strspn, strcspn, and strcmp are declared in string.h, not
  strings.h.
   5. avoid scanning integer into boolean variable
  
  Reviewed by: Josef 'Jeff' Sipek 
  Reviewed by: Andy Stormont 
  Reviewed by: Garrett D'Amore 
  Approved by: Robert Mustacchi 
  Author: Steve Dougherty 

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
  stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.cWed Oct 
12 05:15:53 2016(r307109)
+++ stable/11/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.cWed Oct 
12 05:16:33 2016(r307110)
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include "libnvpair.h"
@@ -1228,7 +1228,8 @@ nvpair_value_match_regex(nvpair_t *nvp, 
break;
}
case DATA_TYPE_BOOLEAN_VALUE: {
-   boolean_t val, val_arg;
+   int32_t val_arg;
+   boolean_t val;
 
/* scanf boolean_t from value and check for match */
sr = sscanf(value, "%"SCNi32, _arg);
@@ -1239,7 +1240,8 @@ nvpair_value_match_regex(nvpair_t *nvp, 
break;
}
case DATA_TYPE_BOOLEAN_ARRAY: {
-   boolean_t *val_array, val_arg;
+   boolean_t *val_array;
+   int32_t val_arg;
 
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi32, _arg);

Modified: 
stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
==
--- stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c   
Wed Oct 12 05:15:53 2016(r307109)
+++ stable/11/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c   
Wed Oct 12 05:16:33 2016(r307110)
@@ -1629,6 +1629,8 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nv
if ((nvl == NULL) || (name == NULL))
return (EINVAL);
 
+   sepp = NULL;
+   idx = 0;
/* step through components of name */
for (np = name; np && *np; np = sepp) {
/* ensure unique names */
@@ -2386,7 +2388,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp,
 */
nv_priv_init(, nva, 0);
 
-   if (err = nvlist_size(nvl, _size, encoding))
+   if ((err = nvlist_size(nvl, _size, encoding)))
return (err);
 
if ((buf = nv_mem_zalloc(, alloc_size)) == NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:15:53 2016
New Revision: 307109
URL: https://svnweb.freebsd.org/changeset/base/307109

Log:
  MFC r305210: MFV r302661:
  7082 bptree_iterate() passes wrong args to zfs_dbgmsg()
  
  illumos/illumos-gate@10e67aa0db0823d5464aafdd681f3c966155c68e
  
https://github.com/illumos/illumos-gate/commit/10e67aa0db0823d5464aafdd681f3c966
  155c68e
  
  https://www.illumos.org/issues/7082
upstream
DLPX-40542 bptree_iterate() passes wrong args to zfs_dbgmsg()
  
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c   Wed Oct 
12 05:15:09 2016(r307108)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c   Wed Oct 
12 05:15:53 2016(r307109)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
 
@@ -220,9 +220,10 @@ bptree_iterate(objset_t *os, uint64_t ob
 
if (zfs_free_leak_on_eio)
flags |= TRAVERSE_HARD;
-   zfs_dbgmsg("bptree index %d: traversing from min_txg=%lld "
+   zfs_dbgmsg("bptree index %lld: traversing from min_txg=%lld "
"bookmark %lld/%lld/%lld/%lld",
-   i, (longlong_t)bte.be_birth_txg,
+   (longlong_t)i,
+   (longlong_t)bte.be_birth_txg,
(longlong_t)bte.be_zb.zb_objset,
(longlong_t)bte.be_zb.zb_object,
(longlong_t)bte.be_zb.zb_level,
___
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: r307108 - in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/...

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:15:09 2016
New Revision: 307108
URL: https://svnweb.freebsd.org/changeset/base/307108

Log:
  MFC r305209: MFV r302660: 6314 buffer overflow in dsl_dataset_name
  
  illumos/illumos-gate@9adfa60d484ce2435f5af77cc99dcd4e692b6660
  
https://github.com/illumos/illumos-gate/commit/9adfa60d484ce2435f5af77cc99dcd4e6
  92b6660
  
  https://www.illumos.org/issues/6314
Callers of dsl_dataset_name pass a buffer of size ZFS_MAXNAMELEN, but
dsl_dataset_name copies the datasets' name PLUS the snapshot name to it,
resulting in a max of 2 * ZFS_MAXNAMELEN + '@'.
  
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

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/zhack/zhack.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_changelist.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
  stable/11/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.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_deleg.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_prop.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_userhold.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.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_dataset.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/spa_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.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.cWed Oct 12 05:14:04 
2016(r307107)
+++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.cWed Oct 12 05:15:09 
2016(r307108)
@@ -60,7 +60,6 @@
 #include 
 #include 
 #include 
-#undef ZFS_MAXNAMELEN
 #undef verify
 #include 
 
@@ -1945,7 +1944,7 @@ dump_dir(objset_t *os)
uint64_t refdbytes, usedobjs, scratch;
char numbuf[32];
char blkbuf[BP_SPRINTF_LEN + 20];
-   char osname[MAXNAMELEN];
+   char osname[ZFS_MAX_DATASET_NAME_LEN];
char *type = "UNKNOWN";
int verbosity = dump_opt['d'];
int print_header = 1;
@@ -3482,7 +3481,7 @@ find_zpool(char **target, nvlist_t **con
nvlist_t *match = NULL;
char *name = NULL;
char *sepp = NULL;
-   char sep;
+   char sep = '\0';
int count = 0;
importargs_t args = { 0 };
 

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Wed Oct 12 
05:14:04 2016(r307107)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Wed Oct 12 
05:15:09 2016(r307108)
@@ -1510,7 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:14:04 2016
New Revision: 307107
URL: https://svnweb.freebsd.org/changeset/base/307107

Log:
  MFC r305206: MFV r302658:
  6872 zfs libraries should not allow uninitialized variables
  
  illumos/illumos-gate@f83b46baf98d276f5f84fa84c8b461f412ac1f5e
  
https://github.com/illumos/illumos-gate/commit/f83b46baf98d276f5f84fa84c8b461f41
  2ac1f5e
  
  https://www.illumos.org/issues/6872
We compile the zfs libraries with -Wno-uninitialized. We should remove
this. Change makefiles, fix new warnings, fix pbchk errors.
  
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Yuri Pankov 
  Approved by: Robert Mustacchi 
  Author: Paul Dagnelie 

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c   Wed Oct 12 
05:13:12 2016(r307106)
+++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c   Wed Oct 12 
05:14:04 2016(r307107)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
  * Copyright 2016 Igor Kozhukhov .
  */
 
@@ -597,7 +597,6 @@ get_replication(nvlist_t *nvroot, boolea
verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
, ) == 0);
 
-   lastrep.zprl_type = NULL;
for (t = 0; t < toplevels; t++) {
uint64_t is_log = B_FALSE;
 

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Oct 12 05:13:12 2016(r307106)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Oct 12 05:14:04 2016(r307107)
@@ -1570,7 +1570,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvl
libzfs_handle_t *hdl = zhp->zfs_hdl;
nvlist_t *nvl;
int nvl_len;
-   int added_resv;
+   int added_resv = 0;
 
(void) snprintf(errbuf, sizeof (errbuf),
dgettext(TEXT_DOMAIN, "cannot set property for '%s'"),
@@ -3201,7 +3201,7 @@ zfs_create_ancestors(libzfs_handle_t *hd
 {
int prefix;
char *path_copy;
-   int rc;
+   int rc = 0;
 
if (check_parents(hdl, path, NULL, B_TRUE, ) != 0)
return (-1);
@@ -3843,7 +3843,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_hand
rollback_data_t cb = { 0 };
int err;
boolean_t restore_resv = 0;
-   uint64_t old_volsize, new_volsize;
+   uint64_t old_volsize = 0, new_volsize;
zfs_prop_t resv_prop;
 
assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM ||
@@ -4060,6 +4060,7 @@ zfs_rename(zfs_handle_t *zhp, const char
"child dataset with inherited mountpoint is used "
"in a non-global zone"));
(void) zfs_error(hdl, EZFS_ZONED, errbuf);
+   ret = -1;
goto error;
}
 

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Wed Oct 12 05:13:12 2016(r307106)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Wed Oct 12 05:14:04 2016(r307107)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
  * Copyright 2015 RackTop Systems.
  * Copyright 2016 Nexenta Systems, Inc.
  */
@@ -440,12 +440,12 @@ get_configs(libzfs_handle_t *hdl, pool_l
pool_entry_t *pe;
vdev_entry_t *ve;
config_entry_t *ce;
-   nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot;
+   nvlist_t *ret = NULL, *config = NULL, *tmp = NULL, *nvtop, *nvroot;
nvlist_t **spares, **l2cache;
uint_t i, nspares, nl2cache;
boolean_t config_seen;
uint64_t best_txg;
-   char *name, *hostname;
+   char *name, *hostname = NULL;
uint64_t 

svn commit: r307106 - in stable/11/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:13:12 2016
New Revision: 307106
URL: https://svnweb.freebsd.org/changeset/base/307106

Log:
  MFC r305205: MFV r302657:
  4521 zfstest is trying to execute evil "zfs unmount -a"
  
  illumos/illumos-gate@8808ac5dae118369991f158b6ab736cb2691ecde
  
https://github.com/illumos/illumos-gate/commit/8808ac5dae118369991f158b6ab736cb2
  691ecde
  
  https://www.illumos.org/issues/4521
zfstest is trying to execute evil "zfs unmount -a", which fails 
(fortunately,
as it would otherwise leave me with my ~ missing):
03:44:11.86 cannot unmount '/export/home/yuri': Device busy cannot unmount 
'/
export/home': Device busy
03:44:11.86 ERROR: /usr/sbin/zfs unmount -a exited 1
This affects, at least, zfs_mount_009_neg and zfs_mount_all_001_pos, both
failing on that step. The pool containing the /export/home hierarchy is
included in KEEP variable, but it doesn't seem to affect anything here.
  
  Reviewed by: Andriy Gapon 
  Reviewed by: Dan McDonald 
  Reviewed by: Matthew Ahrens 
  Reviewed by: John Kennedy 
  Approved by: Robert Mustacchi 
  Author: Yuri Pankov 

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.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   Wed Oct 12 
05:10:48 2016(r307105)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Wed Oct 12 
05:13:12 2016(r307106)
@@ -27,9 +27,9 @@
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright (c) 2012 Martin Matuska . All rights reserved.
  * Copyright (c) 2013 Steven Hartland.  All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2016 Igor Kozhukhov .
+ * Copyright 2016 Nexenta Systems, Inc.
  */
 
 #include 
@@ -6483,6 +6483,15 @@ unshare_unmount(int op, int argc, char *
continue;
}
 
+   /*
+* Ignore datasets that are excluded/restricted by
+* parent pool name.
+*/
+   if (zpool_skip_pool(zfs_get_pool_name(zhp))) {
+   zfs_close(zhp);
+   continue;
+   }
+
switch (op) {
case OP_SHARE:
verify(zfs_prop_get(zhp, ZFS_PROP_SHARENFS,

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Wed Oct 
12 05:10:48 2016(r307105)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Wed Oct 
12 05:13:12 2016(r307106)
@@ -26,8 +26,8 @@
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 Martin Matuska . All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Nexenta Systems, Inc.
  */
 
 #ifndef_LIBZFS_H
@@ -221,6 +221,7 @@ extern void zpool_free_handles(libzfs_ha
  */
 typedef int (*zpool_iter_f)(zpool_handle_t *, void *);
 extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *);
+extern boolean_t zpool_skip_pool(const char *);
 
 /*
  * Functions to create and destroy pools
@@ -411,6 +412,7 @@ extern void zfs_close(zfs_handle_t *);
 extern zfs_type_t zfs_get_type(const zfs_handle_t *);
 extern const char *zfs_get_name(const zfs_handle_t *);
 extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *);
+extern const char *zfs_get_pool_name(const zfs_handle_t *);
 
 /*
  * Property management functions.  Some functions are shared with the kernel,

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
Wed Oct 12 05:10:48 2016(r307105)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
Wed Oct 12 05:13:12 2016(r307106)
@@ -27,6 +27,7 @@
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:10:48 2016
New Revision: 307105
URL: https://svnweb.freebsd.org/changeset/base/307105

Log:
  MFC r305203: MFV r302655: 6873 zfs_destroy_snaps_nvl leaks errlist
  
  illumos/illumos-gate@4cde22c2ffb907ca39d2ebd512812f7e5168
  
https://github.com/illumos/illumos-gate/commit/4cde22c2ffb907ca39d2ebd512812
  f7e5168
  
  https://www.illumos.org/issues/6873
lzc_destroy_snaps() returns an nvlist in errlist.
zfs_destroy_snaps_nvl() should nvlist_free() it before returning.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Approved by: Dan McDonald 
  Author: Chris Williamson 

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.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   
Wed Oct 12 05:10:05 2016(r307104)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Oct 12 05:10:48 2016(r307105)
@@ -3455,12 +3455,14 @@ int
 zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
 {
int ret;
-   nvlist_t *errlist;
+   nvlist_t *errlist = NULL;
 
ret = lzc_destroy_snaps(snaps, defer, );
 
-   if (ret == 0)
+   if (ret == 0) {
+   nvlist_free(errlist);
return (0);
+   }
 
if (nvlist_empty(errlist)) {
char errbuf[1024];
@@ -3488,6 +3490,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *h
}
}
 
+   nvlist_free(errlist);
return (ret);
 }
 
___
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: r307103 - stable/10/sys/dev/hyperv/vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 05:09:26 2016
New Revision: 307103
URL: https://svnweb.freebsd.org/changeset/base/307103

Log:
  MFC 303284,303329,303361,303362,303366,303368-303370
  
  303284
  hyperv/vmbus: Move bufring info definition to vmbus_brvar.h
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7282
  
  303329
  hyperv/vmbus: Nuke unnecessary accessor functions.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7303
  
  303361
  hyperv/vmbus: Initialize RX/TX bufring mutex at channel creation time
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7312
  
  303362
  hyperv/vmbus: Use different struct for RX/TX bufring.
  
  So that they can use suitable MP synchronization mechanism.
  
  While I'm here change the bufring init/read/write function names.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7313
  
  303366
  hyperv/vmbus: Update comment for bufring
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7314
  
  303368
  hyperv/vmbus: Cleanup TX bufring write process.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7315
  
  303369
  hyperv/vmbus: Stringent RX bufring data length checks.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7316
  
  303370
  hyperv/vmbus: Cleanup RX bufring read process.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D7317

Modified:
  stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_brvar.h
  stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_chanvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c
==
--- stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Wed Oct 12 05:09:22 
2016(r307102)
+++ stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Wed Oct 12 05:09:26 
2016(r307103)
@@ -37,32 +37,29 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-/* Amount of space to write to */
-#defineHV_BYTES_AVAIL_TO_WRITE(r, w, z)\
-   ((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w))
-
-static uint32_tcopy_to_ring_buffer(hv_vmbus_ring_buffer_info 
*ring_info,
-   uint32_t start_write_offset, const uint8_t *src,
-   uint32_t src_len);
-static uint32_t copy_from_ring_buffer(hv_vmbus_ring_buffer_info *ring_info,
-   char *dest, uint32_t dest_len, uint32_t start_read_offset);
+/* Amount of space available for write */
+#defineVMBUS_BR_WAVAIL(r, w, z)\
+   (((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w)))
+
+/* Increase bufing index */
+#define VMBUS_BR_IDXINC(idx, inc, sz)  (((idx) + (inc)) % (sz))
 
 static int
 vmbus_br_sysctl_state(SYSCTL_HANDLER_ARGS)
 {
-   const hv_vmbus_ring_buffer_info *br = arg1;
-   uint32_t rindex, windex, intr_mask, ravail, wavail;
+   const struct vmbus_br *br = arg1;
+   uint32_t rindex, windex, imask, ravail, wavail;
char state[256];
 
-   rindex = br->ring_buffer->br_rindex;
-   windex = br->ring_buffer->br_windex;
-   intr_mask = br->ring_buffer->br_imask;
-   wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size);
-   ravail = br->ring_data_size - wavail;
+   rindex = br->vbr_rindex;
+   windex = br->vbr_windex;
+   imask = br->vbr_imask;
+   wavail = VMBUS_BR_WAVAIL(rindex, windex, br->vbr_dsize);
+   ravail = br->vbr_dsize - wavail;
 
snprintf(state, sizeof(state),
-   "rindex:%u windex:%u intr_mask:%u ravail:%u wavail:%u",
-   rindex, windex, intr_mask, ravail, wavail);
+   "rindex:%u windex:%u imask:%u ravail:%u wavail:%u",
+   rindex, windex, imask, ravail, wavail);
return sysctl_handle_string(oidp, state, sizeof(state), req);
 }
 
@@ -79,25 +76,25 @@ vmbus_br_sysctl_state_bin(SYSCTL_HANDLER
 #define BR_STATE_WSPC  4
 #define BR_STATE_MAX   5
 
-   const hv_vmbus_ring_buffer_info *br = arg1;
+   const struct vmbus_br *br = arg1;
uint32_t rindex, windex, wavail, state[BR_STATE_MAX];
 
-   rindex = br->ring_buffer->br_rindex;
-   windex = br->ring_buffer->br_windex;
-   wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size);
+   rindex = br->vbr_rindex;
+   windex = br->vbr_windex;
+   wavail = VMBUS_BR_WAVAIL(rindex, windex, br->vbr_dsize);
 
state[BR_STATE_RIDX] = rindex;
state[BR_STATE_WIDX] = windex;
-   state[BR_STATE_IMSK] = br->ring_buffer->br_imask;
+   state[BR_STATE_IMSK] = br->vbr_imask;

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:10:05 2016
New Revision: 307104
URL: https://svnweb.freebsd.org/changeset/base/307104

Log:
  MFC r305202: MFV r302654:
  6879 incorrect endianness swap for drr_spill.drr_length in libzfs_sendrecv.c
  
  illumos/illumos-gate@20fea7a47472aceb64d3ed48cc2a3ea268bc4795
  
https://github.com/illumos/illumos-gate/commit/20fea7a47472aceb64d3ed48cc2a3ea26
  8bc4795
  
  https://www.illumos.org/issues/6879
In libzfs_sendrecv, there's a typo:
case DRR_SPILL:
if (byteswap) {
drr->drr_u.drr_write.drr_length =
BSWAP_64(drr->drr_u.drr_spill.drr_length);
}
Instead of drr_write.drr_length, we should be assigning the result of the
byteswap to drr_spill.drr_length.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Approved by: Robert Mustacchi 
  Author: Dan Kimmel 

Modified:
  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_sendrecv.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Oct 12 05:09:26 2016(r307103)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Oct 12 05:10:05 2016(r307104)
@@ -2968,7 +2968,7 @@ recv_skip(libzfs_handle_t *hdl, int fd, 
break;
case DRR_SPILL:
if (byteswap) {
-   drr->drr_u.drr_write.drr_length =
+   drr->drr_u.drr_spill.drr_length =
BSWAP_64(drr->drr_u.drr_spill.drr_length);
}
(void) recv_read(hdl, fd, 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: r307102 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:09:22 2016
New Revision: 307102
URL: https://svnweb.freebsd.org/changeset/base/307102

Log:
  MFC r305201: MFV r302653:
  6111 zfs send should ignore datasets created after the ending snapshot
  
  illumos/illumos-gate@4a20c933b148de8a1c1d3538391c64284e636653
  
https://github.com/illumos/illumos-gate/commit/4a20c933b148de8a1c1d3538391c64284
  e636653
  
  https://www.illumos.org/issues/6111
If you create a zfs child folder, zfs send returns an error when a recursive
incremental send is done between two snapshots made prior to the folder
creation.
The problem can be reproduced with the following steps.
root@zfs:/# zfs create pool/test
root@zfs:/# zfs snapshot pool/test@snap1
root@zfs:/# zfs snapshot pool/test@snap2
root@zfs:/# zfs create pool/test/child
root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap2 > /dev/null
WARNING: could not send pool/test/child@snap2: does not exist
WARNING: could not send pool/test/child@snap2: does not exist
root@zfs:/# echo $?
1
root@zfs:/# zfs snapshot -r pool/test@snap3
root@zfs:/# zfs send -R -I pool/test@snap1 pool/test@snap3 > /dev/null
root@zfs:/# echo $?
0
root@zfs:/# zfs send -R -I pool/test@snap2 pool/test@snap3 > /dev/null
root@zfs:/# echo $?
0
Since pool/test/child was created after snap2, zfs send should not expect 
snap2
to be in pool/test/child when doing a recursive send. It should examine the
compare the creation time of the snapshot and each child folder to decide if
the folder will be sent. The next incremental send between snap2 and snap3
would properly create the child folder and snap3 which first appears in the
child folder.
The problem is identical if '-i' is used instead of '-I'.
  
  Reviewed by: Alex Aizman alex.aiz...@nexenta.com
  Reviewed by: Alek Pinchuk alek.pinc...@nexenta.com
  Reviewed by: Roman Strashkin roman.strash...@nexenta.com
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Approved by: Garrett D'Amore 
  Author: Alex Deiter 

Modified:
  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_sendrecv.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Oct 12 05:08:09 2016(r307101)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Oct 12 05:09:22 2016(r307102)
@@ -580,13 +580,30 @@ fsavl_create(nvlist_t *fss)
  * Routines for dealing with the giant nvlist of fs-nvlists, etc.
  */
 typedef struct send_data {
+   /*
+* assigned inside every recursive call,
+* restored from *_save on return:
+*
+* guid of fromsnap snapshot in parent dataset
+* txg of fromsnap snapshot in current dataset
+* txg of tosnap snapshot in current dataset
+*/
+
uint64_t parent_fromsnap_guid;
+   uint64_t fromsnap_txg;
+   uint64_t tosnap_txg;
+
+   /* the nvlists get accumulated during depth-first traversal */
nvlist_t *parent_snaps;
nvlist_t *fss;
nvlist_t *snapprops;
+
+   /* send-receive configuration, does not change during traversal */
+   const char *fsname;
const char *fromsnap;
const char *tosnap;
boolean_t recursive;
+   boolean_t verbose;
 
/*
 * The header nvlist is of the following format:
@@ -619,11 +636,23 @@ send_iterate_snap(zfs_handle_t *zhp, voi
 {
send_data_t *sd = arg;
uint64_t guid = zhp->zfs_dmustats.dds_guid;
+   uint64_t txg = zhp->zfs_dmustats.dds_creation_txg;
char *snapname;
nvlist_t *nv;
 
snapname = strrchr(zhp->zfs_name, '@')+1;
 
+   if (sd->tosnap_txg != 0 && txg > sd->tosnap_txg) {
+   if (sd->verbose) {
+   (void) fprintf(stderr, dgettext(TEXT_DOMAIN,
+   "skipping snapshot %s because it was created "
+   "after the destination snapshot (%s)\n"),
+   zhp->zfs_name, sd->tosnap);
+   }
+   zfs_close(zhp);
+   return (0);
+   }
+
VERIFY(0 == nvlist_add_uint64(sd->parent_snaps, snapname, guid));
/*
 * NB: if there is no fromsnap here (it's a newly created fs in
@@ -717,6 +746,31 @@ send_iterate_prop(zfs_handle_t *zhp, nvl
 }
 
 /*
+ * returns snapshot creation txg
+ * and returns 0 if the snapshot does not exist
+ */
+static uint64_t
+get_snap_txg(libzfs_handle_t *hdl, const char *fs, const char *snap)
+{
+   char name[ZFS_MAXNAMELEN];
+   uint64_t txg = 0;
+
+   if (fs == NULL || fs[0] == '\0' || snap == NULL || 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:08:09 2016
New Revision: 307101
URL: https://svnweb.freebsd.org/changeset/base/307101

Log:
  MFC r305197: MFV r302646:
  6980 6902 causes zfs send to break due to 32-bit/64-bit struct mismatch
  
  illumos/illumos-gate@ea4a67f462de0a39a9adea8197bcdef849de5371
  
https://github.com/illumos/illumos-gate/commit/ea4a67f462de0a39a9adea8197bcdef84
  9de5371
  
  https://www.illumos.org/issues/6980
doing zfs send -i snap1 snap2 >testfile results in
internal error: Invalid argument
Abort (core dumped)
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

Modified:
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
  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/common/zfs/zfs_ioctl_compat.c
==
--- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
Wed Oct 12 05:04:36 2016(r307100)
+++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
Wed Oct 12 05:08:09 2016(r307101)
@@ -55,8 +55,52 @@ zfs_cmd_compat_get(zfs_cmd_t *zc, caddr_
zfs_cmd_zcmd_t *zcmd_c;
zfs_cmd_edbp_t *edbp_c;
zfs_cmd_resume_t *resume_c;
+   zfs_cmd_inlanes_t *inlanes_c;
 
switch (cflag) {
+   case ZFS_CMD_COMPAT_INLANES:
+   inlanes_c = (void *)addr;
+   /* zc */
+   strlcpy(zc->zc_name, inlanes_c->zc_name, MAXPATHLEN);
+   strlcpy(zc->zc_value, inlanes_c->zc_value, MAXPATHLEN * 2);
+   strlcpy(zc->zc_string, inlanes_c->zc_string, MAXPATHLEN);
+
+#define FIELD_COPY(field) zc->field = inlanes_c->field
+   FIELD_COPY(zc_nvlist_src);
+   FIELD_COPY(zc_nvlist_src_size);
+   FIELD_COPY(zc_nvlist_dst);
+   FIELD_COPY(zc_nvlist_dst_size);
+   FIELD_COPY(zc_nvlist_dst_filled);
+   FIELD_COPY(zc_pad2);
+   FIELD_COPY(zc_history);
+   FIELD_COPY(zc_guid);
+   FIELD_COPY(zc_nvlist_conf);
+   FIELD_COPY(zc_nvlist_conf_size);
+   FIELD_COPY(zc_cookie);
+   FIELD_COPY(zc_objset_type);
+   FIELD_COPY(zc_perm_action);
+   FIELD_COPY(zc_history_len);
+   FIELD_COPY(zc_history_offset);
+   FIELD_COPY(zc_obj);
+   FIELD_COPY(zc_iflags);
+   FIELD_COPY(zc_share);
+   FIELD_COPY(zc_jailid);
+   FIELD_COPY(zc_objset_stats);
+   FIELD_COPY(zc_begin_record);
+   FIELD_COPY(zc_inject_record);
+   FIELD_COPY(zc_defer_destroy);
+   FIELD_COPY(zc_flags);
+   FIELD_COPY(zc_action_handle);
+   FIELD_COPY(zc_cleanup_fd);
+   FIELD_COPY(zc_simple);
+   FIELD_COPY(zc_resumable);
+   FIELD_COPY(zc_sendobj);
+   FIELD_COPY(zc_fromobj);
+   FIELD_COPY(zc_createtxg);
+   FIELD_COPY(zc_stat);
+#undef FIELD_COPY
+   break;
+
case ZFS_CMD_COMPAT_RESUME:
resume_c = (void *)addr;
/* zc */
@@ -434,8 +478,50 @@ zfs_cmd_compat_put(zfs_cmd_t *zc, caddr_
zfs_cmd_zcmd_t *zcmd_c;
zfs_cmd_edbp_t *edbp_c;
zfs_cmd_resume_t *resume_c;
+   zfs_cmd_inlanes_t *inlanes_c;
 
switch (cflag) {
+   case ZFS_CMD_COMPAT_INLANES:
+   inlanes_c = (void *)addr;
+   strlcpy(inlanes_c->zc_name, zc->zc_name, MAXPATHLEN);
+   strlcpy(inlanes_c->zc_value, zc->zc_value, MAXPATHLEN * 2);
+   strlcpy(inlanes_c->zc_string, zc->zc_string, MAXPATHLEN);
+
+#define FIELD_COPY(field) inlanes_c->field = zc->field
+   FIELD_COPY(zc_nvlist_src);
+   FIELD_COPY(zc_nvlist_src_size);
+   FIELD_COPY(zc_nvlist_dst);
+   FIELD_COPY(zc_nvlist_dst_size);
+   FIELD_COPY(zc_nvlist_dst_filled);
+   FIELD_COPY(zc_pad2);
+   FIELD_COPY(zc_history);
+   FIELD_COPY(zc_guid);
+   FIELD_COPY(zc_nvlist_conf);
+   FIELD_COPY(zc_nvlist_conf_size);
+   FIELD_COPY(zc_cookie);
+   FIELD_COPY(zc_objset_type);
+   FIELD_COPY(zc_perm_action);
+   FIELD_COPY(zc_history_len);
+   FIELD_COPY(zc_history_offset);
+   FIELD_COPY(zc_obj);
+   FIELD_COPY(zc_iflags);
+   FIELD_COPY(zc_share);
+   

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Wed Oct 12 05:04:36 2016
New Revision: 307100
URL: https://svnweb.freebsd.org/changeset/base/307100

Log:
  MFC r305194: MFV r302642:
  6876 Stack corruption after importing a pool with a too-long name
  
  illumos/illumos-gate@c971037baa5d64dfecf6d87ed602fc3116ebec41
  
https://github.com/illumos/illumos-gate/commit/c971037baa5d64dfecf6d87ed602fc3116ebec41
  
  https://www.illumos.org/issues/6876
Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for
trouble. We should check every dataset on import, using a 1024 byte buffer 
and
checking each time to see if the dataset's new name is longer than 256 
bytes.
  
  Reviewed by: Prakash Surya 
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Yuri Pankov 
  Approved by: Richard Lowe 
  Author: Paul Dagnelie 

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

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c  Wed Oct 
12 03:37:43 2016(r307099)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c  Wed Oct 
12 05:04:36 2016(r307100)
@@ -1799,7 +1799,12 @@ zpool_import_props(libzfs_handle_t *hdl,
case EEXIST:
(void) zpool_standard_error(hdl, error, desc);
break;
-
+   case ENAMETOOLONG:
+   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+   "new name of at least one dataset is longer than "
+   "the maximum allowable length"));
+   (void) zfs_error(hdl, EZFS_NAMETOOLONG, desc);
+   break;
default:
(void) zpool_standard_error(hdl, error, desc);
zpool_explain_recover(hdl,
___
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: r307099 - in stable/10/sys/dev/hyperv: netvsc vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 03:37:43 2016
New Revision: 307099
URL: https://svnweb.freebsd.org/changeset/base/307099

Log:
  MFC 303283
  
  hyperv/vmbus: Rename hv_vmbus_priv.h to vmbus_brvar.h
  
  It only contains bufring related bits for a while.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7281

Added:
  stable/10/sys/dev/hyperv/vmbus/vmbus_brvar.h
 - copied unchanged from r303283, head/sys/dev/hyperv/vmbus/vmbus_brvar.h
Deleted:
  stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
Modified:
  stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c
  stable/10/sys/dev/hyperv/vmbus/hyperv.c
  stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h
  stable/10/sys/dev/hyperv/vmbus/vmbus.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c   Wed Oct 12 03:36:46 
2016(r307098)
+++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c   Wed Oct 12 03:37:43 
2016(r307099)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
 #include "hv_net_vsc.h"
 #include "hv_rndis.h"
 #include "hv_rndis_filter.h"

Modified: stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c
==
--- stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Wed Oct 12 03:36:46 
2016(r307098)
+++ stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Wed Oct 12 03:37:43 
2016(r307099)
@@ -34,8 +34,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "hv_vmbus_priv.h"
 #include 
+#include 
 
 /* Amount of space to write to */
 #defineHV_BYTES_AVAIL_TO_WRITE(r, w, z)\

Modified: stable/10/sys/dev/hyperv/vmbus/hyperv.c
==
--- stable/10/sys/dev/hyperv/vmbus/hyperv.c Wed Oct 12 03:36:46 2016
(r307098)
+++ stable/10/sys/dev/hyperv/vmbus/hyperv.c Wed Oct 12 03:37:43 2016
(r307099)
@@ -43,12 +43,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#if 0
 #include 
+#endif
 
 #define HYPERV_FREEBSD_BUILD   0ULL
 #define HYPERV_FREEBSD_VERSION ((uint64_t)__FreeBSD_version)

Modified: stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h
==
--- stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h Wed Oct 12 03:36:46 2016
(r307098)
+++ stable/10/sys/dev/hyperv/vmbus/hyperv_reg.h Wed Oct 12 03:37:43 2016
(r307099)
@@ -30,6 +30,7 @@
 #define _HYPERV_REG_H_
 
 #include 
+#include 
 
 /*
  * Hyper-V Synthetic MSRs

Modified: stable/10/sys/dev/hyperv/vmbus/vmbus.c
==
--- stable/10/sys/dev/hyperv/vmbus/vmbus.c  Wed Oct 12 03:36:46 2016
(r307098)
+++ stable/10/sys/dev/hyperv/vmbus/vmbus.c  Wed Oct 12 03:37:43 2016
(r307099)
@@ -60,11 +60,11 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include "acpi_if.h"

Copied: stable/10/sys/dev/hyperv/vmbus/vmbus_brvar.h (from r303283, 
head/sys/dev/hyperv/vmbus/vmbus_brvar.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/sys/dev/hyperv/vmbus/vmbus_brvar.hWed Oct 12 03:37:43 
2016(r307099, copy of r303283, head/sys/dev/hyperv/vmbus/vmbus_brvar.h)
@@ -0,0 +1,85 @@
+/*-
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
+ * Copyright (c) 2012 NetApp Inc.
+ * Copyright (c) 2012 Citrix Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * 

svn commit: r307098 - head/sys/dev/usb/controller

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 03:36:46 2016
New Revision: 307098
URL: https://svnweb.freebsd.org/changeset/base/307098

Log:
  Make BCM28x USB driver compatible with upstream device tree
  
  This should have been committed in r307093: resource allocation depends
  on source of the device tree. upstream dts has extra interrupt that we can
  ignore

Modified:
  head/sys/dev/usb/controller/dwc_otg_fdt.c

Modified: head/sys/dev/usb/controller/dwc_otg_fdt.c
==
--- head/sys/dev/usb/controller/dwc_otg_fdt.c   Wed Oct 12 03:32:47 2016
(r307097)
+++ head/sys/dev/usb/controller/dwc_otg_fdt.c   Wed Oct 12 03:36:46 2016
(r307098)
@@ -121,7 +121,12 @@ dwc_otg_attach(device_t dev)
sc->sc_otg.sc_io_hdl = rman_get_bushandle(sc->sc_otg.sc_io_res);
sc->sc_otg.sc_io_size = rman_get_size(sc->sc_otg.sc_io_res);
 
-   rid = 0;
+
+   /*
+* brcm,bcm2708-usb FDT provides two interrupts,
+* we need only second one (VC_USB)
+*/
+   rid = ofw_bus_is_compatible(dev, "brcm,bcm2708-usb") ? 1 : 0;
sc->sc_otg.sc_irq_res =
bus_alloc_resource_any(dev, SYS_RES_IRQ, , RF_ACTIVE);
if (sc->sc_otg.sc_irq_res == NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307097 - stable/10/sys/dev/hyperv/vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 03:32:47 2016
New Revision: 307097
URL: https://svnweb.freebsd.org/changeset/base/307097

Log:
  MFC 303178,303180,303182
  
  303178
  hyperv/vmbus: Cosmetic bufring cleanup.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7267
  
  303180
  hyperv/vmbus: Cleanup and augment bufring sysctl tree creation
  
  Binary state node is added, so that userland programs do not have
  to parse human readable state string.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7268
  
  303182
  hyperv/vmbus: Move vmbus bufring definition to vmbus_reg.h
  
  And add more comment about its fields.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7269

Modified:
  stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c
  stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_chanvar.h
  stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c
==
--- stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Wed Oct 12 03:18:17 
2016(r307096)
+++ stable/10/sys/dev/hyperv/vmbus/hv_ring_buffer.c Wed Oct 12 03:32:47 
2016(r307097)
@@ -35,116 +35,148 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "hv_vmbus_priv.h"
+#include 
 
 /* Amount of space to write to */
-#defineHV_BYTES_AVAIL_TO_WRITE(r, w, z) ((w) >= (r))? \
-   ((z) - ((w) - (r))):((r) - (w))
+#defineHV_BYTES_AVAIL_TO_WRITE(r, w, z)\
+   ((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w))
 
+static uint32_tcopy_to_ring_buffer(hv_vmbus_ring_buffer_info 
*ring_info,
+   uint32_t start_write_offset, const uint8_t *src,
+   uint32_t src_len);
+static uint32_t copy_from_ring_buffer(hv_vmbus_ring_buffer_info *ring_info,
+   char *dest, uint32_t dest_len, uint32_t start_read_offset);
+
+static int
+vmbus_br_sysctl_state(SYSCTL_HANDLER_ARGS)
+{
+   const hv_vmbus_ring_buffer_info *br = arg1;
+   uint32_t rindex, windex, intr_mask, ravail, wavail;
+   char state[256];
+
+   rindex = br->ring_buffer->br_rindex;
+   windex = br->ring_buffer->br_windex;
+   intr_mask = br->ring_buffer->br_imask;
+   wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size);
+   ravail = br->ring_data_size - wavail;
+
+   snprintf(state, sizeof(state),
+   "rindex:%u windex:%u intr_mask:%u ravail:%u wavail:%u",
+   rindex, windex, intr_mask, ravail, wavail);
+   return sysctl_handle_string(oidp, state, sizeof(state), req);
+}
+
+/*
+ * Binary bufring states.
+ */
 static int
-hv_rbi_sysctl_stats(SYSCTL_HANDLER_ARGS)
+vmbus_br_sysctl_state_bin(SYSCTL_HANDLER_ARGS)
 {
-   hv_vmbus_ring_buffer_info* rbi;
-   uint32_t read_index, write_index, interrupt_mask, sz;
-   uint32_t read_avail, write_avail;
-   char rbi_stats[256];
-
-   rbi = (hv_vmbus_ring_buffer_info*)arg1;
-   read_index = rbi->ring_buffer->read_index;
-   write_index = rbi->ring_buffer->write_index;
-   interrupt_mask = rbi->ring_buffer->interrupt_mask;
-   sz = rbi->ring_data_size;
-   write_avail = HV_BYTES_AVAIL_TO_WRITE(read_index,
-   write_index, sz);
-   read_avail = sz - write_avail;
-   snprintf(rbi_stats, sizeof(rbi_stats),
-   "r_idx:%d "
-   "w_idx:%d "
-   "int_mask:%d "
-   "r_avail:%d "
-   "w_avail:%d",
-   read_index, write_index, interrupt_mask,
-   read_avail, write_avail);
+#define BR_STATE_RIDX  0
+#define BR_STATE_WIDX  1
+#define BR_STATE_IMSK  2
+#define BR_STATE_RSPC  3
+#define BR_STATE_WSPC  4
+#define BR_STATE_MAX   5
+
+   const hv_vmbus_ring_buffer_info *br = arg1;
+   uint32_t rindex, windex, wavail, state[BR_STATE_MAX];
+
+   rindex = br->ring_buffer->br_rindex;
+   windex = br->ring_buffer->br_windex;
+   wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size);
+
+   state[BR_STATE_RIDX] = rindex;
+   state[BR_STATE_WIDX] = windex;
+   state[BR_STATE_IMSK] = br->ring_buffer->br_imask;
+   state[BR_STATE_WSPC] = wavail;
+   state[BR_STATE_RSPC] = br->ring_data_size - wavail;
 
-   return (sysctl_handle_string(oidp, rbi_stats,
-   sizeof(rbi_stats), req));
+   return sysctl_handle_opaque(oidp, state, sizeof(state), req);
 }
 
 void
-hv_ring_buffer_stat(
-   struct sysctl_ctx_list  *ctx,
-   struct sysctl_oid_list  *tree_node,
-   hv_vmbus_ring_buffer_info   *rbi,
-   const char  *desc)  
-{
- 

svn commit: r307096 - in stable/10/sys/dev/hyperv: include netvsc storvsc utilities vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 03:18:17 2016
New Revision: 307096
URL: https://svnweb.freebsd.org/changeset/base/307096

Log:
  MFC 303066-303072,303127-303129,303131
  
  303066
  hyperv/vmbus: Get rid of unnecessary definition.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7240
  
  303067
  hyperv/vmbus: Move IC register definition to Hyper-V utilities
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7241
  
  303068
  hyperv/vmbus: Channel struct field rename
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7242
  
  303069
  hyperv/vmbus: Pass channel as the first argument for channel callback
  
  The prepares to kill device private fields in channel struct, which
  are not flexible and extensible.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7243
  
  303070
  hyperv/vmbus: Deprecate the device private data in channel struct
  
  They are neither flexible nor extensible.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7244
  
  303071
  hyperv/vmbus: Hide channel struct definition.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7245
  
  303072
  hyperv/vmbus: Save MNF trigger location instead of MNF trigger index.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7246
  
  303127
  hyperv/vmbus: Save event flag location and evet flag mask.
  
  This avoids unnecessary access to the vmbus_softc struct on sending path.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7257
  
  303128
  hyperv/vmbus: Reorder channel fields.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7258
  
  303129
  hyperv/vmbus: Shuffle function declaration and macro definition.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7259
  
  303131
  hyperv: hv_vmbus_channel -> vmbus_channel
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7260

Added:
  stable/10/sys/dev/hyperv/utilities/hv_utilreg.h
 - copied unchanged from r303067, head/sys/dev/hyperv/utilities/hv_utilreg.h
  stable/10/sys/dev/hyperv/vmbus/vmbus_chanvar.h
 - copied, changed from r303071, head/sys/dev/hyperv/vmbus/vmbus_chanvar.h
Modified:
  stable/10/sys/dev/hyperv/include/hyperv.h
  stable/10/sys/dev/hyperv/include/vmbus.h
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h
  stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/netvsc/hv_rndis.h
  stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h
  stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c
  stable/10/sys/dev/hyperv/utilities/hv_kvp.c
  stable/10/sys/dev/hyperv/utilities/hv_shutdown.c
  stable/10/sys/dev/hyperv/utilities/hv_timesync.c
  stable/10/sys/dev/hyperv/utilities/hv_util.c
  stable/10/sys/dev/hyperv/utilities/hv_util.h
  stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  stable/10/sys/dev/hyperv/vmbus/vmbus.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_var.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/include/hyperv.h
==
--- stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 03:08:58 2016
(r307095)
+++ stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 03:18:17 2016
(r307096)
@@ -58,30 +58,6 @@
 #include 
 #include 
 
-typedef uint8_thv_bool_uint8_t;
-
-#define HV_S_OK0x
-#define HV_E_FAIL  0x80004005
-#define HV_ERROR_NOT_SUPPORTED 0x80070032
-#define HV_ERROR_MACHINE_LOCKED0x800704F7
-
-/*
- * VMBUS version is 32 bit, upper 16 bit for major_number and lower
- * 16 bit for minor_number.
- *
- * 0.13  --  Windows Server 2008
- * 1.1   --  Windows 7
- * 2.4   --  Windows 8
- * 3.0   --  Windows 8.1
- */
-#define VMBUS_VERSION_WS2008   ((0 << 16) | (13))
-#define VMBUS_VERSION_WIN7 ((1 << 16) | (1))
-#define VMBUS_VERSION_WIN8 ((2 << 16) | (4))
-#define VMBUS_VERSION_WIN8_1   ((3 << 16) | (0))
-
-#define VMBUS_VERSION_MAJOR(ver)   (((uint32_t)(ver)) >> 16)
-#define VMBUS_VERSION_MINOR(ver)   (((uint32_t)(ver)) & 0x)
-
 struct hyperv_guid {
uint8_t hv_guid[16];
 } __packed;
@@ -90,183 +66,6 @@ struct hyperv_guid {
 
 inthyperv_guid2str(const struct hyperv_guid *, char *, size_t);
 
-#define 

svn commit: r307095 - head/sys/contrib/vchiq/interface/vchiq_arm

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 03:08:58 2016
New Revision: 307095
URL: https://svnweb.freebsd.org/changeset/base/307095

Log:
  Make VCHI driver compatible with upstream DT
  
  - Add compatibility string
  - Compensate difference in base address between our custom DTB and upstream 
one

Modified:
  head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c

Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c
==
--- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c Wed Oct 12 
03:08:11 2016(r307094)
+++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c Wed Oct 12 
03:08:58 2016(r307095)
@@ -73,14 +73,25 @@ struct bcm_vchiq_softc {
void*   intr_hl;
bus_space_tag_t bst;
bus_space_handle_t  bsh;
+   int regs_offset;
 };
 
 static struct bcm_vchiq_softc *bcm_vchiq_sc = NULL;
 
+#defineBSD_DTB 1
+#defineUPSTREAM_DTB2
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-vchiq",  BSD_DTB},
+   {"brcm,bcm2835-vchiq",  UPSTREAM_DTB},
+   {NULL,  0}
+};
+
 #definevchiq_read_4(reg)   \
-bus_space_read_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, reg)
+bus_space_read_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, (reg) + \
+bcm_vchiq_sc->regs_offset)
 #definevchiq_write_4(reg, val) \
-bus_space_write_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, reg, val)
+bus_space_write_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, (reg) + \
+bcm_vchiq_sc->regs_offset, val)
 
 /* 
  * Extern functions */
@@ -122,12 +133,11 @@ static int
 bcm_vchiq_probe(device_t dev)
 {
 
-   if (ofw_bus_is_compatible(dev, "broadcom,bcm2835-vchiq")) {
-   device_set_desc(dev, "BCM2835 VCHIQ");
-   return(BUS_PROBE_DEFAULT);
-   }
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
+   return (ENXIO);
 
-   return (ENXIO);
+   device_set_desc(dev, "BCM2835 VCHIQ");
+   return (BUS_PROBE_DEFAULT);
 }
 
 static int
@@ -157,6 +167,9 @@ bcm_vchiq_attach(device_t dev)
return (ENXIO);
}
 
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 
UPSTREAM_DTB)
+   sc->regs_offset = -0x40;
+
node = ofw_bus_get_node(dev);
if ((OF_getencprop(node, "cache-line-size", , sizeof(cell))) > 0)
g_cache_line_size = cell;
___
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: r307093 - head/sys/arm/broadcom/bcm2835

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 03:07:49 2016
New Revision: 307093
URL: https://svnweb.freebsd.org/changeset/base/307093

Log:
  Make BCM283x USB driver compatible with upstream DT
  
  - Make resource allocation logic depend on compatibility string
  to check what format of DTS node should be used - FreeBSD's or upstream

Modified:
  head/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c

Modified: head/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c
==
--- head/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c Wed Oct 12 03:06:05 
2016(r307092)
+++ head/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c Wed Oct 12 03:07:49 
2016(r307093)
@@ -51,6 +51,12 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-usb",1},
+   {"brcm,bcm2708-usb",1},
+   {NULL,  0}
+};
+
 static device_probe_t bcm283x_dwc_otg_probe;
 static device_attach_t bcm283x_dwc_otg_attach;
 
@@ -61,7 +67,7 @@ bcm283x_dwc_otg_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-usb"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "DWC OTG 2.0 integrated USB controller (bcm283x)");
___
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: r307092 - head/sys/arm/broadcom/bcm2835

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 03:06:05 2016
New Revision: 307092
URL: https://svnweb.freebsd.org/changeset/base/307092

Log:
  Make BCM2835 GPIO driver compatible with upstream DT
  
  - Add compatibility string
  - Make reserverd and read-only properties optional

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed Oct 12 03:03:55 
2016(r307091)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed Oct 12 03:06:05 
2016(r307092)
@@ -82,8 +82,6 @@ static struct resource_spec bcm_gpio_res
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 0, RF_ACTIVE },  /* bank 0 interrupt */
{ SYS_RES_IRQ, 1, RF_ACTIVE },  /* bank 1 interrupt */
-   { SYS_RES_IRQ, 2, RF_ACTIVE },  /* bank 1 interrupt (mirrored) */
-   { SYS_RES_IRQ, 3, RF_ACTIVE },  /* bank 0-1 interrupt (united) */
{ -1, 0, 0 }
 };
 
@@ -159,6 +157,12 @@ enum bcm_gpio_pud {
 #defineBCM_GPIO_GPPUD(_bank)   (0x94)  /* Pin Pull 
up/down */
 #defineBCM_GPIO_GPPUDCLK(_bank) (0x98 + _bank * 4) /* Pin Pull up 
clock */
 
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-gpio",   1},
+   {"brcm,bcm2835-gpio",   1},
+   {NULL,  0}
+};
+
 static struct bcm_gpio_softc *bcm_gpio_sc = NULL;
 
 #ifdef INTRNG
@@ -672,11 +676,11 @@ bcm_gpio_get_reserved_pins(struct bcm_gp
phandle_t gpio, node, reserved;
ssize_t len;
 
-   /* Get read-only pins. */
+   /* Get read-only pins if they're porvided */
gpio = ofw_bus_get_node(sc->sc_dev);
if (bcm_gpio_get_ro_pins(sc, gpio, "broadcom,read-only",
"read-only") != 0)
-   return (-1);
+   return (0);
/* Traverse the GPIO subnodes to find the reserved pins node. */
reserved = 0;
node = OF_child(gpio);
@@ -742,7 +746,7 @@ bcm_gpio_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-gpio"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "BCM2708/2835 GPIO controller");
___
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: r307091 - head/sys/arm/broadcom/bcm2835

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 03:03:55 2016
New Revision: 307091
URL: https://svnweb.freebsd.org/changeset/base/307091

Log:
  Add compatibility string from upstream DT

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cWed Oct 12 03:03:43 
2016(r307090)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cWed Oct 12 03:03:55 
2016(r307091)
@@ -92,6 +92,12 @@ struct bcm_mbox_softc {
 #definembox_write_4(sc, reg, val)  \
 bus_space_write_4((sc)->bst, (sc)->bsh, reg, val)
 
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-mbox",   1},
+   {"brcm,bcm2835-mbox",   1},
+   {NULL,  0}
+};
+
 static int
 bcm_mbox_read_msg(struct bcm_mbox_softc *sc, int *ochan)
 {
@@ -138,12 +144,12 @@ bcm_mbox_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (ofw_bus_is_compatible(dev, "broadcom,bcm2835-mbox")) {
-   device_set_desc(dev, "BCM2835 VideoCore Mailbox");
-   return(BUS_PROBE_DEFAULT);
-   }
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
+   return (ENXIO);
+
+   device_set_desc(dev, "BCM2835 VideoCore Mailbox");
 
-   return (ENXIO);
+   return (BUS_PROBE_DEFAULT);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307089 - head/sys/arm/broadcom/bcm2835

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 03:03:05 2016
New Revision: 307089
URL: https://svnweb.freebsd.org/changeset/base/307089

Log:
  Make framebuffer driver compatible with upstream DT
  
  - Add compatibility string
  - Add simplebus as possible parent bus

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
  head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Wed Oct 12 03:00:42 2016
(r307088)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Wed Oct 12 03:03:05 2016
(r307089)
@@ -111,6 +111,12 @@ struct bcmsc_softc {
 
 static struct bcmsc_softc bcmsc;
 
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-fb", 1},
+   {"brcm,bcm2708-fb", 1},
+   {NULL,  0}
+};
+
 static int bcm_fb_probe(device_t);
 static int bcm_fb_attach(device_t);
 static void bcmfb_update_margins(video_adapter_t *adp);
@@ -121,8 +127,9 @@ bcm_fb_probe(device_t dev)
 {
int error;
 
-   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-fb"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
+
device_set_desc(dev, "BCM2835 framebuffer device");
error = sc_probe_unit(device_get_unit(dev), 
device_get_flags(dev) | SC_AUTODETECT_KBD);
@@ -196,6 +203,7 @@ static driver_t bcm_fb_driver = {
 };
 
 DRIVER_MODULE(bcm2835fb, ofwbus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
+DRIVER_MODULE(bcm2835fb, simplebus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
 
 /*
  * Video driver routines and glue.

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed Oct 12 03:00:42 2016
(r307088)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed Oct 12 03:03:05 2016
(r307089)
@@ -65,6 +65,12 @@ struct bcmsc_softc {
device_tdev;
 };
 
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-fb", 1},
+   {"brcm,bcm2708-fb", 1},
+   {NULL,  0}
+};
+
 static int bcm_fb_probe(device_t);
 static int bcm_fb_attach(device_t);
 
@@ -191,7 +197,8 @@ bcm_fb_sysctl_init(struct bcmsc_softc *s
 static int
 bcm_fb_probe(device_t dev)
 {
-   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-fb"))
+
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "BCM2835 VT framebuffer driver");
@@ -265,3 +272,4 @@ static driver_t bcm_fb_driver = {
 };
 
 DRIVER_MODULE(bcm2835fb, ofwbus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
+DRIVER_MODULE(bcm2835fb, simplebus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307088 - head/sys/arm/broadcom/bcm2835

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 03:00:42 2016
New Revision: 307088
URL: https://svnweb.freebsd.org/changeset/base/307088

Log:
  Add compatible strings used in upstream dts files

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
  head/sys/arm/broadcom/bcm2835/bcm2835_dma.c
  head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
  head/sys/arm/broadcom/bcm2835/bcm2835_spi.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Wed Oct 12 02:58:27 2016
(r307087)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Wed Oct 12 03:00:42 2016
(r307088)
@@ -52,6 +52,12 @@ __FBSDID("$FreeBSD$");
 
 #include "iicbus_if.h"
 
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-bsc",1},
+   {"brcm,bcm2708-i2c",1},
+   {NULL,  0}
+};
+
 static void bcm_bsc_intr(void *);
 static int bcm_bsc_detach(device_t);
 
@@ -214,7 +220,7 @@ bcm_bsc_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-bsc"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "BCM2708/2835 BSC controller");

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Wed Oct 12 02:58:27 2016
(r307087)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Wed Oct 12 03:00:42 2016
(r307088)
@@ -152,6 +152,12 @@ struct bcm_dma_softc {
 static struct bcm_dma_softc *bcm_dma_sc = NULL;
 static uint32_t bcm_dma_channel_mask;
 
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-dma",1},
+   {"brcm,bcm2835-dma",1},
+   {NULL,  0}
+};
+
 static void
 bcm_dmamap_cb(void *arg, bus_dma_segment_t *segs,
int nseg, int err)
@@ -656,7 +662,7 @@ bcm_dma_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-dma"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "BCM2835 DMA Controller");

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c   Wed Oct 12 02:58:27 
2016(r307087)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c   Wed Oct 12 03:00:42 
2016(r307088)
@@ -71,6 +71,12 @@ __FBSDID("$FreeBSD$");
 static int bcm2835_sdhci_hs = 1;
 static int bcm2835_sdhci_pio_mode = 0;
 
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-sdhci",  1},
+   {"brcm,bcm2835-mmc",1},
+   {NULL,  0}
+};
+
 TUNABLE_INT("hw.bcm2835.sdhci.hs", _sdhci_hs);
 TUNABLE_INT("hw.bcm2835.sdhci.pio_mode", _sdhci_pio_mode);
 
@@ -126,10 +132,11 @@ bcm_sdhci_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-sdhci"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "Broadcom 2708 SDHCI controller");
+
return (BUS_PROBE_DEFAULT);
 }
 

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_spi.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_spi.c Wed Oct 12 02:58:27 2016
(r307087)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_spi.c Wed Oct 12 03:00:42 2016
(r307088)
@@ -56,6 +56,12 @@ __FBSDID("$FreeBSD$");
 
 #include "spibus_if.h"
 
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-spi",1},
+   {"brcm,bcm2835-spi",1},
+   {NULL,  0}
+};
+
 static void bcm_spi_intr(void *);
 
 #ifdef BCM_SPI_DEBUG
@@ -231,7 +237,7 @@ bcm_spi_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-spi"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "BCM2708/2835 SPI controller");
___
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: r307087 - head/sys/arm/broadcom/bcm2835

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Oct 12 02:58:27 2016
New Revision: 307087
URL: https://svnweb.freebsd.org/changeset/base/307087

Log:
  Make sure intc is attached before interrupt consumers
  
  If pass order is not specified devices are attached in the order they are
  defined in dts. Some interrupt consumers may be defined before intc. Also
  make sure intc interrupt-parent local_intc is attached before intc itself.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_intr.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_intr.cWed Oct 12 02:55:24 
2016(r307086)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.cWed Oct 12 02:58:27 
2016(r307087)
@@ -468,7 +468,8 @@ static driver_t bcm_intc_driver = {
 
 static devclass_t bcm_intc_devclass;
 
-DRIVER_MODULE(intc, simplebus, bcm_intc_driver, bcm_intc_devclass, 0, 0);
+EARLY_DRIVER_MODULE(intc, simplebus, bcm_intc_driver, bcm_intc_devclass,
+0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
 
 #ifndef INTRNG
 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: r307086 - in stable/10/sys: conf dev/hyperv/vmbus modules/hyperv/vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 02:55:24 2016
New Revision: 307086
URL: https://svnweb.freebsd.org/changeset/base/307086

Log:
  MFC 303023
  
  hyperv/vmbus: Rename laundered vmbus channel code
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7232

Added:
  stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c
 - copied unchanged from r303023, head/sys/dev/hyperv/vmbus/vmbus_chan.c
Deleted:
  stable/10/sys/dev/hyperv/vmbus/hv_channel.c
Modified:
  stable/10/sys/conf/files.amd64
  stable/10/sys/conf/files.i386
  stable/10/sys/modules/hyperv/vmbus/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files.amd64
==
--- stable/10/sys/conf/files.amd64  Wed Oct 12 02:47:31 2016
(r307085)
+++ stable/10/sys/conf/files.amd64  Wed Oct 12 02:55:24 2016
(r307086)
@@ -271,11 +271,11 @@ dev/hyperv/utilities/hv_kvp.c 
optiona
 dev/hyperv/utilities/hv_shutdown.c optionalhyperv
 dev/hyperv/utilities/hv_timesync.c optionalhyperv
 dev/hyperv/utilities/hv_util.c optionalhyperv
-dev/hyperv/vmbus/hv_channel.c  optionalhyperv
 dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv
+dev/hyperv/vmbus/vmbus_chan.c  optionalhyperv
 dev/hyperv/vmbus/vmbus_et.coptionalhyperv
 dev/hyperv/vmbus/vmbus_if.moptionalhyperv
 dev/hyperv/vmbus/amd64/hyperv_machdep.coptional
hyperv

Modified: stable/10/sys/conf/files.i386
==
--- stable/10/sys/conf/files.i386   Wed Oct 12 02:47:31 2016
(r307085)
+++ stable/10/sys/conf/files.i386   Wed Oct 12 02:55:24 2016
(r307086)
@@ -248,11 +248,11 @@ dev/hyperv/utilities/hv_kvp.c 
optiona
 dev/hyperv/utilities/hv_shutdown.c optionalhyperv
 dev/hyperv/utilities/hv_timesync.c optionalhyperv
 dev/hyperv/utilities/hv_util.c optionalhyperv
-dev/hyperv/vmbus/hv_channel.c  optionalhyperv
 dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv
+dev/hyperv/vmbus/vmbus_chan.c  optionalhyperv
 dev/hyperv/vmbus/vmbus_et.coptionalhyperv
 dev/hyperv/vmbus/vmbus_if.moptionalhyperv
 dev/hyperv/vmbus/i386/hyperv_machdep.c optionalhyperv

Copied: stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c (from r303023, 
head/sys/dev/hyperv/vmbus/vmbus_chan.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 12 02:55:24 2016
(r307086, copy of r303023, head/sys/dev/hyperv/vmbus/vmbus_chan.c)
@@ -0,0 +1,1380 @@
+/*-
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
+ * Copyright (c) 2012 NetApp Inc.
+ * Copyright (c) 2012 Citrix Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN 

Re: svn commit: r307072 - in head/usr.sbin: . efivar

2016-10-11 Thread Warner Losh
On Tue, Oct 11, 2016 at 5:19 PM, Shawn Webb  wrote:
> On Tue, Oct 11, 2016 at 05:13:24PM -0600, Warner Losh wrote:
>> On Tue, Oct 11, 2016 at 5:11 PM, Shawn Webb  
>> wrote:
>> > On Tue, Oct 11, 2016 at 10:31:46PM +, Warner Losh wrote:
>> >> Author: imp
>> >> Date: Tue Oct 11 22:31:45 2016
>> >> New Revision: 307072
>> >> URL: https://svnweb.freebsd.org/changeset/base/307072
>> >>
>> >> Log:
>> >>   Add efivar(1) to manipulate EFI variables. It uses a similar command
>> >>   line interface to the Linux program, as well as adding a number of
>> >>   useful features to make using it in shell scripts easier (since we
>> >>   don't have a filesystem to fall back on interacting with).
>> >>
>> >>   Differential Revision: https://reviews.freebsd.org/D8128
>> >>   Reviewed by: kib@, wblock@, Ganael Laplanche
>> >>
>> >> Added:
>> >>   head/usr.sbin/efivar/
>> >>   head/usr.sbin/efivar/Makefile   (contents, props changed)
>> >>   head/usr.sbin/efivar/efivar.8   (contents, props changed)
>> >>   head/usr.sbin/efivar/efivar.c   (contents, props changed)
>> >> Modified:
>> >>   head/usr.sbin/Makefile
>> >
>> > The commit log says efivar(1), but the manpage is efivar(8). Maybe 1 is
>> > a typo?
>>
>> (1) is a typo :(
>
> No worries. Thanks for the quick response. I just wanted to make sure
> that it was supposed to be 8 versus the 1 in the log.
>
> Good to see a program like this in base. Good work.

Next up: corrected EFI variable support in the boot loader, and
efibootmgr from Linux in ports...

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


svn commit: r307084 - in stable/10/sys/dev/hyperv: include netvsc storvsc utilities vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 02:45:30 2016
New Revision: 307084
URL: https://svnweb.freebsd.org/changeset/base/307084

Log:
  MFC 302888-302892,302986,303020-303022
  
  302888
  hyperv/hn: Busdma-fy rxbuf and chimney sending buffer
  
  Nuke unused channel GPADL API.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7211
  
  302889
  hyperv/vmbus: Back out r302888 temporarily
  
  Committed by accident w/ duplicated commit log
  
  Sponsored by:   Microsoft OSTC
  
  302890
  hyperv/vmbus: Function rename
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7212
  
  302891
  hyperv/vmbus: Cosmetic vmbus channel close cleanup
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7213
  
  302892
  hyperv/vmbus: Cleanup channel sysctl tree creation
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7214
  
  302986
  hyperv/vmbus: Cosmetic vmbus channel open cleanup
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7217
  
  303020
  hyperv/vmbus: Cleanup cpu based channel selection.
  
  And create cpu to channel map at device attach time for storvsc(4).
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7229
  
  303021
  hyperv/vmbus: Function rename
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7230
  
  303022
  hyperv/vmbus: Temp/internal variable/function rename
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7231

Modified:
  stable/10/sys/dev/hyperv/include/hyperv.h
  stable/10/sys/dev/hyperv/include/vmbus.h
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
  stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/utilities/hv_util.c
  stable/10/sys/dev/hyperv/vmbus/hv_channel.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/include/hyperv.h
==
--- stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 02:30:33 2016
(r307083)
+++ stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 02:45:30 2016
(r307084)
@@ -267,42 +267,6 @@ typedef struct hv_vmbus_channel {
 #define VMBUS_CHAN_ST_OPENED_SHIFT 0
 #define VMBUS_CHAN_ST_OPENED   (1 << VMBUS_CHAN_ST_OPENED_SHIFT)
 
-static inline void
-hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on)
-{
-   if (!on)
-   channel->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD;
-   else
-   channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD;
-}
-
-inthv_vmbus_channel_open(
-   hv_vmbus_channel*   channel,
-   uint32_tsend_ring_buffer_size,
-   uint32_trecv_ring_buffer_size,
-   void*   user_data,
-   uint32_tuser_data_len,
-   vmbus_chan_callback_t   cb,
-   void*cbarg);
-
-void   hv_vmbus_channel_close(hv_vmbus_channel *channel);
-
-inthv_vmbus_channel_teardown_gpdal(
-   hv_vmbus_channel*   channel,
-   uint32_tgpadl_handle);
-
-intvmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan,
-   bus_addr_t paddr, int size, uint32_t *gpadl);
-
-struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel 
*promary);
-
-void   vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu);
-void   vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan);
-struct hv_vmbus_channel **
-   vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int 
subchan_cnt);
-void   vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int 
subchan_cnt);
-void   vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan);
-
 /**
  * @brief Get physical address from virtual
  */

Modified: stable/10/sys/dev/hyperv/include/vmbus.h
==
--- stable/10/sys/dev/hyperv/include/vmbus.hWed Oct 12 02:30:33 2016
(r307083)
+++ stable/10/sys/dev/hyperv/include/vmbus.hWed Oct 12 02:45:30 2016
(r307084)
@@ -89,6 +89,27 @@ struct vmbus_chanpkt_rxbuf {
 
 struct hv_vmbus_channel;
 
+intvmbus_chan_open(struct hv_vmbus_channel *chan,
+   int txbr_size, int rxbr_size, const void *udata, int udlen,

Re: svn commit: r307083 - head/sys/netinet

2016-10-11 Thread Jonathan Looney
On Tue, Oct 11, 2016 at 10:30 PM, Jonathan T. Looney 
wrote:

> Author: jtl
> Date: Wed Oct 12 02:30:33 2016
> New Revision: 307083
> URL: https://svnweb.freebsd.org/changeset/base/307083
>
> Log:
>   Currently, when tcp_input() receives a packet on a session that matches a
>   TCPCB, it checks (so->so_options & SO_ACCEPTCONN) to determine whether or
>   not the socket is a listening socket. However, this causes the code to
>   access a different cacheline. If we first check if the socket is in the
>   LISTEN state, we can avoid accessing so->so_options when processing
> packets
>   received for ESTABLISHED sessions.
>
>   If INVARIANTS is defined, the code still needs to access both variables
> to
>   check that so->so_options is consistent with the state.
>
>   Reviewed by:  gallatin
>   MFC after:1 week
>   Sponsored by: Netflix
>

This should have also noted:
Differential Revision: https://reviews.freebsd.org/D8221

Sorry for the omission!

Jonathan
___
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: r307083 - head/sys/netinet

2016-10-11 Thread Jonathan T. Looney
Author: jtl
Date: Wed Oct 12 02:30:33 2016
New Revision: 307083
URL: https://svnweb.freebsd.org/changeset/base/307083

Log:
  Currently, when tcp_input() receives a packet on a session that matches a
  TCPCB, it checks (so->so_options & SO_ACCEPTCONN) to determine whether or
  not the socket is a listening socket. However, this causes the code to
  access a different cacheline. If we first check if the socket is in the
  LISTEN state, we can avoid accessing so->so_options when processing packets
  received for ESTABLISHED sessions.
  
  If INVARIANTS is defined, the code still needs to access both variables to
  check that so->so_options is consistent with the state.
  
  Reviewed by:  gallatin
  MFC after:1 week
  Sponsored by: Netflix

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cWed Oct 12 02:16:42 2016
(r307082)
+++ head/sys/netinet/tcp_input.cWed Oct 12 02:30:33 2016
(r307083)
@@ -1071,11 +1071,11 @@ relocked:
 * state) we look into the SYN cache if this is a new connection
 * attempt or the completion of a previous one.
 */
-   if (so->so_options & SO_ACCEPTCONN) {
+   KASSERT(tp->t_state == TCPS_LISTEN || !(so->so_options & SO_ACCEPTCONN),
+   ("%s: so accepting but tp %p not listening", __func__, tp));
+   if (tp->t_state == TCPS_LISTEN && (so->so_options & SO_ACCEPTCONN)) {
struct in_conninfo inc;
 
-   KASSERT(tp->t_state == TCPS_LISTEN, ("%s: so accepting but "
-   "tp not listening", __func__));
bzero(, sizeof(inc));
 #ifdef INET6
if (isipv6) {
___
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: r307082 - in head: . sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/mips/conf sys/modules/cc sys/modules/khelp sys/netinet sys/netinet/tcp_stacks sys/pc98/conf sy...

2016-10-11 Thread Jonathan T. Looney
Author: jtl
Date: Wed Oct 12 02:16:42 2016
New Revision: 307082
URL: https://svnweb.freebsd.org/changeset/base/307082

Log:
  In the TCP stack, the hhook(9) framework provides hooks for kernel modules
  to add actions that run when a TCP frame is sent or received on a TCP
  session in the ESTABLISHED state. In the base tree, this functionality is
  only used for the h_ertt module, which is used by the cc_cdg, cc_chd, cc_hd,
  and cc_vegas congestion control modules.
  
  Presently, we incur overhead to check for hooks each time a TCP frame is
  sent or received on an ESTABLISHED TCP session.
  
  This change adds a new compile-time option (TCP_HHOOK) to determine whether
  to include the hhook(9) framework for TCP. To retain backwards
  compatibility, I added the TCP_HHOOK option to every configuration file that
  already defined "options INET". (Therefore, this patch introduces no
  functional change. In order to see a functional difference, you need to
  compile a custom kernel without the TCP_HHOOK option.) This change will
  allow users to easily exclude this functionality from their kernel, should
  they wish to do so.
  
  Note that any users who use a custom kernel configuration and use one of the
  congestion control modules listed above will need to add the TCP_HHOOK
  option to their kernel configuration.
  
  Reviewed by:  rrs, lstewart, hiren (previous version), sjg (makefiles only)
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D8185

Modified:
  head/UPDATING
  head/sys/amd64/conf/GENERIC
  head/sys/arm/conf/ATMEL
  head/sys/arm/conf/AVILA
  head/sys/arm/conf/BWCT
  head/sys/arm/conf/CAMBRIA
  head/sys/arm/conf/CNS11XXNAS
  head/sys/arm/conf/CRB
  head/sys/arm/conf/DB-78XXX
  head/sys/arm/conf/DB-88F5XXX
  head/sys/arm/conf/DB-88F6XXX
  head/sys/arm/conf/DOCKSTAR
  head/sys/arm/conf/DREAMPLUG-1001
  head/sys/arm/conf/EA3250
  head/sys/arm/conf/EB9200
  head/sys/arm/conf/ETHERNUT5
  head/sys/arm/conf/EXYNOS5.common
  head/sys/arm/conf/GUMSTIX
  head/sys/arm/conf/HL200
  head/sys/arm/conf/HL201
  head/sys/arm/conf/KB920X
  head/sys/arm/conf/NSLU
  head/sys/arm/conf/QILA9G20
  head/sys/arm/conf/SAM9260EK
  head/sys/arm/conf/SAM9G20EK
  head/sys/arm/conf/SAM9X25EK
  head/sys/arm/conf/SHEEVAPLUG
  head/sys/arm/conf/SN9G45
  head/sys/arm/conf/TS7800
  head/sys/arm/conf/std.armv6
  head/sys/arm64/conf/GENERIC
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/i386/conf/GENERIC
  head/sys/mips/conf/ADM5120
  head/sys/mips/conf/ALCHEMY
  head/sys/mips/conf/AR71XX_BASE
  head/sys/mips/conf/AR724X_BASE
  head/sys/mips/conf/BCM
  head/sys/mips/conf/BERI_TEMPLATE
  head/sys/mips/conf/ERL
  head/sys/mips/conf/GXEMUL
  head/sys/mips/conf/GXEMUL32
  head/sys/mips/conf/IDT
  head/sys/mips/conf/MT7620
  head/sys/mips/conf/OCTEON1
  head/sys/mips/conf/PB92
  head/sys/mips/conf/QCA953X_BASE
  head/sys/mips/conf/QEMU
  head/sys/mips/conf/RT305X
  head/sys/mips/conf/RT5350
  head/sys/mips/conf/SENTRY5
  head/sys/mips/conf/XLR
  head/sys/mips/conf/XLR64
  head/sys/mips/conf/XLRN32
  head/sys/mips/conf/std.AR5312
  head/sys/mips/conf/std.AR5315
  head/sys/mips/conf/std.AR91XX
  head/sys/mips/conf/std.AR933X
  head/sys/mips/conf/std.AR934X
  head/sys/mips/conf/std.MALTA
  head/sys/mips/conf/std.QCA955X
  head/sys/mips/conf/std.SWARM
  head/sys/mips/conf/std.XLP
  head/sys/modules/cc/Makefile
  head/sys/modules/khelp/Makefile
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_stacks/fastpath.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_var.h
  head/sys/pc98/conf/GENERIC
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/GENERIC64
  head/sys/powerpc/conf/MPC85XX
  head/sys/riscv/conf/GENERIC
  head/sys/sparc64/conf/GENERIC

Modified: head/UPDATING
==
--- head/UPDATING   Wed Oct 12 02:15:06 2016(r307081)
+++ head/UPDATING   Wed Oct 12 02:16:42 2016(r307082)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20161008:
+   Use of the cc_cdg, cc_chd, cc_hd, or cc_vegas congestion control
+   modules now requires that the kernel configuration contain the
+   TCP_HHOOK option. (This option is included in the GENERIC kernel.)
+
 20161003:
The WITHOUT_ELFCOPY_AS_OBJCOPY src.conf(5) knob has been retired.
ELF Tool Chain's elfcopy is always installed as /usr/bin/objcopy.

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Wed Oct 12 02:15:06 2016(r307081)
+++ head/sys/amd64/conf/GENERIC Wed Oct 12 02:16:42 2016(r307082)
@@ -30,6 +30,7 @@ options   INET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 

svn commit: r307081 - in stable/10/sys/dev/hyperv: include netvsc vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 02:15:06 2016
New Revision: 307081
URL: https://svnweb.freebsd.org/changeset/base/307081

Log:
  MFC 302887
  
  hyperv/hn: Busdma-fy rxbuf and chimney sending buffer
  
  Nuke unused channel GPADL API.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7211

Modified:
  stable/10/sys/dev/hyperv/include/hyperv.h
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h
  stable/10/sys/dev/hyperv/vmbus/hv_channel.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/include/hyperv.h
==
--- stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 02:09:53 2016
(r307080)
+++ stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 02:15:06 2016
(r307081)
@@ -287,14 +287,6 @@ inthv_vmbus_channel_open(
 
 void   hv_vmbus_channel_close(hv_vmbus_channel *channel);
 
-inthv_vmbus_channel_establish_gpadl(
-   hv_vmbus_channel*   channel,
-   /* must be phys and virt contiguous */
-   void*   contig_buffer,
-   /*  page-size multiple  */
-   uint32_tsize,
-   uint32_t*   gpadl_handle);
-
 inthv_vmbus_channel_teardown_gpdal(
hv_vmbus_channel*   channel,
uint32_tgpadl_handle);

Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.cWed Oct 12 02:09:53 
2016(r307080)
+++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.cWed Oct 12 02:15:06 
2016(r307081)
@@ -151,19 +151,27 @@ hv_nv_init_rx_buffer_with_net_vsp(struct
return (ENODEV);
}
 
-   net_dev->rx_buf = contigmalloc(net_dev->rx_buf_size, M_NETVSC,
-   M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0);
+   net_dev->rx_buf = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev),
+   PAGE_SIZE, 0, net_dev->rx_buf_size, _dev->rxbuf_dma,
+   BUS_DMA_WAITOK | BUS_DMA_ZERO);
+   if (net_dev->rx_buf == NULL) {
+   device_printf(sc->hn_dev, "allocate rxbuf failed\n");
+   return ENOMEM;
+   }
 
/*
-* Establish the GPADL handle for this buffer on this channel.
-* Note:  This call uses the vmbus connection rather than the
-* channel to establish the gpadl handle. 
-* GPADL:  Guest physical address descriptor list.
-*/
-   ret = hv_vmbus_channel_establish_gpadl(
-   sc->hn_prichan, net_dev->rx_buf,
-   net_dev->rx_buf_size, _dev->rx_buf_gpadl_handle);
+* Connect the RXBUF GPADL to the primary channel.
+*
+* NOTE:
+* Only primary channel has RXBUF connected to it.  Sub-channels
+* just share this RXBUF.
+*/
+   ret = vmbus_chan_gpadl_connect(sc->hn_prichan,
+   net_dev->rxbuf_dma.hv_paddr, net_dev->rx_buf_size,
+   _dev->rx_buf_gpadl_handle);
if (ret != 0) {
+   device_printf(sc->hn_dev, "rxbuf gpadl connect failed: %d\n",
+   ret);
goto cleanup;
}

@@ -242,22 +250,27 @@ hv_nv_init_send_buffer_with_net_vsp(stru
return (ENODEV);
}
 
-   net_dev->send_buf  = contigmalloc(net_dev->send_buf_size, M_NETVSC,
-   M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0);
+   net_dev->send_buf = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev),
+   PAGE_SIZE, 0, net_dev->send_buf_size, _dev->txbuf_dma,
+   BUS_DMA_WAITOK | BUS_DMA_ZERO);
if (net_dev->send_buf == NULL) {
-   ret = ENOMEM;
-   goto cleanup;
+   device_printf(sc->hn_dev, "allocate chimney txbuf failed\n");
+   return ENOMEM;
}
 
/*
-* Establish the gpadl handle for this buffer on this channel.
-* Note:  This call uses the vmbus connection rather than the
-* channel to establish the gpadl handle. 
+* Connect chimney sending buffer GPADL to the primary channel.
+*
+* NOTE:
+* Only primary channel has chimney sending buffer connected to it.
+* Sub-channels just share this chimney sending buffer.
 */
-   ret = hv_vmbus_channel_establish_gpadl(sc->hn_prichan,
-   net_dev->send_buf, net_dev->send_buf_size,
+   ret = vmbus_chan_gpadl_connect(sc->hn_prichan,
+   net_dev->txbuf_dma.hv_paddr, net_dev->send_buf_size,
_dev->send_buf_gpadl_handle);
if (ret != 0) {
+   

svn commit: r307080 - in stable/10/sys/dev/hyperv: include netvsc storvsc utilities vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 02:09:53 2016
New Revision: 307080
URL: https://svnweb.freebsd.org/changeset/base/307080

Log:
  MFC 302885,302886
  
  302885
  hyperv/vmbus: Cleanup channel receiving.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7202
  
  302886
  hyperv/vmbus: Cleanup channel packet receiving.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7204

Modified:
  stable/10/sys/dev/hyperv/include/hyperv.h
  stable/10/sys/dev/hyperv/include/vmbus.h
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
  stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c
  stable/10/sys/dev/hyperv/utilities/hv_kvp.c
  stable/10/sys/dev/hyperv/utilities/hv_shutdown.c
  stable/10/sys/dev/hyperv/utilities/hv_timesync.c
  stable/10/sys/dev/hyperv/vmbus/hv_channel.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/include/hyperv.h
==
--- stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 02:03:05 2016
(r307079)
+++ stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 02:09:53 2016
(r307080)
@@ -90,28 +90,6 @@ struct hyperv_guid {
 
 inthyperv_guid2str(const struct hyperv_guid *, char *, size_t);
 
-typedef struct {
-   uint16_t type;
-   uint16_t data_offset8;
-   uint16_t length8;
-   uint16_t flags;
-   uint64_t transaction_id;
-} __packed hv_vm_packet_descriptor;
-
-typedef struct {
-   uint32_t byte_count;
-   uint32_t byte_offset;
-} __packed hv_vm_transfer_page;
-
-typedef struct {
-   hv_vm_packet_descriptor d;
-   uint16_ttransfer_page_set_id;
-   hv_bool_uint8_t sender_owns_set;
-   uint8_t reserved;
-   uint32_trange_count;
-   hv_vm_transfer_page ranges[1];
-} __packed hv_vm_transfer_page_packet_header;
-
 #define HW_MACADDR_LEN 6
 
 /*
@@ -298,20 +276,6 @@ hv_set_channel_read_state(hv_vmbus_chann
channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD;
 }
 
-inthv_vmbus_channel_recv_packet(
-   hv_vmbus_channel*   channel,
-   void*   buffer,
-   uint32_tbuffer_len,
-   uint32_t*   buffer_actual_len,
-   uint64_t*   request_id);
-
-inthv_vmbus_channel_recv_packet_raw(
-   hv_vmbus_channel*   channel,
-   void*   buffer,
-   uint32_tbuffer_len,
-   uint32_t*   buffer_actual_len,
-   uint64_t*   request_id);
-
 inthv_vmbus_channel_open(
hv_vmbus_channel*   channel,
uint32_tsend_ring_buffer_size,

Modified: stable/10/sys/dev/hyperv/include/vmbus.h
==
--- stable/10/sys/dev/hyperv/include/vmbus.hWed Oct 12 02:03:05 2016
(r307079)
+++ stable/10/sys/dev/hyperv/include/vmbus.hWed Oct 12 02:09:53 2016
(r307080)
@@ -47,6 +47,19 @@ struct vmbus_gpa {
uint64_tgpa_page;
 } __packed;
 
+#define VMBUS_CHANPKT_SIZE_SHIFT   3
+
+#define VMBUS_CHANPKT_GETLEN(pktlen)   \
+   (((int)(pktlen)) << VMBUS_CHANPKT_SIZE_SHIFT)
+
+struct vmbus_chanpkt_hdr {
+   uint16_tcph_type;   /* VMBUS_CHANPKT_TYPE_ */
+   uint16_tcph_hlen;   /* header len, in 8 bytes */
+   uint16_tcph_tlen;   /* total len, in 8 bytes */
+   uint16_tcph_flags;  /* VMBUS_CHANPKT_FLAG_ */
+   uint64_tcph_xactid;
+} __packed;
+
 #define VMBUS_CHANPKT_TYPE_INBAND  0x0006
 #define VMBUS_CHANPKT_TYPE_RXBUF   0x0007
 #define VMBUS_CHANPKT_TYPE_GPA 0x0009
@@ -54,11 +67,33 @@ struct vmbus_gpa {
 
 #define VMBUS_CHANPKT_FLAG_RC  0x0001  /* report completion */
 
+#define VMBUS_CHANPKT_CONST_DATA(pkt)  \
+   (const void *)((const uint8_t *)(pkt) + \
+   VMBUS_CHANPKT_GETLEN((pkt)->cph_hlen))
+
+struct vmbus_rxbuf_desc {
+   uint32_trb_len;
+   uint32_trb_ofs;
+} __packed;
+
+struct vmbus_chanpkt_rxbuf {
+   struct vmbus_chanpkt_hdr cp_hdr;
+   uint16_tcp_rxbuf_id;
+   uint16_tcp_rsvd;
+   uint32_tcp_rxbuf_cnt;
+   struct vmbus_rxbuf_desc cp_rxbuf[];
+} __packed;
+
 #define VMBUS_CHAN_SGLIST_MAX  32
 #define VMBUS_CHAN_PRPLIST_MAX 32
 
 struct hv_vmbus_channel;
 
+int

svn commit: r307079 - in stable/10/sys/dev/hyperv: include netvsc storvsc utilities vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 02:03:05 2016
New Revision: 307079
URL: https://svnweb.freebsd.org/changeset/base/307079

Log:
  MFC 302882-302884
  
  302882
  hyperv/vmbus: Function rename
  
  And reorder the error prone parameters list.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7191
  
  302883
  hyperv/vmbus: Field rename
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7193
  
  302884
  hyperv/vmbus: Factor out macros to do channel packet length conversion.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7194

Modified:
  stable/10/sys/dev/hyperv/include/hyperv.h
  stable/10/sys/dev/hyperv/include/vmbus.h
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
  stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c
  stable/10/sys/dev/hyperv/utilities/hv_kvp.c
  stable/10/sys/dev/hyperv/utilities/hv_shutdown.c
  stable/10/sys/dev/hyperv/utilities/hv_timesync.c
  stable/10/sys/dev/hyperv/vmbus/hv_channel.c
  stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/include/hyperv.h
==
--- stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 01:52:29 2016
(r307078)
+++ stable/10/sys/dev/hyperv/include/hyperv.h   Wed Oct 12 02:03:05 2016
(r307079)
@@ -323,14 +323,6 @@ inthv_vmbus_channel_open(
 
 void   hv_vmbus_channel_close(hv_vmbus_channel *channel);
 
-inthv_vmbus_channel_send_packet(
-   hv_vmbus_channel*   channel,
-   void*   buffer,
-   uint32_tbuffer_len,
-   uint64_trequest_id,
-   uint16_ttype,
-   uint16_tflags);
-
 inthv_vmbus_channel_establish_gpadl(
hv_vmbus_channel*   channel,
/* must be phys and virt contiguous */

Modified: stable/10/sys/dev/hyperv/include/vmbus.h
==
--- stable/10/sys/dev/hyperv/include/vmbus.hWed Oct 12 01:52:29 2016
(r307078)
+++ stable/10/sys/dev/hyperv/include/vmbus.hWed Oct 12 02:03:05 2016
(r307079)
@@ -59,6 +59,8 @@ struct vmbus_gpa {
 
 struct hv_vmbus_channel;
 
+intvmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type,
+   uint16_t flags, void *data, int dlen, uint64_t xactid);
 intvmbus_chan_send_sglist(struct hv_vmbus_channel *chan,
struct vmbus_gpa sg[], int sglen, void *data, int dlen,
uint64_t xactid);

Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.cWed Oct 12 01:52:29 
2016(r307078)
+++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.cWed Oct 12 02:03:05 
2016(r307079)
@@ -182,9 +182,9 @@ hv_nv_init_rx_buffer_with_net_vsp(struct
 
/* Send the gpadl notification request */
 
-   ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt,
-   sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
-   VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC);
+   ret = vmbus_chan_send(sc->hn_prichan,
+   VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+   init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt);
if (ret != 0) {
goto cleanup;
}
@@ -275,9 +275,9 @@ hv_nv_init_send_buffer_with_net_vsp(stru
 
/* Send the gpadl notification request */
 
-   ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt,
-   sizeof(nvsp_msg), (uint64_t)init_pkt,
-   VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC);
+   ret = vmbus_chan_send(sc->hn_prichan,
+   VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
+   init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt);
if (ret != 0) {
goto cleanup;
}
@@ -334,10 +334,9 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_
revoke_pkt->msgs.vers_1_msgs.revoke_rx_buf.id =
NETVSC_RECEIVE_BUFFER_ID;
 
-   ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan,
-   revoke_pkt, sizeof(nvsp_msg),
-   (uint64_t)(uintptr_t)revoke_pkt,
-   VMBUS_CHANPKT_TYPE_INBAND, 0);
+   ret = vmbus_chan_send(net_dev->sc->hn_prichan,
+   VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, 

svn commit: r307078 - head/sys/net

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Oct 12 01:52:29 2016
New Revision: 307078
URL: https://svnweb.freebsd.org/changeset/base/307078

Log:
  ifnet: Use if_link_state snapshot to invoke ifnet_link_event
  
  So that everyone in this task have consistent view of link state.
  
  Reviewed by:  ae
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8214

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Wed Oct 12 01:21:18 2016(r307077)
+++ head/sys/net/if.c   Wed Oct 12 01:52:29 2016(r307078)
@@ -2206,7 +2206,7 @@ do_link_state_change(void *arg, int pend
if (log_link_state_change)
log(LOG_NOTICE, "%s: link state changed to %s\n", ifp->if_xname,
(link_state == LINK_STATE_UP) ? "UP" : "DOWN" );
-   EVENTHANDLER_INVOKE(ifnet_link_event, ifp, ifp->if_link_state);
+   EVENTHANDLER_INVOKE(ifnet_link_event, ifp, link_state);
CURVNET_RESTORE();
 }
 
___
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: r307076 - head/sys/kern

2016-10-11 Thread Ed Maste
Author: emaste
Date: Wed Oct 12 00:56:49 2016
New Revision: 307076
URL: https://svnweb.freebsd.org/changeset/base/307076

Log:
  Use correct size type in do_setopt_accept_filter
  
  Submitted by: ect...@gmail.com

Modified:
  head/sys/kern/uipc_accf.c

Modified: head/sys/kern/uipc_accf.c
==
--- head/sys/kern/uipc_accf.c   Wed Oct 12 00:42:46 2016(r307075)
+++ head/sys/kern/uipc_accf.c   Wed Oct 12 00:56:49 2016(r307076)
@@ -250,7 +250,7 @@ do_setopt_accept_filter(struct socket *s
newaf = malloc(sizeof(*newaf), M_ACCF, M_WAITOK |
M_ZERO);
if (afp->accf_create != NULL && afap->af_name[0] != '\0') {
-   int len = strlen(afap->af_name) + 1;
+   size_t len = strlen(afap->af_name) + 1;
newaf->so_accept_filter_str = malloc(len, M_ACCF,
M_WAITOK);
strcpy(newaf->so_accept_filter_str, afap->af_name);
___
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: r307075 - head/share/mk

2016-10-11 Thread Jonathan Anderson
Author: jonathan
Date: Wed Oct 12 00:42:46 2016
New Revision: 307075
URL: https://svnweb.freebsd.org/changeset/base/307075

Log:
  Extract suffix rules into bsd.suffixes[-posix].mk.
  
  Refactor make suffix rules into separate files (one for POSIX and one not),
  and rationalise the rules so that bsd.lib.mk can contain only those rules
  that are library-specific (.c.po and .c.pico).
  
  This can be accomplished by adding ${STATIC_CFLAGS} to the .c.o rule
  unconditionally. STATIC_CFLAGS are only defined for use by sys.mk rules in
  lib/libpam/Makefile.inc (see r227797), so it should be safe to include
  them unconditionally in sys.mk's .c.o rule (tested by make universe and a
  ports exp-run).
  
  Reviewed by:  bdrewery, sjg
  Approved by:  rwatson (mentor)
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D6805

Added:
  head/share/mk/bsd.suffixes-posix.mk   (contents, props changed)
  head/share/mk/bsd.suffixes.mk   (contents, props changed)
Modified:
  head/share/mk/Makefile
  head/share/mk/bsd.lib.mk
  head/share/mk/sys.mk

Modified: head/share/mk/Makefile
==
--- head/share/mk/Makefile  Tue Oct 11 22:54:29 2016(r307074)
+++ head/share/mk/Makefile  Wed Oct 12 00:42:46 2016(r307075)
@@ -49,6 +49,8 @@ FILES=\
bsd.progs.mk \
bsd.snmpmod.mk \
bsd.subdir.mk \
+   bsd.suffixes-posix.mk \
+   bsd.suffixes.mk \
bsd.symver.mk \
bsd.sys.mk \
bsd.test.mk \

Modified: head/share/mk/bsd.lib.mk
==
--- head/share/mk/bsd.lib.mkTue Oct 11 22:54:29 2016(r307074)
+++ head/share/mk/bsd.lib.mkWed Oct 12 00:42:46 2016(r307075)
@@ -78,7 +78,6 @@ CTFFLAGS+= -g
 
 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
 # .pico used for PIC object files
-.SUFFIXES:
 .SUFFIXES: .out .o .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
 
 .if !defined(PICFLAG)
@@ -91,10 +90,6 @@ PICFLAG=-fpic
 
 PO_FLAG=-pg
 
-.c.o:
-   ${CC} ${STATIC_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
-   ${CTFCONVERT_CMD}
-
 .c.po:
${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o 
${.TARGET}
${CTFCONVERT_CMD}
@@ -103,9 +98,6 @@ PO_FLAG=-pg
${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o 
${.TARGET}
${CTFCONVERT_CMD}
 
-.cc.o .C.o .cpp.o .cxx.o:
-   ${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
-
 .cc.po .C.po .cpp.po .cxx.po:
${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o 
${.TARGET}
 

Added: head/share/mk/bsd.suffixes-posix.mk
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/mk/bsd.suffixes-posix.mk Wed Oct 12 00:42:46 2016
(r307075)
@@ -0,0 +1,56 @@
+# $FreeBSD$
+
+# Posix 1003.2 mandated rules
+#
+# Quoted directly from the Posix 1003.2 draft, only the macros
+# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
+# ${.PREFIX}, resp.
+
+# SINGLE SUFFIX RULES
+.c:
+   ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
+
+.f:
+   ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
+
+.sh:
+   cp -f ${.IMPSRC} ${.TARGET}
+   chmod a+x ${.TARGET}
+
+# DOUBLE SUFFIX RULES
+
+.c.o:
+   ${CC} ${CFLAGS} -c ${.IMPSRC}
+
+.f.o:
+   ${FC} ${FFLAGS} -c ${.IMPSRC}
+
+.y.o:
+   ${YACC} ${YFLAGS} ${.IMPSRC}
+   ${CC} ${CFLAGS} -c y.tab.c
+   rm -f y.tab.c
+   mv y.tab.o ${.TARGET}
+
+.l.o:
+   ${LEX} ${LFLAGS} ${.IMPSRC}
+   ${CC} ${CFLAGS} -c lex.yy.c
+   rm -f lex.yy.c
+   mv lex.yy.o ${.TARGET}
+
+.y.c:
+   ${YACC} ${YFLAGS} ${.IMPSRC}
+   mv y.tab.c ${.TARGET}
+
+.l.c:
+   ${LEX} ${LFLAGS} ${.IMPSRC}
+   mv lex.yy.c ${.TARGET}
+
+.c.a:
+   ${CC} ${CFLAGS} -c ${.IMPSRC}
+   ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
+   rm -f ${.PREFIX}.o
+
+.f.a:
+   ${FC} ${FFLAGS} -c ${.IMPSRC}
+   ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
+   rm -f ${.PREFIX}.o

Added: head/share/mk/bsd.suffixes.mk
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/mk/bsd.suffixes.mk   Wed Oct 12 00:42:46 2016
(r307075)
@@ -0,0 +1,99 @@
+# $FreeBSD$
+
+.sh:
+   cp -f ${.IMPSRC} ${.TARGET}
+   chmod a+x ${.TARGET}
+
+.c.ln:
+   ${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
+   touch ${.TARGET}
+
+.cc.ln .C.ln .cpp.ln .cxx.ln:
+   ${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \
+   touch ${.TARGET}
+
+.c:
+   ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
+   ${CTFCONVERT_CMD}
+
+.c.o:
+   ${CC} ${STATIC_CFLAGS} 

Re: svn commit: r307072 - in head/usr.sbin: . efivar

2016-10-11 Thread Shawn Webb
On Tue, Oct 11, 2016 at 05:13:24PM -0600, Warner Losh wrote:
> On Tue, Oct 11, 2016 at 5:11 PM, Shawn Webb  
> wrote:
> > On Tue, Oct 11, 2016 at 10:31:46PM +, Warner Losh wrote:
> >> Author: imp
> >> Date: Tue Oct 11 22:31:45 2016
> >> New Revision: 307072
> >> URL: https://svnweb.freebsd.org/changeset/base/307072
> >>
> >> Log:
> >>   Add efivar(1) to manipulate EFI variables. It uses a similar command
> >>   line interface to the Linux program, as well as adding a number of
> >>   useful features to make using it in shell scripts easier (since we
> >>   don't have a filesystem to fall back on interacting with).
> >>
> >>   Differential Revision: https://reviews.freebsd.org/D8128
> >>   Reviewed by: kib@, wblock@, Ganael Laplanche
> >>
> >> Added:
> >>   head/usr.sbin/efivar/
> >>   head/usr.sbin/efivar/Makefile   (contents, props changed)
> >>   head/usr.sbin/efivar/efivar.8   (contents, props changed)
> >>   head/usr.sbin/efivar/efivar.c   (contents, props changed)
> >> Modified:
> >>   head/usr.sbin/Makefile
> >
> > The commit log says efivar(1), but the manpage is efivar(8). Maybe 1 is
> > a typo?
> 
> (1) is a typo :(

No worries. Thanks for the quick response. I just wanted to make sure
that it was supposed to be 8 versus the 1 in the log.

Good to see a program like this in base. Good work.

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r307072 - in head/usr.sbin: . efivar

2016-10-11 Thread Warner Losh
On Tue, Oct 11, 2016 at 5:11 PM, Shawn Webb  wrote:
> On Tue, Oct 11, 2016 at 10:31:46PM +, Warner Losh wrote:
>> Author: imp
>> Date: Tue Oct 11 22:31:45 2016
>> New Revision: 307072
>> URL: https://svnweb.freebsd.org/changeset/base/307072
>>
>> Log:
>>   Add efivar(1) to manipulate EFI variables. It uses a similar command
>>   line interface to the Linux program, as well as adding a number of
>>   useful features to make using it in shell scripts easier (since we
>>   don't have a filesystem to fall back on interacting with).
>>
>>   Differential Revision: https://reviews.freebsd.org/D8128
>>   Reviewed by: kib@, wblock@, Ganael Laplanche
>>
>> Added:
>>   head/usr.sbin/efivar/
>>   head/usr.sbin/efivar/Makefile   (contents, props changed)
>>   head/usr.sbin/efivar/efivar.8   (contents, props changed)
>>   head/usr.sbin/efivar/efivar.c   (contents, props changed)
>> Modified:
>>   head/usr.sbin/Makefile
>
> The commit log says efivar(1), but the manpage is efivar(8). Maybe 1 is
> a typo?

(1) is a typo :(

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


Re: svn commit: r307072 - in head/usr.sbin: . efivar

2016-10-11 Thread Shawn Webb
On Tue, Oct 11, 2016 at 10:31:46PM +, Warner Losh wrote:
> Author: imp
> Date: Tue Oct 11 22:31:45 2016
> New Revision: 307072
> URL: https://svnweb.freebsd.org/changeset/base/307072
> 
> Log:
>   Add efivar(1) to manipulate EFI variables. It uses a similar command
>   line interface to the Linux program, as well as adding a number of
>   useful features to make using it in shell scripts easier (since we
>   don't have a filesystem to fall back on interacting with).
>   
>   Differential Revision: https://reviews.freebsd.org/D8128
>   Reviewed by: kib@, wblock@, Ganael Laplanche
> 
> Added:
>   head/usr.sbin/efivar/
>   head/usr.sbin/efivar/Makefile   (contents, props changed)
>   head/usr.sbin/efivar/efivar.8   (contents, props changed)
>   head/usr.sbin/efivar/efivar.c   (contents, props changed)
> Modified:
>   head/usr.sbin/Makefile

The commit log says efivar(1), but the manpage is efivar(8). Maybe 1 is
a typo?

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


svn commit: r307074 - in head/sys: mips/include pc98/include powerpc/include riscv/include sparc64/include

2016-10-11 Thread Warner Losh
Author: imp
Date: Tue Oct 11 22:54:29 2016
New Revision: 307074
URL: https://svnweb.freebsd.org/changeset/base/307074

Log:
  Include stubs even on the platforms we don't support so libsysdecode
  continues to build.

Added:
  head/sys/mips/include/efi.h
 - copied, changed from r307073, head/sys/i386/include/efi.h
  head/sys/pc98/include/efi.h
 - copied, changed from r307073, head/sys/i386/include/efi.h
  head/sys/powerpc/include/efi.h
 - copied, changed from r307073, head/sys/i386/include/efi.h
  head/sys/riscv/include/efi.h
 - copied, changed from r307073, head/sys/i386/include/efi.h
  head/sys/sparc64/include/efi.h
 - copied, changed from r307073, head/sys/i386/include/efi.h

Copied and modified: head/sys/mips/include/efi.h (from r307073, 
head/sys/i386/include/efi.h)
==
--- head/sys/i386/include/efi.h Tue Oct 11 22:32:12 2016(r307073, copy 
source)
+++ head/sys/mips/include/efi.h Tue Oct 11 22:54:29 2016(r307074)
@@ -29,11 +29,11 @@
  * $FreeBSD$
  */
 
-#ifndef __I386_INCLUDE_EFI_H_
-#define __I386_INCLUDE_EFI_H_
+#ifndef __MIPS_INCLUDE_EFI_H_
+#define __MIPS_INCLUDE_EFI_H_
 
-#defineEFIABI_ATTR /* __attribute__((ms_abi)) */ /* clang fails with 
this */
+#defineEFIABI_ATTR
 
-/* Note: we don't actually support this on i386 yet */
+/* Note: we don't actually support this on mips */
 
-#endif /* __I386_INCLUDE_EFI_H_ */
+#endif /* __MIPS_INCLUDE_EFI_H_ */

Copied and modified: head/sys/pc98/include/efi.h (from r307073, 
head/sys/i386/include/efi.h)
==
--- head/sys/i386/include/efi.h Tue Oct 11 22:32:12 2016(r307073, copy 
source)
+++ head/sys/pc98/include/efi.h Tue Oct 11 22:54:29 2016(r307074)
@@ -29,11 +29,11 @@
  * $FreeBSD$
  */
 
-#ifndef __I386_INCLUDE_EFI_H_
-#define __I386_INCLUDE_EFI_H_
+#ifndef __PC98_INCLUDE_EFI_H_
+#define __PC98_INCLUDE_EFI_H_
 
-#defineEFIABI_ATTR /* __attribute__((ms_abi)) */ /* clang fails with 
this */
+#defineEFIABI_ATTR
 
-/* Note: we don't actually support this on i386 yet */
+/* Note: we don't actually support this on pc98 */
 
-#endif /* __I386_INCLUDE_EFI_H_ */
+#endif /* __PC98_INCLUDE_EFI_H_ */

Copied and modified: head/sys/powerpc/include/efi.h (from r307073, 
head/sys/i386/include/efi.h)
==
--- head/sys/i386/include/efi.h Tue Oct 11 22:32:12 2016(r307073, copy 
source)
+++ head/sys/powerpc/include/efi.h  Tue Oct 11 22:54:29 2016
(r307074)
@@ -29,11 +29,11 @@
  * $FreeBSD$
  */
 
-#ifndef __I386_INCLUDE_EFI_H_
-#define __I386_INCLUDE_EFI_H_
+#ifndef __POWERPC_INCLUDE_EFI_H_
+#define __POWERPC_INCLUDE_EFI_H_
 
-#defineEFIABI_ATTR /* __attribute__((ms_abi)) */ /* clang fails with 
this */
+#defineEFIABI_ATTR
 
-/* Note: we don't actually support this on i386 yet */
+/* Note: we don't actually support this on powerpc */
 
-#endif /* __I386_INCLUDE_EFI_H_ */
+#endif /* __POWERPC_INCLUDE_EFI_H_ */

Copied and modified: head/sys/riscv/include/efi.h (from r307073, 
head/sys/i386/include/efi.h)
==
--- head/sys/i386/include/efi.h Tue Oct 11 22:32:12 2016(r307073, copy 
source)
+++ head/sys/riscv/include/efi.hTue Oct 11 22:54:29 2016
(r307074)
@@ -29,11 +29,11 @@
  * $FreeBSD$
  */
 
-#ifndef __I386_INCLUDE_EFI_H_
-#define __I386_INCLUDE_EFI_H_
+#ifndef __RISCV_INCLUDE_EFI_H_
+#define __RISCV_INCLUDE_EFI_H_
 
-#defineEFIABI_ATTR /* __attribute__((ms_abi)) */ /* clang fails with 
this */
+#defineEFIABI_ATTR
 
-/* Note: we don't actually support this on i386 yet */
+/* Note: we don't actually support this on riscv */
 
 #endif /* __I386_INCLUDE_EFI_H_ */

Copied and modified: head/sys/sparc64/include/efi.h (from r307073, 
head/sys/i386/include/efi.h)
==
--- head/sys/i386/include/efi.h Tue Oct 11 22:32:12 2016(r307073, copy 
source)
+++ head/sys/sparc64/include/efi.h  Tue Oct 11 22:54:29 2016
(r307074)
@@ -29,11 +29,11 @@
  * $FreeBSD$
  */
 
-#ifndef __I386_INCLUDE_EFI_H_
-#define __I386_INCLUDE_EFI_H_
+#ifndef __SPARC64_INCLUDE_EFI_H_
+#define __SPARC64_INCLUDE_EFI_H_
 
-#defineEFIABI_ATTR /* __attribute__((ms_abi)) */ /* clang fails with 
this */
+#defineEFIABI_ATTR
 
-/* Note: we don't actually support this on i386 yet */
+/* Note: we don't actually support this on sparc64 */
 
 #endif /* __I386_INCLUDE_EFI_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307073 - head/sys/modules/bwn

2016-10-11 Thread Warner Losh
Author: imp
Date: Tue Oct 11 22:32:12 2016
New Revision: 307073
URL: https://svnweb.freebsd.org/changeset/base/307073

Log:
  Properly include the 802.11n PHY support files when the BWM_GPL_PHY
  option is included. Remove the comment suggesting that people
  uncomment things because it is OBE.

Modified:
  head/sys/modules/bwn/Makefile

Modified: head/sys/modules/bwn/Makefile
==
--- head/sys/modules/bwn/Makefile   Tue Oct 11 22:31:45 2016
(r307072)
+++ head/sys/modules/bwn/Makefile   Tue Oct 11 22:32:12 2016
(r307073)
@@ -14,17 +14,15 @@ SRCS+=  if_bwn_phy_n.c
 # Other
 SRCS+= device_if.h bus_if.h pci_if.h opt_bwn.h opt_wlan.h
 
-# Uncomment this for the GPL PHY code; this requires the
-# module be built with BWN_GPL_PHY set in the kernel
-# configuration.
-
-#.PATH: ${.CURDIR}/../../gnu/dev/bwn/phy_n
-#SRCS+=  if_bwn_radio_2055.c
-#SRCS+=  if_bwn_radio_2056.c
-#SRCS+=  if_bwn_radio_2057.c
-#SRCS+=  if_bwn_phy_n_tables.c
-#SRCS+=  if_bwn_phy_n_ppr.c
-#SRCS+=  if_bwn_phy_n_core.c
+# The following need the BWN_GPL_PHY kenrel option to opt-in
+# to the GPL'd 802.11n PHY support for this driver.
+.PATH: ${.CURDIR}/../../gnu/dev/bwn/phy_n
+SRCS.BWN_GPL_PHY+=  if_bwn_radio_2055.c
+SRCS.BWN_GPL_PHY+=  if_bwn_radio_2056.c
+SRCS.BWN_GPL_PHY+=  if_bwn_radio_2057.c
+SRCS.BWN_GPL_PHY+=  if_bwn_phy_n_tables.c
+SRCS.BWN_GPL_PHY+=  if_bwn_phy_n_ppr.c
+SRCS.BWN_GPL_PHY+=  if_bwn_phy_n_core.c
 
 .include 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307072 - in head/usr.sbin: . efivar

2016-10-11 Thread Warner Losh
Author: imp
Date: Tue Oct 11 22:31:45 2016
New Revision: 307072
URL: https://svnweb.freebsd.org/changeset/base/307072

Log:
  Add efivar(1) to manipulate EFI variables. It uses a similar command
  line interface to the Linux program, as well as adding a number of
  useful features to make using it in shell scripts easier (since we
  don't have a filesystem to fall back on interacting with).
  
  Differential Revision: https://reviews.freebsd.org/D8128
  Reviewed by: kib@, wblock@, Ganael Laplanche

Added:
  head/usr.sbin/efivar/
  head/usr.sbin/efivar/Makefile   (contents, props changed)
  head/usr.sbin/efivar/efivar.8   (contents, props changed)
  head/usr.sbin/efivar/efivar.c   (contents, props changed)
Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Tue Oct 11 22:30:41 2016(r307071)
+++ head/usr.sbin/Makefile  Tue Oct 11 22:31:45 2016(r307072)
@@ -123,6 +123,7 @@ SUBDIR.${MK_BSNMP}+=bsnmpd
 SUBDIR.${MK_CTM}+= ctm
 SUBDIR.${MK_DIALOG}+=  tzsetup
 SUBDIR.${MK_DIALOG}+=  bsdconfig
+SUBDIR.${MK_EFI}+= efivar
 SUBDIR.${MK_FLOPPY}+=  fdcontrol
 SUBDIR.${MK_FLOPPY}+=  fdformat
 SUBDIR.${MK_FLOPPY}+=  fdread

Added: head/usr.sbin/efivar/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/efivar/Makefile   Tue Oct 11 22:31:45 2016
(r307072)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG=  efivar
+MAN=   efivar.8
+
+LIBADD= efivar
+
+.include 

Added: head/usr.sbin/efivar/efivar.8
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/efivar/efivar.8   Tue Oct 11 22:31:45 2016
(r307072)
@@ -0,0 +1,164 @@
+.\" Copyright (c) 2003 Netflix, Inc
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 29, 2016
+.Dt EFIVAR 8
+.Os
+.Sh NAME
+.Nm efivar
+.Nd UEFI environemnt variable interaction
+.Sh SYNOPSIS
+.Nm
+.Op Fl abdDHlLNpRtw
+.Op Fl n Ar name
+.Op Fl f Ar file
+.Op Fl -append
+.Op Fl -ascii
+.Op Fl -attributes
+.Op Fl -binary
+.Op Fl -delete
+.Op Fl -fromfile Ar file
+.Op Fl -hex
+.Op Fl -list-guids
+.Op Fl -list
+.Op Fl -name Ar name
+.Op Fl -no-name
+.Op Fl -print
+.Op Fl -print-decimal
+.Op Fl -raw-guid
+.Op Fl -write
+.Ar name Ns Op = Ns Ar value
+.Sh DESCRIPTION
+This program manages
+.Dq Unified Extensible Firmware Interface
+.Pq UEFI
+environment variables.
+UEFI variables have three part: A namespace, a name and a value.
+The namespace is a GUID that's self assigned by the group defining the
+variables.
+The name is a Unicode name for the variable.
+The value is binary data.
+All Unicode data is presented to the user as UTF-8.
+.Pp
+The following options are available:
+.Bl -tag -width 20m
+.It Fl n Ar name Fl -name Ar name
+Specify the name of the variable to operate on.
+The
+.Ar name
+argument is the GUID of variable, followed by a dash, followed by the
+UEFI variable name.
+The GUID may be in numeric format, or may be one of the well known
+symbolic name (see
+.Fl -list-guids
+for a complete list).
+.It Fl f Ar file Fl -fromfile Ar file
+When writing or appending to a variable, take the data for the
+variable's value from
+.Ar file
+instead of from the command line.
+This flag implies
+.Fl -write
+unless the
+.Fl -append
+flag is given.
+This is not well understood and currently unimplemented.
+.It Fl a Fl -append
+Append the specified value to the UEFI variable rather than 

svn commit: r307071 - in head: lib lib/libefi lib/libefivar share/mk

2016-10-11 Thread Warner Losh
Author: imp
Date: Tue Oct 11 22:30:41 2016
New Revision: 307071
URL: https://svnweb.freebsd.org/changeset/base/307071

Log:
  Create libefivar library. This library aims to provide
  the same API as the GPL'd version of this library. It implements the common
  Linux API for programatically manipulating UEFI environment varibales using
  the UEFI Runtime Services the kernel provides. It replaces the old efi
  library since it is programmed to a different interface, but retails the
  CHAR16 to UTF-8 and vice versa conversion routines. The new name is to match
  Linux program's expectations.
  
  Differential Revision: https://reviews.freebsd.org/D8128
  Reviewed by: kib@, wblock@, Ganael Laplanche

Added:
  head/lib/libefivar/
  head/lib/libefivar/Makefile   (contents, props changed)
  head/lib/libefivar/efivar.3   (contents, props changed)
  head/lib/libefivar/efivar.c   (contents, props changed)
  head/lib/libefivar/efivar.h   (contents, props changed)
  head/lib/libefivar/libefivar.c
 - copied, changed from r307070, head/lib/libefi/libefi.c
  head/lib/libefivar/libefivar_int.h
 - copied, changed from r307070, head/lib/libefi/libefi_int.h
Deleted:
  head/lib/libefi/
Modified:
  head/lib/Makefile
  head/share/mk/bsd.libnames.mk
  head/share/mk/src.libnames.mk
  head/share/mk/src.opts.mk

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Tue Oct 11 22:24:30 2016(r307070)
+++ head/lib/Makefile   Tue Oct 11 22:30:41 2016(r307071)
@@ -49,6 +49,7 @@ SUBDIR=   ${SUBDIR_BOOTSTRAP} \
libdevstat \
libdwarf \
libedit \
+   ${_libefivar} \
${_libelftc} \
libevent \
libexecinfo \
@@ -240,6 +241,10 @@ _libcxxrt= libcxxrt
 _libcplusplus= libc++
 .endif
 
+.if ${MACHINE_ARCH} == "amd64"
+_libefivar=libefivar
+.endif
+
 .if ${MK_LIBTHR} != "no"
 _libthr=   libthr
 .endif

Added: head/lib/libefivar/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libefivar/Makefile Tue Oct 11 22:30:41 2016(r307071)
@@ -0,0 +1,53 @@
+# Copyright 1998 Juniper Networks, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include 
+
+PACKAGE=lib${LIB}
+LIB=   efivar
+SRCS=  efivar.c libefivar.c
+INCS=  efivar.h
+SHLIB_MAJOR=   1
+MAN=   efivar.3
+
+MLINKS+=efivar.3 efi_set_variables_supported.3 \
+   efivar.3 efi_del_variable.3 \
+   efivar.3 efi_get_variable.3 \
+   efivar.3 efi_get_variable_attributes.3 \
+   efivar.3 efi_get_variable_size.3 \
+   efivar.3 efi_append_variable.3 \
+   efivar.3 efi_set_variable.3 \
+   efivar.3 efi_get_next_variable_name.3 \
+   efivar.3 efi_str_to_guid.3 \
+   efivar.3 efi_guid_to_str.3 \
+   efivar.3 efi_name_to_guid.3 \
+   efivar.3 efi_guid_to_name.3 \
+   efivar.3 efi_guid_to_symbol.3 \
+   efivar.3 libefivar.3
+
+WARNS?=9
+
+.include 

Added: head/lib/libefivar/efivar.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libefivar/efivar.3 Tue Oct 11 22:30:41 2016(r307071)
@@ -0,0 +1,98 @@
+.\" Copyright 2016 Netflix, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following 

svn commit: r307070 - in head/sys: amd64/amd64 conf dev/efidev i386/include modules/efirt sys

2016-10-11 Thread Warner Losh
Author: imp
Date: Tue Oct 11 22:24:30 2016
New Revision: 307070
URL: https://svnweb.freebsd.org/changeset/base/307070

Log:
  Create /dev/efidev to provide an ioctl interface to
  userland.  It supports userland interfaces to UEFI Runtime Services. This is
  indended to the the MI portion of EFI RuntimeServices support.
  
  Differential Revision: https://reviews.freebsd.org/D8128
  Reviewed by: kib@, wblock@, Ganael Laplanche

Added:
  head/sys/dev/efidev/
  head/sys/dev/efidev/efidev.c   (contents, props changed)
  head/sys/i386/include/efi.h   (contents, props changed)
  head/sys/sys/efiio.h   (contents, props changed)
Modified:
  head/sys/amd64/amd64/efirt.c
  head/sys/conf/files
  head/sys/modules/efirt/Makefile
  head/sys/sys/efi.h

Modified: head/sys/amd64/amd64/efirt.c
==
--- head/sys/amd64/amd64/efirt.cTue Oct 11 21:59:22 2016
(r307069)
+++ head/sys/amd64/amd64/efirt.cTue Oct 11 22:24:30 2016
(r307070)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 static struct efi_systbl *efi_systbl;
 static struct efi_cfgtbl *efi_cfgtbl;
 static struct efi_rt *efi_runtime;
+static struct cdev *efi_cdev;
 
 static int efi_status2err[25] = {
0,  /* EFI_SUCCESS */
@@ -402,13 +403,15 @@ efi_init(void)
return (ENXIO);
}
 
-   return (0);
+   return (efidev_init(_cdev));
 }
 
 static void
 efi_uninit(void)
 {
 
+   efidev_uninit(efi_cdev);
+
efi_destroy_1t1_map();
 
efi_systbl = NULL;

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Oct 11 21:59:22 2016(r307069)
+++ head/sys/conf/files Tue Oct 11 22:24:30 2016(r307070)
@@ -1431,6 +1431,7 @@ dev/ed/if_ed_novell.c optional ed
 dev/ed/if_ed_rtl80x9.c optional ed
 dev/ed/if_ed_pccard.c  optional ed pccard
 dev/ed/if_ed_pci.c optional ed pci
+dev/efidev/efidev.coptional efirt
 dev/eisa/eisa_if.m standard
 dev/eisa/eisaconf.coptional eisa
 dev/e1000/if_em.c  optional em \

Added: head/sys/dev/efidev/efidev.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/efidev/efidev.cTue Oct 11 22:24:30 2016
(r307070)
@@ -0,0 +1,199 @@
+/*-
+ * Copyright (c) 2016 Netflix, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer
+ *in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+static d_ioctl_t efidev_ioctl;
+
+static struct cdevsw efi_cdevsw = {
+   .d_name = "efi",
+   .d_version = D_VERSION,
+   .d_ioctl = efidev_ioctl,
+};
+   
+/* ARGSUSED */
+static int
+efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr,
+int flags __unused, struct thread *td __unused)
+{
+   int error;
+
+   switch (cmd) {
+   case EFIIOC_GET_TABLE:
+   {
+   struct efi_get_table_ioc *egtioc =
+   (struct efi_get_table_ioc *)addr;
+
+   error = efi_get_table(>uuid, >ptr);
+   break;
+   }
+   case EFIIOC_GET_TIME:
+   {
+   struct efi_tm *tm = (struct efi_tm *)addr;
+
+   error = efi_get_time(tm);
+   break;
+   }
+   case EFIIOC_SET_TIME:
+   {
+   struct efi_tm *tm = (struct efi_tm *)addr;
+
+   error = efi_set_time(tm);
+   break;
+   }
+   case 

svn commit: r307069 - stable/11/lib/libc/sys

2016-10-11 Thread Jilles Tjoelker
Author: jilles
Date: Tue Oct 11 21:59:22 2016
New Revision: 307069
URL: https://svnweb.freebsd.org/changeset/base/307069

Log:
  MFC r305628: intro(2),_exit(2): Update for reaper 
(procctl(PROC_REAP_ACQUIRE)).

Modified:
  stable/11/lib/libc/sys/_exit.2
  stable/11/lib/libc/sys/intro.2
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/sys/_exit.2
==
--- stable/11/lib/libc/sys/_exit.2  Tue Oct 11 21:40:15 2016
(r307068)
+++ stable/11/lib/libc/sys/_exit.2  Tue Oct 11 21:59:22 2016
(r307069)
@@ -28,7 +28,7 @@
 .\" @(#)_exit.28.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd September 8, 2016
 .Dt EXIT 2
 .Os
 .Sh NAME
@@ -64,9 +64,11 @@ is set as defined by
 .Xr wait 2 .
 .It
 The parent process-ID of all of the calling process's existing child
-processes are set to 1; the initialization process
+processes are set to the process-ID of the calling process's reaper;
+the reaper (normally the initialization process)
 inherits each of these processes
 (see
+.Xr procctl 2 ,
 .Xr init 8
 and the
 .Sx DEFINITIONS

Modified: stable/11/lib/libc/sys/intro.2
==
--- stable/11/lib/libc/sys/intro.2  Tue Oct 11 21:40:15 2016
(r307068)
+++ stable/11/lib/libc/sys/intro.2  Tue Oct 11 21:59:22 2016
(r307069)
@@ -28,7 +28,7 @@
 .\" @(#)intro.28.5 (Berkeley) 2/27/95
 .\" $FreeBSD$
 .\"
-.Dd May 4, 2013
+.Dd September 8, 2016
 .Dt INTRO 2
 .Os
 .Sh NAME
@@ -484,7 +484,10 @@ A new process is created by a currently 
 .Xr fork 2 ) .
 The parent process ID of a process is initially the process ID of its creator.
 If the creating process exits,
-the parent process ID of each child is set to the ID of a system process,
+the parent process ID of each child is set to the ID of the calling process's
+reaper (see
+.Xr procctl 2 ) ,
+normally
 .Xr init 8 .
 .It Process Group
 Each active process is a member of a process group that is identified by
@@ -533,7 +536,7 @@ when none of its members has a parent pr
 as the group,
 but is in a different process group.
 Note that when a process exits, the parent process for its children
-is changed to be
+is normally changed to be
 .Xr init 8 ,
 which is in a separate session.
 Not all members of an orphaned process group are necessarily orphaned
___
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: r307068 - head/sys/arm/broadcom/bcm2835

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Oct 11 21:40:15 2016
New Revision: 307068
URL: https://svnweb.freebsd.org/changeset/base/307068

Log:
  Make Rapsberry Pi watchdog driver compatible with upstream DTS
  
  - Fix compatibility strings
  - Compensate the difference in base address for our custom DTS and
  upstream one (for backward compatibility)

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_wdog.cTue Oct 11 21:37:34 
2016(r307067)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_wdog.cTue Oct 11 21:40:15 
2016(r307068)
@@ -52,8 +52,8 @@ __FBSDID("$FreeBSD$");
 #define BCM2835_WDOG_TIME_MASK 0x000f
 #define BCM2835_WDOG_TIME_SHIFT0
 
-#defineREAD(_sc, _r) bus_space_read_4((_sc)->bst, (_sc)->bsh, (_r))
-#defineWRITE(_sc, _r, _v) bus_space_write_4((_sc)->bst, (_sc)->bsh, 
(_r), (_v))
+#defineREAD(_sc, _r) bus_space_read_4((_sc)->bst, (_sc)->bsh, (_r) + 
(_sc)->regs_offset)
+#defineWRITE(_sc, _r, _v) bus_space_write_4((_sc)->bst, (_sc)->bsh, 
(_r) + (_sc)->regs_offset, (_v))
 
 #define BCM2835_RSTC_WRCFG_CLR 0xffcf
 #define BCM2835_RSTC_WRCFG_SET 0x0030
@@ -75,6 +75,17 @@ struct bcmwd_softc {
int wdog_period;
charwdog_passwd;
struct mtx  mtx;
+   int regs_offset;
+};
+
+#defineBSD_DTB 1
+#defineUPSTREAM_DTB2
+#defineUPSTREAM_DTB_REGS_OFFSET0x1c
+
+static struct ofw_compat_data compat_data[] = {
+   {"broadcom,bcm2835-wdt",BSD_DTB},
+   {"brcm,bcm2835-pm-wdt", UPSTREAM_DTB},
+   {NULL,  0}
 };
 
 static void bcmwd_watchdog_fn(void *private, u_int cmd, int *error);
@@ -86,12 +97,12 @@ bcmwd_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (ofw_bus_is_compatible(dev, "broadcom,bcm2835-wdt")) {
-   device_set_desc(dev, "BCM2708/2835 Watchdog");
-   return (BUS_PROBE_DEFAULT);
-   }
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
+   return (ENXIO);
+
+   device_set_desc(dev, "BCM2708/2835 Watchdog");
 
-   return (ENXIO);
+   return (BUS_PROBE_DEFAULT);
 }
 
 static int
@@ -119,6 +130,11 @@ bcmwd_attach(device_t dev)
sc->bst = rman_get_bustag(sc->res);
sc->bsh = rman_get_bushandle(sc->res);
 
+   /* compensate base address difference */
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data
+  == UPSTREAM_DTB)
+   sc->regs_offset = UPSTREAM_DTB_REGS_OFFSET;
+
bcmwd_lsc = sc;
mtx_init(>mtx, "BCM2835 Watchdog", "bcmwd", MTX_DEF);
EVENTHANDLER_REGISTER(watchdog_list, bcmwd_watchdog_fn, sc, 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: r307067 - head/sys/arm/broadcom/bcm2835

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Oct 11 21:37:34 2016
New Revision: 307067
URL: https://svnweb.freebsd.org/changeset/base/307067

Log:
  Make intc driver compatible with upstream DTS
  
  - Fix compatibility strings
  - Properly decode upstream's two-cell interrupt specs. Our home-made dts
  does not have two-cell interrupts so no need to preserve backward
  compatibility

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_common.c
  head/sys/arm/broadcom/bcm2835/bcm2835_intr.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_common.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_common.c  Tue Oct 11 20:31:59 
2016(r307066)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_common.c  Tue Oct 11 21:37:34 
2016(r307067)
@@ -52,7 +52,8 @@ fdt_intc_decode_ic(phandle_t node, pcell
 int *pol)
 {
 
-   if (fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic")) {
+   if (fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic") ||
+   fdt_is_compatible(node, "brcm,bcm2836-armctrl-ic")) {
*interrupt = fdt32_to_cpu(intr[0]);
*trig = INTR_TRIGGER_CONFORM;
*pol = INTR_POLARITY_CONFORM;

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_intr.cTue Oct 11 20:31:59 
2016(r307066)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.cTue Oct 11 21:37:34 
2016(r307067)
@@ -270,6 +270,7 @@ bcm_intc_map_intr(device_t dev, struct i
u_int irq;
struct intr_map_data_fdt *daf;
struct bcm_intc_softc *sc;
+   bool valid;
 
if (data->type != INTR_MAP_DATA_FDT)
return (ENOTSUP);
@@ -277,8 +278,36 @@ bcm_intc_map_intr(device_t dev, struct i
daf = (struct intr_map_data_fdt *)data;
if (daf->ncells == 1)
irq = daf->cells[0];
-   else if (daf->ncells == 2)
-   irq = daf->cells[0] * 32 + daf->cells[1];
+   else if (daf->ncells == 2) {
+   valid = true;
+   switch (daf->cells[0]) {
+   case 0:
+   irq = daf->cells[1];
+   if (irq >= BANK1_START)
+   valid = false;
+   break;
+   case 1:
+   irq = daf->cells[1] + BANK1_START;
+   if (irq > BANK1_END)
+   valid = false;
+   break;
+   case 2:
+   irq = daf->cells[1] + BANK2_START;
+   if (irq > BANK2_END)
+   valid = false;
+   break;
+   default:
+   valid = false;
+   break;
+   }
+
+   if (!valid) {
+   device_printf(dev,
+   "invalid IRQ config: bank=%d, irq=%d\n",
+   daf->cells[0], daf->cells[1]);
+   return (EINVAL);
+   }
+   }
else
return (EINVAL);
 
@@ -355,7 +384,8 @@ bcm_intc_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-armctrl-ic"))
+   if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-armctrl-ic") &&
+   !ofw_bus_is_compatible(dev, "brcm,bcm2836-armctrl-ic"))
return (ENXIO);
device_set_desc(dev, "BCM2835 Interrupt Controller");
return (BUS_PROBE_DEFAULT);
___
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: r307066 - in head/lib/msun: . src

2016-10-11 Thread Ruslan Bukin
Author: br
Date: Tue Oct 11 20:31:59 2016
New Revision: 307066
URL: https://svnweb.freebsd.org/changeset/base/307066

Log:
  Don't use fmaxl/fminl on platforms with no long double support,
  use fmax/fmin instead.
  
  This fixes fmaxmin test failure on MIPS64.
  
  Reviewed by:  emaste
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D8216

Modified:
  head/lib/msun/Makefile
  head/lib/msun/src/s_fmax.c
  head/lib/msun/src/s_fmin.c

Modified: head/lib/msun/Makefile
==
--- head/lib/msun/Makefile  Tue Oct 11 18:51:03 2016(r307065)
+++ head/lib/msun/Makefile  Tue Oct 11 20:31:59 2016(r307066)
@@ -63,8 +63,8 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c 
s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c s_fabsf.c s_fdim.c \
s_finite.c s_finitef.c \
s_floor.c s_floorf.c s_fma.c s_fmaf.c \
-   s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c \
-   s_fminf.c s_fminl.c s_frexp.c s_frexpf.c s_ilogb.c s_ilogbf.c \
+   s_fmax.c s_fmaxf.c s_fmin.c \
+   s_fminf.c s_frexp.c s_frexpf.c s_ilogb.c s_ilogbf.c \
s_ilogbl.c s_isfinite.c s_isnan.c s_isnormal.c \
s_llrint.c s_llrintf.c s_llround.c s_llroundf.c s_llroundl.c \
s_log1p.c s_log1pf.c s_logb.c s_logbf.c s_lrint.c s_lrintf.c \
@@ -101,9 +101,9 @@ COMMON_SRCS+=   e_acoshl.c e_acosl.c e_asi
invtrig.c k_cosl.c k_sinl.c k_tanl.c \
s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c s_cosl.c s_cprojl.c \
s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \
-   s_frexpl.c s_logbl.c s_logl.c s_nanl.c s_nextafterl.c \
-   s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c s_scalbnl.c \
-   s_sinl.c s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c
+   s_fmaxl.c s_fminl.c s_frexpl.c s_logbl.c s_logl.c s_nanl.c \
+   s_nextafterl.c s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c \
+   s_scalbnl.c s_sinl.c s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c
 .endif
 
 # C99 complex functions

Modified: head/lib/msun/src/s_fmax.c
==
--- head/lib/msun/src/s_fmax.c  Tue Oct 11 18:51:03 2016(r307065)
+++ head/lib/msun/src/s_fmax.c  Tue Oct 11 20:31:59 2016(r307066)
@@ -27,6 +27,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 
 #include "fpmath.h"
@@ -51,3 +52,7 @@ fmax(double x, double y)
 
return (x > y ? x : y);
 }
+
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(fmax, fmaxl);
+#endif

Modified: head/lib/msun/src/s_fmin.c
==
--- head/lib/msun/src/s_fmin.c  Tue Oct 11 18:51:03 2016(r307065)
+++ head/lib/msun/src/s_fmin.c  Tue Oct 11 20:31:59 2016(r307066)
@@ -27,6 +27,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 
 #include "fpmath.h"
@@ -51,3 +52,7 @@ fmin(double x, double y)
 
return (x < y ? x : y);
 }
+
+#if (LDBL_MANT_DIG == 53)
+__weak_reference(fmin, fminl);
+#endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307065 - in stable/10: sys/kern tests/sys/kern

2016-10-11 Thread Jilles Tjoelker
Author: jilles
Date: Tue Oct 11 18:51:03 2016
New Revision: 307065
URL: https://svnweb.freebsd.org/changeset/base/307065

Log:
  wait: Do not copyout uninitialized status/rusage/wrusage.
  
  If wait4() or wait6() return 0 because of WNOHANG, the status, rusage and
  wrusage information should not be returned.
  
  PR:   212048
  Reported by:  Casey Lucas

Added:
  stable/10/tests/sys/kern/waitpid_nohang.c
 - copied unchanged from r305676, head/tests/sys/kern/waitpid_nohang.c
Modified:
  stable/10/sys/kern/kern_exit.c
  stable/10/tests/sys/kern/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_exit.c
==
--- stable/10/sys/kern/kern_exit.c  Tue Oct 11 18:09:37 2016
(r307064)
+++ stable/10/sys/kern/kern_exit.c  Tue Oct 11 18:51:03 2016
(r307065)
@@ -785,9 +785,9 @@ sys_wait4(struct thread *td, struct wait
else
rup = NULL;
error = kern_wait(td, uap->pid, , uap->options, rup);
-   if (uap->status != NULL && error == 0)
+   if (uap->status != NULL && error == 0 && td->td_retval[0] != 0)
error = copyout(, uap->status, sizeof(status));
-   if (uap->rusage != NULL && error == 0)
+   if (uap->rusage != NULL && error == 0 && td->td_retval[0] != 0)
error = copyout(, uap->rusage, sizeof(struct rusage));
return (error);
 }
@@ -821,9 +821,9 @@ sys_wait6(struct thread *td, struct wait
 */
error = kern_wait6(td, idtype, id, , uap->options, wrup, sip);
 
-   if (uap->status != NULL && error == 0)
+   if (uap->status != NULL && error == 0 && td->td_retval[0] != 0)
error = copyout(, uap->status, sizeof(status));
-   if (uap->wrusage != NULL && error == 0)
+   if (uap->wrusage != NULL && error == 0 && td->td_retval[0] != 0)
error = copyout(, uap->wrusage, sizeof(wru));
if (uap->info != NULL && error == 0)
error = copyout(, uap->info, sizeof(si));

Modified: stable/10/tests/sys/kern/Makefile
==
--- stable/10/tests/sys/kern/Makefile   Tue Oct 11 18:09:37 2016
(r307064)
+++ stable/10/tests/sys/kern/Makefile   Tue Oct 11 18:51:03 2016
(r307065)
@@ -11,6 +11,7 @@ ATF_TESTS_C+= ptrace_test
 ATF_TESTS_C+=  unix_seqpacket_test
 ATF_TESTS_C+=  unix_passfd_test
 TEST_METADATA.unix_seqpacket_test+=timeout="15"
+ATF_TESTS_C+=  waitpid_nohang
 
 LDADD.ptrace_test+=-lpthread
 LDADD.unix_seqpacket_test+=-lpthread

Copied: stable/10/tests/sys/kern/waitpid_nohang.c (from r305676, 
head/tests/sys/kern/waitpid_nohang.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/tests/sys/kern/waitpid_nohang.c   Tue Oct 11 18:51:03 2016
(r307065, copy of r305676, head/tests/sys/kern/waitpid_nohang.c)
@@ -0,0 +1,70 @@
+/*-
+ * Copyright (c) 2016 Jilles Tjoelker
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+
+#include 
+#include 
+#include 
+
+ATF_TC_WITHOUT_HEAD(waitpid_nohang);
+ATF_TC_BODY(waitpid_nohang, tc)
+{
+   pid_t child, pid;
+   int status, r;
+
+   child = fork();
+   ATF_REQUIRE(child != -1);
+   if (child == 0) {
+   sleep(10);
+   _exit(1);
+   }
+
+   status = 42;
+   pid = waitpid(child, , WNOHANG);
+   ATF_REQUIRE(pid == 0);
+   ATF_CHECK(status == 42);
+
+   r = kill(child, 

svn commit: r307064 - head/sys/vm

2016-10-11 Thread Konstantin Belousov
Author: kib
Date: Tue Oct 11 18:09:37 2016
New Revision: 307064
URL: https://svnweb.freebsd.org/changeset/base/307064

Log:
  When downgrading exclusively busied page to shared-busy state, wakeup
  waiters.  Otherwise, owners of the shared-busy state are left blocked
  and might get into a deadlock.
  
  Note that the vm_page_busy_downgrade() function is not used in the
  tree right now.
  
  Reported and tested by:   pho (previous version)
  Reviewed by:  alc, markj
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D8195

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Tue Oct 11 17:47:54 2016(r307063)
+++ head/sys/vm/vm_page.c   Tue Oct 11 18:09:37 2016(r307064)
@@ -655,15 +655,26 @@ void
 vm_page_busy_downgrade(vm_page_t m)
 {
u_int x;
+   bool locked;
 
vm_page_assert_xbusied(m);
+   locked = mtx_owned(vm_page_lockptr(m));
 
for (;;) {
x = m->busy_lock;
x &= VPB_BIT_WAITERS;
+   if (x != 0 && !locked)
+   vm_page_lock(m);
if (atomic_cmpset_rel_int(>busy_lock,
-   VPB_SINGLE_EXCLUSIVER | x, VPB_SHARERS_WORD(1) | x))
+   VPB_SINGLE_EXCLUSIVER | x, VPB_SHARERS_WORD(1)))
break;
+   if (x != 0 && !locked)
+   vm_page_unlock(m);
+   }
+   if (x != 0) {
+   wakeup(m);
+   if (!locked)
+   vm_page_unlock(m);
}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307063 - stable/11/release/doc/en_US.ISO8859-1/errata

2016-10-11 Thread Glen Barber
Author: gjb
Date: Tue Oct 11 17:47:54 2016
New Revision: 307063
URL: https://svnweb.freebsd.org/changeset/base/307063

Log:
  Use the sponsors/vendors entities in the errata docs.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/en_US.ISO8859-1/errata/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Oct 11 
17:41:13 2016(r307062)
+++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Oct 11 
17:47:54 2016(r307063)
@@ -4,6 +4,10 @@
 http://www.FreeBSD.org/release/XML/release.ent;>
 %release;
+
+%sponsor;
+
+%vendor;
 
 
 ]>
@@ -176,18 +180,21 @@ boot
 

  
-   Support for the Cavium
- Virtualized NIC ethernet driver has been added.
+   Support for the Cavium Virtualized
+ NIC ethernet driver has been added.
  
 
  
-   Support for the GICv3 and
- ITS device drivers has been added.
+   Support for the GICv3 and ITS device
+ drivers has been added.
  
 
  
-   Support for PCI
- Enhanced Allocation support has been added.
+   Support for PCI Enhanced Allocation
+ support has been added.
  

   
___
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: r307062 - head/sys/net

2016-10-11 Thread Andrey V. Elsukov
Author: ae
Date: Tue Oct 11 17:41:13 2016
New Revision: 307062
URL: https://svnweb.freebsd.org/changeset/base/307062

Log:
  Make LLTABLE list lock private for if_llatbl.c
  
  Rename lock and macros to reflect that it protects V_lltables list.

Modified:
  head/sys/net/if_llatbl.c
  head/sys/net/if_llatbl.h

Modified: head/sys/net/if_llatbl.c
==
--- head/sys/net/if_llatbl.cTue Oct 11 17:12:26 2016(r307061)
+++ head/sys/net/if_llatbl.cTue Oct 11 17:41:13 2016(r307062)
@@ -66,8 +66,13 @@ static VNET_DEFINE(SLIST_HEAD(, lltable)
 SLIST_HEAD_INITIALIZER(lltables);
 #defineV_lltables  VNET(lltables)
 
-struct rwlock lltable_rwlock;
-RW_SYSINIT(lltable_rwlock, _rwlock, "lltable_rwlock");
+static struct rwlock lltable_list_lock;
+RW_SYSINIT(lltable_list_lock, _list_lock, "lltable_list_lock");
+#defineLLTABLE_LIST_RLOCK()rw_rlock(_list_lock)
+#defineLLTABLE_LIST_RUNLOCK()  rw_runlock(_list_lock)
+#defineLLTABLE_LIST_WLOCK()rw_wlock(_list_lock)
+#defineLLTABLE_LIST_WUNLOCK()  rw_wunlock(_list_lock)
+#defineLLTABLE_LIST_LOCK_ASSERT()  rw_assert(_list_lock, 
RA_LOCKED)
 
 static void lltable_unlink(struct lltable *llt);
 static void llentries_unlink(struct lltable *llt, struct llentries *head);
@@ -85,7 +90,7 @@ lltable_dump_af(struct lltable *llt, str
 {
int error;
 
-   LLTABLE_LOCK_ASSERT();
+   LLTABLE_LIST_LOCK_ASSERT();
 
if (llt->llt_ifp->if_flags & IFF_LOOPBACK)
return (0);
@@ -108,7 +113,7 @@ lltable_sysctl_dumparp(int af, struct sy
struct lltable *llt;
int error = 0;
 
-   LLTABLE_RLOCK();
+   LLTABLE_LIST_RLOCK();
SLIST_FOREACH(llt, _lltables, llt_link) {
if (llt->llt_af == af) {
error = lltable_dump_af(llt, wr);
@@ -117,7 +122,7 @@ lltable_sysctl_dumparp(int af, struct sy
}
}
 done:
-   LLTABLE_RUNLOCK();
+   LLTABLE_LIST_RUNLOCK();
return (error);
 }
 
@@ -531,7 +536,7 @@ lltable_drain(int af)
struct llentry  *lle;
register int i;
 
-   LLTABLE_RLOCK();
+   LLTABLE_LIST_RLOCK();
SLIST_FOREACH(llt, _lltables, llt_link) {
if (llt->llt_af != af)
continue;
@@ -547,7 +552,7 @@ lltable_drain(int af)
}
}
}
-   LLTABLE_RUNLOCK();
+   LLTABLE_LIST_RUNLOCK();
 }
 #endif
 
@@ -591,14 +596,14 @@ lltable_prefix_free(int af, struct socka
 {
struct lltable *llt;
 
-   LLTABLE_RLOCK();
+   LLTABLE_LIST_RLOCK();
SLIST_FOREACH(llt, _lltables, llt_link) {
if (llt->llt_af != af)
continue;
 
llt->llt_prefix_free(llt, addr, mask, flags);
}
-   LLTABLE_RUNLOCK();
+   LLTABLE_LIST_RUNLOCK();
 }
 
 struct lltable *
@@ -632,18 +637,18 @@ void
 lltable_link(struct lltable *llt)
 {
 
-   LLTABLE_WLOCK();
+   LLTABLE_LIST_WLOCK();
SLIST_INSERT_HEAD(_lltables, llt, llt_link);
-   LLTABLE_WUNLOCK();
+   LLTABLE_LIST_WUNLOCK();
 }
 
 static void
 lltable_unlink(struct lltable *llt)
 {
 
-   LLTABLE_WLOCK();
+   LLTABLE_LIST_WLOCK();
SLIST_REMOVE(_lltables, llt, lltable, llt_link);
-   LLTABLE_WUNLOCK();
+   LLTABLE_LIST_WUNLOCK();
 
 }
 
@@ -739,13 +744,13 @@ lla_rt_output(struct rt_msghdr *rtm, str
}
 
/* XXX linked list may be too expensive */
-   LLTABLE_RLOCK();
+   LLTABLE_LIST_RLOCK();
SLIST_FOREACH(llt, _lltables, llt_link) {
if (llt->llt_af == dst->sa_family &&
llt->llt_ifp == ifp)
break;
}
-   LLTABLE_RUNLOCK();
+   LLTABLE_LIST_RUNLOCK();
KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n"));
 
error = 0;

Modified: head/sys/net/if_llatbl.h
==
--- head/sys/net/if_llatbl.hTue Oct 11 17:12:26 2016(r307061)
+++ head/sys/net/if_llatbl.hTue Oct 11 17:41:13 2016(r307062)
@@ -37,17 +37,9 @@ struct ifnet;
 struct sysctl_req;
 struct rt_msghdr;
 struct rt_addrinfo;
-
 struct llentry;
 LIST_HEAD(llentries, llentry);
 
-extern struct rwlock lltable_rwlock;
-#defineLLTABLE_RLOCK() rw_rlock(_rwlock)
-#defineLLTABLE_RUNLOCK()   rw_runlock(_rwlock)
-#defineLLTABLE_WLOCK() rw_wlock(_rwlock)
-#defineLLTABLE_WUNLOCK()   rw_wunlock(_rwlock)
-#defineLLTABLE_LOCK_ASSERT()   rw_assert(_rwlock, RA_LOCKED)
-
 #defineLLE_MAX_LINKHDR 24  /* Full IB header */
 /*
  * Code referencing llentry must at least hold
___
svn-src-all@freebsd.org mailing list

svn commit: r307061 - in stable/11/release/doc: en_US.ISO8859-1/errata share/xml

2016-10-11 Thread Ed Maste
Author: emaste
Date: Tue Oct 11 17:12:26 2016
New Revision: 307061
URL: https://svnweb.freebsd.org/changeset/base/307061

Log:
  Add missing ThunderX release notes
  
  Reviewed by:  gjb
  Differential Revision:https://reviews.freebsd.org/D8217

Modified:
  stable/11/release/doc/en_US.ISO8859-1/errata/article.xml
  stable/11/release/doc/share/xml/release.ent

Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Oct 11 
17:11:17 2016(r307060)
+++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Oct 11 
17:12:26 2016(r307061)
@@ -168,6 +168,29 @@ boot
  state Wireless support for 802.11n has been added for
  additional wireless network drivers.
   
+
+  
+   Some release notes pertaining to the Cavium ThunderX
+ platform (the / reference platform) were
+ omitted:
+
+   
+ 
+   Support for the Cavium
+ Virtualized NIC ethernet driver has been added.
+ 
+
+ 
+   Support for the GICv3 and
+ ITS device drivers has been added.
+ 
+
+ 
+   Support for PCI
+ Enhanced Allocation support has been added.
+ 
+   
+  
 
   
 

Modified: stable/11/release/doc/share/xml/release.ent
==
--- stable/11/release/doc/share/xml/release.ent Tue Oct 11 17:11:17 2016
(r307060)
+++ stable/11/release/doc/share/xml/release.ent Tue Oct 11 17:12:26 2016
(r307061)
@@ -70,7 +70,7 @@
 
 
 
-
+
 
 
 
___
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: r307060 - head/usr.bin/truss

2016-10-11 Thread John Baldwin
Author: jhb
Date: Tue Oct 11 17:11:17 2016
New Revision: 307060
URL: https://svnweb.freebsd.org/changeset/base/307060

Log:
  Fix printf format warning.

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

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Tue Oct 11 17:00:29 2016
(r307059)
+++ head/usr.bin/truss/syscalls.c   Tue Oct 11 17:11:17 2016
(r307060)
@@ -1924,9 +1924,9 @@ print_arg(struct syscall_args *sc, unsig
cloudabi_filestat_t fsb;
if (get_struct(pid, (void *)args[sc->offset], , sizeof(fsb))
!= -1)
-   fprintf(fp, "{ %s, %lu }",
+   fprintf(fp, "{ %s, %ju }",
xlookup(cloudabi_filetype, fsb.st_filetype),
-   fsb.st_size);
+   (uintmax_t)fsb.st_size);
else
fprintf(fp, "0x%lx", args[sc->offset]);
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: r307059 - head/sys/kern

2016-10-11 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Oct 11 17:00:29 2016
New Revision: 307059
URL: https://svnweb.freebsd.org/changeset/base/307059

Log:
  INTRNG - fix MSI/MSIX release path
  
  Use isrc in attached MSI data structure instead of using map's
  isrc directly. map's isrc is set to NULL on IRQ deactivation
  which happens prior to pci_release_msi so MSI_RELEASE_MSI
  receives array of NULLs
  
  Reviewed by:  mmel
  Differential Revision:https://reviews.freebsd.org/D8206

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==
--- head/sys/kern/subr_intr.c   Tue Oct 11 16:53:50 2016(r307058)
+++ head/sys/kern/subr_intr.c   Tue Oct 11 17:00:29 2016(r307059)
@@ -145,6 +145,7 @@ static u_int intrcnt_index;
 
 static struct intr_irqsrc *intr_map_get_isrc(u_int res_id);
 static void intr_map_set_isrc(u_int res_id, struct intr_irqsrc *isrc);
+static struct intr_map_data * intr_map_get_map_data(u_int res_id);
 static void intr_map_copy_map_data(u_int res_id, device_t *dev, intptr_t *xref,
 struct intr_map_data **data);
 
@@ -1309,6 +1310,7 @@ intr_release_msi(device_t pci, device_t 
 {
struct intr_irqsrc **isrc;
struct intr_pic *pic;
+   struct intr_map_data_msi *msi;
int i, err;
 
pic = pic_lookup(NULL, xref);
@@ -1321,8 +1323,14 @@ intr_release_msi(device_t pci, device_t 
 
isrc = malloc(sizeof(*isrc) * count, M_INTRNG, M_WAITOK);
 
-   for (i = 0; i < count; i++)
-   isrc[i] = intr_map_get_isrc(irqs[i]);
+   for (i = 0; i < count; i++) {
+   msi = (struct intr_map_data_msi *)
+   intr_map_get_map_data(irqs[i]);
+   KASSERT(msi->hdr.type == INTR_MAP_DATA_MSI,
+   ("%s: irq %d map data is not MSI", __func__,
+   irqs[i]));
+   isrc[i] = msi->isrc;
+   }
 
err = MSI_RELEASE_MSI(pic->pic_dev, child, count, isrc);
 
@@ -1369,6 +1377,7 @@ intr_release_msix(device_t pci, device_t
 {
struct intr_irqsrc *isrc;
struct intr_pic *pic;
+   struct intr_map_data_msi *msi;
int err;
 
pic = pic_lookup(NULL, xref);
@@ -1379,7 +1388,12 @@ intr_release_msix(device_t pci, device_t
("%s: Found a non-MSI controller: %s", __func__,
 device_get_name(pic->pic_dev)));
 
-   isrc = intr_map_get_isrc(irq);
+   msi = (struct intr_map_data_msi *)
+   intr_map_get_map_data(irq);
+   KASSERT(msi->hdr.type == INTR_MAP_DATA_MSI,
+   ("%s: irq %d map data is not MSI", __func__,
+   irq));
+   isrc = msi->isrc;
if (isrc == NULL) {
intr_unmap_irq(irq);
return (EINVAL);
@@ -1516,6 +1530,24 @@ intr_map_set_isrc(u_int res_id, struct i
 /*
  * Get a copy of intr_map_entry data
  */
+static struct intr_map_data *
+intr_map_get_map_data(u_int res_id)
+{
+   struct intr_map_data *data;
+
+   data = NULL;
+   mtx_lock(_map_lock);
+   if (res_id >= irq_map_count || irq_map[res_id] == NULL)
+   panic("Attempt to copy invalid resource id: %u\n", res_id);
+   data = irq_map[res_id]->map_data;
+   mtx_unlock(_map_lock);
+
+   return (data);
+}
+
+/*
+ * Get a copy of intr_map_entry data
+ */
 static void
 intr_map_copy_map_data(u_int res_id, device_t *map_dev, intptr_t *map_xref,
 struct intr_map_data **data)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307058 - in stable/10: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:53:50 2016
New Revision: 307058
URL: https://svnweb.freebsd.org/changeset/base/307058

Log:
  MFC r305207: MFV r302659: 6931 lib/libzfs: cleanup gcc warnings
  
  illumos/illumos-gate@88f61dee20b358671b1b643e9d1dbf220a1d69be
  
https://github.com/illumos/illumos-gate/commit/88f61dee20b358671b1b643e9d1dbf220a1d69be
  
  https://www.illumos.org/issues/6931
need cleanup:
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-function
  
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Igor Kozhukhov 

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c
Directory Properties:
  stable/10/   (props changed)

Modified: 
stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
Tue Oct 11 16:52:57 2016(r307057)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
Tue Oct 11 16:53:50 2016(r307058)
@@ -24,9 +24,9 @@
  * Use is subject to license terms.
  *
  * Portions Copyright 2007 Ramprakash Jelari
- *
  * Copyright (c) 2011 Pawel Jakub Dawidek .
  * All rights reserved.
+ * Copyright 2016 Igor Kozhukhov 
  */
 
 #include 
@@ -136,6 +136,9 @@ changelist_prefix(prop_changelist_t *clp
case ZFS_PROP_SHARESMB:
(void) zfs_unshare_smb(cn->cn_handle, NULL);
break;
+
+   default:
+   break;
}
}
}

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Tue Oct 11 16:52:57 2016(r307057)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Tue Oct 11 16:53:50 2016(r307058)
@@ -29,6 +29,7 @@
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Igor Kozhukhov 
  */
 
 #include 
@@ -78,55 +79,18 @@ zfs_type_to_name(zfs_type_t type)
return (dgettext(TEXT_DOMAIN, "snapshot"));
case ZFS_TYPE_VOLUME:
return (dgettext(TEXT_DOMAIN, "volume"));
+   case ZFS_TYPE_POOL:
+   return (dgettext(TEXT_DOMAIN, "pool"));
+   case ZFS_TYPE_BOOKMARK:
+   return (dgettext(TEXT_DOMAIN, "bookmark"));
+   default:
+   assert(!"unhandled zfs_type_t");
}
 
return (NULL);
 }
 
 /*
- * Given a path and mask of ZFS types, return a string describing this dataset.
- * This is used when we fail to open a dataset and we cannot get an exact type.
- * We guess what the type would have been based on the path and the mask of
- * acceptable types.
- */
-static const char *
-path_to_str(const char *path, int types)
-{
-   /*
-* When given a single type, always report the exact type.
-*/
-   if (types == ZFS_TYPE_SNAPSHOT)
-   return (dgettext(TEXT_DOMAIN, "snapshot"));
-   if (types == ZFS_TYPE_FILESYSTEM)
-   return (dgettext(TEXT_DOMAIN, "filesystem"));
-   if (types == ZFS_TYPE_VOLUME)
-   return (dgettext(TEXT_DOMAIN, "volume"));
-
-   /*
-* The user is requesting more than one type of dataset.  If this is the
-* case, consult the path itself.  If we're looking for a snapshot, and
-* a '@' is found, then report it as "snapshot".  Otherwise, remove the
-* snapshot attribute and try again.
-*/
-   if (types & ZFS_TYPE_SNAPSHOT) {
-   if (strchr(path, '@') != NULL)
-   return (dgettext(TEXT_DOMAIN, "snapshot"));
-   return (path_to_str(path, types & ~ZFS_TYPE_SNAPSHOT));
-   }
-
-   /*
-* The user has requested either filesystems or volumes.
-* We have no way of knowing a priori what type this would be, so always
-* report it as "filesystem" or "volume", our two primitive 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:52:57 2016
New Revision: 307057
URL: https://svnweb.freebsd.org/changeset/base/307057

Log:
  MFC r305200: MFV r302651:
  7054 dmu_tx_hold_t should use refcount_t to track space
  
  illumos/illumos-gate@0c779ad424a92a84d1e07d47cab7f8009189202b
  
https://github.com/illumos/illumos-gate/commit/0c779ad424a92a84d1e07d47cab7f8009
  189202b
  
  https://www.illumos.org/issues/7054
upstream:
ee0003de7d3e598499be7ac3fe6b61efcc47cb7f
DLPX-40399 dmu_tx_hold_t should use refcount_t to track space
  
  Reviewed by: George Wilson 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c   Tue Oct 
11 16:50:45 2016(r307056)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c   Tue Oct 
11 16:52:57 2016(r307057)
@@ -129,6 +129,12 @@ dmu_tx_hold_object_impl(dmu_tx_t *tx, ob
txh = kmem_zalloc(sizeof (dmu_tx_hold_t), KM_SLEEP);
txh->txh_tx = tx;
txh->txh_dnode = dn;
+   refcount_create(>txh_space_towrite);
+   refcount_create(>txh_space_tofree);
+   refcount_create(>txh_space_tooverwrite);
+   refcount_create(>txh_space_tounref);
+   refcount_create(>txh_memory_tohold);
+   refcount_create(>txh_fudge);
 #ifdef ZFS_DEBUG
txh->txh_type = type;
txh->txh_arg1 = arg1;
@@ -201,12 +207,18 @@ dmu_tx_count_twig(dmu_tx_hold_t *txh, dn
freeable = (bp && (freeable ||
dsl_dataset_block_freeable(ds, bp, bp->blk_birth)));
 
-   if (freeable)
-   txh->txh_space_tooverwrite += space;
-   else
-   txh->txh_space_towrite += space;
-   if (bp)
-   txh->txh_space_tounref += bp_get_dsize(os->os_spa, bp);
+   if (freeable) {
+   (void) refcount_add_many(>txh_space_tooverwrite,
+   space, FTAG);
+   } else {
+   (void) refcount_add_many(>txh_space_towrite,
+   space, FTAG);
+   }
+
+   if (bp) {
+   (void) refcount_add_many(>txh_space_tounref,
+   bp_get_dsize(os->os_spa, bp), FTAG);
+   }
 
dmu_tx_count_twig(txh, dn, parent, level + 1,
blkid >> epbs, freeable, history);
@@ -336,8 +348,11 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u
bits = 64 - min_bs;
epbs = min_ibs - SPA_BLKPTRSHIFT;
for (bits -= epbs * (nlvls - 1);
-   bits >= 0; bits -= epbs)
-   txh->txh_fudge += 1ULL << max_ibs;
+   bits >= 0; bits -= epbs) {
+   (void) refcount_add_many(
+   >txh_fudge,
+   1ULL << max_ibs, FTAG);
+   }
goto out;
}
off += delta;
@@ -353,7 +368,8 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u
 */
start = P2ALIGN(off, 1ULL << max_bs);
end = P2ROUNDUP(off + len, 1ULL << max_bs) - 1;
-   txh->txh_space_towrite += end - start + 1;
+   (void) refcount_add_many(>txh_space_towrite,
+   end - start + 1, FTAG);
 
start >>= min_bs;
end >>= min_bs;
@@ -368,18 +384,21 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u
start >>= epbs;
end >>= epbs;
ASSERT3U(end, >=, start);
-   txh->txh_space_towrite += (end - start + 1) << max_ibs;
+   (void) refcount_add_many(>txh_space_towrite,
+   (end - start + 1) << max_ibs, FTAG);
if (start != 0) {
/*
 * We also need a new blkid=0 indirect block
 * to reference any existing file data.
 */
-   txh->txh_space_towrite += 1ULL << max_ibs;
+   (void) refcount_add_many(>txh_space_towrite,
+   1ULL << max_ibs, FTAG);
}

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:50:45 2016
New Revision: 307056
URL: https://svnweb.freebsd.org/changeset/base/307056

Log:
  MFC r305199: MFV r302648: 7019 zfsdev_ioctl skips secpolicy when FKIOCTL is 
set
  
  Note that the bulk of the upstream change is not applicable to FreeBSD
  and the affected files are not even in the vendor area.
  
  illumos/illumos-gate@45b1747515a17db45e8971501ee84a26bdff37b2
  
https://github.com/illumos/illumos-gate/commit/45b1747515a17db45e8971501ee84a26bdff37b2
  
  https://www.illumos.org/issues/7019
Currently zfsdev_ioctl, when confronted by a request with the FKIOCTL flag 
set,
skips all processing of secpolicy functions. This means that ZFS is not 
doing
any kind of verification of the credentials or access rights of the caller 
and
assuming that (as it is an in-kernel client) all such checks have already 
been
done.
This turns out to be quite a dangerous assumption, especially with respect 
to
sdev. In general I don't think it's particularly reasonable to offload this
enforcement of access rights onto other kernel subsystems when ZFS has some
particular local semantics in this area (delegated datasets etc) and does 
not
provide any kind of API to allow other subsystems to avoid code duplication
when doing it. ZFS should apply its normal access policy to requests from
within the kernel, and callers should take care to give it the correct
credentials and call it from the correct context in order to get the results
they need.
You can observe the currently unfortunate consequences of this bug in any 
non-
global zone that has access to /dev/zvol or any subset of it via sdev 
profiles.
In particular, a zone used to contain a KVM or similar which has a single 
zvol
passed through to it using a 
  Reviewed by: Richard Lowe 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Alex Wilson 

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

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Tue Oct 11 16:49:16 2016(r307055)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Tue Oct 11 16:50:45 2016(r307056)
@@ -26,7 +26,7 @@
  * Copyright 2014 Xin Li . All rights reserved.
  * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
- * Copyright (c) 2014, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, 2016 Joyent, Inc. All rights reserved.
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
@@ -6366,7 +6366,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zc
break;
}
 
-   if (error == 0 && !(flag & FKIOCTL))
+   if (error == 0)
error = vec->zvec_secpolicy(zc, innvl, cr);
 
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: r307055 - in stable/10/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys/sysevent

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:49:16 2016
New Revision: 307055
URL: https://svnweb.freebsd.org/changeset/base/307055

Log:
  MFC r305198: MFV r302647:
  6922 Emit ESC_ZFS_VDEV_REMOVE_AUX after removing an aux device
  
  illumos/illumos-gate@63364b0ee2604783e7a55f842567768eafa4
  
https://github.com/illumos/illumos-gate/commit/63364b0ee2604783e7a55f8425677
  68eafa4
  
  https://www.illumos.org/issues/6922
ZFS does not do a config_sync after removing an aux (spare, log, or cache)
device. AFAICT this isn't being done because it is slow and was deemed
unnecessary. However, it should be such a rare operation that speed doesn't
matter, and not doing it results in two problems:
1) It is theoretically possible to remove an aux device from one pool and
attach it to another, then lose power. When power is restored, both pools 
woul
  d
think that they own the aux device.
2) Removal of the aux device doesn't send any useful sysevents to userland.
  
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Alan Somers 

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

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Tue Oct 
11 16:48:12 2016(r307054)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Tue Oct 
11 16:49:16 2016(r307055)
@@ -5680,6 +5680,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
} else {
error = SET_ERROR(EBUSY);
}
+   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (spa->spa_l2cache.sav_vdevs != NULL &&
nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, , ) == 0 &&
@@ -5691,6 +5692,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
spa_load_l2cache(spa);
spa->spa_l2cache.sav_sync = B_TRUE;
+   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (vd != NULL && vd->vdev_islog) {
ASSERT(!locked);
ASSERT(vd == vd->vdev_top);
@@ -5729,6 +5731,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
 */
spa_vdev_remove_from_namespace(spa, vd);
 
+   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
} else if (vd != NULL) {
/*
 * Normal vdevs cannot be removed (yet).
@@ -5742,7 +5745,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
}
 
if (!locked)
-   return (spa_vdev_exit(spa, NULL, txg, error));
+   error = spa_vdev_exit(spa, NULL, txg, error);
 
return (error);
 }

Modified: 
stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h  
Tue Oct 11 16:48:12 2016(r307054)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h  
Tue Oct 11 16:49:16 2016(r307055)
@@ -249,6 +249,8 @@ extern "C" {
 #defineESC_ZFS_RESILVER_START  "ESC_ZFS_resilver_start"
 #defineESC_ZFS_RESILVER_FINISH "ESC_ZFS_resilver_finish"
 #defineESC_ZFS_VDEV_REMOVE "ESC_ZFS_vdev_remove"
+#defineESC_ZFS_VDEV_REMOVE_AUX "ESC_ZFS_vdev_remove_aux"
+#defineESC_ZFS_VDEV_REMOVE_DEV "ESC_ZFS_vdev_remove_dev"
 #defineESC_ZFS_POOL_CREATE "ESC_ZFS_pool_create"
 #defineESC_ZFS_POOL_DESTROY"ESC_ZFS_pool_destroy"
 #defineESC_ZFS_POOL_IMPORT "ESC_ZFS_pool_import"
___
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: r307054 - in stable/10/sys/cddl/contrib/opensolaris: common/zfs uts/common/fs/zfs uts/common/fs/zfs/sys

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:48:12 2016
New Revision: 307054
URL: https://svnweb.freebsd.org/changeset/base/307054

Log:
  MFC r305197: MFV r302646:
  6980 6902 causes zfs send to break due to 32-bit/64-bit struct mismatch
  
  illumos/illumos-gate@ea4a67f462de0a39a9adea8197bcdef849de5371
  
https://github.com/illumos/illumos-gate/commit/ea4a67f462de0a39a9adea8197bcdef84
  9de5371
  
  https://www.illumos.org/issues/6980
doing zfs send -i snap1 snap2 >testfile results in
internal error: Invalid argument
Abort (core dumped)
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 

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

Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
==
--- stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
Tue Oct 11 16:47:21 2016(r307053)
+++ stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
Tue Oct 11 16:48:12 2016(r307054)
@@ -55,8 +55,52 @@ zfs_cmd_compat_get(zfs_cmd_t *zc, caddr_
zfs_cmd_zcmd_t *zcmd_c;
zfs_cmd_edbp_t *edbp_c;
zfs_cmd_resume_t *resume_c;
+   zfs_cmd_inlanes_t *inlanes_c;
 
switch (cflag) {
+   case ZFS_CMD_COMPAT_INLANES:
+   inlanes_c = (void *)addr;
+   /* zc */
+   strlcpy(zc->zc_name, inlanes_c->zc_name, MAXPATHLEN);
+   strlcpy(zc->zc_value, inlanes_c->zc_value, MAXPATHLEN * 2);
+   strlcpy(zc->zc_string, inlanes_c->zc_string, MAXPATHLEN);
+
+#define FIELD_COPY(field) zc->field = inlanes_c->field
+   FIELD_COPY(zc_nvlist_src);
+   FIELD_COPY(zc_nvlist_src_size);
+   FIELD_COPY(zc_nvlist_dst);
+   FIELD_COPY(zc_nvlist_dst_size);
+   FIELD_COPY(zc_nvlist_dst_filled);
+   FIELD_COPY(zc_pad2);
+   FIELD_COPY(zc_history);
+   FIELD_COPY(zc_guid);
+   FIELD_COPY(zc_nvlist_conf);
+   FIELD_COPY(zc_nvlist_conf_size);
+   FIELD_COPY(zc_cookie);
+   FIELD_COPY(zc_objset_type);
+   FIELD_COPY(zc_perm_action);
+   FIELD_COPY(zc_history_len);
+   FIELD_COPY(zc_history_offset);
+   FIELD_COPY(zc_obj);
+   FIELD_COPY(zc_iflags);
+   FIELD_COPY(zc_share);
+   FIELD_COPY(zc_jailid);
+   FIELD_COPY(zc_objset_stats);
+   FIELD_COPY(zc_begin_record);
+   FIELD_COPY(zc_inject_record);
+   FIELD_COPY(zc_defer_destroy);
+   FIELD_COPY(zc_flags);
+   FIELD_COPY(zc_action_handle);
+   FIELD_COPY(zc_cleanup_fd);
+   FIELD_COPY(zc_simple);
+   FIELD_COPY(zc_resumable);
+   FIELD_COPY(zc_sendobj);
+   FIELD_COPY(zc_fromobj);
+   FIELD_COPY(zc_createtxg);
+   FIELD_COPY(zc_stat);
+#undef FIELD_COPY
+   break;
+
case ZFS_CMD_COMPAT_RESUME:
resume_c = (void *)addr;
/* zc */
@@ -434,8 +478,50 @@ zfs_cmd_compat_put(zfs_cmd_t *zc, caddr_
zfs_cmd_zcmd_t *zcmd_c;
zfs_cmd_edbp_t *edbp_c;
zfs_cmd_resume_t *resume_c;
+   zfs_cmd_inlanes_t *inlanes_c;
 
switch (cflag) {
+   case ZFS_CMD_COMPAT_INLANES:
+   inlanes_c = (void *)addr;
+   strlcpy(inlanes_c->zc_name, zc->zc_name, MAXPATHLEN);
+   strlcpy(inlanes_c->zc_value, zc->zc_value, MAXPATHLEN * 2);
+   strlcpy(inlanes_c->zc_string, zc->zc_string, MAXPATHLEN);
+
+#define FIELD_COPY(field) inlanes_c->field = zc->field
+   FIELD_COPY(zc_nvlist_src);
+   FIELD_COPY(zc_nvlist_src_size);
+   FIELD_COPY(zc_nvlist_dst);
+   FIELD_COPY(zc_nvlist_dst_size);
+   FIELD_COPY(zc_nvlist_dst_filled);
+   FIELD_COPY(zc_pad2);
+   FIELD_COPY(zc_history);
+   FIELD_COPY(zc_guid);
+   FIELD_COPY(zc_nvlist_conf);
+   FIELD_COPY(zc_nvlist_conf_size);
+   FIELD_COPY(zc_cookie);
+   FIELD_COPY(zc_objset_type);
+   FIELD_COPY(zc_perm_action);
+   FIELD_COPY(zc_history_len);
+   FIELD_COPY(zc_history_offset);
+   FIELD_COPY(zc_obj);
+   FIELD_COPY(zc_iflags);
+   FIELD_COPY(zc_share);
+   

svn commit: r307053 - in stable/10: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/commo...

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:47:21 2016
New Revision: 307053
URL: https://svnweb.freebsd.org/changeset/base/307053

Log:
  MFC r305195: MFV r302643:
  6902 speed up listing of snapshots if requesting name only and sorting by name
  
  This was our change from the beginning, so just reduce the upstream diff.

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c   Tue Oct 11 
16:46:16 2016(r307052)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c   Tue Oct 11 
16:47:21 2016(r307053)
@@ -21,8 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012 Pawel Jakub Dawidek .
- * All rights reserved.
+ * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
  */
@@ -320,8 +319,8 @@ zfs_sort(const void *larg, const void *r
} else if (psc->sc_prop == ZFS_PROP_NAME) {
lvalid = rvalid = B_TRUE;
 
-   (void) strlcpy(lbuf, zfs_get_name(l), sizeof(lbuf));
-   (void) strlcpy(rbuf, zfs_get_name(r), sizeof(rbuf));
+   (void) strlcpy(lbuf, zfs_get_name(l), sizeof (lbuf));
+   (void) strlcpy(rbuf, zfs_get_name(r), sizeof (rbuf));
 
lstr = lbuf;
rstr = rbuf;

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h   Tue Oct 11 
16:46:16 2016(r307052)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h   Tue Oct 11 
16:47:21 2016(r307053)
@@ -22,6 +22,7 @@
 /*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  */
 

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Tue Oct 11 
16:46:16 2016(r307052)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Tue Oct 11 
16:47:21 2016(r307053)
@@ -24,8 +24,7 @@
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright 2012 Milan Jurik. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
- * Copyright (c) 2011-2012 Pawel Jakub Dawidek .
- * All rights reserved.
+ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright (c) 2012 Martin Matuska . All rights reserved.
  * Copyright (c) 2013 Steven Hartland.  All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
@@ -3008,7 +3007,7 @@ print_dataset(zfs_handle_t *zhp, list_cb
 
if (pl->pl_prop == ZFS_PROP_NAME) {
(void) strlcpy(property, zfs_get_name(zhp),
-   sizeof(property));
+   sizeof (property));
propstr = property;
right_justify = zfs_prop_align_right(pl->pl_prop);
} else if (pl->pl_prop != ZPROP_INVAL) {

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Tue Oct 
11 16:46:16 2016(r307052)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Tue Oct 
11 16:47:21 2016(r307053)
@@ -21,8 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 Pawel Jakub Dawidek .
- * All rights reserved.
+ * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved.
  * Copyright (c) 2011, 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:46:16 2016
New Revision: 307052
URL: https://svnweb.freebsd.org/changeset/base/307052

Log:
  MFC r305193: MFV r302642:
  6876 Stack corruption after importing a pool with a too-long name
  
  illumos/illumos-gate@c971037baa5d64dfecf6d87ed602fc3116ebec41
  
https://github.com/illumos/illumos-gate/commit/c971037baa5d64dfecf6d87ed602fc3116ebec41
  
  https://www.illumos.org/issues/6876
Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for
trouble. We should check every dataset on import, using a 1024 byte buffer 
and
checking each time to see if the dataset's new name is longer than 256 
bytes.
  
  Reviewed by: Prakash Surya 
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Yuri Pankov 
  Approved by: Richard Lowe 
  Author: Paul Dagnelie 

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

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Tue Oct 
11 16:38:39 2016(r307051)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Tue Oct 
11 16:46:16 2016(r307052)
@@ -1975,6 +1975,19 @@ spa_load_verify_cb(spa_t *spa, zilog_t *
return (0);
 }
 
+/* ARGSUSED */
+int
+verify_dataset_name_len(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
+{
+   char namebuf[MAXPATHLEN];
+   dsl_dataset_name(ds, namebuf);
+   if (strlen(namebuf) > MAXNAMELEN) {
+   return (SET_ERROR(ENAMETOOLONG));
+   }
+
+   return (0);
+}
+
 static int
 spa_load_verify(spa_t *spa)
 {
@@ -1989,6 +2002,14 @@ spa_load_verify(spa_t *spa)
if (policy.zrp_request & ZPOOL_NEVER_REWIND)
return (0);
 
+   dsl_pool_config_enter(spa->spa_dsl_pool, FTAG);
+   error = dmu_objset_find_dp(spa->spa_dsl_pool,
+   spa->spa_dsl_pool->dp_root_dir_obj, verify_dataset_name_len, NULL,
+   DS_FIND_CHILDREN);
+   dsl_pool_config_exit(spa->spa_dsl_pool, FTAG);
+   if (error != 0)
+   return (error);
+
rio = zio_root(spa, NULL, ,
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE);
 
___
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: r307051 - stable/11/sys/conf

2016-10-11 Thread Glen Barber
Author: gjb
Date: Tue Oct 11 16:38:39 2016
New Revision: 307051
URL: https://svnweb.freebsd.org/changeset/base/307051

Log:
  Switch stable/11 to -STABLE following the release.
  
  Reminded by:  Piotr Smyrak
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/conf/newvers.sh

Modified: stable/11/sys/conf/newvers.sh
==
--- stable/11/sys/conf/newvers.sh   Tue Oct 11 16:33:43 2016
(r307050)
+++ stable/11/sys/conf/newvers.sh   Tue Oct 11 16:38:39 2016
(r307051)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="11.0"
-BRANCH="PRERELEASE"
+BRANCH="STABLE"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:33:43 2016
New Revision: 307050
URL: https://svnweb.freebsd.org/changeset/base/307050

Log:
  MFC r305207: MFV r302659: 6931 lib/libzfs: cleanup gcc warnings
  
  illumos/illumos-gate@88f61dee20b358671b1b643e9d1dbf220a1d69be
  
https://github.com/illumos/illumos-gate/commit/88f61dee20b358671b1b643e9d1dbf220a1d69be
  
  https://www.illumos.org/issues/6931
need cleanup:
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-function
  
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Igor Kozhukhov 

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c
Directory Properties:
  stable/11/   (props changed)

Modified: 
stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
Tue Oct 11 16:32:49 2016(r307049)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
Tue Oct 11 16:33:43 2016(r307050)
@@ -24,9 +24,9 @@
  * Use is subject to license terms.
  *
  * Portions Copyright 2007 Ramprakash Jelari
- *
  * Copyright (c) 2011 Pawel Jakub Dawidek .
  * All rights reserved.
+ * Copyright 2016 Igor Kozhukhov 
  */
 
 #include 
@@ -136,6 +136,9 @@ changelist_prefix(prop_changelist_t *clp
case ZFS_PROP_SHARESMB:
(void) zfs_unshare_smb(cn->cn_handle, NULL);
break;
+
+   default:
+   break;
}
}
}

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Tue Oct 11 16:32:49 2016(r307049)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Tue Oct 11 16:33:43 2016(r307050)
@@ -29,6 +29,7 @@
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016 Igor Kozhukhov 
  */
 
 #include 
@@ -78,55 +79,18 @@ zfs_type_to_name(zfs_type_t type)
return (dgettext(TEXT_DOMAIN, "snapshot"));
case ZFS_TYPE_VOLUME:
return (dgettext(TEXT_DOMAIN, "volume"));
+   case ZFS_TYPE_POOL:
+   return (dgettext(TEXT_DOMAIN, "pool"));
+   case ZFS_TYPE_BOOKMARK:
+   return (dgettext(TEXT_DOMAIN, "bookmark"));
+   default:
+   assert(!"unhandled zfs_type_t");
}
 
return (NULL);
 }
 
 /*
- * Given a path and mask of ZFS types, return a string describing this dataset.
- * This is used when we fail to open a dataset and we cannot get an exact type.
- * We guess what the type would have been based on the path and the mask of
- * acceptable types.
- */
-static const char *
-path_to_str(const char *path, int types)
-{
-   /*
-* When given a single type, always report the exact type.
-*/
-   if (types == ZFS_TYPE_SNAPSHOT)
-   return (dgettext(TEXT_DOMAIN, "snapshot"));
-   if (types == ZFS_TYPE_FILESYSTEM)
-   return (dgettext(TEXT_DOMAIN, "filesystem"));
-   if (types == ZFS_TYPE_VOLUME)
-   return (dgettext(TEXT_DOMAIN, "volume"));
-
-   /*
-* The user is requesting more than one type of dataset.  If this is the
-* case, consult the path itself.  If we're looking for a snapshot, and
-* a '@' is found, then report it as "snapshot".  Otherwise, remove the
-* snapshot attribute and try again.
-*/
-   if (types & ZFS_TYPE_SNAPSHOT) {
-   if (strchr(path, '@') != NULL)
-   return (dgettext(TEXT_DOMAIN, "snapshot"));
-   return (path_to_str(path, types & ~ZFS_TYPE_SNAPSHOT));
-   }
-
-   /*
-* The user has requested either filesystems or volumes.
-* We have no way of knowing a priori what type this would be, so always
-* report it as "filesystem" or "volume", our two primitive 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:32:49 2016
New Revision: 307049
URL: https://svnweb.freebsd.org/changeset/base/307049

Log:
  MFC r305200: MFV r302651:
  7054 dmu_tx_hold_t should use refcount_t to track space
  
  illumos/illumos-gate@0c779ad424a92a84d1e07d47cab7f8009189202b
  
https://github.com/illumos/illumos-gate/commit/0c779ad424a92a84d1e07d47cab7f8009
  189202b
  
  https://www.illumos.org/issues/7054
upstream:
ee0003de7d3e598499be7ac3fe6b61efcc47cb7f
DLPX-40399 dmu_tx_hold_t should use refcount_t to track space
  
  Reviewed by: George Wilson 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Igor Kozhukhov 
  Approved by: Dan McDonald 
  Author: Matthew Ahrens 

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c   Tue Oct 
11 16:31:55 2016(r307048)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c   Tue Oct 
11 16:32:49 2016(r307049)
@@ -129,6 +129,12 @@ dmu_tx_hold_object_impl(dmu_tx_t *tx, ob
txh = kmem_zalloc(sizeof (dmu_tx_hold_t), KM_SLEEP);
txh->txh_tx = tx;
txh->txh_dnode = dn;
+   refcount_create(>txh_space_towrite);
+   refcount_create(>txh_space_tofree);
+   refcount_create(>txh_space_tooverwrite);
+   refcount_create(>txh_space_tounref);
+   refcount_create(>txh_memory_tohold);
+   refcount_create(>txh_fudge);
 #ifdef ZFS_DEBUG
txh->txh_type = type;
txh->txh_arg1 = arg1;
@@ -201,12 +207,18 @@ dmu_tx_count_twig(dmu_tx_hold_t *txh, dn
freeable = (bp && (freeable ||
dsl_dataset_block_freeable(ds, bp, bp->blk_birth)));
 
-   if (freeable)
-   txh->txh_space_tooverwrite += space;
-   else
-   txh->txh_space_towrite += space;
-   if (bp)
-   txh->txh_space_tounref += bp_get_dsize(os->os_spa, bp);
+   if (freeable) {
+   (void) refcount_add_many(>txh_space_tooverwrite,
+   space, FTAG);
+   } else {
+   (void) refcount_add_many(>txh_space_towrite,
+   space, FTAG);
+   }
+
+   if (bp) {
+   (void) refcount_add_many(>txh_space_tounref,
+   bp_get_dsize(os->os_spa, bp), FTAG);
+   }
 
dmu_tx_count_twig(txh, dn, parent, level + 1,
blkid >> epbs, freeable, history);
@@ -336,8 +348,11 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u
bits = 64 - min_bs;
epbs = min_ibs - SPA_BLKPTRSHIFT;
for (bits -= epbs * (nlvls - 1);
-   bits >= 0; bits -= epbs)
-   txh->txh_fudge += 1ULL << max_ibs;
+   bits >= 0; bits -= epbs) {
+   (void) refcount_add_many(
+   >txh_fudge,
+   1ULL << max_ibs, FTAG);
+   }
goto out;
}
off += delta;
@@ -353,7 +368,8 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u
 */
start = P2ALIGN(off, 1ULL << max_bs);
end = P2ROUNDUP(off + len, 1ULL << max_bs) - 1;
-   txh->txh_space_towrite += end - start + 1;
+   (void) refcount_add_many(>txh_space_towrite,
+   end - start + 1, FTAG);
 
start >>= min_bs;
end >>= min_bs;
@@ -368,18 +384,21 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, u
start >>= epbs;
end >>= epbs;
ASSERT3U(end, >=, start);
-   txh->txh_space_towrite += (end - start + 1) << max_ibs;
+   (void) refcount_add_many(>txh_space_towrite,
+   (end - start + 1) << max_ibs, FTAG);
if (start != 0) {
/*
 * We also need a new blkid=0 indirect block
 * to reference any existing file data.
 */
-   txh->txh_space_towrite += 1ULL << max_ibs;
+   (void) refcount_add_many(>txh_space_towrite,
+   1ULL << max_ibs, FTAG);
}

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:31:55 2016
New Revision: 307048
URL: https://svnweb.freebsd.org/changeset/base/307048

Log:
  MFC r305199: MFV r302648: 7019 zfsdev_ioctl skips secpolicy when FKIOCTL is 
set
  
  Note that the bulk of the upstream change is not applicable to FreeBSD
  and the affected files are not even in the vendor area.
  
  illumos/illumos-gate@45b1747515a17db45e8971501ee84a26bdff37b2
  
https://github.com/illumos/illumos-gate/commit/45b1747515a17db45e8971501ee84a26bdff37b2
  
  https://www.illumos.org/issues/7019
Currently zfsdev_ioctl, when confronted by a request with the FKIOCTL flag 
set,
skips all processing of secpolicy functions. This means that ZFS is not 
doing
any kind of verification of the credentials or access rights of the caller 
and
assuming that (as it is an in-kernel client) all such checks have already 
been
done.
This turns out to be quite a dangerous assumption, especially with respect 
to
sdev. In general I don't think it's particularly reasonable to offload this
enforcement of access rights onto other kernel subsystems when ZFS has some
particular local semantics in this area (delegated datasets etc) and does 
not
provide any kind of API to allow other subsystems to avoid code duplication
when doing it. ZFS should apply its normal access policy to requests from
within the kernel, and callers should take care to give it the correct
credentials and call it from the correct context in order to get the results
they need.
You can observe the currently unfortunate consequences of this bug in any 
non-
global zone that has access to /dev/zvol or any subset of it via sdev 
profiles.
In particular, a zone used to contain a KVM or similar which has a single 
zvol
passed through to it using a 
  Reviewed by: Richard Lowe 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Alex Wilson 

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
Tue Oct 11 16:30:49 2016(r307047)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Tue Oct 11 16:31:55 2016(r307048)
@@ -26,7 +26,7 @@
  * Copyright 2014 Xin Li . All rights reserved.
  * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
- * Copyright (c) 2014, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, 2016 Joyent, Inc. All rights reserved.
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
@@ -6359,7 +6359,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zc
break;
}
 
-   if (error == 0 && !(flag & FKIOCTL))
+   if (error == 0)
error = vec->zvec_secpolicy(zc, innvl, cr);
 
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: r307047 - in stable/11/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys/sysevent

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:30:49 2016
New Revision: 307047
URL: https://svnweb.freebsd.org/changeset/base/307047

Log:
  MFC r305198: MFV r302647:
  6922 Emit ESC_ZFS_VDEV_REMOVE_AUX after removing an aux device
  
  illumos/illumos-gate@63364b0ee2604783e7a55f842567768eafa4
  
https://github.com/illumos/illumos-gate/commit/63364b0ee2604783e7a55f8425677
  68eafa4
  
  https://www.illumos.org/issues/6922
ZFS does not do a config_sync after removing an aux (spare, log, or cache)
device. AFAICT this isn't being done because it is slow and was deemed
unnecessary. However, it should be such a rare operation that speed doesn't
matter, and not doing it results in two problems:
1) It is theoretically possible to remove an aux device from one pool and
attach it to another, then lose power. When power is restored, both pools 
woul
  d
think that they own the aux device.
2) Removal of the aux device doesn't send any useful sysevents to userland.
  
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Alan Somers 

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h
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  Tue Oct 
11 16:29:43 2016(r307046)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Tue Oct 
11 16:30:49 2016(r307047)
@@ -5773,6 +5773,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
} else {
error = SET_ERROR(EBUSY);
}
+   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (spa->spa_l2cache.sav_vdevs != NULL &&
nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, , ) == 0 &&
@@ -5784,6 +5785,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
spa_load_l2cache(spa);
spa->spa_l2cache.sav_sync = B_TRUE;
+   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
} else if (vd != NULL && vd->vdev_islog) {
ASSERT(!locked);
ASSERT(vd == vd->vdev_top);
@@ -5822,6 +5824,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
 */
spa_vdev_remove_from_namespace(spa, vd);
 
+   spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
} else if (vd != NULL) {
/*
 * Normal vdevs cannot be removed (yet).
@@ -5835,7 +5838,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
}
 
if (!locked)
-   return (spa_vdev_exit(spa, NULL, txg, error));
+   error = spa_vdev_exit(spa, NULL, txg, error);
 
return (error);
 }

Modified: 
stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h  
Tue Oct 11 16:29:43 2016(r307046)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h  
Tue Oct 11 16:30:49 2016(r307047)
@@ -249,6 +249,8 @@ extern "C" {
 #defineESC_ZFS_RESILVER_START  "ESC_ZFS_resilver_start"
 #defineESC_ZFS_RESILVER_FINISH "ESC_ZFS_resilver_finish"
 #defineESC_ZFS_VDEV_REMOVE "ESC_ZFS_vdev_remove"
+#defineESC_ZFS_VDEV_REMOVE_AUX "ESC_ZFS_vdev_remove_aux"
+#defineESC_ZFS_VDEV_REMOVE_DEV "ESC_ZFS_vdev_remove_dev"
 #defineESC_ZFS_POOL_CREATE "ESC_ZFS_pool_create"
 #defineESC_ZFS_POOL_DESTROY"ESC_ZFS_pool_destroy"
 #defineESC_ZFS_POOL_IMPORT "ESC_ZFS_pool_import"
___
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: r307046 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/commo...

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:29:43 2016
New Revision: 307046
URL: https://svnweb.freebsd.org/changeset/base/307046

Log:
  MFC r305195: MFV r302643:
  6902 speed up listing of snapshots if requesting name only and sorting by name
  
  This was our change from the beginning, so just reduce the upstream diff.

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.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_impl.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
  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/cmd/zfs/zfs_iter.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c   Tue Oct 11 
16:26:58 2016(r307045)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c   Tue Oct 11 
16:29:43 2016(r307046)
@@ -21,8 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012 Pawel Jakub Dawidek .
- * All rights reserved.
+ * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
  */
@@ -320,8 +319,8 @@ zfs_sort(const void *larg, const void *r
} else if (psc->sc_prop == ZFS_PROP_NAME) {
lvalid = rvalid = B_TRUE;
 
-   (void) strlcpy(lbuf, zfs_get_name(l), sizeof(lbuf));
-   (void) strlcpy(rbuf, zfs_get_name(r), sizeof(rbuf));
+   (void) strlcpy(lbuf, zfs_get_name(l), sizeof (lbuf));
+   (void) strlcpy(rbuf, zfs_get_name(r), sizeof (rbuf));
 
lstr = lbuf;
rstr = rbuf;

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h   Tue Oct 11 
16:26:58 2016(r307045)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h   Tue Oct 11 
16:29:43 2016(r307046)
@@ -22,6 +22,7 @@
 /*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  */
 

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Tue Oct 11 
16:26:58 2016(r307045)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Tue Oct 11 
16:29:43 2016(r307046)
@@ -24,8 +24,7 @@
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright 2012 Milan Jurik. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
- * Copyright (c) 2011-2012 Pawel Jakub Dawidek .
- * All rights reserved.
+ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright (c) 2012 Martin Matuska . All rights reserved.
  * Copyright (c) 2013 Steven Hartland.  All rights reserved.
  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
@@ -3009,7 +3008,7 @@ print_dataset(zfs_handle_t *zhp, list_cb
 
if (pl->pl_prop == ZFS_PROP_NAME) {
(void) strlcpy(property, zfs_get_name(zhp),
-   sizeof(property));
+   sizeof (property));
propstr = property;
right_justify = zfs_prop_align_right(pl->pl_prop);
} else if (pl->pl_prop != ZPROP_INVAL) {

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Tue Oct 
11 16:26:58 2016(r307045)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Tue Oct 
11 16:29:43 2016(r307046)
@@ -21,8 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 Pawel Jakub Dawidek .
- * All rights reserved.
+ * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved.
  * Copyright (c) 2011, 

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

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 16:26:58 2016
New Revision: 307045
URL: https://svnweb.freebsd.org/changeset/base/307045

Log:
  MFC r305193: MFV r302642:
  6876 Stack corruption after importing a pool with a too-long name
  
  illumos/illumos-gate@c971037baa5d64dfecf6d87ed602fc3116ebec41
  
https://github.com/illumos/illumos-gate/commit/c971037baa5d64dfecf6d87ed602fc3116ebec41
  
  https://www.illumos.org/issues/6876
Calling dsl_dataset_name on a dataset with a 256 byte buffer is asking for
trouble. We should check every dataset on import, using a 1024 byte buffer 
and
checking each time to see if the dataset's new name is longer than 256 
bytes.
  
  Reviewed by: Prakash Surya 
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Reviewed by: Yuri Pankov 
  Approved by: Richard Lowe 
  Author: Paul Dagnelie 

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  Tue Oct 
11 16:12:12 2016(r307044)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Tue Oct 
11 16:26:58 2016(r307045)
@@ -1996,6 +1996,19 @@ spa_load_verify_cb(spa_t *spa, zilog_t *
return (0);
 }
 
+/* ARGSUSED */
+int
+verify_dataset_name_len(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
+{
+   char namebuf[MAXPATHLEN];
+   dsl_dataset_name(ds, namebuf);
+   if (strlen(namebuf) > MAXNAMELEN) {
+   return (SET_ERROR(ENAMETOOLONG));
+   }
+
+   return (0);
+}
+
 static int
 spa_load_verify(spa_t *spa)
 {
@@ -2010,6 +2023,14 @@ spa_load_verify(spa_t *spa)
if (policy.zrp_request & ZPOOL_NEVER_REWIND)
return (0);
 
+   dsl_pool_config_enter(spa->spa_dsl_pool, FTAG);
+   error = dmu_objset_find_dp(spa->spa_dsl_pool,
+   spa->spa_dsl_pool->dp_root_dir_obj, verify_dataset_name_len, NULL,
+   DS_FIND_CHILDREN);
+   dsl_pool_config_exit(spa->spa_dsl_pool, FTAG);
+   if (error != 0)
+   return (error);
+
rio = zio_root(spa, NULL, ,
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE);
 
___
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: r307044 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2016-10-11 Thread George V. Neville-Neil
Author: gnn
Date: Tue Oct 11 16:12:12 2016
New Revision: 307044
URL: https://svnweb.freebsd.org/changeset/base/307044

Log:
  Corrected non-portable reuse of va_list in dt_printf()
  
  Submitted by: Graeme Jenkinson
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D8157

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.cTue Oct 
11 15:55:45 2016(r307043)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.cTue Oct 
11 16:12:12 2016(r307044)
@@ -581,6 +581,7 @@ int
 dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
 {
va_list ap;
+   va_list ap2;
int n;
 
 #ifndef illumos
@@ -605,11 +606,13 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
len = dtp->dt_sprintf_buflen - len;
assert(len >= 0);
 
-   if ((n = vsnprintf(buf, len, format, ap)) < 0)
+   va_copy(ap2, ap);
+   if ((n = vsnprintf(buf, len, format, ap2)) < 0)
n = dt_set_errno(dtp, errno);
 
+   va_end(ap2);
va_end(ap);
-
+   
return (n);
}
 
@@ -640,11 +643,14 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
dtp->dt_buffered_buf[0] = '\0';
}
 
-   if ((needed = vsnprintf(NULL, 0, format, ap)) < 0) {
+   va_copy(ap2, ap);
+   if ((needed = vsnprintf(NULL, 0, format, ap2)) < 0) {
rval = dt_set_errno(dtp, errno);
+   va_end(ap2);
va_end(ap);
return (rval);
}
+   va_end(ap2);
 
if (needed == 0) {
va_end(ap);
@@ -670,12 +676,15 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
dtp->dt_buffered_size <<= 1;
}
 
+   va_copy(ap2, ap);
if (vsnprintf(>dt_buffered_buf[dtp->dt_buffered_offs],
-   avail, format, ap) < 0) {
+   avail, format, ap2) < 0) {
rval = dt_set_errno(dtp, errno);
+   va_end(ap2);
va_end(ap);
return (rval);
}
+   va_end(ap2);
 
dtp->dt_buffered_offs += needed;
assert(dtp->dt_buffered_buf[dtp->dt_buffered_offs] == '\0');
@@ -683,8 +692,10 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
return (0);
}
 
-   n = vfprintf(fp, format, ap);
+   va_copy(ap2, ap);
+   n = vfprintf(fp, format, ap2);
fflush(fp);
+   va_end(ap2);
va_end(ap);
 
if (n < 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: r307043 - head

2016-10-11 Thread Konstantin Belousov
Author: kib
Date: Tue Oct 11 15:55:45 2016
New Revision: 307043
URL: https://svnweb.freebsd.org/changeset/base/307043

Log:
  Remove mqtest{3,4} from the obsoleted list.
  
  Reported by:  O. Hartmann 
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Oct 11 15:27:39 2016(r307042)
+++ head/ObsoleteFiles.inc  Tue Oct 11 15:55:45 2016(r307043)
@@ -482,9 +482,6 @@ OLD_FILES+=usr/lib/clang/3.7.0/lib/freeb
 OLD_DIRS+=usr/lib/clang/3.7.0/lib/freebsd
 OLD_DIRS+=usr/lib/clang/3.7.0/lib
 OLD_DIRS+=usr/lib/clang/3.7.0
-# 20151201: mqueue tests 3 and 4 disabled
-OLD_FILES+=usr/tests/sys/mqueue/mqtest3
-OLD_FILES+=usr/tests/sys/mqueue/mqtest4
 # 20151130: libelf moved from /usr/lib to /lib (libkvm dependency in r291406)
 OLD_LIBS+=usr/lib/libelf.so.2
 # 20151115: Fox bad upgrade scheme
___
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: r307042 - head/sys/cam

2016-10-11 Thread Ngie Cooper (yaneurabeya)

> On Oct 11, 2016, at 8:27 AM, Alexander Motin  wrote:
> 
> Author: mav
> Date: Tue Oct 11 15:27:39 2016
> New Revision: 307042
> URL: https://svnweb.freebsd.org/changeset/base/307042
> 
> Log:
>  Fix copy/paste bug in r306747.
> 
>  Submitted by:emaste, pfg
>  MFC after:   3 days

Also, Coverity (I’ve marked the CIDs fixed):

CID:1364119, 1364120

Thanks,
-Ngie
___
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: r307042 - head/sys/cam

2016-10-11 Thread Alexander Motin
Author: mav
Date: Tue Oct 11 15:27:39 2016
New Revision: 307042
URL: https://svnweb.freebsd.org/changeset/base/307042

Log:
  Fix copy/paste bug in r306747.
  
  Submitted by: emaste, pfg
  MFC after:3 days

Modified:
  head/sys/cam/cam_compat.c

Modified: head/sys/cam/cam_compat.c
==
--- head/sys/cam/cam_compat.c   Tue Oct 11 14:08:53 2016(r307041)
+++ head/sys/cam/cam_compat.c   Tue Oct 11 15:27:39 2016(r307042)
@@ -228,7 +228,7 @@ cam_compat_handle_0x17(struct cdev *dev,
 
cts = >cts;
cts17 = (struct ccb_trans_settings_0x17 *)hdr17;
-   cts17->type = cts17->type;
+   cts17->type = cts->type;
cts17->protocol = cts->protocol;
cts17->protocol_version = cts->protocol_version;
cts17->transport = cts->transport;
@@ -335,7 +335,7 @@ cam_compat_handle_0x18(struct cdev *dev,
 
cts = >cts;
cts18 = (struct ccb_trans_settings_0x18 *)hdr18;
-   cts18->type = cts18->type;
+   cts18->type = cts->type;
cts18->protocol = cts->protocol;
cts18->protocol_version = cts->protocol_version;
cts18->transport = cts->transport;
___
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: r307041 - head/sys/kern

2016-10-11 Thread Sean Bruno
Author: sbruno
Date: Tue Oct 11 14:08:53 2016
New Revision: 307041
URL: https://svnweb.freebsd.org/changeset/base/307041

Log:
  Fix bug where malloc(.., M_NOWAIT) return value is not checked, Change to
  M_WAITOK and move outside the mutex
  
  Submitted by: shurd
  Reviewed by:  mm...@nextbsd.org
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D7649

Modified:
  head/sys/kern/subr_gtaskqueue.c

Modified: head/sys/kern/subr_gtaskqueue.c
==
--- head/sys/kern/subr_gtaskqueue.c Tue Oct 11 13:30:39 2016
(r307040)
+++ head/sys/kern/subr_gtaskqueue.c Tue Oct 11 14:08:53 2016
(r307041)
@@ -728,7 +728,7 @@ taskqgroup_bind(struct taskqgroup *qgrou
 * one.
 */
for (i = 0; i < qgroup->tqg_cnt; i++) {
-   gtask = malloc(sizeof (*gtask), M_DEVBUF, M_NOWAIT);
+   gtask = malloc(sizeof (*gtask), M_DEVBUF, M_WAITOK);
GTASK_INIT(>bt_task, 0, 0, taskqgroup_binder, gtask);
gtask->bt_cpuid = qgroup->tqg_queue[i].tgc_cpu;
grouptaskqueue_enqueue(qgroup->tqg_queue[i].tgc_taskq,
@@ -827,11 +827,11 @@ _taskqgroup_adjust(struct taskqgroup *qg
for (i = cnt; i < old_cnt; i++)
taskqgroup_cpu_remove(qgroup, i);
 
+   taskqgroup_bind(qgroup);
+
mtx_lock(>tqg_lock);
qgroup->tqg_adjusting = 0;
 
-   taskqgroup_bind(qgroup);
-
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307040 - head/release/doc/share/xml

2016-10-11 Thread Ed Maste
Author: emaste
Date: Tue Oct 11 13:30:39 2016
New Revision: 307040
URL: https://svnweb.freebsd.org/changeset/base/307040

Log:
  Add Cavium sponsor entity

Modified:
  head/release/doc/share/xml/sponsor.ent

Modified: head/release/doc/share/xml/sponsor.ent
==
--- head/release/doc/share/xml/sponsor.ent  Tue Oct 11 13:22:37 2016
(r307039)
+++ head/release/doc/share/xml/sponsor.ent  Tue Oct 11 13:30:39 2016
(r307040)
@@ -11,6 +11,7 @@
 
 
 
+
 
 
 
___
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: r307039 - stable/11/release/doc/share/xml

2016-10-11 Thread Ed Maste
Author: emaste
Date: Tue Oct 11 13:22:37 2016
New Revision: 307039
URL: https://svnweb.freebsd.org/changeset/base/307039

Log:
  Add Cavium sponsor entity

Modified:
  stable/11/release/doc/share/xml/sponsor.ent

Modified: stable/11/release/doc/share/xml/sponsor.ent
==
--- stable/11/release/doc/share/xml/sponsor.ent Tue Oct 11 13:08:48 2016
(r307038)
+++ stable/11/release/doc/share/xml/sponsor.ent Tue Oct 11 13:22:37 2016
(r307039)
@@ -11,6 +11,7 @@
 
 
 
+
 
 
 
___
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: r307038 - head/sys/dev/sfxge/common

2016-10-11 Thread Andrew Rybchenko
Author: arybchik
Date: Tue Oct 11 13:08:48 2016
New Revision: 307038
URL: https://svnweb.freebsd.org/changeset/base/307038

Log:
  sfxge(4): update external port mapping for Medford
  
  Extend the mapping table for external port numbering to support port modes
  which output to the second external port only. Where supported, map from
  the current port mode rather than inferring from all the available modes.
  Updated comments for clarity.
  
  Submitted by:   Richard Houldsworth 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision:  https://reviews.freebsd.org/D8210

Modified:
  head/sys/dev/sfxge/common/ef10_nic.c

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cTue Oct 11 11:46:02 2016
(r307037)
+++ head/sys/dev/sfxge/common/ef10_nic.cTue Oct 11 13:08:48 2016
(r307038)
@@ -1099,41 +1099,50 @@ fail1:
 
 
 /*
- * The external port mapping is a one-based numbering of the external
- * connectors on the board. It does not distinguish off-board separated
- * outputs such as multi-headed cables.
- * The number of ports that map to each external port connector
- * on the board is determined by the chip family and the port modes to
- * which the NIC can be configured. The mapping table lists modes with
- * port numbering requirements in increasing order.
+ * Table of mapping schemes from port number to the number of the external
+ * connector on the board. The external numbering does not distinguish
+ * off-board separated outputs such as from multi-headed cables.
+ *
+ * The count of adjacent port numbers that map to each external port
+ * and the offset in the numbering, is determined by the chip family and
+ * current port mode.
+ *
+ * For the Huntington family, the current port mode cannot be discovered,
+ * so the mapping used is instead the last match in the table to the full
+ * set of port modes to which the NIC can be configured. Therefore the
+ * ordering of entries in the the mapping table is significant.
  */
 static struct {
efx_family_tfamily;
uint32_tmodes_mask;
-   uint32_tstride;
+   int32_t count;
+   int32_t offset;
 }  __ef10_external_port_mappings[] = {
-   /* Supported modes requiring 1 output per port */
+   /* Supported modes with 1 output per external port */
{
EFX_FAMILY_HUNTINGTON,
(1 << TLV_PORT_MODE_10G) |
(1 << TLV_PORT_MODE_10G_10G) |
(1 << TLV_PORT_MODE_10G_10G_10G_10G),
+   1,
1
},
{
EFX_FAMILY_MEDFORD,
(1 << TLV_PORT_MODE_10G) |
(1 << TLV_PORT_MODE_10G_10G),
+   1,
1
},
-   /* Supported modes requiring 2 outputs per port */
+   /* Supported modes with 2 outputs per external port */
{
EFX_FAMILY_HUNTINGTON,
(1 << TLV_PORT_MODE_40G) |
(1 << TLV_PORT_MODE_40G_40G) |
(1 << TLV_PORT_MODE_40G_10G_10G) |
(1 << TLV_PORT_MODE_10G_10G_40G),
-   2
+   2,
+   1
},
{
EFX_FAMILY_MEDFORD,
@@ -1142,15 +1151,22 @@ static struct {
(1 << TLV_PORT_MODE_40G_10G_10G) |
(1 << TLV_PORT_MODE_10G_10G_40G) |
(1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1_Q2),
-   2
+   2,
+   1
},
-   /* Supported modes requiring 4 outputs per port */
+   /* Supported modes with 4 outputs per external port */
{
EFX_FAMILY_MEDFORD,
(1 << TLV_PORT_MODE_10G_10G_10G_10G_Q) |
-   (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1) |
+   (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q1),
+   4,
+   1,
+   },
+   {
+   EFX_FAMILY_MEDFORD,
(1 << TLV_PORT_MODE_10G_10G_10G_10G_Q2),
-   4
+   4,
+   2
},
 };
 
@@ -1164,11 +1180,26 @@ ef10_external_port_mapping(
int i;
uint32_t port_modes;
uint32_t matches;
-   uint32_t stride = 1; /* default 1-1 mapping */
-
-   if ((rc = efx_mcdi_get_port_modes(enp, _modes, NULL)) != 0) {
-   /* No port mode information available - use default mapping */
-   goto out;
+   uint32_t current;
+   int32_t count = 1; /* Default 1-1 mapping */
+   int32_t offset = 1; /* Default starting external port number */
+
+   if ((rc = efx_mcdi_get_port_modes(enp, _modes, )) != 0) {
+   /*
+* No current port mode information
+* - infer mapping from available modes
+*/
+   if ((rc = efx_mcdi_get_port_modes(enp,
+ 

svn commit: r307037 - head/lib/libc/gen

2016-10-11 Thread Konstantin Belousov
Author: kib
Date: Tue Oct 11 11:46:02 2016
New Revision: 307037
URL: https://svnweb.freebsd.org/changeset/base/307037

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

Modified:
  head/lib/libc/gen/recvmmsg.c

Modified: head/lib/libc/gen/recvmmsg.c
==
--- head/lib/libc/gen/recvmmsg.cTue Oct 11 11:45:12 2016
(r307036)
+++ head/lib/libc/gen/recvmmsg.cTue Oct 11 11:46:02 2016
(r307037)
@@ -83,10 +83,9 @@ recvmmsg(int s, struct mmsghdr *__restri
ret = __sys_recvmsg(s, [i].msg_hdr, flags);
if (ret == -1) {
/* We have received messages. Let caller know
-* about the data received, socket
-* error is returned on next
-* invocation.
-*/
+* about the data received, socket error is
+* returned on next invocation.
+*/
return (rcvd);
}
 
___
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: r307036 - head/lib/libc/gen

2016-10-11 Thread Konstantin Belousov
Author: kib
Date: Tue Oct 11 11:45:12 2016
New Revision: 307036
URL: https://svnweb.freebsd.org/changeset/base/307036

Log:
  Fill msg_len for the initial element of msgvec.
  
  Submitted by: Daniel Salzman 
  MFC after:3 days

Modified:
  head/lib/libc/gen/recvmmsg.c

Modified: head/lib/libc/gen/recvmmsg.c
==
--- head/lib/libc/gen/recvmmsg.cTue Oct 11 09:19:30 2016
(r307035)
+++ head/lib/libc/gen/recvmmsg.cTue Oct 11 11:45:12 2016
(r307036)
@@ -69,6 +69,8 @@ recvmmsg(int s, struct mmsghdr *__restri
if (ret == -1)
return (ret);
 
+   msgvec[0].msg_len = ret;
+
/* 
 * Do non-blocking receive for second and later messages if
 * WAITFORONE is set.
___
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: r307035 - stable/10/sys/conf

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Oct 11 09:19:30 2016
New Revision: 307035
URL: https://svnweb.freebsd.org/changeset/base/307035

Log:
  build: Add vmbus_if.m
  
  This is a direct commit, which reflects the difference between
  current and 10-stable.
  
  Sponsored by: Microsoft

Modified:
  stable/10/sys/conf/kmod.mk

Modified: stable/10/sys/conf/kmod.mk
==
--- stable/10/sys/conf/kmod.mk  Tue Oct 11 09:11:23 2016(r307034)
+++ stable/10/sys/conf/kmod.mk  Tue Oct 11 09:19:30 2016(r307035)
@@ -364,6 +364,7 @@ CFLAGS+=${CONF_CFLAGS}
 MFILES?= dev/acpica/acpi_if.m dev/acpi_support/acpi_wmi_if.m \
dev/agp/agp_if.m dev/ata/ata_if.m dev/eisa/eisa_if.m \
dev/fb/fb_if.m dev/gpio/gpio_if.m dev/gpio/gpiobus_if.m \
+   dev/hyperv/vmbus/vmbus_if.m \
dev/iicbus/iicbb_if.m dev/iicbus/iicbus_if.m \
dev/mmc/mmcbr_if.m dev/mmc/mmcbus_if.m \
dev/mii/miibus_if.m dev/mvs/mvs_if.m dev/ofw/ofw_bus_if.m \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307034 - in stable/10/sys/dev/hyperv: include netvsc storvsc utilities vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Oct 11 09:11:23 2016
New Revision: 307034
URL: https://svnweb.freebsd.org/changeset/base/307034

Log:
  MFC 302875,302876,302878-302881
  
  302875
  hyperv/vmbus: Redefine channel packet.
  
  The channel packet header will be shared w/ PRP (physical region page)
  list channel packet and SG (scatter gather) list channel packet.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7155
  
  302876
  hyperv/vmbus: Rework sglist sending.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7156
  
  302878
  hyeprv/vmbus: Rework prplist sending.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7175
  
  302879
  hyperv/vmbus: Move channel packet flags definition to vmbus.h
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7176
  
  302880
  hyperv/vmbus: Move channel packet types definition to vmbus.h
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7177
  
  302881
  hyperv/vmbus: Cleanup channel sending
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7178

Added:
  stable/10/sys/dev/hyperv/include/vmbus.h
 - copied, changed from r302876, head/sys/dev/hyperv/include/vmbus.h
Modified:
  stable/10/sys/dev/hyperv/include/hyperv.h
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h
  stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.h
  stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/utilities/hv_heartbeat.c
  stable/10/sys/dev/hyperv/utilities/hv_kvp.c
  stable/10/sys/dev/hyperv/utilities/hv_shutdown.c
  stable/10/sys/dev/hyperv/utilities/hv_timesync.c
  stable/10/sys/dev/hyperv/vmbus/hv_channel.c
  stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  stable/10/sys/dev/hyperv/vmbus/vmbus_reg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/include/hyperv.h
==
--- stable/10/sys/dev/hyperv/include/hyperv.h   Tue Oct 11 09:02:55 2016
(r307033)
+++ stable/10/sys/dev/hyperv/include/hyperv.h   Tue Oct 11 09:11:23 2016
(r307034)
@@ -82,19 +82,6 @@ typedef uint8_t  hv_bool_uint8_t;
 #define VMBUS_VERSION_MAJOR(ver)   (((uint32_t)(ver)) >> 16)
 #define VMBUS_VERSION_MINOR(ver)   (((uint32_t)(ver)) & 0x)
 
-#define HV_MAX_PAGE_BUFFER_COUNT   32
-#define HV_MAX_MULTIPAGE_BUFFER_COUNT  32
-
-#define HV_ALIGN_UP(value, align)  \
-   (((value) & (align-1)) ?\
-   (((value) + (align-1)) & ~(align-1) ) : (value))
-
-#define HV_ALIGN_DOWN(value, align) ( (value) & ~(align-1) )
-
-#define HV_NUM_PAGES_SPANNED(addr, len)
\
-   ((HV_ALIGN_UP(addr+len, PAGE_SIZE) -\
-   HV_ALIGN_DOWN(addr, PAGE_SIZE)) >> PAGE_SHIFT )
-
 struct hyperv_guid {
uint8_t hv_guid[16];
 } __packed;
@@ -125,25 +112,6 @@ typedef struct {
hv_vm_transfer_page ranges[1];
 } __packed hv_vm_transfer_page_packet_header;
 
-typedef enum {
-   HV_VMBUS_PACKET_TYPE_INVALID= 0x0,
-   HV_VMBUS_PACKET_TYPES_SYNCH = 0x1,
-   HV_VMBUS_PACKET_TYPE_ADD_TRANSFER_PAGE_SET  = 0x2,
-   HV_VMBUS_PACKET_TYPE_REMOVE_TRANSFER_PAGE_SET   = 0x3,
-   HV_VMBUS_PACKET_TYPE_ESTABLISH_GPADL= 0x4,
-   HV_VMBUS_PACKET_TYPE_TEAR_DOWN_GPADL= 0x5,
-   HV_VMBUS_PACKET_TYPE_DATA_IN_BAND   = 0x6,
-   HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES  = 0x7,
-   HV_VMBUS_PACKET_TYPE_DATA_USING_GPADL   = 0x8,
-   HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT  = 0x9,
-   HV_VMBUS_PACKET_TYPE_CANCEL_REQUEST = 0xa,
-   HV_VMBUS_PACKET_TYPE_COMPLETION = 0xb,
-   HV_VMBUS_PACKET_TYPE_DATA_USING_ADDITIONAL_PACKETS  = 0xc,
-   HV_VMBUS_PACKET_TYPE_ADDITIONAL_DATA = 0xd
-} hv_vmbus_packet_type;
-
-#define HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED1
-
 #define HW_MACADDR_LEN 6
 
 /*
@@ -225,18 +193,6 @@ typedef struct {
 } __packed hv_vmbus_ring_buffer;
 
 typedef struct {
-   int length;
-   int offset;
-   uint64_tpfn;
-} __packed hv_vmbus_page_buffer;
-
-typedef struct {
-   int length;
-   int offset;
-   uint64_tpfn_array[HV_MAX_MULTIPAGE_BUFFER_COUNT];
-} 

svn commit: r307033 - in stable/10/sys/dev/hyperv: include vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Oct 11 09:02:55 2016
New Revision: 307033
URL: https://svnweb.freebsd.org/changeset/base/307033

Log:
  MFC 302873,302874
  
  302873
  hyperv/vmbus: Set vcpuid to 0, if MSR_HV_VP_INDEX does not exist.
  
  Mainly for compatibility.  While I'm here, rename cpuid related
  fields in hv_vmbus_channel.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7141
  
  302874
  hyperv/vmbus: Field rename
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7146

Modified:
  stable/10/sys/dev/hyperv/include/hyperv.h
  stable/10/sys/dev/hyperv/vmbus/hv_channel.c
  stable/10/sys/dev/hyperv/vmbus/vmbus.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/include/hyperv.h
==
--- stable/10/sys/dev/hyperv/include/hyperv.h   Tue Oct 11 08:52:27 2016
(r307032)
+++ stable/10/sys/dev/hyperv/include/hyperv.h   Tue Oct 11 09:02:55 2016
(r307033)
@@ -242,7 +242,7 @@ typedef struct {
uint32_tring_data_size; /* ring_size */
 } hv_vmbus_ring_buffer_info;
 
-typedef void (*hv_vmbus_pfn_channel_callback)(void *context);
+typedef void   (*vmbus_chan_callback_t)(void *);
 
 typedef struct hv_vmbus_channel {
device_tch_dev;
@@ -266,24 +266,21 @@ typedef struct hv_vmbus_channel {
 */
hv_vmbus_ring_buffer_info   inbound;
 
-   struct taskqueue *  rxq;
-   struct task channel_task;
-   hv_vmbus_pfn_channel_callback   on_channel_callback;
-   void*   channel_callback_context;
+   struct taskqueue*ch_tq;
+   struct task ch_task;
+   vmbus_chan_callback_t   ch_cb;
+   void*ch_cbarg;
 
struct hyperv_mon_param *ch_monprm;
struct hyperv_dma   ch_monprm_dma;
 
+   int ch_cpuid;   /* owner cpu */
/*
-* From Win8, this field specifies the target virtual process
-* on which to deliver the interupt from the host to guest.
-* Before Win8, all channel interrupts would only be
-* delivered on cpu 0. Setting this value to 0 would preserve
-* the earlier behavior.
-*/
-   uint32_ttarget_vcpu;
-   /* The corresponding CPUID in the guest */
-   uint32_ttarget_cpu;
+* Virtual cpuid for ch_cpuid; it is used to communicate cpuid
+* related information w/ Hyper-V.  If MSR_HV_VP_INDEX does not
+* exist, ch_vcpuid will always be 0 for compatibility.
+*/
+   uint32_tch_vcpuid;
 
/*
 * If this is a primary channel, ch_subchan* fields
@@ -365,9 +362,8 @@ int hv_vmbus_channel_open(
uint32_trecv_ring_buffer_size,
void*   user_data,
uint32_tuser_data_len,
-   hv_vmbus_pfn_channel_callback
-   pfn_on_channel_callback,
-   void*   context);
+   vmbus_chan_callback_t   cb,
+   void*cbarg);
 
 void   hv_vmbus_channel_close(hv_vmbus_channel *channel);
 

Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c
==
--- stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Oct 11 08:52:27 2016
(r307032)
+++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Oct 11 09:02:55 2016
(r307033)
@@ -157,7 +157,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha
>ch_id, 0, "channel id");
}
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO,
-   "cpu", CTLFLAG_RD, >target_cpu, 0, "owner CPU id");
+   "cpu", CTLFLAG_RD, >ch_cpuid, 0, "owner CPU id");
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO,
"monitor_allocated", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
channel, 0, vmbus_channel_sysctl_monalloc, "I",
@@ -193,8 +193,8 @@ hv_vmbus_channel_open(
uint32_trecv_ring_buffer_size,
void*   user_data,
uint32_tuser_data_len,
-   hv_vmbus_pfn_channel_callback   pfn_on_channel_callback,
-   void*   context)
+   vmbus_chan_callback_t   cb,
+   void*cbarg)
 {
struct vmbus_softc *sc = new_channel->vmbus_sc;
const struct 

svn commit: r307032 - in stable/10/sys/dev/hyperv: include vmbus

2016-10-11 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Oct 11 08:52:27 2016
New Revision: 307032
URL: https://svnweb.freebsd.org/changeset/base/307032

Log:
  MFC 302871,302872
  
  302871
  hyperv/vmbus: Add vmbus_chan_gpadl_connect, which takes GPA physaddr
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7139
  
  302872
  hyperv/vmbus: Busdma-fy channel bufring.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D7140

Modified:
  stable/10/sys/dev/hyperv/include/hyperv.h
  stable/10/sys/dev/hyperv/vmbus/hv_channel.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/include/hyperv.h
==
--- stable/10/sys/dev/hyperv/include/hyperv.h   Tue Oct 11 08:48:36 2016
(r307031)
+++ stable/10/sys/dev/hyperv/include/hyperv.h   Tue Oct 11 08:52:27 2016
(r307032)
@@ -257,13 +257,6 @@ typedef struct hv_vmbus_channel {
int ch_montrig_idx; /* MNF trig index */
uint32_tch_montrig_mask;/* MNF trig mask */
 
-   uint32_tring_buffer_gpadl_handle;
-   /*
-* Allocated memory for ring buffer
-*/
-   void*   ring_buffer_pages;
-   unsigned long   ring_buffer_size;
-   uint32_tring_buffer_page_count;
/*
 * send to parent
 */
@@ -312,6 +305,10 @@ typedef struct hv_vmbus_channel {
void*hv_chan_priv2;
void*hv_chan_priv3;
 
+   void*ch_bufring;/* TX+RX bufrings */
+   struct hyperv_dma   ch_bufring_dma;
+   uint32_tch_bufring_gpadl;
+
struct task ch_detach_task;
TAILQ_ENTRY(hv_vmbus_channel)   ch_prilink; /* primary chan link */
uint32_tch_subidx;  /* subchan index */
@@ -409,6 +406,9 @@ int hv_vmbus_channel_teardown_gpdal(
hv_vmbus_channel*   channel,
uint32_tgpadl_handle);
 
+intvmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan,
+   bus_addr_t paddr, int size, uint32_t *gpadl);
+
 struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel 
*promary);
 
 void   vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu);

Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c
==
--- stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Oct 11 08:48:36 2016
(r307031)
+++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c Tue Oct 11 08:52:27 2016
(r307032)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -202,7 +203,7 @@ hv_vmbus_channel_open(
struct vmbus_msghc *mh;
uint32_t status;
int ret = 0;
-   void *in, *out;
+   uint8_t *br;
 
if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) {
device_printf(sc->vmbus_dev,
@@ -210,6 +211,10 @@ hv_vmbus_channel_open(
user_data_len, new_channel->ch_id);
return EINVAL;
}
+   KASSERT((send_ring_buffer_size & PAGE_MASK) == 0,
+   ("send bufring size is not multiple page"));
+   KASSERT((recv_ring_buffer_size & PAGE_MASK) == 0,
+   ("recv bufring size is not multiple page"));
 
if (atomic_testandset_int(_channel->ch_stflags,
VMBUS_CHAN_ST_OPENED_SHIFT))
@@ -230,46 +235,43 @@ hv_vmbus_channel_open(
vmbus_chan_task_nobatch, new_channel);
}
 
-   /* Allocate the ring buffer */
-   out = contigmalloc((send_ring_buffer_size + recv_ring_buffer_size),
-   M_DEVBUF, M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0);
-   KASSERT(out != NULL,
-   ("Error VMBUS: contigmalloc failed to allocate Ring Buffer!"));
-   if (out == NULL) {
+   /*
+* Allocate the TX+RX bufrings.
+* XXX should use ch_dev dtag
+*/
+   br = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev),
+   PAGE_SIZE, 0, send_ring_buffer_size + recv_ring_buffer_size,
+   _channel->ch_bufring_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO);
+   if (br == NULL) {
+   device_printf(sc->vmbus_dev, "bufring allocation failed\n");
ret = ENOMEM;
goto failed;
}
+   new_channel->ch_bufring = br;
 
-   in = ((uint8_t *) out + send_ring_buffer_size);
-
-   new_channel->ring_buffer_pages = out;
-   new_channel->ring_buffer_page_count = (send_ring_buffer_size +
-   recv_ring_buffer_size) >> PAGE_SHIFT;
-   

  1   2   >