主权项 |
1. A method comprising:
generating, by a processing device, a first locking data structure and a second locking data structure on a storage device accessed by a host over a network, the first locking data structure providing locks to one or more host identifiers and the second locking data structure providing locks to one or more resources; acquiring, by the processing device, a lock for the host to one of the host identifiers in response to the host modifying the first locking data structure; receiving, by the processing device, a request from the host for a shared lock on the resource; obtaining, by the processing device, an exclusive lock on the resource for the host using the second locking data structure; subsequently obtaining, by the processing device, the shared lock on the resource for the host by writing a flag to the second locking data structure, wherein the flag indicates the host that has the shared lock on the resource; and releasing the exclusive lock on the resource after obtaining the shared lock. |