Fix races, don't waste IDs in idmap_tdb.
John H Terpstra
jht at samba.org
Sat Jun 21 08:23:38 GMT 2003
On Sat, 21 Jun 2003, Andrew Bartlett wrote:
> This patch fixes some issues with idmap_tdb as raised by bug #181
Confirmed - this does appear to fix the problem. I can not reproduce it
with this patch applied.
- John T.
> The idea here is to eliminate the need to *set* the 'HWM' (High Water
> Mark) in the tdb. Instead, each caller wanting to add an item to the
> TDB uses the fact that an insert will *fail* if entry already exists.
> More importantly, this means that we don't need to know the value of the
> idmap uid/gid values when setting arbitrary entries, which can occur on
> an smb.conf without such values specified.
> Then all we need to do is loop until we get an id that will insert.
> This means that the HWM does not need to be accurate, and we can have
> IDs allocates safely above the HWM.
> Setting the HWM to an arbitrary value was racy in the past - now we
> don't even do it.
> This patch also adds paranoia in reading the tdb - both the entry, and
> it's reverse entry must be present. This means that we don't need to
> 'clean up' after an abnormal failure (which would probably fail too),
> instead we rely on readers to ignore the half-completed entry. The way
> this is done will allow SIDs to then allocated an ID when things are
> normal again.
> Andrew Bartlett
John H Terpstra
Email: jht at samba.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7013 bytes
Url : http://lists.samba.org/archive/samba-technical/attachments/20030621/ff80260e/idmap_tdb-races.bin
More information about the samba-technical