Bug 222007 - Deadlock at shutdown time between zfs and usb when using usb stick as cache device
Summary: Deadlock at shutdown time between zfs and usb when using usb stick as cache d...
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.3-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-02 20:54 UTC by Bertrand Petit
Modified: 2020-05-30 08:59 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Petit 2017-09-02 20:54:58 UTC
Situation: system is booting from a zfs pool configured with two usb sticks as L2 cache devices.

Observation: at shutdown time, after hard-disks are stoped and uptime duration is printed, usual usb shutdown messages are not printed and the system never powers itself off. When the same sticks are pluged in the same host but are not part of the root pool, the system goes to power off as usual.

I suppose there is a deadlock between zfs and usb: zfs keeps references to those two devices and usb waits for the devices to be liberated before winding down.
Comment 1 Hans Petter Selasky freebsd_committer 2017-09-04 20:44:54 UTC
USB will try to detach all USB devices before shutdown. --HPS
Comment 2 Andriy Gapon freebsd_committer 2017-09-05 06:33:53 UTC
ZFS winds down via shutdown_post_sync event hook.
Comment 3 Bertrand Petit 2017-09-05 16:24:57 UTC
I'm not cognizant of the zfs internals, I did a quick search of the zfs sources from which I came to the conclusion that the SPA part is managing the raw devices, am I right? Then I activated that subsystem's debug messages (vfs.zfs.debug set to 32). I expected to see messages when the devices are released but none were printed, not even for the SATA drives. Where should I search next?
Comment 4 Bertrand Petit 2020-05-30 07:10:27 UTC
I'm closing this old bug report which is now useless, the reported behavior is no longer exhibited.