summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.ndpd/ndp.c2
-rw-r--r--usr/src/cmd/zfs/zfs_main.c43
-rw-r--r--usr/src/tools/scripts/jstyle.pl11
-rw-r--r--usr/src/uts/common/io/virtio/virtio.c64
-rw-r--r--usr/src/uts/common/io/virtio/virtioreg.h4
-rw-r--r--usr/src/uts/common/io/virtio/virtiovar.h1
6 files changed, 89 insertions, 36 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/ndp.c b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/ndp.c
index d4395ff9b5..e2a55bc0e0 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/ndp.c
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/ndp.c
@@ -1554,7 +1554,7 @@ update_ra_flag(const struct phyint *pi, const struct sockaddr_in6 *from,
if (errno == ESRCH) {
if (debug & D_IFSCAN) {
logmsg(LOG_DEBUG,
-"update_ra_flag: SIOCLIFGETND: nce doesn't exist, not setting IFF_ROUTER");
+"update_ra_flag: SIOCLIFGETND: nce doesn't exist, not setting IFF_ROUTER\n");
}
} else {
logperror_pi(pi, "update_ra_flag: SIOCLIFGETND");
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c
index 48638750e7..f9fa9ceb64 100644
--- a/usr/src/cmd/zfs/zfs_main.c
+++ b/usr/src/cmd/zfs/zfs_main.c
@@ -582,6 +582,17 @@ finish_progress(char *done)
}
/*
+ * Check if the dataset is mountable and should be automatically mounted.
+ */
+static boolean_t
+should_auto_mount(zfs_handle_t *zhp)
+{
+ if (!zfs_prop_valid_for_type(ZFS_PROP_CANMOUNT, zfs_get_type(zhp)))
+ return (B_FALSE);
+ return (zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON);
+}
+
+/*
* zfs clone [-Fp] [-o prop=value] ... <snap> <fs | vol>
*
* Given an existing dataset, create a writable copy whose initial contents
@@ -675,13 +686,26 @@ zfs_do_clone(int argc, char **argv)
clone = zfs_open(g_zfs, argv[1], ZFS_TYPE_DATASET);
if (clone != NULL) {
- if (zfs_get_type(clone) != ZFS_TYPE_VOLUME) {
+ /*
+ * If the user doesn't want the dataset
+ * automatically mounted, then skip the mount/share
+ * step.
+ */
+ if (should_auto_mount(clone)) {
while ((ret = zfs_mount(clone, NULL, 0)) != 0) {
- if (!keeptrying || errno != EBUSY)
+ if (!keeptrying || errno != EBUSY) {
+ (void) fprintf(stderr,
+ gettext("clone "
+ "successfully created, "
+ "but not mounted\n"));
break;
+ }
+ }
+ if (ret == 0 && (ret = zfs_share(clone)) != 0) {
+ (void) fprintf(stderr, gettext("clone "
+ "successfully created, "
+ "but not shared\n"));
}
- if (ret == 0)
- ret = zfs_share(clone);
}
zfs_close(clone);
}
@@ -728,7 +752,6 @@ zfs_do_create(int argc, char **argv)
int ret = 1;
nvlist_t *props;
uint64_t intval;
- int canmount = ZFS_CANMOUNT_OFF;
if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0)
nomem();
@@ -872,19 +895,15 @@ zfs_do_create(int argc, char **argv)
goto error;
ret = 0;
- /*
- * if the user doesn't want the dataset automatically mounted,
- * then skip the mount/share step
- */
- if (zfs_prop_valid_for_type(ZFS_PROP_CANMOUNT, type))
- canmount = zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT);
/*
* Mount and/or share the new filesystem as appropriate. We provide a
* verbose error message to let the user know that their filesystem was
* in fact created, even if we failed to mount or share it.
+ * If the user doesn't want the dataset automatically mounted,
+ * then skip the mount/share step altogether.
*/
- if (canmount == ZFS_CANMOUNT_ON) {
+ if (should_auto_mount(zhp)) {
if (zfs_mount(zhp, NULL, 0) != 0) {
(void) fprintf(stderr, gettext("filesystem "
"successfully created, but not mounted\n"));
diff --git a/usr/src/tools/scripts/jstyle.pl b/usr/src/tools/scripts/jstyle.pl
index caf7dcc251..f48dc96b35 100644
--- a/usr/src/tools/scripts/jstyle.pl
+++ b/usr/src/tools/scripts/jstyle.pl
@@ -21,8 +21,7 @@
#
#
-# ident "%Z%%M% %I% %E% SMI"
-#
+# Copyright 2015 Toomas Soome <tsoome@me.com>
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -98,7 +97,11 @@ if ($#ARGV >= 0) {
exit $err_stat;
sub err($) {
- printf $fmt, $filename, $., $_[0], $line;
+ if ($verbose) {
+ printf $fmt, $filename, $., $_[0], $line;
+ } else {
+ printf $fmt, $filename, $., $_[0];
+ }
$err_stat = 1;
}
@@ -428,7 +431,7 @@ if (0) {
if (/^\s*\(void\)[^ ]/) {
err("missing space after (void) cast");
}
- if (/\S{/ && !/{{/) {
+ if (/\S\{/ && !/\{\{/) {
err("missing space before left brace");
}
if ($in_class && /^\s+{/ && ($prev =~ /\)\s*$/)) {
diff --git a/usr/src/uts/common/io/virtio/virtio.c b/usr/src/uts/common/io/virtio/virtio.c
index cc86c198b4..adaab62aec 100644
--- a/usr/src/uts/common/io/virtio/virtio.c
+++ b/usr/src/uts/common/io/virtio/virtio.c
@@ -920,13 +920,11 @@ virtio_register_msi(struct virtio_softc *sc,
}
}
- /* We know we are using MSI, so set the config offset. */
- sc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_MSI;
-
ret = ddi_intr_get_cap(sc->sc_intr_htable[0], &sc->sc_intr_cap);
- /* Just in case. */
- if (ret != DDI_SUCCESS)
- sc->sc_intr_cap = 0;
+ if (ret == DDI_SUCCESS) {
+ sc->sc_int_type = int_type;
+ return (DDI_SUCCESS);
+ }
out_add_handlers:
out_msi_prio:
@@ -934,7 +932,8 @@ out_msi_available:
for (i = 0; i < actual; i++)
(void) ddi_intr_free(sc->sc_intr_htable[i]);
out_msi_alloc:
- kmem_free(sc->sc_intr_htable, sizeof (ddi_intr_handle_t) * count);
+ kmem_free(sc->sc_intr_htable,
+ sizeof (ddi_intr_handle_t) * handler_count);
return (ret);
}
@@ -1037,8 +1036,7 @@ virtio_register_intx(struct virtio_softc *sc,
goto out_add_handlers;
}
- /* We know we are not using MSI, so set the config offset. */
- sc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI;
+ sc->sc_int_type = DDI_INTR_TYPE_FIXED;
return (DDI_SUCCESS);
@@ -1065,6 +1063,9 @@ virtio_register_ints(struct virtio_softc *sc,
int ret;
int intr_types;
+ /* Default offset until MSI-X is enabled, if ever. */
+ sc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_NOMSIX;
+
/* Determine which types of interrupts are supported */
ret = ddi_intr_get_supported_types(sc->sc_dev, &intr_types);
if (ret != DDI_SUCCESS) {
@@ -1106,7 +1107,7 @@ virtio_enable_msi(struct virtio_softc *sc)
if (sc->sc_intr_config)
vq_handler_count--;
- /* Enable the iterrupts. Either the whole block, or one by one. */
+ /* Enable the interrupts. Either the whole block, or one by one. */
if (sc->sc_intr_cap & DDI_INTR_FLAG_BLOCK) {
ret = ddi_intr_block_enable(sc->sc_intr_htable,
sc->sc_intr_num);
@@ -1178,6 +1179,12 @@ virtio_enable_msi(struct virtio_softc *sc)
}
}
+ /* Configuration offset depends on whether MSI-X is used. */
+ if (sc->sc_int_type == DDI_INTR_TYPE_MSIX)
+ sc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_MSIX;
+ else
+ ASSERT(sc->sc_int_type == DDI_INTR_TYPE_MSI);
+
return (DDI_SUCCESS);
out_bind:
@@ -1199,6 +1206,26 @@ out_bind:
ddi_put16(sc->sc_ioh, (uint16_t *)(sc->sc_io_addr +
VIRTIO_CONFIG_CONFIG_VECTOR), VIRTIO_MSI_NO_VECTOR);
+ /* Disable the interrupts. Either the whole block, or one by one. */
+ if (sc->sc_intr_cap & DDI_INTR_FLAG_BLOCK) {
+ ret = ddi_intr_block_disable(sc->sc_intr_htable,
+ sc->sc_intr_num);
+ if (ret != DDI_SUCCESS) {
+ dev_err(sc->sc_dev, CE_WARN,
+ "Failed to disable MSIs, won't be able to "
+ "reuse next time");
+ }
+ } else {
+ for (i = 0; i < sc->sc_intr_num; i++) {
+ ret = ddi_intr_disable(sc->sc_intr_htable[i]);
+ if (ret != DDI_SUCCESS) {
+ dev_err(sc->sc_dev, CE_WARN,
+ "Failed to disable interrupt %d, "
+ "won't be able to reuse", i);
+ }
+ }
+ }
+
ret = DDI_FAILURE;
out_enable:
@@ -1227,12 +1254,14 @@ int
virtio_enable_ints(struct virtio_softc *sc)
{
+ ASSERT(sc->sc_config_offset == VIRTIO_CONFIG_DEVICE_CONFIG_NOMSIX);
+
/* See if we are using MSI. */
- if (sc->sc_config_offset == VIRTIO_CONFIG_DEVICE_CONFIG_MSI)
+ if (sc->sc_int_type == DDI_INTR_TYPE_MSIX ||
+ sc->sc_int_type == DDI_INTR_TYPE_MSI)
return (virtio_enable_msi(sc));
- ASSERT(sc->sc_config_offset == VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI);
-
+ ASSERT(sc->sc_int_type == DDI_INTR_TYPE_FIXED);
return (virtio_enable_intx(sc));
}
@@ -1243,7 +1272,8 @@ virtio_release_ints(struct virtio_softc *sc)
int ret;
/* We were running with MSI, unbind them. */
- if (sc->sc_config_offset == VIRTIO_CONFIG_DEVICE_CONFIG_MSI) {
+ if (sc->sc_int_type == DDI_INTR_TYPE_MSIX ||
+ sc->sc_int_type == DDI_INTR_TYPE_MSI) {
/* Unbind all vqs */
for (i = 0; i < sc->sc_nvqs; i++) {
ddi_put16(sc->sc_ioh,
@@ -1265,7 +1295,7 @@ virtio_release_ints(struct virtio_softc *sc)
}
- /* Disable the iterrupts. Either the whole block, or one by one. */
+ /* Disable the interrupts. Either the whole block, or one by one. */
if (sc->sc_intr_cap & DDI_INTR_FLAG_BLOCK) {
ret = ddi_intr_block_disable(sc->sc_intr_htable,
sc->sc_intr_num);
@@ -1296,8 +1326,8 @@ virtio_release_ints(struct virtio_softc *sc)
kmem_free(sc->sc_intr_htable, sizeof (ddi_intr_handle_t) *
sc->sc_intr_num);
- /* After disabling interrupts, the config offset is non-MSI. */
- sc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI;
+ /* After disabling interrupts, the config offset is non-MSI-X. */
+ sc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_NOMSIX;
}
/*
diff --git a/usr/src/uts/common/io/virtio/virtioreg.h b/usr/src/uts/common/io/virtio/virtioreg.h
index 8cfcd59a47..19579e96bc 100644
--- a/usr/src/uts/common/io/virtio/virtioreg.h
+++ b/usr/src/uts/common/io/virtio/virtioreg.h
@@ -107,8 +107,8 @@
#define VIRTIO_CONFIG_CONFIG_VECTOR 20 /* 16bit, optional */
#define VIRTIO_CONFIG_QUEUE_VECTOR 22
-#define VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI 20
-#define VIRTIO_CONFIG_DEVICE_CONFIG_MSI 24
+#define VIRTIO_CONFIG_DEVICE_CONFIG_NOMSIX 20
+#define VIRTIO_CONFIG_DEVICE_CONFIG_MSIX 24
#define VIRTIO_MSI_NO_VECTOR 0xffff
diff --git a/usr/src/uts/common/io/virtio/virtiovar.h b/usr/src/uts/common/io/virtio/virtiovar.h
index c16886dd38..17aebe3864 100644
--- a/usr/src/uts/common/io/virtio/virtiovar.h
+++ b/usr/src/uts/common/io/virtio/virtiovar.h
@@ -145,6 +145,7 @@ struct virtio_softc {
int sc_intr_num;
boolean_t sc_intr_config;
int sc_intr_cap;
+ int sc_int_type;
};
struct virtio_int_handler {