There's a race condition between dbd and cnid_dbd:
- remove CNID database of a large volume
- start dbd -r VOLUMEPATH for rebuilding the database
- connect with AFP to the same volue
- try to copy a folder with lots of file to the AFP volume
Chances are high to hit the following race condition:
- the last used CNID is stored in the db
- both processes, afpd and cnid_dbd fetch the same last used CNID value from the database
- both try to add their entry, the first wins
The second will get this error message:
Dec 04 11:17:27.059951 cnid_dbd[2920] {dbd_add.c:166} (E:CNID): dbd_add(DID: 391637/"SP13_NJC004_R3c.psd", dev/ino 0x19d000f/0x30c2a9): Cannot add CNID: 392025
Fixed in [83416b7b2b6651e76ad20960822249dceb55644a].
Related
Commit: <Commit _id='83416b7b2b6651e76ad20960822249dceb55644a' tree_id='1603024ff5553c6d0c281df4b6be35c7b16d56ac' committed=I{'date': datetime.datetime(2012, 12, 17, 18, 4, 58), 'email': 'sloowfranklin@gmail.com', 'name': 'Ralph Boehme'} authored=I{'date': datetime.datetime(2012, 12, 10, 17, 38, 7), 'email': 'sloowfranklin@gmail.com', 'name': 'Ralph Boehme'} message="Restructure opening and deleting the CNID dbs and CNID wraparound support\n\nIf opening the db fails, delete it and recreate a new empty one.\n\nAdd handling of CNID overflow, ie when the last used CNID reaches\nits maximum (UINT32_MAX), wrap around to CNID_START. This then neccesites\na modification to get_id() where we used to just increment the last\nused CNID counter and use that as next CNID.\nNow we need to ensure that it isn't already used in the db and keep\nsearching for an used in case it is in a loop.\n\nMove locking function back to main.c, as it's only used by cnid_dbd.\n\nModify dbd_add() such that it can add an entry with the CNID passed\nin from the client, the CNID hint read from the adouble file.\n\nInvalidate CNID hint in case lookup detected a problem\n" parent_ids=I['06c0bfaea7c9db5d404813efd23bf06c49c2bc4f'] child_ids=I['5fada3c18c7829183ab4f6fd634ab614ba5a99bb'] repo_ids=I[ObjectId('503b705bfd48f843173d5fd3'), ObjectId('5910acbc2cd81052b64b3380'), ObjectId('5e503de0dd85f4654ba114ee'), ObjectId('5e828a7a9d8bdd372301c28f')]>