Print this page
13065 log when suspending a zpool
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Toomas Soome <tsoome@me.com>


   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  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2011, 2018 by Delphix. All rights reserved.
  24  * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright (c) 2014 Integros [integros.com]
  26  * Copyright (c) 2017, Intel Corporation.

  27  */
  28 
  29 #include <sys/sysmacros.h>
  30 #include <sys/zfs_context.h>
  31 #include <sys/fm/fs/zfs.h>
  32 #include <sys/spa.h>
  33 #include <sys/txg.h>
  34 #include <sys/spa_impl.h>
  35 #include <sys/vdev_impl.h>
  36 #include <sys/vdev_trim.h>
  37 #include <sys/zio_impl.h>
  38 #include <sys/zio_compress.h>
  39 #include <sys/zio_checksum.h>
  40 #include <sys/dmu_objset.h>
  41 #include <sys/arc.h>
  42 #include <sys/ddt.h>
  43 #include <sys/blkptr.h>
  44 #include <sys/zfeature.h>
  45 #include <sys/time.h>
  46 #include <sys/dsl_scan.h>


1967 
1968         /*
1969          * Now that all children have been reexecuted, execute the parent.
1970          * We don't reexecute "The Godfather" I/O here as it's the
1971          * responsibility of the caller to wait on it.
1972          */
1973         if (!(pio->io_flags & ZIO_FLAG_GODFATHER)) {
1974                 pio->io_queued_timestamp = gethrtime();
1975                 zio_execute(pio);
1976         }
1977 }
1978 
1979 void
1980 zio_suspend(spa_t *spa, zio_t *zio, zio_suspend_reason_t reason)
1981 {
1982         if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_PANIC)
1983                 fm_panic("Pool '%s' has encountered an uncorrectable I/O "
1984                     "failure and the failure mode property for this pool "
1985                     "is set to panic.", spa_name(spa));
1986 




1987         zfs_ereport_post(FM_EREPORT_ZFS_IO_FAILURE, spa, NULL,
1988             NULL, NULL, 0, 0);
1989 
1990         mutex_enter(&spa->spa_suspend_lock);
1991 
1992         if (spa->spa_suspend_zio_root == NULL)
1993                 spa->spa_suspend_zio_root = zio_root(spa, NULL, NULL,
1994                     ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE |
1995                     ZIO_FLAG_GODFATHER);
1996 
1997         spa->spa_suspended = reason;
1998 
1999         if (zio != NULL) {
2000                 ASSERT(!(zio->io_flags & ZIO_FLAG_GODFATHER));
2001                 ASSERT(zio != spa->spa_suspend_zio_root);
2002                 ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL);
2003                 ASSERT(zio_unique_parent(zio) == NULL);
2004                 ASSERT(zio->io_stage == ZIO_STAGE_DONE);
2005                 zio_add_child(spa->spa_suspend_zio_root, zio);
2006         }




   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  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2011, 2018 by Delphix. All rights reserved.
  24  * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright (c) 2014 Integros [integros.com]
  26  * Copyright (c) 2017, Intel Corporation.
  27  * Copyright 2020 Joyent, Inc.
  28  */
  29 
  30 #include <sys/sysmacros.h>
  31 #include <sys/zfs_context.h>
  32 #include <sys/fm/fs/zfs.h>
  33 #include <sys/spa.h>
  34 #include <sys/txg.h>
  35 #include <sys/spa_impl.h>
  36 #include <sys/vdev_impl.h>
  37 #include <sys/vdev_trim.h>
  38 #include <sys/zio_impl.h>
  39 #include <sys/zio_compress.h>
  40 #include <sys/zio_checksum.h>
  41 #include <sys/dmu_objset.h>
  42 #include <sys/arc.h>
  43 #include <sys/ddt.h>
  44 #include <sys/blkptr.h>
  45 #include <sys/zfeature.h>
  46 #include <sys/time.h>
  47 #include <sys/dsl_scan.h>


1968 
1969         /*
1970          * Now that all children have been reexecuted, execute the parent.
1971          * We don't reexecute "The Godfather" I/O here as it's the
1972          * responsibility of the caller to wait on it.
1973          */
1974         if (!(pio->io_flags & ZIO_FLAG_GODFATHER)) {
1975                 pio->io_queued_timestamp = gethrtime();
1976                 zio_execute(pio);
1977         }
1978 }
1979 
1980 void
1981 zio_suspend(spa_t *spa, zio_t *zio, zio_suspend_reason_t reason)
1982 {
1983         if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_PANIC)
1984                 fm_panic("Pool '%s' has encountered an uncorrectable I/O "
1985                     "failure and the failure mode property for this pool "
1986                     "is set to panic.", spa_name(spa));
1987 
1988         cmn_err(CE_WARN, "Pool '%s' has encountered an uncorrectable I/O "
1989             "failure and has been suspended; `zpool clear` will be required "
1990             "before the pool can be written to.", spa_name(spa));
1991 
1992         zfs_ereport_post(FM_EREPORT_ZFS_IO_FAILURE, spa, NULL,
1993             NULL, NULL, 0, 0);
1994 
1995         mutex_enter(&spa->spa_suspend_lock);
1996 
1997         if (spa->spa_suspend_zio_root == NULL)
1998                 spa->spa_suspend_zio_root = zio_root(spa, NULL, NULL,
1999                     ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE |
2000                     ZIO_FLAG_GODFATHER);
2001 
2002         spa->spa_suspended = reason;
2003 
2004         if (zio != NULL) {
2005                 ASSERT(!(zio->io_flags & ZIO_FLAG_GODFATHER));
2006                 ASSERT(zio != spa->spa_suspend_zio_root);
2007                 ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL);
2008                 ASSERT(zio_unique_parent(zio) == NULL);
2009                 ASSERT(zio->io_stage == ZIO_STAGE_DONE);
2010                 zio_add_child(spa->spa_suspend_zio_root, zio);
2011         }