[PATCH] LMDB full patch set

Andrew Bartlett abartlet at samba.org
Thu May 3 18:45:58 UTC 2018


On Thu, 2018-05-03 at 15:16 +0100, Howard Chu wrote:
> Andrew Bartlett wrote:
> > On Mon, 2018-04-16 at 16:57 +0100, Howard Chu wrote:
> > > mdb_env_close() will reset any reader slots owned by the process. The PID is
> > > stored in env->me_pid so unfortunately both parent and child will have the
> > > same PID recorded here after a fork. Thus env_close in the child would end up
> > > releasing the parent's reader slots. Fairly disastrous. Obviously we can fix
> > > this trivially by just using getpid() in env_close().
> > 
> > So, if after the fork(), we just ignore the old DB, except to close
> > mdb_env_get_fd() (which is not the lock file, and so has no fcntl
> > semantics) are we safe?
> 
> Safe, yes. But you could also just merge in this patch now
> http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=tree;f=libraries/liblmdb;hb=3b01bbbc67389b63e6623da99d397283729e70e7
> 
> which makes mdb_env_close() safe, as mentioned above.

OK.  At this stage we were not planning on bundling lmdb into
third_party or vendoring it into Samba so we can't rely on recent
fixes, but once there is a released version with this in we can call
that within an #ifdef guard.  (bonus points if some CPP macro declares
it safe).

A reopen would still be nice because then we could match tdb where
would not need a new FD and so can't run out of FDs or have files go
missing under our feet.

Thanks,

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba-technical mailing list