changeset 12916:aab2c5dd2abc

6947180 ndmp snapshots not getting deleted after concurrent backups 6906014 NDMP: removing snapshot during backup causes problem
author Reza Sabdar <Reza.Sabdar@Sun.COM>
date Sat, 24 Jul 2010 18:42:21 -0400
parents 2794a0c9cce1
children 75c3920f2546
files usr/src/cmd/ndmpd/ndmp/ndmpd.h usr/src/cmd/ndmpd/ndmp/ndmpd_chkpnt.c usr/src/cmd/ndmpd/ndmp/ndmpd_tar.c usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c usr/src/cmd/ndmpd/tlm/tlm_lib.c usr/src/cmd/ndmpd/tlm/tlm_proto.h
diffstat 7 files changed, 217 insertions(+), 289 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd.h	Fri Jul 23 18:03:48 2010 -0700
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd.h	Sat Jul 24 18:42:21 2010 -0400
@@ -995,15 +995,9 @@
 extern boolean_t set_debug_level(boolean_t);
 extern boolean_t get_debug_level(void);
 
-typedef struct ndmp_chkpnt_vol {
-	char cv_vol_name[64];
-	unsigned int cv_count;
-	void *cv_next;
-} ndmp_chkpnt_vol_t;
-
 extern int get_zfsvolname(char *, int, char *);
-extern int ndmp_start_check_point(char *, char *);
-extern int ndmp_release_check_point(char *, char *);
+extern int ndmp_create_snapshot(char *, char *);
+extern int ndmp_remove_snapshot(char *, char *);
 extern int ndmpd_mark_inodes_v2(ndmpd_session_t *, ndmp_lbr_params_t *);
 extern void ndmpd_abort_marking_v2(ndmpd_session_t *);
 extern int ndmpd_mark_inodes_v3(ndmpd_session_t *, ndmp_lbr_params_t *);
@@ -1040,8 +1034,8 @@
 extern char *gethostaddr(void);
 extern int tlm_init(void);
 
-extern int chkpnt_backup_successful(char *, char *, boolean_t, int *);
-extern int chkpnt_backup_prepare(char *, char *, boolean_t);
+extern int snapshot_create(char *, char *, boolean_t, boolean_t);
+extern int snapshot_destroy(char *, char *, boolean_t, boolean_t, int *);
 
 extern boolean_t fs_is_chkpntvol(char *);
 extern boolean_t fs_is_chkpnt_enabled(char *);
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_chkpnt.c	Fri Jul 23 18:03:48 2010 -0700
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_chkpnt.c	Sat Jul 24 18:42:21 2010 -0400
@@ -41,12 +41,12 @@
 #include "ndmpd.h"
 #include <libzfs.h>
 
-ndmp_chkpnt_vol_t *chkpnt_vols = NULL;
+typedef struct snap_param {
+	char *snp_name;
+	boolean_t snp_found;
+} snap_param_t;
 
-typedef struct chkpnt_param {
-	char *chp_name;
-	boolean_t chp_found;
-} chkpnt_param_t;
+static int cleanup_fd = -1;
 
 /*
  * ndmp_has_backup
@@ -67,23 +67,23 @@
 ndmp_has_backup(zfs_handle_t *zhp, void *data)
 {
 	const char *name;
-	chkpnt_param_t *chp = (chkpnt_param_t *)data;
+	snap_param_t *chp = (snap_param_t *)data;
 
 	name = zfs_get_name(zhp);
 	if (name == NULL ||
-	    strstr(name, chp->chp_name) == NULL) {
+	    strstr(name, chp->snp_name) == NULL) {
 		zfs_close(zhp);
 		return (-1);
 	}
 
-	chp->chp_found = 1;
+	chp->snp_found = 1;
 	zfs_close(zhp);
 
 	return (0);
 }
 
 /*
- * ndmp_has_backup_chkpnt
+ * ndmp_has_backup_snapshot
  *
  * Returns TRUE if the volume has an active backup snapshot, otherwise,
  * returns FALSE.
@@ -96,136 +96,35 @@
  *  -1: otherwise
  */
 static int
