Print this page
3956 ::vdev -r should work with pipelines
3957 ztest should update the cachefile before killing itself
3958 multiple scans can lead to partial resilvering
3959 ddt entries are not always resilvered
3960 dsl_scan can skip over dedup-ed blocks if physical birth != logical birth
3961 freed gang blocks are not resilvered and can cause pool to suspend
3962 ztest should print out zfs debug buffer before exiting
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright (c) 2012 by Delphix. All rights reserved.
  26  */
  27 
  28 #include <sys/spa.h>
  29 #include <sys/fm/fs/zfs.h>
  30 #include <sys/spa_impl.h>
  31 #include <sys/nvpair.h>
  32 #include <sys/uio.h>
  33 #include <sys/fs/zfs.h>
  34 #include <sys/vdev_impl.h>
  35 #include <sys/zfs_ioctl.h>
  36 #include <sys/utsname.h>
  37 #include <sys/systeminfo.h>
  38 #include <sys/sunddi.h>
  39 #include <sys/zfeature.h>
  40 #ifdef _KERNEL
  41 #include <sys/kobj.h>
  42 #include <sys/zone.h>
  43 #endif
  44 
  45 /*


 181         if (err == 0) {
 182                 err = vn_rdwr(UIO_WRITE, vp, buf, buflen, 0, UIO_SYSSPACE,
 183                     0, RLIM64_INFINITY, kcred, NULL);
 184                 if (err == 0)
 185                         err = VOP_FSYNC(vp, FSYNC, kcred, NULL);
 186                 if (err == 0)
 187                         err = vn_rename(temp, dp->scd_path, UIO_SYSSPACE);
 188                 (void) VOP_CLOSE(vp, oflags, 1, 0, kcred, NULL);
 189                 VN_RELE(vp);
 190         }
 191 
 192         (void) vn_remove(temp, UIO_SYSSPACE, RMFILE);
 193 
 194         kmem_free(buf, buflen);
 195         kmem_free(temp, MAXPATHLEN);
 196         return (err);
 197 }
 198 
 199 /*
 200  * Synchronize pool configuration to disk.  This must be called with the
 201  * namespace lock held.





 202  */
 203 void
 204 spa_config_sync(spa_t *target, boolean_t removing, boolean_t postsysevent)
 205 {
 206         spa_config_dirent_t *dp, *tdp;
 207         nvlist_t *nvl;
 208         boolean_t ccw_failure;
 209         int error;
 210 
 211         ASSERT(MUTEX_HELD(&spa_namespace_lock));
 212 
 213         if (rootdir == NULL || !(spa_mode_global & FWRITE))
 214                 return;
 215 
 216         /*
 217          * Iterate over all cachefiles for the pool, past or present.  When the
 218          * cachefile is changed, the new one is pushed onto this list, allowing
 219          * us to update previous cachefiles that no longer contain this pool.
 220          */
 221         ccw_failure = B_FALSE;




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright (c) 2013 by Delphix. All rights reserved.
  26  */
  27 
  28 #include <sys/spa.h>
  29 #include <sys/fm/fs/zfs.h>
  30 #include <sys/spa_impl.h>
  31 #include <sys/nvpair.h>
  32 #include <sys/uio.h>
  33 #include <sys/fs/zfs.h>
  34 #include <sys/vdev_impl.h>
  35 #include <sys/zfs_ioctl.h>
  36 #include <sys/utsname.h>
  37 #include <sys/systeminfo.h>
  38 #include <sys/sunddi.h>
  39 #include <sys/zfeature.h>
  40 #ifdef _KERNEL
  41 #include <sys/kobj.h>
  42 #include <sys/zone.h>
  43 #endif
  44 
  45 /*


 181         if (err == 0) {
 182                 err = vn_rdwr(UIO_WRITE, vp, buf, buflen, 0, UIO_SYSSPACE,
 183                     0, RLIM64_INFINITY, kcred, NULL);
 184                 if (err == 0)
 185                         err = VOP_FSYNC(vp, FSYNC, kcred, NULL);
 186                 if (err == 0)
 187                         err = vn_rename(temp, dp->scd_path, UIO_SYSSPACE);
 188                 (void) VOP_CLOSE(vp, oflags, 1, 0, kcred, NULL);
 189                 VN_RELE(vp);
 190         }
 191 
 192         (void) vn_remove(temp, UIO_SYSSPACE, RMFILE);
 193 
 194         kmem_free(buf, buflen);
 195         kmem_free(temp, MAXPATHLEN);
 196         return (err);
 197 }
 198 
 199 /*
 200  * Synchronize pool configuration to disk.  This must be called with the
 201  * namespace lock held. Synchronizing the pool cache is typically done after
 202  * the configuration has been synced to the MOS. This exposes a window where
 203  * the MOS config will have been updated but the cache file has not. If
 204  * the system were to crash at that instant then the cached config may not
 205  * contain the correct information to open the pool and an explicity import
 206  * would be required.
 207  */
 208 void
 209 spa_config_sync(spa_t *target, boolean_t removing, boolean_t postsysevent)
 210 {
 211         spa_config_dirent_t *dp, *tdp;
 212         nvlist_t *nvl;
 213         boolean_t ccw_failure;
 214         int error;
 215 
 216         ASSERT(MUTEX_HELD(&spa_namespace_lock));
 217 
 218         if (rootdir == NULL || !(spa_mode_global & FWRITE))
 219                 return;
 220 
 221         /*
 222          * Iterate over all cachefiles for the pool, past or present.  When the
 223          * cachefile is changed, the new one is pushed onto this list, allowing
 224          * us to update previous cachefiles that no longer contain this pool.
 225          */
 226         ccw_failure = B_FALSE;