Print this page
2948 do not generate 0 as random 64-bit guid

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dsl_dataset.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_dataset.c
↓ open down ↓ 795 lines elided ↑ open up ↑
 796  796  
 797  797          dsobj = dmu_object_alloc(mos, DMU_OT_DSL_DATASET, 0,
 798  798              DMU_OT_DSL_DATASET, sizeof (dsl_dataset_phys_t), tx);
 799  799          VERIFY(0 == dmu_bonus_hold(mos, dsobj, FTAG, &dbuf));
 800  800          dmu_buf_will_dirty(dbuf, tx);
 801  801          dsphys = dbuf->db_data;
 802  802          bzero(dsphys, sizeof (dsl_dataset_phys_t));
 803  803          dsphys->ds_dir_obj = dd->dd_object;
 804  804          dsphys->ds_flags = flags;
 805  805          dsphys->ds_fsid_guid = unique_create();
 806      -        (void) random_get_pseudo_bytes((void*)&dsphys->ds_guid,
 807      -            sizeof (dsphys->ds_guid));
      806 +        do {
      807 +                (void) random_get_pseudo_bytes((void*)&dsphys->ds_guid,
      808 +                    sizeof (dsphys->ds_guid));
      809 +        } while (dsphys->ds_guid == 0);
 808  810          dsphys->ds_snapnames_zapobj =
 809  811              zap_create_norm(mos, U8_TEXTPREP_TOUPPER, DMU_OT_DSL_DS_SNAP_MAP,
 810  812              DMU_OT_NONE, 0, tx);
 811  813          dsphys->ds_creation_time = gethrestime_sec();
 812  814          dsphys->ds_creation_txg = tx->tx_txg == TXG_INITIAL ? 1 : tx->tx_txg;
 813  815  
 814  816          if (origin == NULL) {
 815  817                  dsphys->ds_deadlist_obj = dsl_deadlist_alloc(mos, tx);
 816  818          } else {
 817  819                  dsl_dataset_t *ohds;
↓ open down ↓ 1259 lines elided ↑ open up ↑
2077 2079                  crtxg = tx->tx_txg;
2078 2080  
2079 2081          dsobj = dmu_object_alloc(mos, DMU_OT_DSL_DATASET, 0,
2080 2082              DMU_OT_DSL_DATASET, sizeof (dsl_dataset_phys_t), tx);
2081 2083          VERIFY(0 == dmu_bonus_hold(mos, dsobj, FTAG, &dbuf));
2082 2084          dmu_buf_will_dirty(dbuf, tx);
2083 2085          dsphys = dbuf->db_data;
2084 2086          bzero(dsphys, sizeof (dsl_dataset_phys_t));
2085 2087          dsphys->ds_dir_obj = ds->ds_dir->dd_object;
2086 2088          dsphys->ds_fsid_guid = unique_create();
2087      -        (void) random_get_pseudo_bytes((void*)&dsphys->ds_guid,
2088      -            sizeof (dsphys->ds_guid));
     2089 +        do {
     2090 +                (void) random_get_pseudo_bytes((void*)&dsphys->ds_guid,
     2091 +                    sizeof (dsphys->ds_guid));
     2092 +        } while (dsphys->ds_guid == 0);
2089 2093          dsphys->ds_prev_snap_obj = ds->ds_phys->ds_prev_snap_obj;
2090 2094          dsphys->ds_prev_snap_txg = ds->ds_phys->ds_prev_snap_txg;
2091 2095          dsphys->ds_next_snap_obj = ds->ds_object;
2092 2096          dsphys->ds_num_children = 1;
2093 2097          dsphys->ds_creation_time = gethrestime_sec();
2094 2098          dsphys->ds_creation_txg = crtxg;
2095 2099          dsphys->ds_deadlist_obj = ds->ds_phys->ds_deadlist_obj;
2096 2100          dsphys->ds_referenced_bytes = ds->ds_phys->ds_referenced_bytes;
2097 2101          dsphys->ds_compressed_bytes = ds->ds_phys->ds_compressed_bytes;
2098 2102          dsphys->ds_uncompressed_bytes = ds->ds_phys->ds_uncompressed_bytes;
↓ open down ↓ 2215 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX