]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Set 'zfs_expire_snapshot=0' to disable auto-unmount
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 10 Dec 2015 23:23:26 +0000 (15:23 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 14 Dec 2015 19:02:32 +0000 (11:02 -0800)
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 <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
module/zfs/zfs_ctldir.c

index b03c4e5d027354d537d476fe1a6357e1d4b97291..a00d61d1a6f29fd0db7649d6842f984c6b27869d 100644 (file)
@@ -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);