-ndmp_has_backup_chkpnt(char *volname, char *jobname)
+ndmp_has_backup_snapshot(char *volname, char *jobname)
 {
 	zfs_handle_t *zhp;
-	chkpnt_param_t chkp;
+	snap_param_t snp;
 	char chname[ZFS_MAXNAMELEN];
 
 	(void) mutex_lock(&zlib_mtx);
 	if ((zhp = zfs_open(zlibh, volname, ZFS_TYPE_DATASET)) == 0) {
-		NDMP_LOG(LOG_ERR, "Cannot open checkpoint %s.", volname);
+		NDMP_LOG(LOG_ERR, "Cannot open snapshot %s.", volname);
 		(void) mutex_unlock(&zlib_mtx);
 		return (-1);
 	}
 
-	chkp.chp_found = 0;
+	snp.snp_found = 0;
 	(void) snprintf(chname, ZFS_MAXNAMELEN, "@%s", jobname);
-	chkp.chp_name = chname;
+	snp.snp_name = chname;
 
-	(void) zfs_iter_snapshots(zhp, ndmp_has_backup, &chkp);
+	(void) zfs_iter_snapshots(zhp, ndmp_has_backup, &snp);
 	zfs_close(zhp);
 	(void) mutex_unlock(&zlib_mtx);
 
-	return (chkp.chp_found);
+	return (snp.snp_found);
 }
 
-
-/*
- * ndmp_add_chk_pnt_vol
- *
- * This function keep track of check points created by NDMP. Whenever the
- * NDMP check points need to be created, this function should be called.
- * If the value returned is bigger than 1, it indicates that the check point
- * has already exists and should not be created.
- *
- * Parameters:
- *   vol_name (input) - name of the volume
- *
- * Returns:
- *   The number of existing snapshots
- */
-static unsigned int
-ndmp_add_chk_pnt_vol(char *vol_name)
-{
-	ndmp_chkpnt_vol_t *new_chkpnt_vol;
-
-	for (new_chkpnt_vol = chkpnt_vols; new_chkpnt_vol != NULL;
-	    new_chkpnt_vol = new_chkpnt_vol->cv_next) {
-		if (strcmp(new_chkpnt_vol->cv_vol_name, vol_name) == 0) {
-			new_chkpnt_vol->cv_count++;
-			return (new_chkpnt_vol->cv_count);
-		}
-	}
-
-	new_chkpnt_vol = ndmp_malloc(sizeof (ndmp_chkpnt_vol_t));
-	if (new_chkpnt_vol == NULL)
-		return (0);
-
-	(void) memset(new_chkpnt_vol, 0, sizeof (ndmp_chkpnt_vol_t));
-	(void) strlcpy(new_chkpnt_vol->cv_vol_name, vol_name,
-	    sizeof (new_chkpnt_vol->cv_vol_name));
-
-	new_chkpnt_vol->cv_count++;
-
-	if (chkpnt_vols == NULL) {
-		chkpnt_vols = new_chkpnt_vol;
-	} else {
-		new_chkpnt_vol->cv_next = chkpnt_vols;
-		chkpnt_vols = new_chkpnt_vol;
-	}
-
-	return (new_chkpnt_vol->cv_count);
-}
-
-
 /*
- * ndmp_remove_chk_pnt_vol
- *
- * This function will decrement the usage counter belongs to the check point.
- * Whenever a check point needs to be removed, this function should be
- * called. When the return value is greater than zero, it indicates someone
- * else is still using the check point and the check point should not be
- * removed.
- *
- * Parameters:
- *   vol_name (input) - name of the volume
+ * ndmp_create_snapshot
  *
- * Returns:
- *   The number of existing snapshots
- */
-static unsigned int
-ndmp_remove_chk_pnt_vol(char *vol_name)
-{
-	ndmp_chkpnt_vol_t *new_chkpnt_vol, *pre_chkpnt_vol;
-
-	pre_chkpnt_vol = chkpnt_vols;
-	for (new_chkpnt_vol = chkpnt_vols; new_chkpnt_vol != NULL;
-	    new_chkpnt_vol = new_chkpnt_vol->cv_next) {
-		if (strcmp(new_chkpnt_vol->cv_vol_name, vol_name) == 0) {
-			new_chkpnt_vol->cv_count--;
-
-			if (new_chkpnt_vol->cv_count == 0) {
-				if (pre_chkpnt_vol == new_chkpnt_vol &&
-				    new_chkpnt_vol->cv_next == NULL)
-					chkpnt_vols = NULL;
-				else if (pre_chkpnt_vol == new_chkpnt_vol)
-					chkpnt_vols = new_chkpnt_vol->cv_next;
-				else
-					pre_chkpnt_vol->cv_next =
-					    new_chkpnt_vol->cv_next;
-
-				free(new_chkpnt_vol);
-				return (0);
-			}
-			return (new_chkpnt_vol->cv_count);
-		}
-		if (new_chkpnt_vol != chkpnt_vols)
-			pre_chkpnt_vol = pre_chkpnt_vol->cv_next;
-	}
-
-	return (0);
-}
-
-
-
-
-/*
- * ndmp_start_check_point
- *
- * This function will parse the path, vol_name, to get the real volume name.
- * It will then check via ndmp_add_chk_pnt_vol to see if creating a check point
- * for the volume is necessary. If it is, a checkpoint is created.
+ * This function will parse the path to get the real volume name.
+ * It will then create a snapshot based on volume and job name.
  * This function should be called before the NDMP backup is started.
  *
  * Parameters:
@@ -236,40 +135,30 @@
  *   -1: otherwise
  */
 int
