Skip to content

Commit

Permalink
Allow NFS activity to defer snapshot unmounts
Browse files Browse the repository at this point in the history
Accessing a snapshot via NFS should cause an auto-unmount of that
snapshot to be deferred until such as time as the snapshot is idle.
This is analogous to the zpl_revalidate logic employed by locally
mounted snapshots.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#3794
  • Loading branch information
behlendorf committed Sep 23, 2015
1 parent 4a4809f commit b9974e4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions module/zfs/zfs_ctldir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,8 +1147,19 @@ zfsctl_lookup_objset(struct super_block *sb, uint64_t objsetid, zfs_sb_t **zsbp)
*/
mutex_enter(&zfs_snapshot_lock);
if ((se = zfsctl_snapshot_find_by_objsetid(objsetid)) != NULL) {
*zsbp = ITOZSB(se->se_root_dentry->d_inode);
ASSERT3U(dmu_objset_id((*zsbp)->z_os), ==, objsetid);
zfs_sb_t *zsb;

zsb = ITOZSB(se->se_root_dentry->d_inode);
ASSERT3U(dmu_objset_id(zsb->z_os), ==, objsetid);

if (time_after(jiffies, zsb->z_snap_defer_time +
MAX(zfs_expire_snapshot * HZ / 2, HZ))) {
zsb->z_snap_defer_time = jiffies;
zfsctl_snapshot_unmount_delay(objsetid,
zfs_expire_snapshot);
}

*zsbp = zsb;
zfsctl_snapshot_rele(se);
error = SET_ERROR(0);
} else {
Expand Down

0 comments on commit b9974e4

Please sign in to comment.