diff options
| author | Reza Sabdar <Reza.Sabdar@Sun.COM> | 2010-07-02 14:10:15 -0400 |
|---|---|---|
| committer | Reza Sabdar <Reza.Sabdar@Sun.COM> | 2010-07-02 14:10:15 -0400 |
| commit | f3012b5938cc7fcdee754ac9bb2817f86ebd9e92 (patch) | |
| tree | 48e159a13246b1ab89fe669127fa3c5807520e7a /usr/src/cmd/ndmpd | |
| parent | 16e76cdd6e3cfaac7d91c3b0644ee1bc6cf52347 (diff) | |
| download | illumos-joyent-f3012b5938cc7fcdee754ac9bb2817f86ebd9e92.tar.gz | |
6959944 NDMP: Level0 to Level5 backup does not work as expected
6964165 "zfs" backup of zvol's on NBU fails with catalog error 42
Diffstat (limited to 'usr/src/cmd/ndmpd')
| -rw-r--r-- | usr/src/cmd/ndmpd/ndmp/ndmpd_dtime.c | 26 | ||||
| -rw-r--r-- | usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c | 17 |
2 files changed, 24 insertions, 19 deletions
diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_dtime.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_dtime.c index 2e3b6df9b2..125d9f27c0 100644 --- a/usr/src/cmd/ndmpd/ndmp/ndmpd_dtime.c +++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_dtime.c @@ -1,6 +1,5 @@ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. */ /* @@ -820,6 +819,9 @@ find_date(dumpdates_t *ddp, char *path, int level, time_t t) /* * Get the dumpdate of the last level backup done on the path. + * The last level normally is (level - 1) in case of NetBackup + * but some DMAs allow that previous level could be anything + * between 0 and the current level. * * Returns: * 0 on success @@ -833,8 +835,8 @@ ndmpd_get_dumptime(char *path, int *level, time_t *ddate) char vol[ZFS_MAXNAMELEN]; nvlist_t *userprops; zfs_handle_t *zhp; - nvlist_t *propval; - char *strval; + nvlist_t *propval = NULL; + char *strval = NULL; if (!path || !level || !ddate) return (-1); @@ -852,16 +854,22 @@ ndmpd_get_dumptime(char *path, int *level, time_t *ddate) if ((zlibh != NULL) && (get_zfsvolname(vol, sizeof (vol), path) == 0) && ((zhp = zfs_open(zlibh, vol, ZFS_TYPE_DATASET)) != NULL)) { - if ((userprops = zfs_get_user_props(zhp)) == NULL || - (nvlist_lookup_nvlist(userprops, - zfs_dumpdate_props[*level - 1], &propval) != 0)) { + if ((userprops = zfs_get_user_props(zhp)) == NULL) { *level = 0; *ddate = (time_t)0; zfs_close(zhp); (void) mutex_unlock(&zlib_mtx); return (0); } - if (nvlist_lookup_string(propval, ZPROP_VALUE, + for (i = *level - 1; i >= 0; i--) { + if (nvlist_lookup_nvlist(userprops, + zfs_dumpdate_props[i], &propval) == 0) { + *level = i; + break; + } + } + if (propval == NULL || + nvlist_lookup_string(propval, ZPROP_VALUE, &strval) != 0) { *level = 0; *ddate = (time_t)0; @@ -869,7 +877,7 @@ ndmpd_get_dumptime(char *path, int *level, time_t *ddate) (void) mutex_unlock(&zlib_mtx); return (0); } - if (propval == NULL || unctime(strval, ddate) < 0) { + if (unctime(strval, ddate) < 0) { zfs_close(zhp); (void) mutex_unlock(&zlib_mtx); return (-1); diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c index 36f21dc111..7f231ece16 100644 --- a/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c +++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c @@ -504,8 +504,6 @@ ndmpd_zfs_send_fhist(ndmpd_zfs_args_t *ndmpd_zfs_args) (ndmpd_zfs_params->mp_daemon_cookie); struct stat64 st; char *envp; - zfs_handle_t *zhp; - char mountpoint[PATH_MAX]; envp = MOD_GETENV(ndmpd_zfs_params, "HIST"); if (!envp) @@ -518,14 +516,13 @@ ndmpd_zfs_send_fhist(ndmpd_zfs_args_t *ndmpd_zfs_args) return (0); } - if ((zhp = zfs_open(ndmpd_zfs_args->nz_zlibh, - ndmpd_zfs_args->nz_dataset, ndmpd_zfs_args->nz_type)) == NULL || - zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, mountpoint, PATH_MAX, NULL, - NULL, 0, B_FALSE) != 0 || - stat64(mountpoint, &st) != 0) - (void) memset(&st, 0, sizeof (struct stat64)); - if (zhp) - zfs_close(zhp); + /* Build up a sample root dir stat */ + (void) memset(&st, 0, sizeof (struct stat64)); + st.st_mode = S_IFDIR | 0777; + st.st_mtime = st.st_atime = st.st_ctime = time(NULL); + st.st_uid = st.st_gid = 0; + st.st_size = 1; + st.st_nlink = 1; if (ndmpd_api_file_history_dir_v3(session, ".", ROOT_INODE, ROOT_INODE) != 0) |
