Access control method and device for shared storage, medium and program product

By obtaining the storage lock information of the shared storage disk during node initialization and updating the storage lock status, the risk of shared storage being double-written and repeated due to interaction exceptions of master and slave nodes is solved, ensuring data consistency and normal operation of services.

CN119690346APending Publication Date: 2025-03-25INFORMATION2 SOFTWARE SHANGHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411766793.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The existing access control method of shared storage may lead to the risk of shared storage being double-written and repeated when the master-slave node interacts abnormally, resulting in data inconsistency or data loss, affecting the normal operation of the service.

Method used

When the node is initialized, the storage lock information of the shared storage disk is obtained, and the storage lock status of the master node and slave node is updated according to the storage lock information, ensuring that only one node locks and mounts the shared storage disk, avoiding the risk of double-write replication.

Benefits of technology

By setting the storage lock and storage lock status, the operating status of each node is obtained in a timely manner, the risk of shared storage being double-written and duplicated caused by interaction abnormalities of master and slave nodes is reduced, ensuring the consistency of shared storage data, and ensuring the normal operation of services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690346A_ABST
    Figure CN119690346A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of disaster recovery, and discloses an access control method and equipment for shared storage, a medium and a program product. The method comprises the following steps: when a node is initialized, obtaining storage lock information corresponding to a shared storage disk; according to the storage lock information, if a storage lock added to the shared storage disk by the slave node is detected, obtaining a storage lock state corresponding to the slave node; if the storage lock state corresponding to the slave node is a takeover accepting state, the storage lock state corresponding to the master node is updated to a common state from the takeover accepting state; and controlling the main node to add a storage lock to the shared storage disk, and controlling the main node to mount the shared storage disk after the locking is successful. According to the scheme of the embodiment, by setting the storage lock and the storage lock state, the running state of each node can be obtained in time, the risk that shared storage is double-written and duplicated due to interaction abnormity of the master node and the slave node can be reduced, the consistency of shared storage data can be ensured, and normal running of services can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of disaster recovery technology, and in particular to a shared storage access control method, device, medium and program product. Background Art

[0002] By controlling access to shared storage and achieving high service availability, the normal operation of the service can be effectively guaranteed, and fault isolation and recovery can be facilitated.

[0003] At present, the existing shared storage access control method is that when the master and slave nodes mount the same shared storage device, only one working machine can read and write the storage volume group at the same time. When the working machine cannot meet the working conditions, another node can quickly take over the shared storage device to achieve high availability. However, since both the master and slave nodes can access the shared storage, they can both mount the shared storage volume and perform read and write operations. Abnormal interaction between the master and slave nodes may lead to the risk of double-writing the shared storage, resulting in data inconsistency or data loss, which in turn affects the normal operation of the business. Summary of the invention

[0004] The present invention provides a shared storage access control method, device, medium and program product, which can ensure the consistency of shared storage data and the normal operation of services.

[0005] According to one aspect of the present invention, there is provided a method for controlling access to a shared storage, comprising:

[0006] When the node is initialized, the storage lock information corresponding to the shared storage disk is obtained;

[0007] According to the storage lock information, if a storage lock imposed by a slave node on the shared storage disk is detected, a storage lock state corresponding to the slave node is obtained;

[0008] If the storage lock state corresponding to the slave node is in the takeover acceptance state, the storage lock state corresponding to the master node is updated from the takeover acceptance state to the normal state;

[0009] The master node is controlled to add a storage lock to the shared storage disk, and after the lock is successfully added, the master node is controlled to mount the shared storage disk.

[0010] According to another aspect of the present invention, there is provided a shared storage access control device, comprising:

[0011] The storage lock information acquisition module is used to obtain the storage lock information corresponding to the shared storage disk when the node is initialized;

[0012] A storage lock status acquisition module, configured to acquire the storage lock status corresponding to the slave node if a storage lock applied by the slave node to the shared storage disk is detected according to the storage lock information;

[0013] A state updating module, configured to update the storage lock state corresponding to the master node from the accept takeover state to the normal state if the storage lock state corresponding to the slave node is the accept takeover state;

[0014] The disk locking module is used to control the master node to add a storage lock to the shared storage disk, and after the locking is successful, control the master node to mount the shared storage disk.

[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0016] at least one processor; and

[0017] a memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the shared storage access control method described in any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program is used to enable a processor to implement the shared storage access control method described in any embodiment of the present invention when executed.

[0020] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the shared storage access control method according to any embodiment of the present invention is implemented.

