Hybrid Locking Using Network and On-Disk Based Schemes
First Claim
1. A method of acquiring a lock by a node, on a shared resource in a system of a plurality of interconnected nodes, the method comprising:
- (a) probing a local lock metadata of the node to determine if a lock metadata of the lock exists in the local lock metadata, wherein the lock metadata includes an identity of the lock and a lock status;
(b) if the lock metadata does not exist in the local lock metadata, performing steps (i) to (iv),(i) reading shared lock metadata of the lock from a shared storage, the reading includes identifying a current owner of the lock and a current status of the lock;
(ii) probing heartbeat region of the current owner of the lock to ascertain if the current owner is alive, wherein if the current owner is not alive, waiting for a lock lease time to run out and then acquiring the lock and updating the shared lock metadata to indicate that the lock is now owned by the node;
(iii) if the current status of the lock indicates that the current owner is holding the lock in an exclusive mode, returning a message to the node to notify that the lock is not free;
(iv) if the current status of the lock indicates that the current owner is holding the lock in a managed mode, sending a request to the current owner to release the lock, wherein if the current owner has already not released the lock to another requesting node, the lock is granted to the node without performing a mutual exclusive primitive operation on the shared resource, and the shared lock metadata is updated to indicate new lock ownership and lock status; and
(c) if the lock metadata exists in the local lock metadata, of the node, probing the lock status of the lock in the local lock metadata, if the lock status of the lock in the local lock metadata indicates that the lock being owned in a managed mode, changing the lock status of the lock in local lock metadata to indicate an exclusive use of the lock by the node and updating the shared lock metadata to indicate that the lock being owned by the node in an exclusive mode,wherein the managed mode means that the lock is being owned by the node but the lock is not being used by the node.
2 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.
92 Citations
20 Claims
-
1. A method of acquiring a lock by a node, on a shared resource in a system of a plurality of interconnected nodes, the method comprising:
-
(a) probing a local lock metadata of the node to determine if a lock metadata of the lock exists in the local lock metadata, wherein the lock metadata includes an identity of the lock and a lock status; (b) if the lock metadata does not exist in the local lock metadata, performing steps (i) to (iv), (i) reading shared lock metadata of the lock from a shared storage, the reading includes identifying a current owner of the lock and a current status of the lock; (ii) probing heartbeat region of the current owner of the lock to ascertain if the current owner is alive, wherein if the current owner is not alive, waiting for a lock lease time to run out and then acquiring the lock and updating the shared lock metadata to indicate that the lock is now owned by the node; (iii) if the current status of the lock indicates that the current owner is holding the lock in an exclusive mode, returning a message to the node to notify that the lock is not free; (iv) if the current status of the lock indicates that the current owner is holding the lock in a managed mode, sending a request to the current owner to release the lock, wherein if the current owner has already not released the lock to another requesting node, the lock is granted to the node without performing a mutual exclusive primitive operation on the shared resource, and the shared lock metadata is updated to indicate new lock ownership and lock status; and (c) if the lock metadata exists in the local lock metadata, of the node, probing the lock status of the lock in the local lock metadata, if the lock status of the lock in the local lock metadata indicates that the lock being owned in a managed mode, changing the lock status of the lock in local lock metadata to indicate an exclusive use of the lock by the node and updating the shared lock metadata to indicate that the lock being owned by the node in an exclusive mode, wherein the managed mode means that the lock is being owned by the node but the lock is not being used by the node. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. A method of receiving, at a first node from a second node, a request to release a lock, the method comprising:
-
inspecting a local lock metadata of the first node; sending a message to the second node indicating that the lock is in use if the local lock metadata includes information indicating that the lock is being owned in an exclusive mode; removing information of the lock from the local lock metadata and updating information in a heartbeat region corresponding to the lock to grant the lock to the second node if the local lock metadata includes information indicating that the lock being held by the first node but not in use; and returning back a message to the second node indicating that the lock is free, wherein the request to release is received via an IP network. - View Dependent Claims (12, 13, 14, 15, 16, 17)
-
-
18. A method of managing a lock on a shared resource on a network, the method comprising:
-
maintaining a heartbeat region for the node, wherein the shared resource being accessible to the node and the heartbeat region being maintain on a shared storage on the network, the heartbeat region includes space to store heartbeats of the node and space to store a lock metadata of the lock; maintaining a local lock metadata in the node to store status of the lock when the lock is owned by the node; and wherein, when the node attempts to acquire the lock, checking in the local lock metadata to determine if the lock is already owned by the node, if the lock is not 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, if the status indicates that the lock being held by another node in a managed mode, then requesting the another node to grant the lock to the node, wherein if the lock is granted to the node without a use of a mutual exclusive primitive, wherein the managed mode means that the lock is being owned by the node but the lock is not being used by the node. - View Dependent Claims (19, 20)
-
Specification