diff options
author | Brian Behlendorf <[email protected]> | 2015-12-10 15:23:26 -0800 |
---|---|---|
committer | Ned Bass <[email protected]> | 2015-12-23 17:29:34 -0800 |
commit | 279e27db23e44608823c1fe803472027f60a2cb1 (patch) | |
tree | 270b824b30fa0a35460253a5b600e4c2da430a81 /module | |
parent | 5f4004efc0ff2d304708173de24e67b0f3d5d40d (diff) |
Set 'zfs_expire_snapshot=0' to disable auto-unmount
There are cases where it's desirable that auto-mounted snapshots
not expire after a fixed duration. They should be unmounted only
when the filesystem they are a snapshot of is unmounted.
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/zfs_ctldir.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c index b70eb6623..a36959c33 100644 --- a/module/zfs/zfs_ctldir.c +++ b/module/zfs/zfs_ctldir.c @@ -325,6 +325,11 @@ snapentry_expire(void *data) zfs_snapentry_t *se = (zfs_snapentry_t *)data; uint64_t objsetid = se->se_objsetid; + if (zfs_expire_snapshot <= 0) { + zfsctl_snapshot_rele(se); + return; + } + se->se_taskqid = -1; (void) zfsctl_snapshot_unmount(se->se_name, MNT_EXPIRE); zfsctl_snapshot_rele(se); @@ -365,6 +370,9 @@ zfsctl_snapshot_unmount_delay_impl(zfs_snapentry_t *se, int delay) { ASSERT3S(se->se_taskqid, ==, -1); + if (delay <= 0) + return; + se->se_taskqid = taskq_dispatch_delay(zfs_expire_taskq, snapentry_expire, se, TQ_SLEEP, ddi_get_lbolt() + delay * HZ); zfsctl_snapshot_hold(se); |