Red Hat Bugzilla – Bug 103674
fcntl database locking doesn't work
Last modified: 2007-04-18 12:57:21 EDT
fcntl database locking is broken. The Packages database is locked once
at the start of rpm when dependency checking is done (db opened rdonly).
If everything is ok, the database is closed and re-opened rw. The problem
is that the db->close() closes the filedescriptor, and thus the fcntl
lock is lost.
Created attachment 94176 [details]
The more general question is:
Does SuSE need fcntl exclusive locking?
The concurrent locking is reliable and sufficient (for rpmdb,
install/erase locking is different problem) afaict, and I'd
like to eliminate legacy code.
Good question. The current code selects it as we don't have nptl.
"unshared posix mutexes found, adding DB_PRIVATE, using fcntl lock"
This is a run time test for nptl in rpmdb/db3.c.
If you don't have nptl, then you should eliminate the test,
and compile without --enable-posixmutexes (2 occurences,
autogen.sh and rpm.spec).
You will lose unified thread/process locks but that should not mattter,
the CDB locks will work fine.
Uh, this *is still* a bug. If you really think it isn't you should throw
out the fcntl locking code, because it doesn't work.
Yes, fcntl locking is being phased out.
And the real bug is that reopening O_RDWR opens a locking
window, not anything else.