summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2015-12-10 15:23:26 -0800
committerBrian Behlendorf <[email protected]>2015-12-14 11:02:32 -0800
commit5e94284fe57ba0b3b5825676e3fd498c8b4b8115 (patch)
treef2d7179eef42263e4044243904fdc14571af4b57
parenta22502c9e6656e8d19e43de7f983588afc719ec5 (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]>
-rw-r--r--module/zfs/zfs_ctldir.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c
index b03c4e5d0..a00d61d1a 100644
--- a/module/zfs/zfs_ctldir.c
+++ b/module/zfs/zfs_ctldir.c
@@ -333,6 +333,11 @@ snapentry_expire(void *data)
spa_t *spa = se->se_spa;
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);
@@ -373,6 +378,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);