-ndmp_start_check_point(char *vol_name, char *jname)
+ndmp_create_snapshot(char *vol_name, char *jname)
 {
-	int erc = 0;
 	char vol[ZFS_MAXNAMELEN];
 
 	if (vol_name == 0 ||
 	    get_zfsvolname(vol, sizeof (vol), vol_name) == -1)
 		return (0);
 
-	if (ndmp_add_chk_pnt_vol(vol) > 0) {
-		/*
-		 * If there is an old checkpoint left from the previous
-		 * backup and the reference count of backup checkpoint of
-		 * the volume is 1 after increasing it, it shows that the
-		 * checkpoint on file system is a stale one and it must be
-		 * removed before using it.
-		 */
-		if (ndmp_has_backup_chkpnt(vol, jname))
-			(void) chkpnt_backup_successful(vol, jname, B_FALSE,
-			    NULL);
-		if ((erc = chkpnt_backup_prepare(vol, jname, B_FALSE))
-		    < 0)
-			(void) ndmp_remove_chk_pnt_vol(vol);
-	}
+	/*
+	 * If there is an old snapshot left from the previous
+	 * backup it could be stale one and it must be
+	 * removed before using it.
+	 */
+	if (ndmp_has_backup_snapshot(vol, jname))
+		(void) snapshot_destroy(vol, jname, B_FALSE, B_TRUE, NULL);
 
-	return (erc);
+	return (snapshot_create(vol, jname, B_FALSE, B_TRUE));
 }
 
 /*
- * ndmp_release_check_point
+ * ndmp_remove_snapshot
  *
- * This function will parse the path, vol_name, to get the real volume name.
- * It will then check via ndmp_remove_chk_pnt_vol to see if removing a check
- * point for the volume is necessary. If it is, a checkpoint is removed.
+ * This function will parse the path to get the real volume name.
+ * It will then remove the snapshot for that volume and job name.
  * This function should be called after NDMP backup is finished.
  *
  * Parameters:
@@ -280,17 +169,178 @@
  *   -1: otherwise
  */
 int
-ndmp_release_check_point(char *vol_name, char *jname)
+ndmp_remove_snapshot(char *vol_name, char *jname)
 {
-	int erc = 0;
 	char vol[ZFS_MAXNAMELEN];
 
 	if (vol_name == 0 ||
-	    get_zfsvolname(vol, sizeof (vol), vol_name))
+	    get_zfsvolname(vol, sizeof (vol), vol_name) == -1)
 		return (0);
 
