Print this page
5610 zfs clone from different source and target pools produces coredump

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dmu_objset.c
          +++ new/usr/src/uts/common/fs/zfs/dmu_objset.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  24   24   * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  25   25   * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  26   26   * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
       27 + * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  27   28   */
  28   29  
  29   30  /* Portions Copyright 2010 Robert Milkowski */
  30   31  
  31   32  #include <sys/cred.h>
  32   33  #include <sys/zfs_context.h>
  33   34  #include <sys/dmu_objset.h>
  34   35  #include <sys/dsl_dir.h>
  35   36  #include <sys/dsl_dataset.h>
  36   37  #include <sys/dsl_prop.h>
↓ open down ↓ 861 lines elided ↑ open up ↑
 898  899          if (strchr(doca->doca_clone, '@') != NULL)
 899  900                  return (SET_ERROR(EINVAL));
 900  901  
 901  902          error = dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail);
 902  903          if (error != 0)
 903  904                  return (error);
 904  905          if (tail == NULL) {
 905  906                  dsl_dir_rele(pdd, FTAG);
 906  907                  return (SET_ERROR(EEXIST));
 907  908          }
 908      -        /* You can't clone across pools. */
 909      -        if (pdd->dd_pool != dp) {
 910      -                dsl_dir_rele(pdd, FTAG);
 911      -                return (SET_ERROR(EXDEV));
 912      -        }
      909 +
 913  910          error = dsl_fs_ss_limit_check(pdd, 1, ZFS_PROP_FILESYSTEM_LIMIT, NULL,
 914  911              doca->doca_cred);
 915  912          if (error != 0) {
 916  913                  dsl_dir_rele(pdd, FTAG);
 917  914                  return (SET_ERROR(EDQUOT));
 918  915          }
 919  916          dsl_dir_rele(pdd, FTAG);
 920  917  
 921  918          error = dsl_dataset_hold(dp, doca->doca_origin, FTAG, &origin);
 922  919          if (error != 0)
 923  920                  return (error);
 924  921  
 925      -        /* You can't clone across pools. */
 926      -        if (origin->ds_dir->dd_pool != dp) {
 927      -                dsl_dataset_rele(origin, FTAG);
 928      -                return (SET_ERROR(EXDEV));
 929      -        }
 930      -
 931  922          /* You can only clone snapshots, not the head datasets. */
 932  923          if (!origin->ds_is_snapshot) {
 933  924                  dsl_dataset_rele(origin, FTAG);
 934  925                  return (SET_ERROR(EINVAL));
 935  926          }
 936  927          dsl_dataset_rele(origin, FTAG);
 937  928  
 938  929          return (0);
 939  930  }
 940  931  
↓ open down ↓ 915 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX