diff options
author | John Sonnenschein <johns@joyent.com> | 2012-05-17 18:26:57 +0000 |
---|---|---|
committer | John Sonnenschein <johns@joyent.com> | 2012-05-17 18:26:57 +0000 |
commit | 04b244dd661c24b510ac22936decfc0972d202d3 (patch) | |
tree | 3ebfef98afc303fddf3415d6fba64e8682f495e8 /usr/src/uts/common | |
parent | eac250589e41f1b705e1b7427b02b3379aac9f9e (diff) | |
parent | a69187741b83640a90dd8586195456dd50c016a8 (diff) | |
download | illumos-joyent-20120517.tar.gz |
Merge git.joyent.com:illumos-joyent20120517
Diffstat (limited to 'usr/src/uts/common')
-rw-r--r-- | usr/src/uts/common/dtrace/dtrace.c | 17 | ||||
-rw-r--r-- | usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c | 4 | ||||
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_subr.c | 19 | ||||
-rw-r--r-- | usr/src/uts/common/fs/ufs/lufs.c | 2 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/spa.c | 17 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/sys/vdev_impl.h | 5 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/vdev.c | 31 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/vdev_disk.c | 64 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/vdev_file.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/vdev_mirror.c | 8 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/vdev_missing.c | 8 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/vdev_raidz.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/vdev_root.c | 8 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/zfs_ioctl.c | 22 | ||||
-rw-r--r-- | usr/src/uts/common/gssapi/Makefile | 4 | ||||
-rw-r--r-- | usr/src/uts/common/io/scsi/targets/sd.c | 39 | ||||
-rw-r--r-- | usr/src/uts/common/sys/fs/zfs.h | 7 | ||||
-rw-r--r-- | usr/src/uts/common/sys/ib/mgt/ibcm/ibcm_impl.h | 16 | ||||
-rw-r--r-- | usr/src/uts/common/sys/ucode.h | 1 |
19 files changed, 225 insertions, 59 deletions
diff --git a/usr/src/uts/common/dtrace/dtrace.c b/usr/src/uts/common/dtrace/dtrace.c index 290494147f..a5dd75f944 100644 --- a/usr/src/uts/common/dtrace/dtrace.c +++ b/usr/src/uts/common/dtrace/dtrace.c @@ -6120,6 +6120,23 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, continue; } + /* + * Clear the string space, since there's no + * helper to do it for us. + */ + if (DTRACE_USTACK_STRSIZE(rec->dtrd_arg) != 0) { + int depth = DTRACE_USTACK_NFRAMES( + rec->dtrd_arg); + size_t strsize = DTRACE_USTACK_STRSIZE( + rec->dtrd_arg); + uint64_t *buf = (uint64_t *)(tomax + + valoffs); + void *strspace = &buf[depth + 1]; + + dtrace_bzero(strspace, + MIN(depth, strsize)); + } + DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_getupcstack((uint64_t *) (tomax + valoffs), diff --git a/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c b/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c index 45b7d4db87..5cff040236 100644 --- a/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c +++ b/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c @@ -1275,7 +1275,9 @@ static int hyprlofs_seek(vnode_t *vp, offset_t ooff, offset_t *noffp, caller_context_t *ct) { - ASSERT(VTOHLN(vp)->hln_looped == 1); + if (VTOHLN(vp)->hln_looped == 0) + return ((*noffp < 0 || *noffp > MAXOFFSET_T) ? EINVAL : 0); + return (VOP_SEEK(REALVP(vp), ooff, noffp, ct)); } diff --git a/usr/src/uts/common/fs/nfs/nfs4_subr.c b/usr/src/uts/common/fs/nfs/nfs4_subr.c index edc1602e13..c14117c009 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_subr.c +++ b/usr/src/uts/common/fs/nfs/nfs4_subr.c @@ -2110,8 +2110,10 @@ recov_retry: goto out; } } - va.va_type = VNON; - pva.va_type = VNON; + + pgar.n4g_va.va_type = VNON; + gar.n4g_va.va_type = VNON; + remap_lookup(np, rootvp, RML_ORDINARY, cr, &newfh, &gar, &newpfh, &pgar, &e); if (nfs4_needs_recovery(&e, FALSE, mi->mi_vfsp)) { @@ -2137,10 +2139,8 @@ recov_retry: goto out; } - if (!e.error) { - va = gar.n4g_va; - pva = pgar.n4g_va; - } + va = gar.n4g_va; + pva = pgar.n4g_va; if ((e.error != 0) || (va.va_type != VDIR)) { @@ -2173,6 +2173,13 @@ recov_retry: if (pnp != NULL) { remap_lookup(pnp, rootvp, RML_ORDINARY, cr, &newpfh, &pgar, NULL, NULL, &e); + /* + * This remap_lookup call modifies pgar. The following + * line prevents trouble when checking the va_type of + * pva later in this code. + */ + pva = pgar.n4g_va; + if (nfs4_needs_recovery(&e, FALSE, mi->mi_vfsp)) { if (need_start_op) { diff --git a/usr/src/uts/common/fs/ufs/lufs.c b/usr/src/uts/common/fs/ufs/lufs.c index 301bb09c01..43cc78219c 100644 --- a/usr/src/uts/common/fs/ufs/lufs.c +++ b/usr/src/uts/common/fs/ufs/lufs.c @@ -1492,7 +1492,7 @@ lufs_init(void) _init_top(); - if (&bio_lufs_strategy != NULL) + if (bio_lufs_strategy == NULL) bio_lufs_strategy = (void (*) (void *, buf_t *)) lufs_strategy; /* diff --git a/usr/src/uts/common/fs/zfs/spa.c b/usr/src/uts/common/fs/zfs/spa.c index ed0d0cb36f..a4c61fc947 100644 --- a/usr/src/uts/common/fs/zfs/spa.c +++ b/usr/src/uts/common/fs/zfs/spa.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* @@ -167,15 +167,17 @@ spa_prop_add_list(nvlist_t *nvl, zpool_prop_t prop, char *strval, static void spa_prop_get_config(spa_t *spa, nvlist_t **nvp) { + vdev_t *rvd = spa->spa_root_vdev; uint64_t size; uint64_t alloc; + uint64_t space; uint64_t cap, version; zprop_source_t src = ZPROP_SRC_NONE; spa_config_dirent_t *dp; ASSERT(MUTEX_HELD(&spa->spa_props_lock)); - if (spa->spa_root_vdev != NULL) { + if (rvd != NULL) { alloc = metaslab_class_get_alloc(spa_normal_class(spa)); size = metaslab_class_get_space(spa_normal_class(spa)); spa_prop_add_list(*nvp, ZPOOL_PROP_NAME, spa_name(spa), 0, src); @@ -183,6 +185,15 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp) spa_prop_add_list(*nvp, ZPOOL_PROP_ALLOCATED, NULL, alloc, src); spa_prop_add_list(*nvp, ZPOOL_PROP_FREE, NULL, size - alloc, src); + + space = 0; + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + space += tvd->vdev_max_asize - tvd->vdev_asize; + } + spa_prop_add_list(*nvp, ZPOOL_PROP_EXPANDSZ, NULL, space, + src); + spa_prop_add_list(*nvp, ZPOOL_PROP_READONLY, NULL, (spa_mode(spa) == FREAD), src); @@ -193,7 +204,7 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp) ddt_get_pool_dedup_ratio(spa), src); spa_prop_add_list(*nvp, ZPOOL_PROP_HEALTH, NULL, - spa->spa_root_vdev->vdev_state, src); + rvd->vdev_state, src); version = spa_version(spa); if (version == zpool_prop_default_numeric(ZPOOL_PROP_VERSION)) diff --git a/usr/src/uts/common/fs/zfs/sys/vdev_impl.h b/usr/src/uts/common/fs/zfs/sys/vdev_impl.h index c297ae165c..3a2d7a04d8 100644 --- a/usr/src/uts/common/fs/zfs/sys/vdev_impl.h +++ b/usr/src/uts/common/fs/zfs/sys/vdev_impl.h @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _SYS_VDEV_IMPL_H @@ -55,7 +56,8 @@ typedef struct vdev_cache_entry vdev_cache_entry_t; /* * Virtual device operations */ -typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *ashift); +typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *max_size, + uint64_t *ashift); typedef void vdev_close_func_t(vdev_t *vd); typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize); typedef int vdev_io_start_func_t(zio_t *zio); @@ -119,6 +121,7 @@ struct vdev { uint64_t vdev_orig_guid; /* orig. guid prior to remove */ uint64_t vdev_asize; /* allocatable device capacity */ uint64_t vdev_min_asize; /* min acceptable asize */ + uint64_t vdev_max_asize; /* max acceptable asize */ uint64_t vdev_ashift; /* block alignment shift */ uint64_t vdev_state; /* see VDEV_STATE_* #defines */ uint64_t vdev_prevstate; /* used when reopening a vdev */ diff --git a/usr/src/uts/common/fs/zfs/vdev.c b/usr/src/uts/common/fs/zfs/vdev.c index 1af113e2e0..6606b1f486 100644 --- a/usr/src/uts/common/fs/zfs/vdev.c +++ b/usr/src/uts/common/fs/zfs/vdev.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include <sys/zfs_context.h> @@ -108,7 +108,7 @@ vdev_get_min_asize(vdev_t *vd) vdev_t *pvd = vd->vdev_parent; /* - * The our parent is NULL (inactive spare or cache) or is the root, + * If our parent is NULL (inactive spare or cache) or is the root, * just return our own asize. */ if (pvd == NULL) @@ -737,6 +737,7 @@ vdev_add_parent(vdev_t *cvd, vdev_ops_t *ops) mvd->vdev_asize = cvd->vdev_asize; mvd->vdev_min_asize = cvd->vdev_min_asize; + mvd->vdev_max_asize = cvd->vdev_max_asize; mvd->vdev_ashift = cvd->vdev_ashift; mvd->vdev_state = cvd->vdev_state; mvd->vdev_crtxg = cvd->vdev_crtxg; @@ -1108,7 +1109,8 @@ vdev_open(vdev_t *vd) spa_t *spa = vd->vdev_spa; int error; uint64_t osize = 0; - uint64_t asize, psize; + uint64_t max_osize = 0; + uint64_t asize, max_asize, psize; uint64_t ashift = 0; ASSERT(vd->vdev_open_thread == curthread || @@ -1139,7 +1141,7 @@ vdev_open(vdev_t *vd) return (ENXIO); } - error = vd->vdev_ops->vdev_op_open(vd, &osize, &ashift); + error = vd->vdev_ops->vdev_op_open(vd, &osize, &max_osize, &ashift); /* * Reset the vdev_reopening flag so that we actually close @@ -1197,6 +1199,7 @@ vdev_open(vdev_t *vd) } osize = P2ALIGN(osize, (uint64_t)sizeof (vdev_label_t)); + max_osize = P2ALIGN(max_osize, (uint64_t)sizeof (vdev_label_t)); if (vd->vdev_children == 0) { if (osize < SPA_MINDEVSIZE) { @@ -1206,6 +1209,8 @@ vdev_open(vdev_t *vd) } psize = osize; asize = osize - (VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE); + max_asize = max_osize - (VDEV_LABEL_START_SIZE + + VDEV_LABEL_END_SIZE); } else { if (vd->vdev_parent != NULL && osize < SPA_MINDEVSIZE - (VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE)) { @@ -1215,6 +1220,7 @@ vdev_open(vdev_t *vd) } psize = 0; asize = osize; + max_asize = max_osize; } vd->vdev_psize = psize; @@ -1234,16 +1240,22 @@ vdev_open(vdev_t *vd) * For testing purposes, a higher ashift can be requested. */ vd->vdev_asize = asize; + vd->vdev_max_asize = max_asize; vd->vdev_ashift = MAX(ashift, vd->vdev_ashift); } else { /* - * Make sure the alignment requirement hasn't increased. + * Detect if the alignment requirement has increased. + * We don't want to make the pool unavailable, just + * issue a warning instead. */ - if (ashift > vd->vdev_top->vdev_ashift) { - vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN, - VDEV_AUX_BAD_LABEL); - return (EINVAL); + if (ashift > vd->vdev_top->vdev_ashift && + vd->vdev_ops->vdev_op_leaf) { + cmn_err(CE_WARN, + "Disk, '%s', has a block alignment that is " + "larger than the pool's alignment\n", + vd->vdev_path); } + vd->vdev_max_asize = max_asize; } /* @@ -2467,6 +2479,7 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) vs->vs_rsize = vdev_get_min_asize(vd); if (vd->vdev_ops->vdev_op_leaf) vs->vs_rsize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; + vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize; mutex_exit(&vd->vdev_stat_lock); /* diff --git a/usr/src/uts/common/fs/zfs/vdev_disk.c b/usr/src/uts/common/fs/zfs/vdev_disk.c index f78580d0f1..49e425929f 100644 --- a/usr/src/uts/common/fs/zfs/vdev_disk.c +++ b/usr/src/uts/common/fs/zfs/vdev_disk.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, Joyent, Inc. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include <sys/zfs_context.h> @@ -32,6 +33,7 @@ #include <sys/fs/zfs.h> #include <sys/zio.h> #include <sys/sunldi.h> +#include <sys/efi_partition.h> #include <sys/fm/fs/zfs.h> /* @@ -104,8 +106,39 @@ vdev_disk_rele(vdev_t *vd) } } +static uint64_t +vdev_disk_get_space(vdev_t *vd, uint64_t capacity, uint_t blksz) +{ + ASSERT(vd->vdev_wholedisk); + + vdev_disk_t *dvd = vd->vdev_tsd; + dk_efi_t dk_ioc; + efi_gpt_t *efi; + uint64_t avail_space = 0; + int efisize = EFI_LABEL_SIZE * 2; + + dk_ioc.dki_data = kmem_alloc(efisize, KM_SLEEP); + dk_ioc.dki_lba = 1; + dk_ioc.dki_length = efisize; + dk_ioc.dki_data_64 = (uint64_t)(uintptr_t)dk_ioc.dki_data; + efi = dk_ioc.dki_data; + + if (ldi_ioctl(dvd->vd_lh, DKIOCGETEFI, (intptr_t)&dk_ioc, + FKIOCTL, kcred, NULL) == 0) { + uint64_t efi_altern_lba = LE_64(efi->efi_gpt_AlternateLBA); + + zfs_dbgmsg("vdev %s, capacity %llu, altern lba %llu", + vd->vdev_path, capacity, efi_altern_lba); + if (capacity > efi_altern_lba) + avail_space = (capacity - efi_altern_lba) * blksz; + } + kmem_free(dk_ioc.dki_data, efisize); + return (avail_space); +} + static int -vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { spa_t *spa = vd->vdev_spa; vdev_disk_t *dvd; @@ -276,16 +309,6 @@ skip_open: } /* - * If we own the whole disk, try to enable disk write caching. - * We ignore errors because it's OK if we can't do it. - */ - if (vd->vdev_wholedisk == 1) { - int wce = 1; - (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce, - FKIOCTL, kcred, NULL); - } - - /* * Determine the device's minimum transfer size. * If the ioctl isn't supported, assume DEV_BSIZE. */ @@ -295,6 +318,25 @@ skip_open: *ashift = highbit(MAX(dkmext.dki_pbsize, SPA_MINBLOCKSIZE)) - 1; + if (vd->vdev_wholedisk == 1) { + uint64_t capacity = dkmext.dki_capacity - 1; + uint64_t blksz = dkmext.dki_lbsize; + int wce = 1; + + /* + * If we own the whole disk, try to enable disk write caching. + * We ignore errors because it's OK if we can't do it. + */ + (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce, + FKIOCTL, kcred, NULL); + + *max_psize = *psize + vdev_disk_get_space(vd, capacity, blksz); + zfs_dbgmsg("capacity change: vdev %s, psize %llu, " + "max_psize %llu", vd->vdev_path, *psize, *max_psize); + } else { + *max_psize = *psize; + } + /* * Clear the nowritecache bit, so that on a vdev_reopen() we will * try again. diff --git a/usr/src/uts/common/fs/zfs/vdev_file.c b/usr/src/uts/common/fs/zfs/vdev_file.c index 8c22aa5316..043fa51294 100644 --- a/usr/src/uts/common/fs/zfs/vdev_file.c +++ b/usr/src/uts/common/fs/zfs/vdev_file.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include <sys/zfs_context.h> @@ -47,7 +48,8 @@ vdev_file_rele(vdev_t *vd) } static int -vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { vdev_file_t *vf; vnode_t *vp; @@ -112,7 +114,7 @@ skip_open: return (error); } - *psize = vattr.va_size; + *max_psize = *psize = vattr.va_size; *ashift = SPA_MINBLOCKSHIFT; return (0); diff --git a/usr/src/uts/common/fs/zfs/vdev_mirror.c b/usr/src/uts/common/fs/zfs/vdev_mirror.c index 698c0275d3..a28ca3e396 100644 --- a/usr/src/uts/common/fs/zfs/vdev_mirror.c +++ b/usr/src/uts/common/fs/zfs/vdev_mirror.c @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + #include <sys/zfs_context.h> #include <sys/spa.h> #include <sys/vdev_impl.h> @@ -127,7 +131,8 @@ vdev_mirror_map_alloc(zio_t *zio) } static int -vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) +vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, + uint64_t *ashift) { int numerrors = 0; int lasterror = 0; @@ -149,6 +154,7 @@ vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) } *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; + *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; *ashift = MAX(*ashift, cvd->vdev_ashift); } diff --git a/usr/src/uts/common/fs/zfs/vdev_missing.c b/usr/src/uts/common/fs/zfs/vdev_missing.c index 6a5588d592..3bd8c90e04 100644 --- a/usr/src/uts/common/fs/zfs/vdev_missing.c +++ b/usr/src/uts/common/fs/zfs/vdev_missing.c @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +/* * The 'missing' vdev is a special vdev type used only during import. It * signifies a placeholder in the root vdev for some vdev that we know is * missing. We pass it down to the kernel to allow the rest of the @@ -40,7 +44,8 @@ /* ARGSUSED */ static int -vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { /* * Really this should just fail. But then the root vdev will be in the @@ -49,6 +54,7 @@ vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) * will fail the GUID sum check before ever trying to open the pool. */ *psize = 0; + *max_psize = 0; *ashift = 0; return (0); } diff --git a/usr/src/uts/common/fs/zfs/vdev_raidz.c b/usr/src/uts/common/fs/zfs/vdev_raidz.c index 6094e01876..3ac3d3b167 100644 --- a/usr/src/uts/common/fs/zfs/vdev_raidz.c +++ b/usr/src/uts/common/fs/zfs/vdev_raidz.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Joyent, Inc. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include <sys/zfs_context.h> @@ -1445,7 +1446,8 @@ vdev_raidz_reconstruct(raidz_map_t *rm, int *t, int nt) } static int -vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) +vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, + uint64_t *ashift) { vdev_t *cvd; uint64_t nparity = vd->vdev_nparity; @@ -1473,10 +1475,12 @@ vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) } *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; + *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; *ashift = MAX(*ashift, cvd->vdev_ashift); } *asize *= vd->vdev_children; + *max_asize *= vd->vdev_children; if (numerrors > nparity) { vd->vdev_stat.vs_aux = VDEV_AUX_NO_REPLICAS; diff --git a/usr/src/uts/common/fs/zfs/vdev_root.c b/usr/src/uts/common/fs/zfs/vdev_root.c index 879f78f3a5..1abc79d330 100644 --- a/usr/src/uts/common/fs/zfs/vdev_root.c +++ b/usr/src/uts/common/fs/zfs/vdev_root.c @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + #include <sys/zfs_context.h> #include <sys/spa.h> #include <sys/vdev_impl.h> @@ -50,7 +54,8 @@ too_many_errors(vdev_t *vd, int numerrors) } static int -vdev_root_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) +vdev_root_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, + uint64_t *ashift) { int lasterror = 0; int numerrors = 0; @@ -77,6 +82,7 @@ vdev_root_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) } *asize = 0; + *max_asize = 0; *ashift = 0; return (0); diff --git a/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c index baffc223a3..f2bf4fc98f 100644 --- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c +++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c @@ -22,7 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright 2011 Martin Matuska * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ @@ -4066,6 +4066,22 @@ zfs_ioc_clear(zfs_cmd_t *zc) return (error); } +static int +zfs_ioc_pool_reopen(zfs_cmd_t *zc) +{ + spa_t *spa; + int error; + + error = spa_open(zc->zc_name, &spa, FTAG); + if (error) + return (error); + + spa_vdev_state_enter(spa, SCL_NONE); + vdev_reopen(spa->spa_root_vdev); + (void) spa_vdev_state_exit(spa, NULL, 0); + spa_close(spa, FTAG); + return (0); +} /* * inputs: * zc_name name of filesystem @@ -4910,7 +4926,9 @@ static zfs_ioc_vec_t zfs_ioc_vec[] = { { zfs_ioc_destroy_snaps_nvl, zfs_secpolicy_destroy_recursive, DATASET_NAME, B_TRUE, POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY }, { zfs_ioc_pool_reguid, zfs_secpolicy_config, POOL_NAME, B_TRUE, - POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY } + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY }, + { zfs_ioc_pool_reopen, zfs_secpolicy_config, POOL_NAME, B_TRUE, + POOL_CHECK_SUSPENDED }, }; int diff --git a/usr/src/uts/common/gssapi/Makefile b/usr/src/uts/common/gssapi/Makefile index 1b691b92cb..0f02a03623 100644 --- a/usr/src/uts/common/gssapi/Makefile +++ b/usr/src/uts/common/gssapi/Makefile @@ -23,7 +23,7 @@ # Copyright (c) 1989,1997,1999 by Sun Microsystems, Inc. # All rights reserved. # -#pragma ident "%Z%%M% %I% %E% SMI" +# Copyright 2012 Milan Jurik. All rights reserved. # # uts/common/gssd/Makefile # @@ -64,7 +64,7 @@ $(GSSDDIRS): gssd_prot.h: gssd.x $(RM) $@ - $(RPCGEN) -M -h gssd.x > $@ + $(RPCGEN) -CM -h gssd.x > $@ gssd_prot.c: gssd.x $(RM) $@ diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c index 4ab44d9eb3..8ec8672eb9 100644 --- a/usr/src/uts/common/io/scsi/targets/sd.c +++ b/usr/src/uts/common/io/scsi/targets/sd.c @@ -4224,6 +4224,18 @@ sd_set_properties(struct sd_lun *un, char *name, char *value) "RMW type set to %d\n", un->un_f_rmw_type); } + if (strcasecmp(name, "physical-block-size") == 0) { + if (ddi_strtol(value, &endptr, 0, &val) == 0 && + ISP2(val) && val >= un->un_tgt_blocksize && + val >= un->un_sys_blocksize) { + un->un_phy_blocksize = val; + } else { + goto value_invalid; + } + SD_INFO(SD_LOG_ATTACH_DETACH, un, "sd_set_properties: " + "physical block size set to %d\n", un->un_phy_blocksize); + } + /* * Validate the throttle values. * If any of the numbers are invalid, set everything to defaults. @@ -7624,6 +7636,13 @@ sd_unit_attach(dev_info_t *devi) un->un_f_mmc_gesn_polling = TRUE; /* + * physical sector size defaults to DEV_BSIZE currently. We can + * override this value via the driver configuration file so we must + * set it before calling sd_read_unit_properties(). + */ + un->un_phy_blocksize = DEV_BSIZE; + + /* * Retrieve the properties from the static driver table or the driver * configuration file (.conf) for this unit and update the soft state * for the device as needed for the indicated properties. @@ -7668,11 +7687,6 @@ sd_unit_attach(dev_info_t *devi) un->un_blockcount = 0; /* - * physical sector size default to DEV_BSIZE currently. - */ - un->un_phy_blocksize = DEV_BSIZE; - - /* * Set up the per-instance info needed to determine the correct * CDBs and other info for issuing commands to the target. */ @@ -23482,10 +23496,17 @@ sd_get_media_info_com(dev_t dev, uint_t *dki_media_type, uint_t *dki_lbsize, * Now read the capacity so we can provide the lbasize, * pbsize and capacity. */ - if (dki_pbsize && un->un_f_descr_format_supported) + if (dki_pbsize && un->un_f_descr_format_supported) { rval = sd_send_scsi_READ_CAPACITY_16(ssc, &capacity, &lbasize, &pbsize, SD_PATH_DIRECT); + /* + * Override the physical blocksize if the instance already + * has a larger value. + */ + pbsize = MAX(pbsize, un->un_phy_blocksize); + } + if (dki_pbsize == NULL || rval != 0 || !un->un_f_descr_format_supported) { rval = sd_send_scsi_READ_CAPACITY(ssc, &capacity, &lbasize, @@ -31747,7 +31768,11 @@ sd_check_emulation_mode(sd_ssc_t *ssc) } else { if (!ISP2(pbsize % DEV_BSIZE) || pbsize == 0) { un->un_phy_blocksize = DEV_BSIZE; - } else { + } else if (pbsize > un->un_phy_blocksize) { + /* + * Don't reset the physical blocksize + * unless we've detected a larger value. + */ un->un_phy_blocksize = pbsize; } } diff --git a/usr/src/uts/common/sys/fs/zfs.h b/usr/src/uts/common/sys/fs/zfs.h index baa201d7a5..a523201954 100644 --- a/usr/src/uts/common/sys/fs/zfs.h +++ b/usr/src/uts/common/sys/fs/zfs.h @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ @@ -167,6 +167,7 @@ typedef enum { ZPOOL_PROP_ALLOCATED, ZPOOL_PROP_READONLY, ZPOOL_PROP_COMMENT, + ZPOOL_PROP_EXPANDSZ, ZPOOL_NUM_PROPS } zpool_prop_t; @@ -672,6 +673,7 @@ typedef struct vdev_stat { uint64_t vs_space; /* total capacity */ uint64_t vs_dspace; /* deflated capacity */ uint64_t vs_rsize; /* replaceable dev size */ + uint64_t vs_esize; /* expandable dev size */ uint64_t vs_ops[ZIO_TYPES]; /* operation count */ uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */ uint64_t vs_read_errors; /* read errors */ @@ -788,7 +790,8 @@ typedef enum zfs_ioc { ZFS_IOC_SPACE_WRITTEN, ZFS_IOC_SPACE_SNAPS, ZFS_IOC_DESTROY_SNAPS_NVL, - ZFS_IOC_POOL_REGUID + ZFS_IOC_POOL_REGUID, + ZFS_IOC_POOL_REOPEN } zfs_ioc_t; /* diff --git a/usr/src/uts/common/sys/ib/mgt/ibcm/ibcm_impl.h b/usr/src/uts/common/sys/ib/mgt/ibcm/ibcm_impl.h index 2fb6454396..e7751760bd 100644 --- a/usr/src/uts/common/sys/ib/mgt/ibcm/ibcm_impl.h +++ b/usr/src/uts/common/sys/ib/mgt/ibcm/ibcm_impl.h @@ -2170,15 +2170,15 @@ void ibcm_dump_noderec(sa_node_record_t *); void ibcm_query_classport_info(ibt_channel_hdl_t channel); -#define IBCM_DUMP_RAW_MSG ibcm_dump_raw_message -#define IBCM_DUMP_SERVICE_REC ibcm_dump_srvrec -#define IBCM_DUMP_PATH_REC ibcm_dump_pathrec -#define IBCM_DUMP_NODE_REC ibcm_dump_noderec +#define IBCM_DUMP_RAW_MSG(x) ibcm_dump_raw_message(x) +#define IBCM_DUMP_SERVICE_REC(x) ibcm_dump_srvrec(x) +#define IBCM_DUMP_PATH_REC(x) ibcm_dump_pathrec(x) +#define IBCM_DUMP_NODE_REC(x) ibcm_dump_noderec(x) #else -#define IBCM_DUMP_RAW_MSG 0 && -#define IBCM_DUMP_SERVICE_REC 0 && -#define IBCM_DUMP_PATH_REC 0 && -#define IBCM_DUMP_NODE_REC 0 && +#define IBCM_DUMP_RAW_MSG(x) +#define IBCM_DUMP_SERVICE_REC(x) +#define IBCM_DUMP_PATH_REC(x) +#define IBCM_DUMP_NODE_REC(x) #endif ibt_status_t ibcm_ibmf_analyze_error(int ibmf_status); diff --git a/usr/src/uts/common/sys/ucode.h b/usr/src/uts/common/sys/ucode.h index e4f01bfeb0..d96c354c45 100644 --- a/usr/src/uts/common/sys/ucode.h +++ b/usr/src/uts/common/sys/ucode.h @@ -116,6 +116,7 @@ typedef struct ucode_file_amd { uint8_t uf_resv[896]; uint8_t uf_code_present; uint8_t uf_code[191]; + uint8_t uf_encr[2048]; #else uint8_t *ucodep; uint32_t usize; |