Print this page
4047 panic from dbuf_free_range() from dmu_free_object() while doing zfs receive
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>


   4  * The contents of this file are subject to the terms of the
   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 (c) 2012 by Delphix. All rights reserved.
  25  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  26  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  27  */
  28 
  29 /* Portions Copyright 2010 Robert Milkowski */
  30 
  31 #ifndef _SYS_DMU_H
  32 #define _SYS_DMU_H
  33 
  34 /*
  35  * This file describes the interface that the DMU provides for its
  36  * consumers.
  37  *
  38  * The DMU also interacts with the SPA.  That interface is described in
  39  * dmu_spa.h.
  40  */
  41 
  42 #include <sys/inttypes.h>
  43 #include <sys/types.h>
  44 #include <sys/param.h>


 564  * it cannot be committed or aborted. It can be assigned to a txg or not.
 565  *
 566  * The callback will be called after the transaction has been safely written
 567  * to stable storage and will also be called if the dmu_tx is aborted.
 568  * If there is any error which prevents the transaction from being committed to
 569  * disk, the callback will be called with a value of error != 0.
 570  */
 571 typedef void dmu_tx_callback_func_t(void *dcb_data, int error);
 572 
 573 void dmu_tx_callback_register(dmu_tx_t *tx, dmu_tx_callback_func_t *dcb_func,
 574     void *dcb_data);
 575 
 576 /*
 577  * Free up the data blocks for a defined range of a file.  If size is
 578  * -1, the range from offset to end-of-file is freed.
 579  */
 580 int dmu_free_range(objset_t *os, uint64_t object, uint64_t offset,
 581         uint64_t size, dmu_tx_t *tx);
 582 int dmu_free_long_range(objset_t *os, uint64_t object, uint64_t offset,
 583         uint64_t size);
 584 int dmu_free_object(objset_t *os, uint64_t object);
 585 
 586 /*
 587  * Convenience functions.
 588  *
 589  * Canfail routines will return 0 on success, or an errno if there is a
 590  * nonrecoverable I/O error.
 591  */
 592 #define DMU_READ_PREFETCH       0 /* prefetch */
 593 #define DMU_READ_NO_PREFETCH    1 /* don't prefetch */
 594 int dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
 595         void *buf, uint32_t flags);
 596 void dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
 597         const void *buf, dmu_tx_t *tx);
 598 void dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
 599         dmu_tx_t *tx);
 600 int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size);
 601 int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size,
 602     dmu_tx_t *tx);
 603 int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size,
 604     dmu_tx_t *tx);




   4  * The contents of this file are subject to the terms of the
   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 (c) 2013 by Delphix. All rights reserved.
  25  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  26  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  27  */
  28 
  29 /* Portions Copyright 2010 Robert Milkowski */
  30 
  31 #ifndef _SYS_DMU_H
  32 #define _SYS_DMU_H
  33 
  34 /*
  35  * This file describes the interface that the DMU provides for its
  36  * consumers.
  37  *
  38  * The DMU also interacts with the SPA.  That interface is described in
  39  * dmu_spa.h.
  40  */
  41 
  42 #include <sys/inttypes.h>
  43 #include <sys/types.h>
  44 #include <sys/param.h>


 564  * it cannot be committed or aborted. It can be assigned to a txg or not.
 565  *
 566  * The callback will be called after the transaction has been safely written
 567  * to stable storage and will also be called if the dmu_tx is aborted.
 568  * If there is any error which prevents the transaction from being committed to
 569  * disk, the callback will be called with a value of error != 0.
 570  */
 571 typedef void dmu_tx_callback_func_t(void *dcb_data, int error);
 572 
 573 void dmu_tx_callback_register(dmu_tx_t *tx, dmu_tx_callback_func_t *dcb_func,
 574     void *dcb_data);
 575 
 576 /*
 577  * Free up the data blocks for a defined range of a file.  If size is
 578  * -1, the range from offset to end-of-file is freed.
 579  */
 580 int dmu_free_range(objset_t *os, uint64_t object, uint64_t offset,
 581         uint64_t size, dmu_tx_t *tx);
 582 int dmu_free_long_range(objset_t *os, uint64_t object, uint64_t offset,
 583         uint64_t size);
 584 int dmu_free_long_object(objset_t *os, uint64_t object);
 585 
 586 /*
 587  * Convenience functions.
 588  *
 589  * Canfail routines will return 0 on success, or an errno if there is a
 590  * nonrecoverable I/O error.
 591  */
 592 #define DMU_READ_PREFETCH       0 /* prefetch */
 593 #define DMU_READ_NO_PREFETCH    1 /* don't prefetch */
 594 int dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
 595         void *buf, uint32_t flags);
 596 void dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
 597         const void *buf, dmu_tx_t *tx);
 598 void dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
 599         dmu_tx_t *tx);
 600 int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size);
 601 int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size,
 602     dmu_tx_t *tx);
 603 int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size,
 604     dmu_tx_t *tx);