Patent attributes
The disclosed embodiments disclose techniques for managing opportunistic locks in a distributed filesystem. Two or more cloud controllers collectively manage distributed filesystem data that is stored in the cloud storage systems; the cloud controllers ensure data consistency for the stored data, and each cloud controller caches portions of the distributed filesystem. During operation, a client sending a request to access a file from a cloud controller also requests an opportunistic lock for the file. If there are no other outstanding client accesses on the other cloud controllers that preclude the requested opportunistic lock, the cloud controller grants the client file access and the opportunistic lock.