Bug 253227 - zfs does not respect snapshot_limit (at least for volumes)
Summary: zfs does not respect snapshot_limit (at least for volumes)
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-03 19:08 UTC by Walter von Entferndt
Modified: 2021-02-03 22:44 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Walter von Entferndt 2021-02-03 19:08:21 UTC
This is very bad for periodic snapshot taking...  I have checked
$ zpool get all | fgrep feature@filesystem_limits
t450s  feature@filesystem_limits      active                         local

but
# zfs snapshot -r t450s@`date -u +%F-%T-%Z`
$ zfs get -r snapshot_count,snapshot_limit t450s/SWAP
NAME                                PROPERTY        VALUE    SOURCE
t450s/SWAP                          snapshot_count  1        local
t450s/SWAP                          snapshot_limit  0        local
t450s/SWAP@2021-02-03-19:03:42-UTC  snapshot_count  -        -
t450s/SWAP@2021-02-03-19:03:42-UTC  snapshot_limit  -        -
Comment 1 Alan Somers freebsd_committer freebsd_triage 2021-02-03 22:44:19 UTC
I think you're misunderstanding the feature.  From the man page "The limit is not enforced if the user is allowed to change the limit."  That means that the limit never affects root.  It only matters if you've delegated the snapshot permission.  Have you?

Here's a demonstration:
$ sudo zfs create bar/barf
$ sudo zfs set snapshot_limit=2 bar/barf
$ sudo zfs allow -u somers snapshot bar/barf
$ zfs snapshot bar/barf@1
$ zfs snapshot bar/barf@2
$ zfs snapshot bar/barf@3
cannot create snapshot 'bar/barf': out of space
$ sudo zfs snapshot bar/barf@3

Notice that even after the limit was exceeded, root was allowed to take another snapshot.