From f22f900f15c28ebd8b8b764ee6229a7069c74a13 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 10 Dec 2015 15:47:18 -0800 Subject: [PATCH] Fix zfsctl_lookup_objset() deadlock The zfsctl_snapshot_unmount_delay() function must not be called from zfsctl_lookup_objset() while it is currently holding the zfs_snapshot_lock. This will result in a deadlock. It is safe to call zfsctl_snapshot_unmount_delay_impl() directly because the function already has a reference on the zfs_snapentry_t. Signed-off-by: Brian Behlendorf Signed-off-by: Chunwei Chen Closes #3997 --- module/zfs/zfs_ctldir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c index a00d61d1a6f2..0bf530c9659e 100644 --- a/module/zfs/zfs_ctldir.c +++ b/module/zfs/zfs_ctldir.c @@ -1190,7 +1190,8 @@ zfsctl_lookup_objset(struct super_block *sb, uint64_t objsetid, zfs_sb_t **zsbp) 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(spa, objsetid, + zfsctl_snapshot_unmount_cancel(se); + zfsctl_snapshot_unmount_delay_impl(se, zfs_expire_snapshot); }