[0021] The technical solution of the embodiment of the present invention is as follows: when the node is initialized, the storage lock information corresponding to the shared storage disk is obtained; according to the storage lock information, if the storage lock added by the slave node to the shared storage disk is detected, the storage lock status corresponding to the slave node is obtained; if the storage lock status corresponding to the slave node is the accept takeover status, the storage lock status corresponding to the master node is updated from the accept takeover status to the normal status; the master node is controlled to add a storage lock to the shared storage disk, and after the lock is successfully added, the master node is controlled to mount the shared storage disk. By setting the storage lock and the storage lock status, the operating status of each node can be obtained in time, the risk of shared storage being double-written due to abnormal interaction between the master and slave nodes can be reduced, the consistency of the shared storage data can be ensured, and the normal operation of the business can be ensured.

[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 is a flow chart of a shared storage access control method provided according to Embodiment 1 of the present invention;

[0025] Figure 2 This is a schematic diagram of a process of uninstalling a disk by a master node provided in Embodiment 1 of the present invention;

[0026] Figure 3 It is a schematic diagram of a process of mounting a disk from a node according to the first embodiment of the present invention;

[0027] Figure 4 is a schematic diagram of the structure of a shared storage access control device provided according to Embodiment 2 of the present invention;

[0028] Figure 5 It is a structural schematic diagram of an electronic device for implementing the shared storage access control method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "first", "second", "target", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] Embodiment 1

[0032] Figure 1 A flowchart of a shared storage access control method is provided for the first embodiment of the present invention. This embodiment is applicable to the case where access control is performed on a shared storage device based on host high availability. The method can be executed by a shared storage access control device, which can be implemented in the form of hardware and / or software. Typically, the shared storage access control device can be configured in an electronic device, such as a computer device or a server. Figure 1 As shown, the method includes:

[0033] S110. When the node is initialized, storage lock information corresponding to the shared storage disk is obtained.

[0034] The shared storage disk may be a storage disk accessible to both the master node and the slave node. The storage lock information may include all locks corresponding to the shared storage disk and the status of each lock. In this embodiment, the shared storage disk is locked, and only the node with the storage lock can read and write data to the shared storage disk to ensure that the shared storage disk can only be read and written by a single working machine at the same time. The storage lock feature information definition may include reservation key, cancellation of reservation key, reservation device, release of reservation device, clearing storage lock, modifying key, etc.

[0035] Specifically, the control node of the high-availability system can create a high-availability rule for switching resources to storage volume devices and start the high-availability rule; then, based on the high-availability rule, the log mark can be reset and the initialization mark can be set to false, and the timer can be called after 8 seconds to set a scheduled task. Among them, the scheduled task is responsible for checking the storage lock information corresponding to the shared storage disk and updating the relevant lock status according to the storage lock information. When the high-availability rule needs to be disabled, the timer can be disabled, the storage lock can be released, and the automatic mounting configuration item can be restored to complete the rule deactivation.

[0036] S120. According to the storage lock information, if it is detected that a storage lock is applied by a slave node to the shared storage disk, a storage lock state corresponding to the slave node is obtained.

[0037] In this embodiment, when the node is initialized, the original master node can be controlled to lock the shared storage disk, that is, the master node is responsible for reading and writing data on the shared storage disk. Specifically, according to the current storage lock information, it is determined whether there is a storage lock added by the slave node to the shared storage disk; if it is determined that it does not exist, the master node can be controlled to directly lock the shared storage disk; and if it is determined that it exists, it is necessary to determine whether the master node can take over the shared storage disk according to the storage lock status corresponding to the slave node.

[0038] The storage lock state may include at least one of a normal state, a takeover request state, a takeover rejection state, a takeover acceptance state, an uninstallation failure state, and an identification change state. In this embodiment, different key values ​​may be used to represent different storage lock states, and each node may set a corresponding key value according to its own state to represent its own storage lock state.

[0039] Optionally, obtaining the storage lock state corresponding to the slave node may include:

[0040] Obtaining a key value corresponding to the slave node, and obtaining a target key feature according to the key value and a preset key format;

[0041] According to the target key feature and the mapping relationship between the preset key feature and the storage lock state, the storage lock state corresponding to the slave node is obtained.

