diff options
author | mckusick <mckusick@FreeBSD.org> | 2012-06-11 23:07:21 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2012-06-11 23:07:21 +0000 |
commit | fd7780e6f70b54ef9bdd13b86e93835ea4c339fc (patch) | |
tree | 6dcf7c903b6ad149c23d77a62339a0556b4096a7 /bin/sh/eval.c | |
parent | 13b6af6d652fdfe2a296a8c5705d171400484261 (diff) | |
download | FreeBSD-src-fd7780e6f70b54ef9bdd13b86e93835ea4c339fc.zip FreeBSD-src-fd7780e6f70b54ef9bdd13b86e93835ea4c339fc.tar.gz |
In softdep_setup_inomapdep() we may have to allocate both inodedep
and bmsafemap dependency structures in inodedep_lookup() and
bmsafemap_lookup() respectively. The setup of these structures must
be done while holding the soft-dependency mutex. If the inodedep is
allocated first, it may be freed in the I/O completion callback when
the mutex is released to allocate the bmsafemap. If the bmsafemap is
allocated first, it may be freed in the I/O completion callback when
the mutex is released to allocate the inodedep.
To resolve this problem, bmsafemap_lookup has had a parameter added
that allows a pre-malloc'ed bmsafemap to be passed in so that it does
not need to release the mutex to create a new bmsafemap. The
softdep_setup_inomapdep() routine pre-malloc's a bmsafemap dependency
before acquiring the mutex and starting to build the inodedep with a
call to inodedep_lookup(). The subsequent call to bmsafemap_lookup()
is passed this pre-allocated bmsafemap entry so that it need not
release the mutex if it needs to create a new one.
Reported by: Peter Holm
Tested by: Peter Holm
MFC after: 1 week
Diffstat (limited to 'bin/sh/eval.c')
0 files changed, 0 insertions, 0 deletions