test: add Linux Open File Description (OFD) locking regression tests

Summary

Adds regression and persistence tests in ofd_linux_test.go for Linux Open File Description (OFD) locking.

Test Coverage

  1. TestOFDLockSurvivesOSClose: Verifies that an active SQLite exclusive transaction lock persists when an unrelated raw descriptor to the same file is opened and closed (os.Open / os.Close) within the same process. Uses syscall.FcntlFlock (ensuring 32-bit linux/386 and linux/arm route through fcntl64) with t.Skip on EINVAL.
  2. TestOFDLockInterleavedReadersWrite: Verifies that interleaved read transactions across multiple in-process connections release their respective OFD locks cleanly upon commit so that subsequent write transactions are not blocked by leaked read locks.
  3. TestOFDLockReadOnlyFirstLocker: Verifies that when a read-only connection is the first locker on an inode and a read-write connection subsequently joins at SHARED (triggering designated descriptor migration), the kernel read lock on the SHARED range remains held throughout and the read-write connection can upgrade.
  4. TestOFDLockFailedFirstLock: Verifies that if the first SHARED attempt on an inode fails due to external lock contention after PENDING succeeded and that connection closes, subsequent reads on surviving connections that kept the inode alive do not attempt operations on the closed descriptor.

Edited by Nathan Herring

Merge request reports

Loading
Loading