Re: Possible deadlock on IO / page fault

From: Mark Johnston <markj_at_freebsd.org>
Date: Tue, 29 Sep 2020 09:31:59 -0400
On Tue, Sep 29, 2020 at 04:20:26PM +0300, Konstantin Belousov wrote:
> On Tue, Sep 29, 2020 at 02:59:43PM +0300, Michael Zhilin wrote:
> > Hi,
> > 
> > I'm using FreeBSD 13-CURRENT (pre-ZoF, r359724) on my laptop with installed
> > Gnome. Sometimes
> > (once a week/month) gnome hangs and the system may be still responsible
> > (may be not).
> > This week it happened again and I've gathered information via ddb/textdump
> > and rebooted laptop.
> > 
> > gnome-shell is trying to get exclusive lock on some directory according to
> > information
> > from "show alllocks" and "bt":
> > 
> > [...]
> >     Tracing command evolution pid 4536 tid 101436 td 0xfffffe00bf484c00
> >     sched_switch() at sched_switch+0x5b2/frame 0xfffffe00bfd446e0
> >     mi_switch() at mi_switch+0x155/frame 0xfffffe00bfd44700
> >     sleepq_switch() at sleepq_switch+0x11a/frame 0xfffffe00bfd44740
> >     _cv_wait() at _cv_wait+0x15a/frame 0xfffffe00bfd447a0
> >     rangelock_enter() at rangelock_enter+0x306/frame 0xfffffe00bfd447f0
> This call to rangelock_enter() looks suspicious.  This is a call to ZFS
> own rangelocks, not our rangelocks.  Still, if write took rangelock on the
> same range, we get a deadlock due to LoR between rangelock and page busy.

This was fixed by r361287.  In particular zfs_getpages() will no longer
block on the ZFS range lock, exactly because of this deadlock.  So I
would suggest updating to that revision or later.

> >     zfs_freebsd_getpages() at zfs_freebsd_getpages+0x14f/frame
> > 0xfffffe00bfd448a0
> >     vnode_pager_getpages() at vnode_pager_getpages+0x37/frame
> > 0xfffffe00bfd448e0
> >     vm_pager_get_pages() at vm_pager_get_pages+0x4f/frame 0xfffffe00bfd44930
> >     vm_fault() at vm_fault+0x780/frame 0xfffffe00bfd44a40
> >     vm_fault_trap() at vm_fault_trap+0x6e/frame 0xfffffe00bfd44a80
> >     trap_pfault() at trap_pfault+0x1ee/frame 0xfffffe00bfd44ae0
> >     trap() at trap+0x44c/frame 0xfffffe00bfd44bf0
> >     calltrap() at calltrap+0x8/frame 0xfffffe00bfd44bf0
> >     --- trap 0xc, rip = 0x80a55de3f, rsp = 0x7fffffffcc60, rbp =
> > 0x7fffffffcc60 ---
Received on Tue Sep 29 2020 - 11:32:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:25 UTC