git: hammer2 - Fix focus vs modify race
Matthew Dillon
dillon at crater.dragonflybsd.org
Sat May 26 11:18:36 PDT 2018
commit fda30e02bc0f8ddfe436df9a4fa2b0bacb9287fd
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Thu May 24 19:22:52 2018 -0700
hammer2 - Fix focus vs modify race
* Fixes rare panics when e.g. removing large numbers (as in hundreds of
millions) of directory entries.
The XOP collection code holds the collected cluster but cannot
safely lock it without risking a deadlock against backend operations
or dead backends. The hold on the chain prevents its destruction,
but does not prevent another thread from locking it and issuing
hammer2_chain_modify().
* Fix bugs due to the unsafe nature of an unlocked chain's content,
especially chain->data and chain->dio, by adding an interlock between
frontend access to the data and backend hammer2_chain_modify() calls.
Held but unlocked chains are used by the XOP API to pass chains back to
the frontend.
* Remove the automatic (because it is unsafe) dio synchronization
in hammer2_xop_collect() and instead implement an API that the
frontend can use to safely access the data. The API is
hammer2_xop_gdata()/hammer2_xop_pdata().
* Remove the unsafe hammer2_cluster_rdata(). Use gdata/pdata for this
too.
* Rewire hammer2_inode_get() to pass-in a hammer2_xop_head instead
of a hammer2_cluster so it can use the gdata/pdata API too.
Summary of changes:
sys/vfs/hammer2/hammer2.h | 48 +++++++++++++++++--
sys/vfs/hammer2/hammer2_admin.c | 12 +++++
sys/vfs/hammer2/hammer2_chain.c | 40 +++++++++++++---
sys/vfs/hammer2/hammer2_cluster.c | 47 ++++--------------
sys/vfs/hammer2/hammer2_inode.c | 25 +++++-----
sys/vfs/hammer2/hammer2_io.c | 9 ++++
sys/vfs/hammer2/hammer2_ioctl.c | 5 +-
sys/vfs/hammer2/hammer2_strategy.c | 44 +++++++++--------
sys/vfs/hammer2/hammer2_synchro.c | 98 ++++++++++++++++++++++----------------
sys/vfs/hammer2/hammer2_vfsops.c | 36 +++++++-------
sys/vfs/hammer2/hammer2_vnops.c | 29 +++++------
11 files changed, 237 insertions(+), 156 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/fda30e02bc0f8ddfe436df9a4fa2b0bacb9287fd
--
DragonFly BSD source repository
More information about the Commits
mailing list