-	if (ndmp_remove_chk_pnt_vol(vol) == 0)
-		erc = chkpnt_backup_successful(vol, jname, B_FALSE, NULL);
+	return (snapshot_destroy(vol, jname, B_FALSE, B_TRUE, NULL));
+}
+
+/*
+ * Put a hold on snapshot
+ */
+int
+snapshot_hold(char *volname, char *snapname, char *jname, boolean_t recursive)
+{
+	zfs_handle_t *zhp;
+	char *p;
+
+	if ((zhp = zfs_open(zlibh, volname, ZFS_TYPE_DATASET)) == 0) {
+		NDMP_LOG(LOG_ERR, "Cannot open volume %s.", volname);
+		return (-1);
+	}
+
+	if (cleanup_fd == -1 && (cleanup_fd = open(ZFS_DEV,
+	    O_RDWR|O_EXCL)) < 0) {
+		NDMP_LOG(LOG_ERR, "Cannot open dev %d", errno);
+		zfs_close(zhp);
+		return (-1);
+	}
+
+	p = strchr(snapname, '@') + 1;
+	if (zfs_hold(zhp, p, jname, recursive, B_TRUE, B_FALSE,
+	    cleanup_fd, 0, 0) != 0) {
+		NDMP_LOG(LOG_ERR, "Cannot hold snapshot %s", p);
+		zfs_close(zhp);
+		return (-1);
+	}
+	zfs_close(zhp);
+	return (0);
+}
+
+int
+snapshot_release(char *volname, char *snapname, char *jname,
+    boolean_t recursive)
+{
+	zfs_handle_t *zhp;
+	char *p;
+	int rv = 0;
+
+	if ((zhp = zfs_open(zlibh, volname, ZFS_TYPE_DATASET)) == 0) {
+		NDMP_LOG(LOG_ERR, "Cannot open volume %s", volname);
+		return (-1);
+	}
+
+	p = strchr(snapname, '@') + 1;
+	if (zfs_release(zhp, p, jname, recursive) != 0) {
+		NDMP_LOG(LOG_DEBUG, "Cannot release snapshot %s", p);
+		rv = -1;
+	}
+	if (cleanup_fd != -1) {
+		(void) close(cleanup_fd);
+		cleanup_fd = -1;
+	}
+	zfs_close(zhp);
+	return (rv);
+}
+
+/*
+ * Create a snapshot on the volume
+ */
+int
+snapshot_create(char *volname, char *jname, boolean_t recursive,
+    boolean_t hold)
+{
+	char snapname[ZFS_MAXNAMELEN];
+	int rv;
+
+	if (!volname || !*volname)
+		return (-1);
+
+	(void) snprintf(snapname, ZFS_MAXNAMELEN, "%s@%s", volname, jname);
 
-	return (erc);
+	(void) mutex_lock(&zlib_mtx);
+	if ((rv = zfs_snapshot(zlibh, snapname, recursive, NULL))
+	    == -1) {
+		if (errno == EEXIST) {
+			(void) mutex_unlock(&zlib_mtx);
+			return (0);
+		}
+		NDMP_LOG(LOG_DEBUG,
+		    "snapshot_create: %s failed (err=%d): %s",
+		    snapname, errno, libzfs_error_description(zlibh));
+		(void) mutex_unlock(&zlib_mtx);
+		return (rv);
+	}
+	if (hold && snapshot_hold(volname, snapname, jname, recursive) != 0) {
+		NDMP_LOG(LOG_DEBUG,
+		    "snapshot_create: %s hold failed (err=%d): %s",
+		    snapname, errno, libzfs_error_description(zlibh));
+		(void) mutex_unlock(&zlib_mtx);
+		return (-1);
+	}
+
+	(void) mutex_unlock(&zlib_mtx);
+	return (0);
 }
