]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix zfsctl_lookup_objset() deadlock
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 10 Dec 2015 23:47:18 +0000 (15:47 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 14 Dec 2015 20:05:52 +0000 (12:05 -0800)
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 <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #3997

module/zfs/zfs_ctldir.c

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