[0042] Among them, the preset key format of the key value can be an 8-digit hexadecimal number, the first 4 digits are used as the characteristic value, and the last 4 digits are random numbers generated by the node itself. In a specific example, the mapping relationship between the key feature and the storage lock state can be 100a corresponding to the normal state, 101a corresponding to the request takeover state, 102a corresponding to the refusal to takeover state, 103a corresponding to the acceptance takeover state, 104a corresponding to the unloading failure state, and 105a corresponding to the identification change state. In this embodiment, when the nodes are initialized, their respective key features are set to 103a, that is, the default storage lock state is the acceptance takeover state. The master node reads that the slave node is in the 103a acceptance takeover state, which means that it can be taken over directly. Before taking over, it is necessary to use the 100a key feature to lock. Only when the lock is successful can the shared storage disk be mounted.

[0043] The advantage of the above setting is that it can greatly reduce the risk of shared storage data being double-written or duplicated due to abnormal interaction between master and slave nodes, and can effectively ensure the consistency of shared storage data.

[0044] Specifically, when obtaining the storage lock state corresponding to the slave node, first, the key value corresponding to the slave node can be obtained, and the first 4 digits of the key value can be extracted from the key value according to the preset key format as the target key feature; then, the key feature that is the same as the target key feature can be found from each key feature of the preset mapping relationship, and the storage lock state corresponding to the key feature found can be used as the storage lock state corresponding to the slave node.

[0045] Optionally, after obtaining the storage lock information corresponding to the shared storage disk, the following steps may also be performed:

[0046] According to the storage lock information, if the storage lock added by the slave node to the shared storage disk is not detected, the storage lock state corresponding to the master node is updated from the takeover state to the normal state;

[0047] The master node is controlled to add a storage lock to the shared storage disk, and after the lock is successfully added, the master node is controlled to mount the shared storage disk.

[0048] In another case, according to the current storage lock information, if it is determined that there is no storage lock added by the slave node to the shared storage disk, the storage lock state corresponding to the master node can be updated from the accept takeover state (corresponding to the key feature 103a) to the normal state (corresponding to the key feature 100a), and the 100a key feature can be used to add a storage lock to the shared storage disk. After determining that the lock is successful, the master node can mount the shared storage disk to perform subsequent disk data read and write operations.

[0049] S130: If the storage lock state corresponding to the slave node is in the takeover acceptance state, the storage lock state corresponding to the master node is updated from the takeover acceptance state to the normal state.

[0050] Specifically, if the storage lock state corresponding to the slave node is detected to be in the accept takeover state, which means that the takeover can be performed, the storage lock state corresponding to the master node can be updated from the accept takeover state to the normal state to prepare to lock the shared storage disk. Secondly, if the storage lock state corresponding to the slave node is detected to be in the reject takeover state, a takeover failure prompt message can be generated.

[0051] S140: Control the master node to add a storage lock to the shared storage disk, and after the lock is successfully added, control the master node to mount the shared storage disk.

[0052] Specifically, after determining that the master node has successfully switched to the normal state, the master node may be controlled to add a storage lock to the shared storage disk, and after the lock is successfully added, a volume mount operation may be started to mount the shared storage disk.

[0053] The technical solution of the embodiment of the present invention is as follows: when the node is initialized, the storage lock information corresponding to the shared storage disk is obtained; according to the storage lock information, if the storage lock added by the slave node to the shared storage disk is detected, the storage lock status corresponding to the slave node is obtained; if the storage lock status corresponding to the slave node is the accept takeover status, the storage lock status corresponding to the master node is updated from the accept takeover status to the normal status; the master node is controlled to add a storage lock to the shared storage disk, and after the lock is successfully added, the master node is controlled to mount the shared storage disk. By setting the storage lock and the storage lock status, the operating status of each node can be obtained in time, the risk of shared storage being double-written due to abnormal interaction between the master and slave nodes can be reduced, the consistency of the shared storage data can be ensured, and the normal operation of the business can be ensured.

[0054] In an optional implementation of this embodiment, the technical solution of this embodiment may further include:

[0055] After the node is initialized, at a first set time interval, the storage lock state corresponding to the master node is obtained;

[0056] If it is detected that the storage lock state corresponding to the master node is in a normal state, the slave node is controlled to unload the shared storage disk and release the storage lock imposed on the shared storage disk.

[0057] The first set time may be 10 seconds. In this embodiment, the slave node may detect the storage lock state corresponding to the master node at the 10th second after the node is initialized and started. If the storage lock state is in the normal state, a deactivation operation is performed, that is, the shared storage disk is uninstalled to ensure that the slave node application cannot access, read or write the disk data content, and the storage lock added to the shared storage disk is released. If it is detected that the storage lock state corresponding to the master node is not in the normal state, the shared storage disk may be kept in the normal state.

