process shared robust mutexes for tdb

Stefan (metze) Metzmacher metze at samba.org
Mon May 27 06:19:17 MDT 2013


Hi,

here's the current patchset including configure checks and runtime
checks for robust mutexes.

I think there's only one thing left that needs a bit more work,
it's the error path handling in tdb_allrecord_upgrade().

For the non mutex case we do this:

     ret = tdb_brlock_retry(tdb, F_WRLCK, FREELIST_TOP,
                            tdb->hash_size * 4,
                            TDB_LOCK_WAIT|TDB_LOCK_PROBE);

     ret = tdb_brlock_retry(tdb, F_WRLCK, lock_offset(tdb->hash_size), 0,
                            TDB_LOCK_WAIT|TDB_LOCK_PROBE);

while we locked the whole range with one call before.

The error path to cleanup the first lock if the 2nd fails does this
currently:

        ret = tdb_brlock(tdb, F_RDLCK, FREELIST_TOP,
                         tdb->hash_size * 4, TDB_LOCK_WAIT);

Wouldn't the following be the more correct way to undo the first lock?

     ret = tdb_brunlock(tdb, F_WRLCK, FREELIST_TOP, tdb->hash_size * 4)

instead of doing an additional read lock?

For the mutex case we'd also need to undo tdb_mutex_allrecord_upgrade().

This passes make test for me on an ubuntu 12.04 system with mutexes in use.
(also with a hack to use mutexes whenever CLEAR_IF_FIRST is passed to
tdb_open_ex()).

Note that older systems like SLES 10 or ubuntu 10.04 doesn't offer
robust mutexes at runtime
and our autobuild on sn-devel-104 (ubuntu 10.04) will not test mutexes
in use,
it'll silently fallback to fcntl() locks.

metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmp.diff
Type: text/x-diff
Size: 141414 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20130527/1b7e41e5/attachment-0001.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20130527/1b7e41e5/attachment-0001.pgp>


More information about the samba-technical mailing list