Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Apr 2016 11:38:20 -0700
From:      Ravi Pokala <rpokala@mac.com>
To:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, "freebsd-geom@freebsd.org" <freebsd-geom@freebsd.org>, "Rai, Sushanth" <srai@panasas.com>
Subject:   g_event and sysctllock
Message-ID:  <1E22BEFB-5C0E-4DE2-91E1-FD5F8AEFD04A@mac.com>

next in thread | raw e-mail | index | archive | help
Hi folks,

My colleague Sushanth (CCed) tried to send this to hackers@ yesterday, but it didn't go through for some reason. Resending on his behalf, adding geom@, and noting that while we saw this on 7-STABLE, it looks like it could still be an issue in -HEAD.

--------------------------------

Hello,

We have a home-grown geom driver that creates sysctl in the device creation path. Device creation is handled by the geom event thread. The call to SYSCTL_ADD_NODE() takes the sysctllock in exclusive mode. If the event thread is racing with another thread that calls sysctl_disks(), then you end up with a deadlock since sysctl_disks() tickles the event thread and goes to sleep while holding the sysctllock. It is expected to woken up by the event thread when the event of listing all the disks is processed. But the geom event is blocked waiting for the sysctllock.

I did see g_disk_create() adds a sysctl variable in a similar fashion, hence the email. I'm thinking of fixing the sysctl_disks() to drop the sysctllock before going to sleep and reacquiring it after being woken up. Let me know your thoughts.

Thanks,
Sushanth


--------------------------------

-Ravi (rpokala@)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1E22BEFB-5C0E-4DE2-91E1-FD5F8AEFD04A>