Bug 243064 - mount_unionfs panics in latest -current
Summary: mount_unionfs panics in latest -current
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Mateusz Guzik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-03 19:34 UTC by Mason Loring Bliss
Modified: 2020-01-09 13:09 UTC (History)
3 users (show)

See Also:


Attachments
Photo of panic (612.24 KB, image/jpeg)
2020-01-03 19:34 UTC, Mason Loring Bliss
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mason Loring Bliss 2020-01-03 19:34:36 UTC
Created attachment 210423 [details]
Photo of panic

In trying a -current build with the 20200102 media, I encountered a kernel panic from a bad assertion. Screenshot attached, and I'll be happy to gather more data. It gives me a usable debugger prompt, so we can explore, if someone can guide me. I can also see about reproducing it in a VM so I'm not a gating factor.
Comment 1 Mason Loring Bliss 2020-01-03 19:35:59 UTC
To get to where I was in the screenshot, boot, select a live session, and
enter these two commands:

mkdir /tmp/etc
mount_unionfs /tmp/etc /etc
Comment 2 Mason Loring Bliss 2020-01-03 19:36:15 UTC
Context of my attempt:

https://wiki.freebsd.org/MasonLoringBliss/InstallEnvironment
Comment 3 Kyle Evans freebsd_committer 2020-01-03 19:38:21 UTC
CC'ing kib and mjg for vfs expertise.
Comment 4 Mason Loring Bliss 2020-01-03 20:02:24 UTC
The amazing folks in Freenode #freebsd have nailed it down:

14:47 < RhodiumToad> everywhere else, VOP_UNLOCK is called as VOP_UNLOCK(vp,0)
14:48 < RhodiumToad> unionfs uses VOP_UNLOCK(vp,LK_RELEASE), which I suspect is 
                     just an obsolete form from years back
...
14:51 < RhodiumToad> anyway, unionfs can probably be fixed trivially
14:52 < kevans91> yeah, looks like it just has a dozen or so VOP_UNLOCK 
                  invocations that are incorrect

related:

14:50 < kevans91> I thought mjg was cooking up something to drop the second 
                  argument entirely
14:50 < kevans91> ah, yeah: - Exp-run PR 240156 to remove flags argument from 
                  VOP_UNLOCK
14:50 < VimDiesel> 240156 – Remove flags argument from VOP_UNLOCK 
                   https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240156
14:51 < kevans91> https://reviews.freebsd.org/D21427
14:51 < VimDiesel> Title: ⚙ D21427 vfs: remove flags argument from VOP_UNLOCK 
                   (at reviews.freebsd.org)
Comment 5 Mateusz Guzik freebsd_committer 2020-01-03 20:21:49 UTC
I'll sort this out, note however that unionfs will likely panic on something else when debug is enabled.
Comment 6 commit-hook freebsd_committer 2020-01-03 22:13:08 UTC
A commit references this bug:

Author: mjg
Date: Fri Jan  3 22:12:26 UTC 2020
New revision: 356336
URL: https://svnweb.freebsd.org/changeset/base/356336

Log:
  unionfs: fix up VOP_UNLOCK use after flags stopped being supported

  For the most part the code was passing the LK_RELEASE flag.
  The 2 cases which did not use the VOP_UNLOCK_FLAGS macro.

  This fixes a panic when stacking unionfs on top of e.g., tmpfs when
  debug is enabled.

  Note there are latent bugs which prevent unionfs from working with debug
  regardless of this change.

  PR:		243064
  Reported by:	Mason Loring Bliss

Changes:
  head/sys/fs/unionfs/union_subr.c
  head/sys/fs/unionfs/union_vfsops.c
  head/sys/fs/unionfs/union_vnops.c
Comment 7 Mason Loring Bliss 2020-01-04 06:16:36 UTC
Regarding your comment, "Note there are latent bugs which prevent unionfs from
working with debug regardless of this change," I'm wondering if these are
described anywhere, or should I report them as I slam into them?

Thanks!
Comment 8 Mason Loring Bliss 2020-01-09 13:09:03 UTC
Mateusz,

Hello again! My apologies if this was unclear or if you're simply busy, but this
question was directed at you.

Regarding your comment, "Note there are latent bugs which prevent unionfs from
working with debug regardless of this change," I'm wondering if these are
described anywhere, or should I report them as I slam into them?

Thanks!