[0058] In another optional implementation of this embodiment, after controlling the master node to mount the shared storage disk, the following may also be included:

[0059] When a master-slave node switching request is detected, the master node is controlled to uninstall the shared storage disk, and after the uninstallation is successful, the storage lock added to the shared storage disk is released, and the storage lock state corresponding to the master node is updated from the normal state to the takeover acceptance state;

[0060] The storage lock state corresponding to the slave node is updated from the takeover state to the normal state, and the slave node is controlled to add a storage lock to the shared storage disk. After the lock is successfully added, the slave node is controlled to mount the shared storage disk.

[0061] In this embodiment, when the master-slave node is in a normal switching scenario (manual switching scenario), when a master-slave node switching request is detected, the master node can be controlled to unload the shared storage disk, and the storage lock can be released after the unloading is successful, and the master node can be controlled to adjust the corresponding storage lock state to the takeover state; then, the storage lock state corresponding to the slave node can be adjusted to the normal state, and the slave node can be controlled to lock the disk, and the shared storage disk can be mounted only after the locking is successful.

[0062] In a specific implementation of this embodiment, when the master and slave nodes are in a normal state of the switching scenario, the process of the master node unloading the disk can be as follows: Figure 2 As shown. First, after successfully completing the disk check, the shared storage disk is uninstalled; if it is determined that the disk is successfully uninstalled, the storage lock on the shared storage disk is cleared, and the master node adjusts the corresponding storage lock state to the takeover state by modifying the key feature. If it is determined that the disk uninstallation fails, the mark bit is set for scheduled cleaning.

[0063] Secondly, the process of mounting the shared storage disk from the node can be as follows Figure 3 As shown. First, after successfully completing the disk check, determine whether the shared storage disk has a storage lock. If it is determined that it does not exist, control the slave node to directly add a storage lock to the shared storage disk; if it is determined that it exists, determine whether it can be taken over based on the storage lock information corresponding to the master node. If it is determined that it can be taken over, control the slave node to add a storage lock to the shared storage disk. If it is determined that it cannot be taken over, you can enter the disk usage log and end directly. After determining that the locking is successful, control the master node to mount the shared storage disk. If it is determined that the disk check fails or the locking fails, it ends directly.

[0064] In another optional implementation of this embodiment, after controlling the master node to mount the shared storage disk, the following may also be included:

[0065] When an abnormality is detected in the master node, the storage lock state corresponding to the slave node is updated from the accept takeover state to the request takeover state;

[0066] If the storage lock state corresponding to other nodes is not detected as a takeover rejection state within the second set time, the slave node is controlled to clear the storage lock added by the master node to the shared storage disk, and re-add the storage lock to the shared storage disk;

[0067] After the slave node is locked successfully, the slave node is controlled to mount the shared storage disk.

[0068] In this implementation, when it is detected that the master node is disconnected from the network, downtime, etc., it can be determined that the master node is abnormal, and at this time, the slave node can be controlled to attempt to take over. For example, the takeover attempt process can be to first interact through storage lock information. If the master node responds, the takeover will not be performed. If the master node does not respond, the storage lock added by the master node is cleared and re-locked, and then the disk is mounted.

[0069] Specifically, first update the storage lock state corresponding to the slave node from the accept takeover state to the request takeover state (corresponding to key feature 101a), and cyclically detect the second set time (for example, 30 seconds, etc.) to check whether the storage lock state of other nodes is the refuse takeover state (corresponding to key feature 102a). If the storage lock state of other nodes is not detected to be the refuse takeover state, clear the storage lock added by the master node and re-add the storage lock to the shared storage disk. After the lock is successfully added, mount the shared storage disk to complete the takeover of the master node. The second set time may be the same as or different from the first set time.

[0070] It is understandable that, whether the master node or the slave node is currently occupying the shared storage disk, when an exception occurs, other nodes can take over it using the above method to ensure high availability of the shared storage disk and normal operation of the business.

[0071] Embodiment 2

[0072] Figure 4 This is a schematic diagram of the structure of a shared storage access control device provided by Embodiment 2 of the present invention. Figure 4 As shown, the device includes: a storage lock information acquisition module 210, a storage lock status acquisition module 220, a status update module 230 and a disk locking module 240; wherein,

[0073] The storage lock information acquisition module 210 is used to acquire the storage lock information corresponding to the shared storage disk when the node is initialized;

