summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2018-01-19 12:30:03 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2018-01-19 12:30:03 +0000
commit200c85e77efe7067ee2a4b310f6a8f8e42ab3d0b (patch)
tree698d27bfc47ca2b4af698902743de8ddc9eb0632
parent6b5092032142a30ce4cc20f531c421740910f0cd (diff)
parente9b7d6e7f7a6477679a35b73eb3934b096b3dd39 (diff)
downloadillumos-joyent-200c85e77efe7067ee2a4b310f6a8f8e42ab3d0b.tar.gz
[illumos-gate merge]
commit e9b7d6e7f7a6477679a35b73eb3934b096b3dd39 8972 zfs holds: In scripted mode, do not pad columns with spaces commit 5cb8d943bc8513c6230589aad5a409d58b0297cb 8835 Speculative prefetch in ZFS not working for misaligned reads commit 4ae5f5f06c6c2d1db8167480f7d9e3b5378ba2f2 8652 Tautological comparisons with ZPROP_INVAL commit 2ba5f978a4f9b02da9db1b8cdd9ea5498eb00ad9 8641 "zpool clear" and "zinject" don't work on "spare" or "replacing" vdevs commit 620632424515d984b96f0a398e2d0cba9412182c 8560 Reference leak on ipsec_action_t
-rw-r--r--usr/src/cmd/zfs/zfs_main.c11
-rw-r--r--usr/src/cmd/zpool/zpool_main.c2
-rw-r--r--usr/src/lib/libzfs/common/libzfs_pool.c15
-rw-r--r--usr/src/uts/common/fs/zfs/dmu_zfetch.c24
-rw-r--r--usr/src/uts/common/fs/zfs/spa.c8
-rw-r--r--usr/src/uts/common/inet/ip/spd.c7
-rw-r--r--usr/src/uts/common/sys/fs/zfs.h7
7 files changed, 48 insertions, 26 deletions
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c
index 231a80f181..8d8a9d67be 100644
--- a/usr/src/cmd/zfs/zfs_main.c
+++ b/usr/src/cmd/zfs/zfs_main.c
@@ -5683,8 +5683,6 @@ print_holds(boolean_t scripted, size_t nwidth, size_t tagwidth, nvlist_t *nvl)
uint64_t val = 0;
time_t time;
struct tm t;
- char sep = scripted ? '\t' : ' ';
- size_t sepnum = scripted ? 1 : 2;
(void) nvpair_value_uint64(nvp2, &val);
time = (time_t)val;
@@ -5692,8 +5690,13 @@ print_holds(boolean_t scripted, size_t nwidth, size_t tagwidth, nvlist_t *nvl)
(void) strftime(tsbuf, DATETIME_BUF_LEN,
gettext(STRFTIME_FMT_STR), &t);
- (void) printf("%-*s%*c%-*s%*c%s\n", nwidth, zname,
- sepnum, sep, tagwidth, tagname, sepnum, sep, tsbuf);
+ if (scripted) {
+ (void) printf("%s\t%s\t%s\n", zname,
+ tagname, tsbuf);
+ } else {
+ (void) printf("%-*s %-*s %s\n", nwidth,
+ zname, tagwidth, tagname, tsbuf);
+ }
}
}
}
diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c
index 67e0487586..5ca9a4e4f4 100644
--- a/usr/src/cmd/zpool/zpool_main.c
+++ b/usr/src/cmd/zpool/zpool_main.c
@@ -441,7 +441,7 @@ add_prop_list(const char *propname, char *propval, nvlist_t **props,
* feature@ properties and version should not be specified
* at the same time.
*/
- if ((prop == ZPROP_INVAL && zpool_prop_feature(propname) &&
+ if ((prop == ZPOOL_PROP_INVAL && zpool_prop_feature(propname) &&
nvlist_exists(proplist, vname)) ||
(prop == ZPOOL_PROP_VERSION &&
prop_list_contains_feature(proplist))) {
diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c
index 4e0213205f..d235f46b52 100644
--- a/usr/src/lib/libzfs/common/libzfs_pool.c
+++ b/usr/src/lib/libzfs/common/libzfs_pool.c
@@ -50,6 +50,7 @@
#include "zfeature_common.h"
static int read_efi_label(nvlist_t *, diskaddr_t *, boolean_t *);
+static boolean_t zpool_vdev_is_interior(const char *name);
#define BACKUP_SLICE "s2"
@@ -445,7 +446,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
const char *propname = nvpair_name(elem);
prop = zpool_name_to_prop(propname);
- if (prop == ZPROP_INVAL && zpool_prop_feature(propname)) {
+ if (prop == ZPOOL_PROP_INVAL && zpool_prop_feature(propname)) {
int err;
char *fname = strchr(propname, '@') + 1;
@@ -484,7 +485,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
/*
* Make sure this property is valid and applies to this type.
*/
- if (prop == ZPROP_INVAL) {
+ if (prop == ZPOOL_PROP_INVAL) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"invalid property '%s'"), propname);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
@@ -2080,10 +2081,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
break;
}
- verify(strncmp(type, VDEV_TYPE_RAIDZ,
- strlen(VDEV_TYPE_RAIDZ)) == 0 ||
- strncmp(type, VDEV_TYPE_MIRROR,
- strlen(VDEV_TYPE_MIRROR)) == 0);
+ verify(zpool_vdev_is_interior(type));
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID,
&id) == 0);
@@ -2190,10 +2188,13 @@ zpool_find_vdev_by_physpath(zpool_handle_t *zhp, const char *ppath,
/*
* Determine if we have an "interior" top-level vdev (i.e mirror/raidz).
*/
-boolean_t
+static boolean_t
zpool_vdev_is_interior(const char *name)
{
if (strncmp(name, VDEV_TYPE_RAIDZ, strlen(VDEV_TYPE_RAIDZ)) == 0 ||
+ strncmp(name, VDEV_TYPE_SPARE, strlen(VDEV_TYPE_SPARE)) == 0 ||
+ strncmp(name,
+ VDEV_TYPE_REPLACING, strlen(VDEV_TYPE_REPLACING)) == 0 ||
strncmp(name, VDEV_TYPE_MIRROR, strlen(VDEV_TYPE_MIRROR)) == 0)
return (B_TRUE);
return (B_FALSE);
diff --git a/usr/src/uts/common/fs/zfs/dmu_zfetch.c b/usr/src/uts/common/fs/zfs/dmu_zfetch.c
index 5d5c478627..5d6f20d072 100644
--- a/usr/src/uts/common/fs/zfs/dmu_zfetch.c
+++ b/usr/src/uts/common/fs/zfs/dmu_zfetch.c
@@ -235,19 +235,33 @@ dmu_zfetch(zfetch_t *zf, uint64_t blkid, uint64_t nblks, boolean_t fetch_data)
rw_enter(&zf->zf_rwlock, RW_READER);
+ /*
+ * Find matching prefetch stream. Depending on whether the accesses
+ * are block-aligned, first block of the new access may either follow
+ * the last block of the previous access, or be equal to it.
+ */
for (zs = list_head(&zf->zf_stream); zs != NULL;
zs = list_next(&zf->zf_stream, zs)) {
- if (blkid == zs->zs_blkid) {
+ if (blkid == zs->zs_blkid || blkid + 1 == zs->zs_blkid) {
mutex_enter(&zs->zs_lock);
/*
* zs_blkid could have changed before we
* acquired zs_lock; re-check them here.
*/
- if (blkid != zs->zs_blkid) {
- mutex_exit(&zs->zs_lock);
- continue;
+ if (blkid == zs->zs_blkid) {
+ break;
+ } else if (blkid + 1 == zs->zs_blkid) {
+ blkid++;
+ nblks--;
+ if (nblks == 0) {
+ /* Already prefetched this before. */
+ mutex_exit(&zs->zs_lock);
+ rw_exit(&zf->zf_rwlock);
+ return;
+ }
+ break;
}
- break;
+ mutex_exit(&zs->zs_lock);
}
}
diff --git a/usr/src/uts/common/fs/zfs/spa.c b/usr/src/uts/common/fs/zfs/spa.c
index 4fc9847610..cc66deed8e 100644
--- a/usr/src/uts/common/fs/zfs/spa.c
+++ b/usr/src/uts/common/fs/zfs/spa.c
@@ -336,7 +336,7 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp)
zprop_source_t src = ZPROP_SRC_DEFAULT;
zpool_prop_t prop;
- if ((prop = zpool_name_to_prop(za.za_name)) == ZPROP_INVAL)
+ if ((prop = zpool_name_to_prop(za.za_name)) == ZPOOL_PROP_INVAL)
continue;
switch (za.za_integer_length) {
@@ -424,7 +424,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props)
zpool_prop_t prop = zpool_name_to_prop(propname);
switch (prop) {
- case ZPROP_INVAL:
+ case ZPOOL_PROP_INVAL:
if (!zpool_prop_feature(propname)) {
error = SET_ERROR(EINVAL);
break;
@@ -667,7 +667,7 @@ spa_prop_set(spa_t *spa, nvlist_t *nvp)
prop == ZPOOL_PROP_READONLY)
continue;
- if (prop == ZPOOL_PROP_VERSION || prop == ZPROP_INVAL) {
+ if (prop == ZPOOL_PROP_VERSION || prop == ZPOOL_PROP_INVAL) {
uint64_t ver;
if (prop == ZPOOL_PROP_VERSION) {
@@ -6174,7 +6174,7 @@ spa_sync_props(void *arg, dmu_tx_t *tx)
spa_feature_t fid;
switch (prop = zpool_name_to_prop(nvpair_name(elem))) {
- case ZPROP_INVAL:
+ case ZPOOL_PROP_INVAL:
/*
* We checked this earlier in spa_prop_validate().
*/
diff --git a/usr/src/uts/common/inet/ip/spd.c b/usr/src/uts/common/inet/ip/spd.c
index 841c345013..d703170c9f 100644
--- a/usr/src/uts/common/inet/ip/spd.c
+++ b/usr/src/uts/common/inet/ip/spd.c
@@ -23,7 +23,7 @@
* Use is subject to license terms.
* Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2016 by Delphix. All rights reserved.
- * Copyright (c) 2017, Joyent, Inc.
+ * Copyright (c) 2018, Joyent, Inc.
*/
/*
@@ -4123,6 +4123,11 @@ ipsec_in_release_refs(ip_recv_attr_t *ira)
IPSA_REFRELE(ira->ira_ipsec_esp_sa);
ira->ira_ipsec_esp_sa = NULL;
}
+ if (ira->ira_ipsec_action != NULL) {
+ IPACT_REFRELE(ira->ira_ipsec_action);
+ ira->ira_ipsec_action = NULL;
+ }
+
ira->ira_flags &= ~IRAF_IPSEC_SECURE;
}
diff --git a/usr/src/uts/common/sys/fs/zfs.h b/usr/src/uts/common/sys/fs/zfs.h
index c37104708d..b37fa81211 100644
--- a/usr/src/uts/common/sys/fs/zfs.h
+++ b/usr/src/uts/common/sys/fs/zfs.h
@@ -87,7 +87,8 @@ typedef enum dmu_objset_type {
* the property table in usr/src/common/zfs/zfs_prop.c.
*/
typedef enum {
- ZFS_PROP_BAD = -1,
+ ZPROP_CONT = -2,
+ ZPROP_INVAL = -1,
ZFS_PROP_TYPE = 0,
ZFS_PROP_CREATION,
ZFS_PROP_USED,
@@ -181,6 +182,7 @@ extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
* the property table in usr/src/common/zfs/zpool_prop.c.
*/
typedef enum {
+ ZPOOL_PROP_INVAL = -1,
ZPOOL_PROP_NAME,
ZPOOL_PROP_SIZE,
ZPOOL_PROP_CAPACITY,
@@ -213,9 +215,6 @@ typedef enum {
/* Small enough to not hog a whole line of printout in zpool(1M). */
#define ZPROP_MAX_COMMENT 32
-#define ZPROP_CONT -2
-#define ZPROP_INVAL -1
-
#define ZPROP_VALUE "value"
#define ZPROP_SOURCE "source"