]> git.proxmox.com Git - mirror_zfs.git/commit
Fix deadlock between zfs umount & snapentry_expire
authorRohan Puri <rohan.puri15@gmail.com>
Sat, 28 Jul 2018 13:02:12 +0000 (18:32 +0530)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 1 Aug 2018 22:00:02 +0000 (15:00 -0700)
commitfd7265c646f40e364396af5014bbb83e809e124a
tree4f4d7f280ce699992cbb0224a2951c2eb101d0d4
parent492f64e941e3d6b947d1cc387a1a380c0c738b09
Fix deadlock between zfs umount & snapentry_expire

zfs umount -> zfsctl_destroy() takes the zfs_snapshot_lock as a
writer and calls zfsctl_snapshot_unmount_cancel(), which waits
for snapentry_expire() if present (when snap is automounted).
This snapentry_expire() itself then waits for zfs_snapshot_lock
as a reader, resulting in a deadlock.

The fix is to only hold the zfs_snapshot_lock over the tree
lookup and removal.  After a successful lookup the lock can
be dropped and zfs_snapentry_t will remain valid until the
reference taken by the lookup is released.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rohan Puri <rohan.puri15@gmail.com>
Closes #7751
Closes #7752
module/zfs/zfs_ctldir.c