[0074] A storage lock status acquisition module 220 is used to acquire the storage lock status corresponding to the slave node if a storage lock applied by the slave node to the shared storage disk is detected according to the storage lock information;

[0075] The state updating module 230 is used to update the storage lock state corresponding to the master node from the accept takeover state to the normal state if the storage lock state corresponding to the slave node is the accept takeover state;

[0076] The disk locking module 240 is used to control the master node to add a storage lock to the shared storage disk, and after the locking is successful, control the master node to mount the shared storage disk.

[0077] The technical solution of the embodiment of the present invention is as follows: when the node is initialized, the storage lock information corresponding to the shared storage disk is obtained; according to the storage lock information, if the storage lock added by the slave node to the shared storage disk is detected, the storage lock status corresponding to the slave node is obtained; if the storage lock status corresponding to the slave node is the accept takeover status, the storage lock status corresponding to the master node is updated from the accept takeover status to the normal status; the master node is controlled to add a storage lock to the shared storage disk, and after the lock is successfully added, the master node is controlled to mount the shared storage disk. By setting the storage lock and the storage lock status, the operating status of each node can be obtained in time, the risk of shared storage being double-written due to abnormal interaction between the master and slave nodes can be reduced, the consistency of the shared storage data can be ensured, and the normal operation of the business can be ensured.

[0078] Optionally, the shared storage access control device further includes:

[0079] A state acquisition module, used to obtain the storage lock state corresponding to the master node at a first set time interval after the node is initialized;

[0080] The disk unloading module is used to control the slave node to unload the shared storage disk and release the storage lock imposed on the shared storage disk if it is detected that the storage lock state corresponding to the master node is in a normal state.

[0081] Optionally, the shared storage access control device further includes:

[0082] A storage lock release module is used to control the master node to uninstall the shared storage disk when a master-slave node switching request is detected, and after the uninstallation is successful, release the storage lock added to the shared storage disk, and update the storage lock state corresponding to the master node from the normal state to the takeover acceptance state;

[0083] The first disk mounting module is used to update the storage lock state corresponding to the slave node from the takeover state to the normal state, and control the slave node to add a storage lock to the shared storage disk, and after the lock is successfully added, control the slave node to mount the shared storage disk.

[0084] Optionally, the shared storage access control device further includes:

[0085] An abnormality detection module, used for updating the storage lock state corresponding to the slave node from the accept takeover state to the request takeover state when an abnormality is detected in the master node;

[0086] A state detection module, used for controlling the slave node to clear the storage lock added by the master node to the shared storage disk and re-add the storage lock to the shared storage disk if the storage lock state corresponding to other nodes is not detected as a takeover rejection state within a second set time;

[0087] The second disk mounting module is used to control the slave node to mount the shared storage disk after the slave node is locked successfully.

[0088] Optionally, the storage lock state acquisition module 220 is specifically used to obtain the key value corresponding to the slave node, and obtain the target key feature according to the key value and the preset key format;

[0089] According to the target key feature and the mapping relationship between the preset key feature and the storage lock state, the storage lock state corresponding to the slave node is obtained.

[0090] Optionally, the shared storage access control device further includes:

[0091] A storage lock detection module is used to update the storage lock state corresponding to the master node from the takeover state to the normal state if the storage lock added by the slave node to the shared storage disk is not detected according to the storage lock information;

[0092] The third disk mounting module is used to control the master node to add a storage lock to the shared storage disk, and after the lock is successfully added, control the master node to mount the shared storage disk.

[0093] Optionally, the storage lock state includes at least one of a normal state, a takeover request state, a takeover rejection state, a takeover acceptance state, an uninstallation failure state, and an identification change state.

[0094] The shared storage access control device provided in the embodiment of the present invention can execute the shared storage access control method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0095] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0096] Embodiment 3

[0097] Figure 5A schematic diagram of the structure of an electronic device 30 that can be used to implement an embodiment of the present invention is shown. The electronic device 30 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 30 can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0098] like Figure 5 As shown, the electronic device 30 includes at least one processor 31, and a memory connected to the at least one processor 31, such as a read-only memory (ROM) 32, a random access memory (RAM) 33, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 31 can perform various appropriate actions and processes according to the computer program stored in the read-only memory 32 or the computer program loaded from the storage unit 38 to the random access memory 33. In the RAM 33, various programs and data required for the operation of the electronic device 30 can also be stored. The processor 31, the ROM 32 and the RAM 33 are connected to each other through a bus 34. The input / output (I / O) interface 35 is also connected to the bus 34.

