CN109753485B - Disk lock management method and device - Google Patents

Disk lock management method and device Download PDF

Info

Publication number
CN109753485B
CN109753485B CN201811496918.4A CN201811496918A CN109753485B CN 109753485 B CN109753485 B CN 109753485B CN 201811496918 A CN201811496918 A CN 201811496918A CN 109753485 B CN109753485 B CN 109753485B
Authority
CN
China
Prior art keywords
disk lock
node
target
identity
target disk
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811496918.4A
Other languages
Chinese (zh)
Other versions
CN109753485A (en
Inventor
张端
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Cloud Technologies Co Ltd
Original Assignee
New H3C Cloud Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Cloud Technologies Co Ltd filed Critical New H3C Cloud Technologies Co Ltd
Priority to CN201811496918.4A priority Critical patent/CN109753485B/en
Publication of CN109753485A publication Critical patent/CN109753485A/en
Application granted granted Critical
Publication of CN109753485B publication Critical patent/CN109753485B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention provides a disk lock management method and device, and relates to the technical field of data processing. The method and the device analyze the received unlocking request to obtain a logical block address and a first identity, read a second identity of a resource corresponding to the actual disk lock when the actual disk lock corresponding to the logical block address is found, and unlock the target disk lock when the first identity is consistent with the second identity so that the second node locks the target disk lock. By judging whether the first identity identification of the resource corresponding to the target disk lock is consistent with the second identity identification of the resource corresponding to the actual disk lock, and when the first identity identification is consistent with the second identity identification, the resource corresponding to the target disk lock and the resource corresponding to the actual disk lock are actually the same resource, the resource acquired by the second node is ensured to be the target resource, and the problems of read-only of a file system or crash of a server and the like are avoided.

Description

Disk lock management method and device
Technical Field
The invention relates to the technical field of data processing, in particular to a disk lock management method and device.
Background
The shared file system means that a plurality of nodes form a cluster, access to the same storage space, read and write files on any node, still can access the files on other nodes, and negotiate read and write permissions through a distributed lock between the nodes.
The disk lock is an implementation form of a distributed lock, a node with the disk lock is used for accessing the right of a resource corresponding to the disk lock, the node writes locking and unlocking messages into the disk in a Small Computer System Interface (SCSI) command mode through an optical Fiber Storage Area Network (FC SAN) or an Internet Protocol Storage Area Network (IP SAN) or an SCSI command mode through an IP SAN, or reads out the lock state from the disk in a SCSI command mode through the FC-SAN or the IP-SAN, and therefore whether locking or unlocking is performed is determined.
In the prior art, a node holding a target disk lock cannot distinguish a received unlocking request, so that even if the node holding the target disk lock receives an overdue unlocking request, the node can directly unlock the disk lock corresponding to a logical block address contained in the unlocking request; if the node holding the target disk lock deletes the resource corresponding to the target disk lock before receiving the unlocking request, the node holding the target disk lock unlocks the newly-built disk lock which is the same as the logical block address contained in the unlocking request, which may cause the resource actually acquired by initiating the unlocking request to be inconsistent with the target resource, and may cause problems such as read-only of a file system or downtime of a server.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a method and an apparatus for managing a disk lock, so as to avoid the problems of inconsistent data, read-only file system or server crash caused by processing expired messages.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:
in a first aspect, an embodiment of the present invention provides a disk lock management method, which is applied to a first node of a shared file system, where the first node is in communication connection with a second node of the shared file system, and the disk lock management method includes:
receiving an unlocking request transmitted by a second node and generated based on a logical block address of a target disk lock and a first identity of a resource corresponding to the target disk lock;
analyzing the unlocking request to obtain the logic block address and the first identity mark;
when the actual disk lock corresponding to the logical block address is found, reading a second identity of the resource corresponding to the actual disk lock;
and when the first identity identification is consistent with the second identity identification, unlocking the target disk lock so that the second node locks the target disk lock.
In a second aspect, an embodiment of the present invention further provides a disk lock management method, which is applied to a second node of a shared file system, where the second node is in communication connection with at least one first node of the shared file system, and the disk lock management method includes:
sending an unlocking request generated based on a logical block address of a target disk lock and a first identity of a resource corresponding to the target disk lock to a target node which holds the target disk lock in the at least one first node, so that the target node reads a second identity of the resource corresponding to the actual disk lock when finding the actual disk lock corresponding to the logical block address according to the unlocking request, and unlocking the target disk lock when the first identity is consistent with the second identity;
and when the target disk lock is not held by the target node, locking the target disk lock.
In a third aspect, an embodiment of the present invention further provides a disk lock management device, which is applied to a first node of a shared file system, where the first node is in communication connection with a second node of the shared file system, and the disk lock management device includes an information receiving unit, an analysis unit, a reading unit, and a disk lock management unit. The information receiving unit is used for receiving an unlocking request which is transmitted by a second node and generated based on the logical block address of a target disk lock and a first identity of a resource corresponding to the target disk lock; the analysis unit is used for analyzing the unlocking request to obtain the logical block address and the first identity identification; the reading unit is used for reading a second identity of a resource corresponding to the actual disk lock when the actual disk lock corresponding to the logical block address is found; and the disk lock management unit is used for unlocking the target disk lock when the first identity identification is consistent with the second identity identification so that the second node locks the target disk lock.
In a fourth aspect, an embodiment of the present invention further provides a disk lock management device, which is applied to a second node of a shared file system, where the second node is in communication connection with at least one first node of the shared file system, and the disk lock management device includes an information sending unit and a disk lock management unit. The information sending unit is used for sending an unlocking request generated based on a logical block address of a target disk lock and a first identity of a resource corresponding to the target disk lock to a target node which holds the target disk lock in the at least one first node, so that the target node reads a second identity of the resource corresponding to the actual disk lock when finding the actual disk lock corresponding to the logical block address according to the unlocking request, and performs unlocking operation on the target disk lock when the first identity is consistent with the second identity; and the disk lock management unit is used for locking the target disk lock when the target disk lock is not held by the target node.
According to the disk lock management method and device provided by the embodiment of the invention, the unlocking request transmitted by the second node and generated based on the logical block address and the first identity of the target disk lock is received and analyzed to obtain the logical block address and the first identity, when the actual disk lock corresponding to the logical block address is found, the second identity of the actual disk lock is read, and when the first identity is consistent with the second identity, the target disk lock is unlocked so that the second node locks the target disk lock. Whether the first identity identification of the target disk lock is consistent with the second identity identification of the actual disk lock or not is judged, when the first identity identification is consistent with the second identity identification, it is indicated that the resource corresponding to the target disk lock is actually the same resource as the resource corresponding to the actual disk lock, and the unlocking request transmitted by the second node is not an overdue message, so that the fact that the resource acquired by the second node is the target resource is ensured, and the problems of read-only of a file system or downtime of a server and the like are avoided.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic diagram illustrating a logical structure of a shared file system according to an embodiment of the present invention.
Fig. 2 is a block diagram illustrating a node according to an embodiment of the present invention.
FIG. 3 shows a schematic of the structure of a resource stored in a shared storage device.
Fig. 4 shows a flowchart of a disk lock management method according to a first embodiment of the present invention.
Fig. 5 shows a specific structure diagram of a resource.
Fig. 6 shows a flowchart of a disk lock management method according to a second embodiment of the present invention.
Fig. 7 is a functional block diagram showing a disk lock management apparatus according to a third embodiment of the present invention.
Fig. 8 is a functional block diagram showing a disk lock management apparatus according to a fourth embodiment of the present invention.
Icon: 100-shared file system; 110-node; 120-shared storage; 122-a resource; 1222-disk lock; 1224-metadata; 130-a storage network; 140-a management network; 111-a memory; 112-a processor; 113-a communication unit; 200-disk lock management means; 210-an information receiving unit; 220-an analysis unit; 230-a reading unit; 240-a judgment unit; 250-disk lock management unit; 260-an unlocking request generating unit; 270-information sending unit.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It is noted that relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
In a shared file system, different nodes may access the same storage device. When a node needs to access a certain resource, a disk lock corresponding to the resource needs to be applied to a storage device storing the resource, if the disk lock is not held by any node, the node accessing the resource can directly read the resource and perform locking operation on the disk lock corresponding to the resource to become a holding node of the disk lock; if the disk lock is held by a node, a node accessing the resource needs to initiate an unlocking request to the node holding the disk lock, where the unlocking request includes the logical block address of the disk lock, and after the node holding the disk lock receives the unlocking request, the node directly performs an unlocking operation on the disk lock corresponding to the logical block address included in the unlocking request, and does not distinguish the unlocking request.
Fig. 1 is a schematic diagram of a logic structure of a shared file system 100 according to an embodiment of the present invention. The shared file system 100 includes a plurality of nodes 110, a shared storage device 120, a storage network 130, and a management network 140, wherein each node 110 is communicatively connected to the shared storage device 120 through the storage network 130, and each node 110 is communicatively connected to each other through the management network 140.
Wherein each node 110 is a server. Each node 110 may access resources 122 stored within the shared storage 120 through the storage network 130; meanwhile, different nodes 110 may communicate with each other through the management network 140, such as receiving/sending unlocking requests, and the like.
In an alternative embodiment, the management network 140 includes the management network 140 implemented in a Transmission Control Protocol (TCP).
In an alternative embodiment, the Storage Network 130 may be a Fiber Channel Storage Area Network (FC SAN) or an Internet Protocol Storage Area Network (IP SAN).
Referring to fig. 2, a block diagram of a node 110 according to an embodiment of the present invention is shown. The server includes a disk lock management device 200, a processor 112, a memory 111, and a communication unit 113.
The memory 111, the processor 112 and the communication unit 113 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The disk lock management device 200 includes at least one software functional module which can be stored in the memory 111 in the form of software or Firmware (Firmware) or solidified in an Operating System (OS) of the server. The processor 112 is used for executing executable modules stored in the memory 111, such as software functional modules and computer programs included in the disk lock management device 200.
The Memory 111 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 111 is used to store programs or data.
The communication unit 113 is configured to establish a communication connection between the node 110 and another communication terminal through the network, and to transceive data through the network.
The shared storage device 120 has data stored thereon, and the data stored on the shared storage device 120 is accessed and stored in a form supported by the shared file system 100. For example, data stored in shared storage 120 may be organized as files that are shared by different nodes 110.
In an alternative embodiment, the shared storage 120 divides the data into a plurality of resources 122, and each resource 122 is organized in the form of a file. Please refer to fig. 3, which is a schematic structural diagram of the resource 122. Each resource 122 includes a disk lock 1222 and metadata 1224. The metadata 1224 stores information such as a unique Logical Block Address (LBA) and a unique identifier of the resource 122, and the disk lock 1222 corresponding to the LBA and the identifier of the resource 122 can be found through the LBA. Meanwhile, each disk lock 1222 contains holding information and the like, wherein the holding information is used to represent whether the disk lock 1222 is held by a certain node 110, specifically, if a certain disk lock 1222 is held by a node 110, the holding information contains the identification of the node 110 holding the disk lock 1222.
In an alternative embodiment, the identity identifies a serial number created by the shared storage device 120 for the resource 122 when the resource 122 is created.
First embodiment
The embodiment of the invention provides a disk lock management method, which is applied to a first node of a shared file system 100, wherein the first node is in communication connection with a second node of the shared file system 100, and is used for avoiding the problems of data inconsistency, file system read-only or server downtime and the like caused by processing of outdated messages.
It should be noted that, in this embodiment, the second node is a node 110 that initiates an access request to a certain resource 122 of the shared file system 100, and the first node is a node 110 that holds a disk lock 1222 corresponding to the resource 122.
It should be further noted that, in other embodiments, the second node may be a node 110 holding a disk lock 1222 corresponding to the resource 122, and the first node may be a node 110 initiating an access request to a certain resource 122 of the shared file system 100, that is, each node 110 may be a node 110 initiating an access request to a certain resource 122 of the shared file system 100, or may be a node 110 holding a disk lock 1222 corresponding to a certain resource 122.
Fig. 4 is a flowchart of a disk lock management method according to an embodiment of the present invention. The disk lock management method comprises the following steps:
step S401: and receiving an unlocking request transmitted by the second node and generated based on the logical block address of the target disk lock and the first identity corresponding to the target disk lock.
Specifically, the first node receives an unlock request transmitted by the second node through the management network 140. And the unlocking request is used for unlocking the target disk lock.
Before the first node receives an unlocking request transmitted by the second node, the second node determines that the target disk lock is held by the first node by reading holding information of the target disk lock, meanwhile, the second node also needs to read a first identity of a resource 122 corresponding to the target disk lock, and then generates the unlocking request based on the logical block address and the first identity.
For example, as shown in fig. 5, the resource 122 has a logical block address 2179ED38A5C9671B, which is a random code expressed by 16-bit numbers and 64 bits in total, and when the second node issues an access request to the resource 122 according to the logical block address 2179ED38A5C9671B, the holding information of the target disk lock is read to be 02, and 02 is the node identifier of the first node, so as to determine that the target disk lock is held by the first node. Meanwhile, the identity identifier in the metadata 1224 is read, and the identity identifier of the resource 122 corresponding to the target disk lock is determined to be 421F89BD352A4C16, and similarly, the identity identifier is also a random code which has 64 bits in total and is represented by a 16-ary number; an unlock request is then generated based on the logical block address 2179ED38A5C9671B and the first identity 421F89BD352A4C 16.
The resource 122 to which a disk lock 1222 belongs is the resource 122 corresponding to the disk lock 1222. Meanwhile, it should be noted that although the same logical block address may store different resources 122 at different time points, each resource 122 has a unique identity, so as to be distinguished from other different resources 122, and the first identity is the identity of the resource 122 corresponding to the target disk lock.
Step S402: and analyzing the unlocking request to obtain the logical block address and the first identity identification.
That is, the logical block address and the first identity identifier are obtained from the unlocking request transmitted from the second node.
Step S403: when the actual disk lock corresponding to the logical block address is found, the second id of the resource 122 corresponding to the actual disk lock is read.
Because the same logical block address may store different resources 122 at different time points, if the first node deletes the resource 122 (hereinafter, referred to as an old resource) corresponding to the target disk lock before receiving the unlocking request, and creates a new resource 122 (hereinafter, referred to as a new resource) at the logical block address where the old resource is located, the old resource and the new resource have the same logical block address, at this time, the second node may find the disk lock 1222 of the new resource according to the logical block address carried by the unlocking request, and if the disk lock 1222 of the new resource is directly unlocked, the second node actually accesses the new resource, but not the new resource, which is the old resource of the target resource, which may cause the problem that the resource 122 actually obtained by initiating the unlocking request is inconsistent with the target resource, and may cause a read-only file system or a server crash.
Therefore, when the actual disk lock corresponding to the logical block address is found, the second identifier of the resource 122 corresponding to the actual disk lock is first read to determine whether the resource 122 corresponding to the logical block address is an old resource serving as the target resource of the second node.
Step S404: judging whether the first identity mark is consistent with the second identity mark, if so, executing the step S405; if not, step S406 is performed.
Since each resource 122 has a unique identity, it can be determined whether the resource 122 corresponding to the actual disk lock is the resource 122 corresponding to the target disk lock by determining whether the first identity is consistent with the second identity.
For example, when the second id is 421F89BD352A4C16, the first id is determined to be consistent with the second id, otherwise, the first id is determined to be inconsistent with the second id.
Step S405: and unlocking the target disk lock so that the second node locks the target disk lock.
When the first identity is consistent with the second identity, the resource 122 corresponding to the actual disk lock is the resource 122 corresponding to the target disk lock, the actual disk lock is the target disk lock, and the unlocking request is not an expired message, so that the target disk lock is unlocked.
Meanwhile, after the first node unlocks the target disk, the second node can lock the target disk lock, so as to access the resource 122 corresponding to the target disk lock.
In an optional embodiment, after determining that the first identity is consistent with the second identity, the first node may unlock the target disk lock when there is no currently ongoing access operation on the resource 122 or when the currently ongoing access operation on the resource 122 is finished.
Step S406: the locked state of the target disk lock is maintained.
When the first identity identifier is inconsistent with the second identity identifier, the resource 122 corresponding to the actual disk lock is not the resource 122 corresponding to the target disk lock, the unlocking request fails, and the first node discards the unlocking request and maintains the locking state of the target disk lock, so that the problems of file system read-only or server crash and the like caused by the inconsistency between the resource 122 actually acquired by the second node and the target resource are avoided.
Second embodiment
The embodiment of the invention provides a disk lock management method, which is applied to a second node of a shared file system 100, wherein the second node is in communication connection with at least one first node of the shared file system 100, and is used for avoiding the problems of data inconsistency, file system read-only or server downtime and the like caused by processing of outdated messages.
It should be noted that the second node in this embodiment is a node 110 that initiates an access request to a certain resource 122 of the shared file system 100, and at least one first node is a node 110 that is mounted on the same shared file system 100 as the second node, that is, a node 110 belonging to the same cluster. In addition, there may be a node 110 holding a target disk lock corresponding to the resource 122 in the at least one first node, and there may not be a node 110 holding a target disk lock corresponding to the resource 122.
Fig. 6 is a flowchart of a disk lock management method according to an embodiment of the present invention. The disk lock management method comprises the following steps:
step S601: and reading the corresponding target disk lock according to the acquired logical block address.
When the second node initiates an access request to the target resource according to the acquired logical block address, the second node needs to first lock the target disk according to the target resource.
For example, disk lock 1222 of the resource shown in FIG. 5 is read according to logical block address 2179ED38A5C 9671B.
Step S602: judging whether the target disk lock is held by at least one first node, if so, executing step S603; if not, step S607 is performed.
Specifically, it can be determined whether the target disk lock is held by at least one first node by reading the holding information included in the target disk lock.
For example, the holding information does not include the node identifier of any first node, that is, when the holding information is empty, the target disk lock is not held by any first node in the at least one first node. On the contrary, when the holding information includes the node identifier shown in fig. 5, it indicates that the target disk lock is held by the first node with the node identifier 02, and the first node with the node identifier 02 is taken as the target node.
Step S603: when the target disk lock is held by a target node of the at least one first node, a first identity of the resource 122 corresponding to the target disk lock is read.
By reading the first identity of the resource 122 corresponding to the target disk lock, the first identity can be used as a reference for a subsequent target node to determine whether the unlocking request is expired.
Step S604: an unlocking request is generated based on the logical block address of the target disk lock and the first identity of the resource 122 corresponding to the target disk lock.
By adding the first identity identifier of the resource 122 corresponding to the target disk lock into the unlocking request, the target node can analyze the first identity identifier according to the received unlocking request, so that the first identity identifier is used as a reference for subsequently judging whether the unlocking request is expired.
For example, when a second node initiates an access request to a resource 122 as shown in FIG. 5, an unlock request needs to be generated based on the logical block address 2179ED38A5C9671B and the first identity 421F89BD352A4C 16.
Step S605: and sending an unlocking request generated based on the logical block address of the target disk lock and the first identity of the resource 122 corresponding to the target disk lock to a target node with the target disk lock in the at least one first node, so that the target node reads the second identity of the resource 122 corresponding to the actual disk lock when finding the actual disk lock corresponding to the logical block address according to the unlocking request, and unlocking the target disk lock when the first identity is consistent with the second identity.
Step S606: judging whether the target disk lock is held by the target node, if so, executing the step S601 again; if not, step S607 is performed.
After the second node sends an unlocking request to the target node, whether the target disk lock is held by the target node is judged so as to determine whether the locking operation can be continued.
When the target disk lock is still held by the target node, step S604 is executed again, so that the second node can know that the target node successfully performs the unlocking operation on the target disk lock in the first time.
In an alternative embodiment, after sending the unlocking request to the target node holding the target disk lock in the at least one first node, the second node may read the holding information of the target disk lock to determine whether the target disk lock is still held by the target node.
In another optional embodiment, after the target node successfully unlocks the target disk lock, the target node sends a message that the unlocking is successful to the second node, and when the second node receives the message that the unlocking is successful, the second node can determine that the target disk lock is no longer held by the target node.
Step S607: and locking the target disk lock.
It is to be understood that the second node performs the locking operation on the target disk lock when the target disk lock is not held by any of the at least one first node.
In addition, if the target disk lock is not held by the target node, it indicates that the target node has read the second identity of the resource 122 corresponding to the actual disk lock when finding the actual disk lock corresponding to the logical block address according to the unlocking request, and performs an unlocking operation on the target disk lock when the first identity is consistent with the second identity, so that the target disk lock is not held by any first node in the at least one first node at this time, and thus the second node can also perform a locking operation on the target disk lock at this time.
It is understood that, after the locking operation is performed on the target disk lock, the holding information of the target disk lock is written into the node identifier of the second node.
Third embodiment
It should be noted that the basic principle and the generated technical effect of the disk lock management device 200 provided in this embodiment are the same as those of the first embodiment, and for brief description, reference may be made to corresponding contents in the first embodiment for the part not mentioned in this embodiment. Referring to fig. 7, a functional block diagram of a disk lock management device 200 according to an embodiment of the present invention is shown, where the disk lock management device 200 includes: an information receiving unit 210, a parsing unit 220, a reading unit 230, a judging unit 240, and a disk lock management unit 250.
The information receiving unit 210 is configured to receive an unlocking request transmitted by the second node and generated based on the logical block address of the target disk lock and the first identity of the resource 122 corresponding to the target disk lock.
It is to be understood that, in a preferred embodiment, the information receiving unit 210 is operable to perform step S401.
The parsing unit 220 is configured to parse the unlocking request to obtain the logical block address and the first identity identifier.
It is to be understood that, in a preferred embodiment, the parsing unit 220 may be configured to perform the step S402.
The reading unit 230 is configured to, when the actual disk lock corresponding to the logical block address is found, read the second identity of the resource 122 corresponding to the actual disk lock.
It is to be understood that, in a preferred embodiment, the reading unit 230 is operable to perform step S403.
The determining unit 240 is configured to determine whether the first identity is consistent with the second identity.
It is to be understood that, in a preferred embodiment, the judging unit 240 is operable to execute the step S404.
The disk lock management unit 250 is configured to, when the first identity is consistent with the second identity, perform an unlocking operation on the target disk lock so that the second node performs a locking operation on the target disk lock.
The disk lock management unit 250 is further configured to maintain the locked state of the target disk lock when the first identity is inconsistent with the second identity.
It is understood that, in a preferred embodiment, the disk lock management unit 250 is configured to execute step S405 and step S406.
Fourth embodiment
It should be noted that the basic principle and the generated technical effect of the disk lock management device 200 provided in this embodiment are the same as those of the second embodiment, and for brief description, reference may be made to corresponding contents in the second embodiment for the part not mentioned in this embodiment. Referring to fig. 8, a functional block diagram of a disk lock management device 200 according to an embodiment of the present invention is shown, where the disk lock management device 200 includes: a reading unit 230, a judging unit 240, an unlocking request generating unit 260, an information transmitting unit 270, and a disk lock managing unit 250.
The reading unit 230 is configured to read the corresponding target disk lock according to the acquired logical block address.
It is to be understood that, in a preferred embodiment, the reading unit 230 may be configured to perform step S601.
The determining unit 240 is configured to determine whether the target disk lock is held by at least one first node.
It is to be understood that, in a preferred embodiment, the determining unit 240 is configured to execute step S602.
The reading unit 230 is further configured to read a first identity of the resource 122 corresponding to the target disk lock when the target disk lock is held by a target node of the at least one first node.
It is to be understood that, in a preferred embodiment, the reading unit 230 is configured to perform step S603.
The unlocking request generating unit 260 is configured to generate an unlocking request based on the logical block address of the target disk lock and the first identity of the resource 122 corresponding to the target disk lock.
It is to be understood that, in a preferred embodiment, the unlocking request generating unit 260 is operable to execute the step S604.
The information sending unit 270 is configured to send, to a target node having a target disk lock in the at least one first node, an unlocking request generated based on the logical block address of the target disk lock and the first identity of the resource 122 corresponding to the target disk lock, so that the target node reads the second identity of the resource 122 corresponding to the actual disk lock when finding the actual disk lock corresponding to the logical block address according to the unlocking request, and performs an unlocking operation on the target disk lock when the first identity is consistent with the second identity.
It is to be understood that, in a preferred embodiment, the information sending unit 270 is configured to execute step S605.
The determining unit 240 is further configured to determine whether the target disk lock is held by the target node.
It is to be understood that, in a preferred embodiment, the determining unit 240 is configured to execute the step S606.
The disk lock management unit 250 is configured to lock the target disk lock when the target disk lock is held by any one of the at least one first node or when the target disk lock is not held by the target node.
It is to be appreciated that, in a preferred embodiment, the disk lock management unit 250 is operable to perform step S607.
In summary, the disk lock management method and apparatus provided in the embodiments of the present invention receive an unlocking request transmitted by a second node and generated based on a logical block address of a target disk lock and a first identity, analyze the unlocking request to obtain the logical block address and the first identity, read a second identity of the actual disk lock when the actual disk lock corresponding to the logical block address is found, and unlock the target disk lock when the first identity and the second identity are consistent, so that the second node locks the target disk lock. Whether the first identity identification of the target disk lock is consistent with the second identity identification of the actual disk lock or not is judged, when the first identity identification is consistent with the second identity identification, it is indicated that the resource corresponding to the target disk lock is actually the same resource as the resource corresponding to the actual disk lock, and the unlocking request transmitted by the second node is not an overdue message, so that the fact that the resource acquired by the second node is the target resource is ensured, and the problems of read-only of a file system or downtime of a server and the like are avoided.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A disk lock management method is applied to a first node of a shared file system, and the first node is in communication connection with a second node of the shared file system, and the disk lock management method comprises the following steps:
receiving an unlocking request transmitted by a second node and generated based on a logical block address of a target disk lock and a first identity of a resource corresponding to the target disk lock;
analyzing the unlocking request to obtain the logic block address and the first identity mark;
when the actual disk lock corresponding to the logical block address is found, reading a second identity of the resource corresponding to the actual disk lock;
when the first identity mark is consistent with the second identity mark, unlocking the target disk lock so that the second node locks the target disk lock;
and when the first identity mark is inconsistent with the second identity mark, keeping the locking state of the target disk lock.
2. A disk lock management method is applied to a second node of a shared file system, the second node is in communication connection with at least one first node of the shared file system, and the disk lock management method comprises the following steps:
sending an unlocking request generated based on a logical block address of a target disk lock and a first identity of a resource corresponding to the target disk lock to a target node which holds the target disk lock in the at least one first node, so that the target node reads a second identity of the resource corresponding to the actual disk lock when finding the actual disk lock corresponding to the logical block address according to the unlocking request, performs unlocking operation on the target disk lock when the first identity is consistent with the second identity, and maintains the locking state of the target disk lock when the first identity is inconsistent with the second identity;
and when the target disk lock is not held by the target node, locking the target disk lock.
3. The disk lock management method according to claim 2, wherein before the step of sending, to a target node holding a target disk lock among the at least one first node, an unlocking request generated based on the logical block address of the target disk lock and the first identity of the resource corresponding to the target disk lock, the disk lock management method further includes:
reading a corresponding target disk lock according to the acquired logical block address;
judging whether the target disk lock is held by the at least one first node;
when the target disk lock is held by the target node in the at least one first node, reading a first identity of a resource corresponding to the target disk lock;
and generating the unlocking request based on the logic block address of the target disk lock and the first identity of the resource corresponding to the target disk lock.
4. The disk lock management method according to claim 3, wherein after the step of determining whether the target disk lock is held by the at least one first node, the disk lock management method further comprises:
and when the target disk lock is not held by the at least one first node, locking the target disk lock.
5. A disk lock management device is applied to a first node of a shared file system, and the first node is in communication connection with a second node of the shared file system, and the disk lock management device comprises:
the information receiving unit is used for receiving an unlocking request which is transmitted by a second node and generated based on the logical block address of a target disk lock and a first identity of a resource corresponding to the target disk lock;
the analysis unit is used for analyzing the unlocking request to obtain the logical block address and the first identity identifier;
the reading unit is used for reading a second identity of a resource corresponding to the actual disk lock when the actual disk lock corresponding to the logical block address is found;
the disk lock management unit is used for unlocking the target disk lock to enable the second node to lock the target disk lock when the first identity is consistent with the second identity;
and the disk lock management unit is further used for keeping the locking state of the target disk lock when the first identity identification is inconsistent with the second identity identification.
6. A disk lock management apparatus, applied to a second node of a shared file system, where the second node is in communication connection with at least one first node of the shared file system, the disk lock management apparatus comprising:
an information sending unit, configured to send, to a target node holding a target disk lock among the at least one first node, an unlocking request generated based on a logical block address of the target disk lock and a first identity of a resource corresponding to the target disk lock, so that when the target node finds an actual disk lock corresponding to the logical block address according to the unlocking request, a second identity of the resource corresponding to the actual disk lock is read, and when the first identity is consistent with the second identity, an unlocking operation is performed on the target disk lock, and when the first identity is inconsistent with the second identity, a locked state of the target disk lock is maintained;
and the disk lock management unit is used for locking the target disk lock when the target disk lock is not held by the target node.
7. The disk lock management device according to claim 6, wherein the disk lock management device further comprises:
the reading unit is used for reading the corresponding target disk lock according to the acquired logical block address;
the judging unit is used for judging whether the target disk lock is held by the at least one first node;
the reading unit is further configured to read a first identity of a resource corresponding to the target disk lock when the target disk lock is held by the target node in the at least one first node;
and the unlocking request generating unit is used for generating the unlocking request based on the logic block address of the target disk lock and the first identity of the resource corresponding to the target disk lock.
8. The apparatus according to claim 7, wherein the disk lock management unit is further configured to lock the target disk lock when the target disk lock is not held by the at least one first node.
CN201811496918.4A 2018-12-07 2018-12-07 Disk lock management method and device Active CN109753485B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811496918.4A CN109753485B (en) 2018-12-07 2018-12-07 Disk lock management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811496918.4A CN109753485B (en) 2018-12-07 2018-12-07 Disk lock management method and device

Publications (2)

Publication Number Publication Date
CN109753485A CN109753485A (en) 2019-05-14
CN109753485B true CN109753485B (en) 2021-05-07

Family

ID=66403637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811496918.4A Active CN109753485B (en) 2018-12-07 2018-12-07 Disk lock management method and device

Country Status (1)

Country Link
CN (1) CN109753485B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113986124B (en) * 2021-10-25 2024-02-23 深信服科技股份有限公司 User configuration file access method, device, equipment and medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102239660A (en) * 2008-12-08 2011-11-09 贝金姆·维瑟利 System and method to authenticate products

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7228351B2 (en) * 2002-12-31 2007-06-05 International Business Machines Corporation Method and apparatus for managing resource contention in a multisystem cluster
CN101650646B (en) * 2009-09-22 2012-02-08 杭州华三通信技术有限公司 Method and device for realizing shared data consistency
US9703931B2 (en) * 2012-06-06 2017-07-11 Jennifer M. Hinkel Method and system for authenticating and monitoring home health interactions
CN106648909A (en) * 2016-10-13 2017-05-10 华为技术有限公司 Management method and device for dish lock and system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102239660A (en) * 2008-12-08 2011-11-09 贝金姆·维瑟利 System and method to authenticate products

Also Published As

Publication number Publication date
CN109753485A (en) 2019-05-14

Similar Documents

Publication Publication Date Title
EP2695083B1 (en) Cluster unique identifier
US9977811B2 (en) Presenting availability statuses of synchronized objects
KR102606582B1 (en) File service using a shared file access-rest interface
CN109101341B (en) Distribution method and equipment of distributed lock
CN112153085B (en) Data processing method, node and block chain system
US10749985B2 (en) Custom communication channels for application deployment
EP3470984B1 (en) Method, device, and system for managing disk lock
US20050125461A1 (en) Version control of metadata
US20080120297A1 (en) Versioning and concurrency control for multiple client access of data
EP3495981B1 (en) Directory deletion method and device, and storage server
EP4161012A1 (en) Authentication method and apparatus, electronic device, server, program, and storage medium
US11811839B2 (en) Managed distribution of data stream contents
CN115114305B (en) Lock management method, device, equipment and storage medium for distributed database
US20210216523A1 (en) Data Storage Method, Metadata Server, and Client
CN109753485B (en) Disk lock management method and device
CN106878252B (en) Method for establishing password-free login relationship, method for clearing account and device thereof
CN116070294B (en) Authority management method, system, device, server and storage medium
TWI571754B (en) Method for performing file synchronization control, and associated apparatus
CN115269541A (en) File interconversion method, device, equipment and storage medium
CN117643015A (en) Snapshot-based client-side key modification of log records manages keys across a series of nodes
CN113553566A (en) Account locking method and device, electronic equipment and computer readable storage medium
CN109408485B (en) Distributed lock implementation method and system
KR101852727B1 (en) Cross-Resource Subscriptions Management Method
US11907137B2 (en) Systems and methods for leader node election in cluster server configurations
WO2022077777A1 (en) Locking reapplication method, lock management method, and server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant