What does NTSTATUS 0xC0000055 (STATUS_LOCK_NOT_GRANTED) mean?

 
Previous Next
STATUS_FILE_LOCK_CONFLICT STATUS_DELETE_PENDING

STATUS_LOCK_NOT_GRANTED

STATUS_LOCK_NOT_GRANTED is returned when a caller tries to acquire a byte-range lock and the requested range overlaps a lock that cannot coexist with it. The file itself can still be open and accessible outside the overlapping region.

How it differs from related statuses

  • STATUS_SHARING_VIOLATION concerns the access and sharing policy of file handles during an open operation.
  • STATUS_LOCK_NOT_GRANTED concerns an attempt to create a new byte-range lock.
  • STATUS_FILE_LOCK_CONFLICT commonly means that an I/O operation cannot proceed because a conflicting lock already covers the requested data.

Design implications

Lock requests must use stable, documented ranges. If one component locks records by fixed-size slots while another locks variable-length records, accidental overlap can be difficult to reproduce. The lock owner should release the exact range it acquired; Windows documents that adjacent regions locked separately cannot be released as one larger region.

For a transient conflict, a caller can wait or retry according to its own concurrency rules. For a nonblocking request, the preferred outcome is often to report a contention result to the caller rather than spin. Persistent conflicts should be investigated as a lock-ordering or lifetime problem, especially on network shares where another client may hold the range.

See LockFileEx, Windows byte-range locking guidance, and the SMB2 locking and create specification.


Looking for a different code? Search another status or error code.