Hybrid locking using network and on-disk based schemes
First Claim
1. A method of breaking and acquiring a lock on a shared resource on a network, wherein the lock is held by a node, the method comprising:
- reading lock metadata for the lock;
based on the lock metadata, determining the lock is in a managed mode and is held by the node and is not being used by the node;
sending a request to the node to release the lock;
determining that the node has not renewed a lock lease time and that the lock lease time has expired; and
breaking and acquiring the lock by performing an operation on the shared resource using a mutual exclusion primitive, updating a local lock metadata to include information that a new lock owner node owns the lock, and updating the lock metadata in a shared storage to add a pointer to point to a heartbeat region for the new lock owner node.
0 Assignments
0 Petitions
Accused Products
Abstract
A method of acquiring a lock by a node, on a shared resource in a system of a plurality of interconnected nodes, is disclosed. Each node that competes for a lock on the shared resource maintains a list of locks currently owned by the node. A lock metadata is maintained on a shared storage that is accessible to all nodes that may compete for locks on shared resources. A heartbeat region is maintained on a shared resource corresponding to each node so nodes can register their liveness. A lock state is maintained in the lock metadata in the shared storage. A lock state may indicate lock held exclusively, lock free or lock in managed mode. If the lock is held in the managed mode, the ownership of the lock can be transferred to another node without a use of a mutual exclusion primitive such as the SCSI reservation.
-
Citations
18 Claims
-
1. A method of breaking and acquiring a lock on a shared resource on a network, wherein the lock is held by a node, the method comprising:
-
reading lock metadata for the lock; based on the lock metadata, determining the lock is in a managed mode and is held by the node and is not being used by the node; sending a request to the node to release the lock; determining that the node has not renewed a lock lease time and that the lock lease time has expired; and breaking and acquiring the lock by performing an operation on the shared resource using a mutual exclusion primitive, updating a local lock metadata to include information that a new lock owner node owns the lock, and updating the lock metadata in a shared storage to add a pointer to point to a heartbeat region for the new lock owner node. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A method of acquiring a lock by a first node, the method comprising:
-
changing a lock state in a local lock metadata for the lock attempting to be acquired by the first node to indicate that the lock is requested by the first node; reading lock information from a heartbeat region; responsive to the lock information indicating that the lock is being held by a second node, sending a request to the second node to release the lock; responsive to the lock information indicating that the lock is free or that the first node has the lock or that the lock points to a stale heartbeat region, attempting to acquire the lock; and prior to the step of changing the lock state in a local lock metadata for the lock attempting to be acquired by the first node to indicate that the lock is requested by the first node; checking the local lock metadata to determine whether the lock is in a managed mode in which the lock is owned by a second node but the lock is not being used by the second node and a lock lease has not timed out; responsive to the lock being in a managed mode and the lock lease not being timed out, updating the lock state in a shared storage of lock metadata to indicate that the lock is held by the first node, thereby allowing the first node to acquire the lock without going through a process of a mutual exclusion primitive; and responsive to the lock not being m a managed mode, proceeding to the step of changing the lock state in the local lock metadata to indicate that the lock is requested by the first node. - View Dependent Claims (10, 11, 12, 13, 14, 15)
-
-
16. A method of managing a lock on a shared resource on a network, the method comprising:
-
maintaining a heartbeat region for a node on a shared storage on the network, the heartbeat region includes memory to store heartbeats of the node and memory to store a lock metadata of a corresponding lock; maintaining a local lock metadata in the node to store status of a lock when the lock is owned by the node; and responsive to a node attempting to acquire a lock, performing the steps comprising; checking the local lock metadata to determine whether the lock is already owned by the node; responsive to the lock is not being owned by the node, probing the lock metadata in the shared storage to retrieve the status of the lock and current owner of the lock; and responsive to the status indicating that the lock is being held by another node in a managed mode in which the lock is being owned by that node but the shared resource is not being used by that node, requesting the another node to grant the lock to the node. - View Dependent Claims (17, 18)
-
Specification