Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Mar 2018 09:17:10 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-fs@FreeBSD.org
Subject:   [Bug 225960] zfs: g_access leak when unmounting UFS on a zvol
Message-ID:  <bug-225960-3630-flUET5aWjl@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-225960-3630@https.bugs.freebsd.org/bugzilla/>
References:  <bug-225960-3630@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D225960

--- Comment #15 from commit-hook@freebsd.org ---
A commit references this bug:

Author: avg
Date: Thu Mar 15 09:16:11 UTC 2018
New revision: 330977
URL: https://svnweb.freebsd.org/changeset/base/330977

Log:
  g_access: deal with races created by geoms that drop the topology lock

  The problem is that g_access() must be called with the GEOM topology
  lock held.  And that gives a false impression that the lock is indeed
  held across the call.  But this isn't always true because many classes,
  ZVOL being one of the many, need to drop the lock.  It's either to
  perform an I/O on the first open or to acquire a different lock (like in
  g_mirror_access).

  That, of course, can break many assumptions.  For example,
  g_slice_access() adds an extra exclusive count on the first open. As
  described above, an underlying geom may drop the topology lock and that
  would open a race with another thread that would also request another
  extra exclusive count.  In general, two consumers may be granted
  incompatible accesses.

  To avoid this problem the code is changed to mark a geom with special
  flag before calling its access method and clear the flag afterwards.  If
  another thread sees that flag, then it means that the topology lock has
  been dropped (either by the geom in question or downstream from it), so
  it is not safe to make another access call.  So, the second thread would
  use g_topology_sleep() to wait until the flag is cleared and only then
  would it proceed with the access.

  Also see
http://docs.freebsd.org/cgi/mid.cgi?809d9254-ee56-59d8-69a4-08838e985cea

  PR:           225960
  Reported by:  asomers
  Reviewed by:  markj, mav
  MFC after:    3 weeks
  Differential Revision: https://reviews.freebsd.org/D14533

Changes:
  head/sys/geom/geom.h
  head/sys/geom/geom_subr.c

--=20
You are receiving this mail because:
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-225960-3630-flUET5aWjl>