Bug 13950 - Lock ordering bug with metadata.tdb in partitions module
Summary: Lock ordering bug with metadata.tdb in partitions module
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: AD: LDB/DSDB/SAMDB (show other bugs)
Version: 4.11.0rc1
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-15 22:47 UTC by Andrew Bartlett
Modified: 2019-08-09 07:53 UTC (History)
3 users (show)

See Also:


Attachments
lock ordering 4.11 backport (16.78 KB, patch)
2019-07-24 00:01 UTC, Aaron Haslett (dead mail address)
no flags Details
lock ordering 4.11 backport V2 (16.92 KB, patch)
2019-07-30 03:34 UTC, Aaron Haslett (dead mail address)
no flags Details
lock ordering 4.11 backport V3 (17.06 KB, patch)
2019-07-30 03:35 UTC, Aaron Haslett (dead mail address)
garming: review+
abartlet: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Bartlett 2019-05-15 22:47:55 UTC
metadata.tdb was not being locked alongside all the other databases during lock_read in the partitions module, which causes a lock ordering issue later during transaction commit if another process reads the schema sequence number.
Comment 1 Andrew Bartlett 2019-05-17 02:28:40 UTC
This wasn't the issue.
Comment 2 Andrew Bartlett 2019-07-23 23:31:18 UTC
This actually was a real issue, we need to lock metadata.tdb at the start of every read_lock and write transaction, and close it last.
Comment 3 Aaron Haslett (dead mail address) 2019-07-24 00:01:16 UTC
Created attachment 15319 [details]
lock ordering 4.11 backport

4.11 backport, no changes from master merge request, tested on 4.11.0rc1
Comment 4 Aaron Haslett (dead mail address) 2019-07-30 03:34:46 UTC
Created attachment 15334 [details]
lock ordering 4.11 backport V2

Last backport didn't use -x on cherry-pick and was cherry-picked from my branch instead of master.  This one is correct.
Comment 5 Aaron Haslett (dead mail address) 2019-07-30 03:35:48 UTC
Created attachment 15335 [details]
lock ordering 4.11 backport V3

Correct file...
Comment 6 Garming Sam 2019-08-02 01:00:11 UTC
Comment on attachment 15335 [details]
lock ordering 4.11 backport V3

Note that there's still a double semi-colon, which Coverity doesn't like. I don't think it matters here though.
Comment 7 Andrew Bartlett 2019-08-02 01:07:28 UTC
G'Day Karolin,

Please select for Samba 4.11.0rcNEXT, this fixes an important race for us in CI (but is not important for end users, so no release note required).
Comment 8 Karolin Seeger 2019-08-09 07:53:27 UTC
Pushed to v4-11-test.
Closing out bug report.

Thanks!