2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

References:
  https://www.illumos.org/issues/2882
  https://www.illumos.org/issues/2883
  https://www.illumos.org/issues/2900
  illumos/illumos-gate@4445fffbbb

Ported-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1293

Porting notes:

WARNING: This patch changes the user/kernel ABI.  That means that
the zfs/zpool utilities built from master are NOT compatible with
the 0.6.2 kernel modules.  Ensure you load the matching kernel
modules from master after updating the utilities.  Otherwise the
zfs/zpool commands will be unable to interact with your pool and
you will see errors similar to the following:

  $ zpool list
  failed to read pool configuration: bad address
  no pools available

  $ zfs list
  no datasets available

Add zvol minor device creation to the new zfs_snapshot_nvl function.

Remove the logging of the "release" operation in
dsl_dataset_user_release_sync().  The logging caused a null dereference
because ds->ds_dir is zeroed in dsl_dataset_destroy_sync() and the
logging functions try to get the ds name via the dsl_dataset_name()
function. I've got no idea why this particular code would have worked
in Illumos.  This code has subsequently been completely reworked in
Illumos commit 3b2aab1 (3464 zfs synctask code needs restructuring).

Squash some "may be used uninitialized" warning/erorrs.

Fix some printf format warnings for %lld and %llu.

Apply a few spa_writeable() changes that were made to Illumos in
illumos/illumos-gate.git@cd1c8b8 as part of the 3112, 3113, 3114 and
3115 fixes.

Add a missing call to fnvlist_free(nvl) in log_internal() that was added
in Illumos to fix issue 3085 but couldn't be ported to ZoL at the time
(zfsonlinux/zfs@9e11c73) because it depended on future work.
This commit is contained in:
Matthew Ahrens
2013-08-28 06:45:09 -05:00
committed by Brian Behlendorf
parent 0c28fb4808
commit 6f1ffb0665
56 changed files with 2887 additions and 1528 deletions
+25 -55
View File
@@ -52,6 +52,16 @@ typedef enum {
ZFS_TYPE_POOL = 0x8
} zfs_type_t;
typedef enum dmu_objset_type {
DMU_OST_NONE,
DMU_OST_META,
DMU_OST_ZFS,
DMU_OST_ZVOL,
DMU_OST_OTHER, /* For testing only! */
DMU_OST_ANY, /* Be careful! */
DMU_OST_NUMTYPES
} dmu_objset_type_t;
#define ZFS_TYPE_DATASET \
(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
@@ -753,10 +763,10 @@ typedef struct ddt_histogram {
/*
* /dev/zfs ioctl numbers.
*/
#define ZFS_IOC ('Z' << 8)
typedef enum zfs_ioc {
ZFS_IOC_POOL_CREATE = ZFS_IOC,
ZFS_IOC_FIRST = ('Z' << 8),
ZFS_IOC = ZFS_IOC_FIRST,
ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
ZFS_IOC_POOL_DESTROY,
ZFS_IOC_POOL_IMPORT,
ZFS_IOC_POOL_EXPORT,
@@ -793,7 +803,7 @@ typedef enum zfs_ioc {
ZFS_IOC_ERROR_LOG,
ZFS_IOC_CLEAR,
ZFS_IOC_PROMOTE,
ZFS_IOC_DESTROY_SNAPS_NVL,
ZFS_IOC_DESTROY_SNAPS,
ZFS_IOC_SNAPSHOT,
ZFS_IOC_DSOBJ_TO_DSNAME,
ZFS_IOC_OBJ_TO_PATH,
@@ -823,6 +833,11 @@ typedef enum zfs_ioc {
ZFS_IOC_SPACE_SNAPS,
ZFS_IOC_POOL_REOPEN,
ZFS_IOC_SEND_PROGRESS,
ZFS_IOC_LOG_HISTORY,
ZFS_IOC_SEND_NEW,
ZFS_IOC_SEND_SPACE,
ZFS_IOC_CLONE,
ZFS_IOC_LAST
} zfs_ioc_t;
/*
@@ -864,6 +879,12 @@ typedef enum {
#define ZPOOL_HIST_TXG "history txg"
#define ZPOOL_HIST_INT_EVENT "history internal event"
#define ZPOOL_HIST_INT_STR "history internal str"
#define ZPOOL_HIST_INT_NAME "internal_name"
#define ZPOOL_HIST_IOCTL "ioctl"
#define ZPOOL_HIST_INPUT_NVL "in_nvl"
#define ZPOOL_HIST_OUTPUT_NVL "out_nvl"
#define ZPOOL_HIST_DSNAME "dsname"
#define ZPOOL_HIST_DSID "dsid"
/*
* Flags for ZFS_IOC_VDEV_SET_STATE
@@ -909,57 +930,6 @@ typedef enum {
#define ZFS_EV_VDEV_PATH "vdev_path"
#define ZFS_EV_VDEV_GUID "vdev_guid"
/*
* Note: This is encoded on-disk, so new events must be added to the
* end, and unused events can not be removed. Be sure to edit
* libzfs_pool.c: hist_event_table[].
*/
typedef enum history_internal_events {
LOG_NO_EVENT = 0,
LOG_POOL_CREATE,
LOG_POOL_VDEV_ADD,
LOG_POOL_REMOVE,
LOG_POOL_DESTROY,
LOG_POOL_EXPORT,
LOG_POOL_IMPORT,
LOG_POOL_VDEV_ATTACH,
LOG_POOL_VDEV_REPLACE,
LOG_POOL_VDEV_DETACH,
LOG_POOL_VDEV_ONLINE,
LOG_POOL_VDEV_OFFLINE,
LOG_POOL_UPGRADE,
LOG_POOL_CLEAR,
LOG_POOL_SCAN,
LOG_POOL_PROPSET,
LOG_DS_CREATE,
LOG_DS_CLONE,
LOG_DS_DESTROY,
LOG_DS_DESTROY_BEGIN,
LOG_DS_INHERIT,
LOG_DS_PROPSET,
LOG_DS_QUOTA,
LOG_DS_PERM_UPDATE,
LOG_DS_PERM_REMOVE,
LOG_DS_PERM_WHO_REMOVE,
LOG_DS_PROMOTE,
LOG_DS_RECEIVE,
LOG_DS_RENAME,
LOG_DS_RESERVATION,
LOG_DS_REPLAY_INC_SYNC,
LOG_DS_REPLAY_FULL_SYNC,
LOG_DS_ROLLBACK,
LOG_DS_SNAPSHOT,
LOG_DS_UPGRADE,
LOG_DS_REFQUOTA,
LOG_DS_REFRESERV,
LOG_POOL_SCAN_DONE,
LOG_DS_USER_HOLD,
LOG_DS_USER_RELEASE,
LOG_POOL_SPLIT,
LOG_POOL_GUID_CHANGE,
LOG_END
} history_internal_events_t;
#ifdef __cplusplus
}
#endif