Print this page
zpool import is braindead

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libzfs/common/libzfs_dataset.c
          +++ new/usr/src/lib/libzfs/common/libzfs_dataset.c
↓ open down ↓ 19 lines elided ↑ open up ↑
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  25   25   * Copyright (c) 2013 by Delphix. All rights reserved.
  26   26   * Copyright (c) 2012 DEY Storage Systems, Inc.  All rights reserved.
  27   27   * Copyright (c) 2013 Martin Matuska. All rights reserved.
  28   28   * Copyright (c) 2013 Steven Hartland. All rights reserved.
  29   29   * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       30 + * Copyright 2014 RackTop Systems.
  30   31   */
  31   32  
  32   33  #include <ctype.h>
  33   34  #include <errno.h>
  34   35  #include <libintl.h>
  35   36  #include <math.h>
  36   37  #include <stdio.h>
  37   38  #include <stdlib.h>
  38   39  #include <strings.h>
  39   40  #include <unistd.h>
↓ open down ↓ 1438 lines elided ↑ open up ↑
1478 1479  zfs_prop_set(zfs_handle_t *zhp, const char *propname, const char *propval)
1479 1480  {
1480 1481          zfs_cmd_t zc = { 0 };
1481 1482          int ret = -1;
1482 1483          prop_changelist_t *cl = NULL;
1483 1484          char errbuf[1024];
1484 1485          libzfs_handle_t *hdl = zhp->zfs_hdl;
1485 1486          nvlist_t *nvl = NULL, *realprops;
1486 1487          zfs_prop_t prop;
1487 1488          boolean_t do_prefix = B_TRUE;
1488      -        int added_resv;
     1489 +        int added_resv = 0;
1489 1490  
1490 1491          (void) snprintf(errbuf, sizeof (errbuf),
1491 1492              dgettext(TEXT_DOMAIN, "cannot set property for '%s'"),
1492 1493              zhp->zfs_name);
1493 1494  
1494 1495          if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0 ||
1495 1496              nvlist_add_string(nvl, propname, propval) != 0) {
1496 1497                  (void) no_memory(hdl);
1497 1498                  goto error;
1498 1499          }
↓ open down ↓ 1499 lines elided ↑ open up ↑
2998 2999  }
2999 3000  
3000 3001  /*
3001 3002   * Creates non-existing ancestors of the given path.
3002 3003   */
3003 3004  int
3004 3005  zfs_create_ancestors(libzfs_handle_t *hdl, const char *path)
3005 3006  {
3006 3007          int prefix;
3007 3008          char *path_copy;
3008      -        int rc;
     3009 +        int rc = 0;
3009 3010  
3010 3011          if (check_parents(hdl, path, NULL, B_TRUE, &prefix) != 0)
3011 3012                  return (-1);
3012 3013  
3013 3014          if ((path_copy = strdup(path)) != NULL) {
3014 3015                  rc = create_parents(hdl, path_copy, prefix);
3015 3016                  free(path_copy);
3016 3017          }
3017 3018          if (path_copy == NULL || rc != 0)
3018 3019                  return (-1);
↓ open down ↓ 601 lines elided ↑ open up ↑
3620 3621   *
3621 3622   * Any snapshots and bookmarks more recent than the target are
3622 3623   * destroyed, along with their dependents (i.e. clones).
3623 3624   */
3624 3625  int
3625 3626  zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, boolean_t force)
3626 3627  {
3627 3628          rollback_data_t cb = { 0 };
3628 3629          int err;
3629 3630          boolean_t restore_resv = 0;
3630      -        uint64_t old_volsize, new_volsize;
     3631 +        uint64_t old_volsize = 0, new_volsize;
3631 3632          zfs_prop_t resv_prop;
3632 3633  
3633 3634          assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM ||
3634 3635              zhp->zfs_type == ZFS_TYPE_VOLUME);
3635 3636  
3636 3637          /*
3637 3638           * Destroy all recent snapshots and their dependents.
3638 3639           */
3639 3640          cb.cb_force = force;
3640 3641          cb.cb_target = snap->zfs_name;
↓ open down ↓ 51 lines elided ↑ open up ↑
3692 3693          return (err);
3693 3694  }
3694 3695  
3695 3696  /*
3696 3697   * Renames the given dataset.
3697 3698   */
3698 3699  int
3699 3700  zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive,
3700 3701      boolean_t force_unmount)
3701 3702  {
3702      -        int ret;
     3703 +        int ret = -1;
3703 3704          zfs_cmd_t zc = { 0 };
3704 3705          char *delim;
3705 3706          prop_changelist_t *cl = NULL;
3706 3707          zfs_handle_t *zhrp = NULL;
3707 3708          char *parentname = NULL;
3708 3709          char parent[ZFS_MAXNAMELEN];
3709 3710          libzfs_handle_t *hdl = zhp->zfs_hdl;
3710 3711          char errbuf[1024];
3711 3712  
3712 3713          /* if we have the same exact name, just return success */
↓ open down ↓ 901 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX