Files
mirror_zfs/module/zfs
Brian Behlendorf 76351672c2 Fix zfsctl_expire_snapshot() deadlock
It is possible for an automounted snapshot which is expiring to
deadlock with a manual unmount of the snapshot.  This can occur
because taskq_cancel_id() will block if the task is currently
executing until it completes.  But it will never complete because
zfsctl_unmount_snapshot() is holding the zsb->z_ctldir_lock which
zfsctl_expire_snapshot() must acquire.

---------------------- z_unmount/0:2153 ---------------------
  mutex_lock                <blocking on zsb->z_ctldir_lock>
  zfsctl_unmount_snapshot
  zfsctl_expire_snapshot
  taskq_thread

------------------------- zfs:10690 -------------------------
  taskq_wait_id             <waiting for z_unmount to exit>
  taskq_cancel_id
  __zfsctl_unmount_snapshot
  zfsctl_unmount_snapshot   <takes zsb->z_ctldir_lock>
  zfs_unmount_snap
  zfs_ioc_destroy_snaps_nvl
  zfsdev_ioctl
  do_vfs_ioctl

We resolve the deadlock by dropping the zsb->z_ctldir_lock before
calling __zfsctl_unmount_snapshot().  The lock is only there to
prevent concurrent modification to the zsb->z_ctldir_snaps AVL
tree.  Moreover, we're careful to remove the zfs_snapentry_t from
the AVL tree before dropping the lock which ensures no other tasks
can find it.  On failure it's added back to the tree.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chris Dunlap <cdunlap@llnl.gov>
Closes #1527
2013-07-12 10:06:53 -07:00
..
2013-07-09 11:53:28 -07:00
2012-08-27 12:01:37 -07:00
2013-06-19 15:14:10 -07:00
2013-07-02 13:34:31 -07:00
2013-07-02 13:34:31 -07:00
2013-07-02 13:34:31 -07:00
2010-08-31 13:41:58 -07:00
2013-07-02 13:34:31 -07:00
2013-07-02 13:34:31 -07:00
2012-08-27 12:01:37 -07:00
2013-06-19 15:14:10 -07:00
2013-06-19 15:14:10 -07:00
2013-01-08 10:35:35 -08:00
2013-06-19 15:14:10 -07:00
2012-09-17 11:22:23 -07:00
2013-07-02 13:34:31 -07:00
2013-06-19 15:14:10 -07:00
2012-10-15 16:01:54 -07:00
2010-08-31 08:38:46 -07:00
2013-03-06 15:48:48 -08:00
2012-08-27 12:01:37 -07:00
2013-06-19 16:22:39 -07:00
2012-08-27 12:01:37 -07:00
2010-12-07 16:05:25 -08:00
2010-08-31 13:41:59 -07:00
2010-08-31 13:41:58 -07:00
2010-08-31 13:41:58 -07:00
2012-08-27 12:01:37 -07:00
2013-05-06 12:39:34 -07:00
2013-06-19 16:22:39 -07:00
2013-04-26 14:42:36 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2013-01-08 10:35:42 -08:00
2013-07-11 13:53:50 -07:00
2013-05-01 17:05:52 -07:00
2013-06-19 15:14:10 -07:00
2013-06-19 16:22:39 -07:00
2012-09-05 08:44:58 -07:00
2013-06-19 15:14:10 -07:00
2013-06-19 15:14:10 -07:00
2010-08-31 13:41:58 -07:00
2013-06-19 15:14:10 -07:00
2013-04-19 15:43:16 -07:00
2013-05-01 17:05:52 -07:00
2011-03-02 11:44:34 -08:00
2012-12-20 09:56:28 -08:00
2010-08-31 13:41:50 -07:00
2013-06-19 15:14:10 -07:00
2013-06-19 15:14:10 -07:00
2013-07-02 13:34:31 -07:00
2013-05-01 17:05:52 -07:00
2013-01-23 16:33:29 -08:00
2013-02-12 10:27:39 -08:00
2010-09-17 16:24:15 -07:00