+
+/*
+ * Remove and release the backup snapshot
+ */
+int
+snapshot_destroy(char *volname, char *jname, boolean_t recursive,
+    boolean_t hold, int *zfs_err)
+{
+	char snapname[ZFS_MAXNAMELEN];
+	zfs_handle_t *zhp;
+	zfs_type_t ztype;
+	int err;
+
+	if (zfs_err)
+		*zfs_err = 0;
+
+	if (!volname || !*volname)
+		return (-1);
+
+	if (recursive) {
+		ztype = ZFS_TYPE_VOLUME | ZFS_TYPE_FILESYSTEM;
+	} else {
+		(void) snprintf(snapname, ZFS_MAXNAMELEN, "%s@%s", volname,
+		    jname);
+		ztype = ZFS_TYPE_SNAPSHOT;
+	}
+
+	(void) mutex_lock(&zlib_mtx);
+	if (hold &&
+	    snapshot_release(volname, snapname, jname, recursive) != 0) {
+		NDMP_LOG(LOG_DEBUG,
+		    "snapshot_destroy: %s release failed (err=%d): %s",
+		    snapname, errno, libzfs_error_description(zlibh));
+		(void) mutex_unlock(&zlib_mtx);
+		return (-1);
+	}
+
+	if ((zhp = zfs_open(zlibh, snapname, ztype)) == NULL) {
+		NDMP_LOG(LOG_DEBUG, "snapshot_destroy: open %s failed",
+		    snapname);
+		(void) mutex_unlock(&zlib_mtx);
+		return (-1);
+	}
+
+	if (recursive) {
+		err = zfs_destroy_snaps(zhp, jname, B_TRUE);
+	} else {
+		err = zfs_destroy(zhp, B_TRUE);
+	}
+
+	if (err) {
+		NDMP_LOG(LOG_ERR, "%s (recursive destroy: %d): %d; %s; %s",
+		    snapname,
+		    recursive,
+		    libzfs_errno(zlibh),
+		    libzfs_error_action(zlibh),
+		    libzfs_error_description(zlibh));
+
+		if (zfs_err)
+			*zfs_err = err;
+	}
+
+	zfs_close(zhp);
+	(void) mutex_unlock(&zlib_mtx);
+
+	return (0);
+}
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_tar.c	Fri Jul 23 18:03:48 2010 -0700
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_tar.c	Sat Jul 24 18:42:21 2010 -0400
@@ -1601,11 +1601,6 @@
 	} else if (!S_ISDIR(st.st_mode)) {
 		MOD_LOG(params, "Error: %s is not a directory.\n", bkpath);
 		rv = NDMP_ILLEGAL_ARGS_ERR;
-	} else if (ndmp_is_chkpnt_root(bkpath)) {
-		/* It's a .chkpnt directory */
-		MOD_LOG(params, "Error: %s is a checkpoint root directory.\n",
-		    bkpath);
-		rv = NDMP_BAD_FILE_ERR;
 	} else if (fs_is_rdonly(bkpath) && !fs_is_chkpntvol(bkpath) &&
 	    fs_is_chkpnt_enabled(bkpath)) {
 		MOD_LOG(params, "Error: %s is not a checkpointed path.\n",
@@ -1882,7 +1877,7 @@
 		NLP_SET(nlp, NLPF_CHKPNTED_PATH);
 	else {
 		NLP_UNSET(nlp, NLPF_CHKPNTED_PATH);
-		if (ndmp_start_check_point(nlp->nlp_backup_path,
+		if (ndmp_create_snapshot(nlp->nlp_backup_path,
 		    nlp->nlp_jstat->js_job_name) < 0) {
 			MOD_LOG(mod_params,
 			    "Error: creating checkpoint on %s\n",
@@ -1914,7 +1909,7 @@
 	}
 
 	if (!NLP_ISCHKPNTED(nlp))
-		(void) ndmp_release_check_point(nlp->nlp_backup_path,
+		(void) ndmp_remove_snapshot(nlp->nlp_backup_path,
 		    nlp->nlp_jstat->js_job_name);
 
 	NDMP_LOG(LOG_DEBUG, "err %d, update %c",
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c	Fri Jul 23 18:03:48 2010 -0700
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_tar3.c	Sat Jul 24 18:42:21 2010 -0400
@@ -668,12 +668,6 @@
 		    "\"%s\" is not a directory.\n", bkpath);
 		return (FALSE);
 	}
-	if (ndmp_is_chkpnt_root(bkpath)) {
-		/* it is the chkpnt root directory */
-		MOD_LOGV3(params, NDMP_LOG_ERROR,
-		    "\"%s\" is a checkpoint root directory.\n", bkpath);
-		return (FALSE);
-	}
 	if (fs_is_rdonly(bkpath) && !fs_is_chkpntvol(bkpath) &&
 	    fs_is_chkpnt_enabled(bkpath)) {
 		/* it is not a chkpnted path */
@@ -2312,7 +2306,7 @@
 	}
 	ft.ft_arg = &bp;
 	ft.ft_logfp = (ft_log_t)ndmp_log;
-	ft.ft_flags = FST_VERBOSE;	/* Solaris */
+	ft.ft_flags = FST_VERBOSE | FST_STOP_ONERR;
 
 	/* take into account the header written to the stream so far */
 	n = tlm_get_data_offset(lcmd);
@@ -2328,6 +2322,11 @@
 			n = tlm_get_data_offset(lcmd) - bpos;
 			nlp->nlp_session->
 			    ns_data.dd_module.dm_stats.ms_bytes_processed += n;
+		} else {
+			MOD_LOGV3(nlp->nlp_params, NDMP_LOG_ERROR,
+			    "Filesystem traverse error.\n");
+			ndmpd_data_error(nlp->nlp_session,
+			    NDMP_DATA_HALT_INTERNAL_ERROR);
 		}
 	}
 
@@ -3755,7 +3754,7 @@
 
 	err = 0;
 	if (!NLP_ISCHKPNTED(nlp) &&
-	    ndmp_start_check_point(nlp->nlp_backup_path, jname) < 0) {
+	    ndmp_create_snapshot(nlp->nlp_backup_path, jname) < 0) {
 		MOD_LOGV3(params, NDMP_LOG_ERROR,
 		    "Creating checkpoint on \"%s\".\n",
 		    nlp->nlp_backup_path);
@@ -3785,7 +3784,7 @@
 	}
 
 	if (!NLP_ISCHKPNTED(nlp))
-		(void) ndmp_release_check_point(nlp->nlp_backup_path, jname);
+		(void) ndmp_remove_snapshot(nlp->nlp_backup_path, jname);
 
 	NDMP_LOG(LOG_DEBUG, "err %d, update %c",
 	    err, NDMP_YORN(NLP_SHOULD_UPDATE(nlp)));
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c	Fri Jul 23 18:03:48 2010 -0700
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c	Sat Jul 24 18:42:21 2010 -0400
@@ -129,9 +129,6 @@
 
 static int ndmpd_zfs_backup(ndmpd_zfs_args_t *);
 
-#define	snapshot_create chkpnt_backup_prepare
-#define	snapshot_destroy chkpnt_backup_successful
-
 /*
  * Syntax for com.sun.ndmp:incr property value:
  *	#.#.n|u/$LEVEL.$DMP_NAME.$ZFS_MODE(/ ...)
@@ -1739,7 +1736,8 @@
 				recursive = B_TRUE;
 
 			(void) snapshot_destroy(ndmpd_zfs_args->nz_dataset,
-			    ndmpd_zfs_args->nz_snapname, recursive, &zfs_err);
+			    ndmpd_zfs_args->nz_snapname, recursive, B_FALSE,
+			    &zfs_err);
 		}
 
 		return (-1);
@@ -1847,7 +1845,7 @@
 		recursive = B_TRUE;
 
 	if (snapshot_create(ndmpd_zfs_args->nz_dataset,
-	    ndmpd_zfs_args->nz_snapname, recursive) != 0) {
+	    ndmpd_zfs_args->nz_snapname, recursive, B_FALSE) != 0) {
 		NDMP_LOG(LOG_ERR, "could not create snapshot %s@%s",
 		    ndmpd_zfs_args->nz_dataset, ndmpd_zfs_args->nz_snapname);
 		return (-1);
@@ -1886,7 +1884,7 @@
 			recursive = B_TRUE;
 
 		err = snapshot_destroy(ndmpd_zfs_args->nz_dataset,
-		    snapdata_p->nzs_snapname, recursive, &zfs_err);
+		    snapdata_p->nzs_snapname, recursive, B_FALSE, &zfs_err);
 
 		if (err) {
 			NDMP_LOG(LOG_ERR, "snapshot_destroy: %s@%s;"
--- a/usr/src/cmd/ndmpd/tlm/tlm_lib.c	Fri Jul 23 18:03:48 2010 -0700
+++ b/usr/src/cmd/ndmpd/tlm/tlm_lib.c	Sat Jul 24 18:42:21 2010 -0400
@@ -1170,111 +1170,6 @@
  */
 
 /*
- * Create a snapshot on the volume
- */
-int
-chkpnt_backup_prepare(char *volname, char *jname, boolean_t recursive)
-{
-	char chk_name[PATH_MAX];
-	char *p;
-	int rv;
-
-	if (!volname || !*volname)
-		return (-1);
-
-	/* Should also return -1 if checkpoint not enabled */
-
-	/* Remove the leading slash */
-	p = volname;
-	while (*p == '/')
-		p++;
-
-	(void) snprintf(chk_name, PATH_MAX, "%s@%s", p, jname);
-
-	(void) mutex_lock(&zlib_mtx);
-	if ((rv = zfs_snapshot(zlibh, chk_name, recursive, NULL))
-	    == -1) {
-		if (errno == EEXIST) {
-			(void) mutex_unlock(&zlib_mtx);
-			return (0);
-		}
-		NDMP_LOG(LOG_DEBUG,
-		    "chkpnt_backup_prepare: %s failed (err=%d): %s",
-		    chk_name, errno, libzfs_error_description(zlibh));
-		(void) mutex_unlock(&zlib_mtx);
-		return (rv);
-	}
-	(void) mutex_unlock(&zlib_mtx);
-	return (0);
-}
-
-/*
- * Remove the 'backup' snapshot if backup was successful
- */
-int
-chkpnt_backup_successful(char *volname, char *jname, boolean_t recursive,
-    int *zfs_err)
-{
-	char chk_name[PATH_MAX];
-	zfs_handle_t *zhp;
-	zfs_type_t ztype;
-	int err;
-	char *p;
-
-	if (zfs_err)
-		*zfs_err = 0;
-
-	if (!volname || !*volname)
-		return (-1);
-
-	/* Should also return -1 if checkpoint not enabled */
-
-	/* Remove the leading slash */
-	p = volname;
-	while (*p == '/')
-		p++;
-
-	if (recursive) {
-		ztype = ZFS_TYPE_VOLUME | ZFS_TYPE_FILESYSTEM;
-	} else {
-		(void) snprintf(chk_name, PATH_MAX, "%s@%s", p, jname);
-		p = chk_name;
-		ztype = ZFS_TYPE_SNAPSHOT;
-	}
-
-	(void) mutex_lock(&zlib_mtx);
-	if ((zhp = zfs_open(zlibh, p, ztype)) == NULL) {
-		NDMP_LOG(LOG_DEBUG, "chkpnt_backup_successful: open %s failed",
-		    p);
-		(void) mutex_unlock(&zlib_mtx);
-		return (-1);
-	}
-
-	if (recursive) {
-		err = zfs_destroy_snaps(zhp, jname, B_TRUE);
-	} else {
-		err = zfs_destroy(zhp, B_TRUE);
-	}
-
-	if (err) {
-		NDMP_LOG(LOG_ERR, "%s (recursive destroy: %d): %d; %s; %s",
-		    p,
-		    recursive,
-		    libzfs_errno(zlibh),
-		    libzfs_error_action(zlibh),
-		    libzfs_error_description(zlibh));
-
-		if (zfs_err)
-			*zfs_err = err;
-	}
-
-	zfs_close(zhp);
-	(void) mutex_unlock(&zlib_mtx);
-
-	return (0);
-}
-
-/*
  * Get the snapshot creation time
  */
 int
--- a/usr/src/cmd/ndmpd/tlm/tlm_proto.h	Fri Jul 23 18:03:48 2010 -0700
+++ b/usr/src/cmd/ndmpd/tlm/tlm_proto.h	Sat Jul 24 18:42:21 2010 -0400
@@ -1,6 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -106,8 +105,6 @@
 
 extern boolean_t fs_is_rdonly(char *);
 extern boolean_t fs_is_chkpntvol();
-extern int chkpnt_backup_successful();
-extern int chkpnt_backup_prepare();
 extern int get_zfsvolname(char *, int, char *);
 extern int chkpnt_creationtime_bypattern();