mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Always track temporary fses and snapshots for accounting
The root cause of the issue is that we only occasionally do as the comments in the code suggest and actually ignore the %recv dataset when it comes to filesystem limit tracking. Specifically, the only time we ignore it is when initializing the filesystem and snapshot limit values; when creating a new %recv dataset or deleting one, we always update the bookkeeping. This causes a problem if you init the fs count on a filesystem that already has a %recv dataset, since the bookmarking will be decremented but not incremented. This is resolved in this patch by simply always tracking the %recv dataset as a child. Reviewed-by: Matt Ahrens <matt@delphix.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Signed-off-by: Paul Dagnelie <pcd@delphix.com> Closes #10791
This commit is contained in:
committed by
Brian Behlendorf
parent
510179f086
commit
79d6a1b1da
+6
-17
@@ -121,13 +121,6 @@
|
||||
* and updated by dsl_fs_ss_count_adjust(). A new limit value is setup in
|
||||
* dsl_dir_activate_fs_ss_limit() and the counts are adjusted, if necessary, by
|
||||
* dsl_dir_init_fs_ss_count().
|
||||
*
|
||||
* There is a special case when we receive a filesystem that already exists. In
|
||||
* this case a temporary clone name of %X is created (see dmu_recv_begin). We
|
||||
* never update the filesystem counts for temporary clones.
|
||||
*
|
||||
* Likewise, we do not update the snapshot counts for temporary snapshots,
|
||||
* such as those created by zfs diff.
|
||||
*/
|
||||
|
||||
extern inline dsl_dir_phys_t *dsl_dir_phys(dsl_dir_t *dd);
|
||||
@@ -593,11 +586,9 @@ dsl_dir_init_fs_ss_count(dsl_dir_t *dd, dmu_tx_t *tx)
|
||||
&chld_dd));
|
||||
|
||||
/*
|
||||
* Ignore hidden ($FREE, $MOS & $ORIGIN) objsets and
|
||||
* temporary datasets.
|
||||
* Ignore hidden ($FREE, $MOS & $ORIGIN) objsets.
|
||||
*/
|
||||
if (chld_dd->dd_myname[0] == '$' ||
|
||||
chld_dd->dd_myname[0] == '%') {
|
||||
if (chld_dd->dd_myname[0] == '$') {
|
||||
dsl_dir_rele(chld_dd, FTAG);
|
||||
continue;
|
||||
}
|
||||
@@ -910,14 +901,12 @@ dsl_fs_ss_count_adjust(dsl_dir_t *dd, int64_t delta, const char *prop,
|
||||
strcmp(prop, DD_FIELD_SNAPSHOT_COUNT) == 0);
|
||||
|
||||
/*
|
||||
* When we receive an incremental stream into a filesystem that already
|
||||
* exists, a temporary clone is created. We don't count this temporary
|
||||
* clone, whose name begins with a '%'. We also ignore hidden ($FREE,
|
||||
* $MOS & $ORIGIN) objsets.
|
||||
* We don't do accounting for hidden ($FREE, $MOS & $ORIGIN) objsets.
|
||||
*/
|
||||
if ((dd->dd_myname[0] == '%' || dd->dd_myname[0] == '$') &&
|
||||
strcmp(prop, DD_FIELD_FILESYSTEM_COUNT) == 0)
|
||||
if (dd->dd_myname[0] == '$' && strcmp(prop,
|
||||
DD_FIELD_FILESYSTEM_COUNT) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* e.g. if renaming a dataset with no snapshots, count adjustment is 0
|
||||
|
||||
Reference in New Issue
Block a user