diff options
author | Michael Adam <obnox@samba.org> | 2010-01-23 01:17:06 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-02-12 23:12:12 +0100 |
commit | 83fffbeb44441a87569e543054af21d975eb20ae (patch) | |
tree | 6aae54a15631d447db506578e71b14907cb3b7c5 /source3/registry/reg_backend_db.c | |
parent | e4af0bc5af2c3ee025ca7fac251c3672ba2c8dd5 (diff) | |
download | samba-83fffbeb44441a87569e543054af21d975eb20ae.tar.gz samba-83fffbeb44441a87569e543054af21d975eb20ae.tar.bz2 samba-83fffbeb44441a87569e543054af21d975eb20ae.zip |
s3:g_lock: remove a nested event loop, replacing the inner loop by select
This made smbd crash in g_lock_lock() when trying to start a
transaction on a db with an already started transaction,
e.g. in a tcon_and_X where the share_info.tdb was not yet
initialized but share_info.tdb was already locked by another
process or writing acces to the winreg rpc pipe where the
registry tdb was already locked by another process.
What we really _want_ to do here by design is to react to
MSG_DBWRAP_G_LOCK_RETRY messages that are either sent
by a client doing g_lock_unlock or by ourselves when
we receive a CTDB_SRVID_SAMBA_NOTIFY or
CTDB_SRVID_RECONFIGURE message from ctdbd, i.e. when
either a client holding a lock or a complete node
has died.
Doing this properly involves calling tevent_loop_once(),
but doing this here with the main ctdbd messaging context
creates a nested event loop when g_lock_lock() is called
from the main event loop.
So as a quick fix, we act a little corasely here: we do
a select on the ctdb connection fd and when it is readable
or we get EINTR, then we retry without actually parsing
any ctdb packages or dispatching messages. This means that
we retry more often than necessary and intended by design,
but this does not harm and it is unobtrusive. When we have
finished, the main loop will pick up all the messages and
ctdb packets. The only extra twist is that we cannot use
timed events here but have to handcode a timeout for select.
Michael
Diffstat (limited to 'source3/registry/reg_backend_db.c')
0 files changed, 0 insertions, 0 deletions