diff options
author | Paul Dagnelie <[email protected]> | 2020-08-26 21:38:27 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-26 21:38:27 -0700 |
commit | 4aa3b3bd471cd8b9b18fd1e67c685932763f306b (patch) | |
tree | 98888588563fc93bbee1c5d480b2a5bfbf5100a3 /module | |
parent | ad52de77c2a518d32f979358f9a3e4cefeb44977 (diff) |
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 <[email protected]>
Reviewed by: Jerry Jelinek <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Closes #10791
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/dsl_dir.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c index 73b7943b8..29672e9a6 100644 --- a/module/zfs/dsl_dir.c +++ b/module/zfs/dsl_dir.c @@ -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 |