[0099] A number of components in the electronic device 30 are connected to the I / O interface 35, including: an input unit 36, such as a keyboard, a mouse, etc.; an output unit 37, such as various types of displays, speakers, etc.; a storage unit 38, such as a disk, an optical disk, etc.; and a communication unit 39, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 39 allows the electronic device 30 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0100] The processor 31 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 31 include, but are not limited to, a central processing unit, a graphics processing unit, various special artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any appropriate processors, controllers, microcontrollers, etc. The processor 31 executes the various methods and processes described above, such as a shared storage access control method.

[0101] In some embodiments, the access control method for shared storage may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 38. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 30 via the ROM 32 and / or the communication unit 39. When the computer program is loaded into the RAM 33 and executed by the processor 31, one or more steps of the access control method for shared storage described above may be performed. Alternatively, in other embodiments, the processor 31 may be configured to execute the access control method for shared storage in any other appropriate manner (e.g., by means of firmware).

[0102] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays, application specific integrated circuits, application specific standard products, systems on a chip, load programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0103] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0104] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0105] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device 30 having: a display device (e.g., a cathode ray tube or a liquid crystal display) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the electronic device 30. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0106] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area networks, wide area networks, blockchain networks, and the Internet.

[0107] A computing system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other. The server may be a cloud server.

[0108] This embodiment may also include a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the shared storage access control method provided by any embodiment of the present invention.

[0109] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0110] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for controlling access to shared storage, characterized in that: include: When the node is initialized, the storage lock information corresponding to the shared storage disk is obtained; According to the storage lock information, if a storage lock imposed by a slave node on the shared storage disk is detected, a storage lock state corresponding to the slave node is obtained; If the storage lock state corresponding to the slave node is in the takeover acceptance state, the storage lock state corresponding to the master node is updated from the takeover acceptance state to the normal state; The master node is controlled to add a storage lock to the shared storage disk, and after the lock is successfully added, the master node is controlled to mount the shared storage disk.

2. The method according to claim 1, characterized in that Also includes: After the node is initialized, at a first set time interval, the storage lock state corresponding to the master node is obtained; If it is detected that the storage lock state corresponding to the master node is in a normal state, the slave node is controlled to unload the shared storage disk and release the storage lock imposed on the shared storage disk.

3. The method according to claim 1, characterized in that After controlling the master node to mount the shared storage disk, the method further includes: When a master-slave node switching request is detected, the master node is controlled to uninstall the shared storage disk, and after the uninstallation is successful, the storage lock added to the shared storage disk is released, and the storage lock state corresponding to the master node is updated from the normal state to the takeover state; The storage lock state corresponding to the slave node is updated from the takeover state to the normal state, and the slave node is controlled to add a storage lock to the shared storage disk. After the lock is successfully added, the slave node is controlled to mount the shared storage disk.

4. The method according to claim 1, characterized in that: After controlling the master node to mount the shared storage disk, the method further includes: When an abnormality is detected in the master node, the storage lock state corresponding to the slave node is updated from the accept takeover state to the request takeover state; If the storage lock state corresponding to other nodes is not detected as a takeover rejection state within the second set time, the slave node is controlled to clear the storage lock added by the master node to the shared storage disk, and re-add the storage lock to the shared storage disk; After the slave node is locked successfully, the slave node is controlled to mount the shared storage disk.

5. The method according to claim 1, characterized in that Obtaining the storage lock status corresponding to the slave node includes: Obtaining a key value corresponding to the slave node, and obtaining a target key feature according to the key value and a preset key format; According to the target key feature and the mapping relationship between the preset key feature and the storage lock state, the storage lock state corresponding to the slave node is obtained.

6. The method according to claim 1, characterized in that After obtaining the storage lock information corresponding to the shared storage disk, it also includes: According to the storage lock information, if the storage lock added by the slave node to the shared storage disk is not detected, the storage lock state corresponding to the master node is updated from the takeover state to the normal state; The master node is controlled to add a storage lock to the shared storage disk, and after the lock is successfully added, the master node is controlled to mount the shared storage disk.

7. The method according to any one of claims 1 to 6, characterized in that The storage lock state includes at least one of a normal state, a takeover request state, a takeover rejection state, a takeover acceptance state, an uninstallation failure state, and an identification change state.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor, and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the shared storage access control method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to enable a processor to implement the shared storage access control method according to any one of claims 1 to 7 when executed.

10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the shared storage access control method according to any one of claims 1 to 7.