A hard disk access permission regulation method and system, electronic equipment and medium
Patent Information
- Application Number
- CN202311105409.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2043-08-30
AI Technical Summary
但是在实际使用过程中,存储集群中可能会出现多个节点同时发生变化,进而导致多个节点同时访问硬盘,此时多个节点同时修改硬盘上的同一区域内的数据,容易导致盘内数据被破坏的情况
[0057]1.本申请实施例提供的硬盘访问权限调控方法,应用于存储集群内节点向目标硬盘访问,所述存储集群包括若干节点,其具体包括节点向目标硬盘发送登记请求,此时接收来自节点的登记请求,根据登记请求执行在节点请求的目标硬盘上的登记操作,并设置完成登记操作的节点在目标硬盘上具有初级权限,接收来自节点的订阅请求,同时确认此节点已在目标硬盘上完成登记,然后根据订阅请求执行在目标硬盘上的订阅操作,并设置完成订阅操作的节点在目标硬盘上具有读写的权限;通过以上方案,能够对需要访问目标硬盘的节点的设置不同的权限,即完成登记的节点能在目标硬盘进行读数据,完成订阅的节点才能够在目标硬盘上进行读写过程,并且一个目标硬盘能够同时接受多个节点的登记,但一个目标硬盘只能接受一个节点的订阅,从而实现对目标硬盘的访问过程的限定,以确保盘中的数据的安全性。
Smart Images

Figure CN117111850B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of hard disks, specifically to a method, system, electronic device, and medium for controlling hard disk access permissions. Background Technology
[0002] A cluster typically consists of multiple nodes. By distributing data across multiple nodes, the cluster can overcome the limitations of single-machine storage space, and each master node can provide read and write services, ensuring the cluster's responsiveness.
[0003] In actual operation, if a cluster fails and needs to be rebuilt and restored based on stored critical information, this critical information is typically written to the hard drive by the storage cluster and stored in a fixed location on the hard drive. When the critical data on a node changes, this critical information is automatically synchronized to the designated area on the hard drive. However, in actual use, multiple nodes in the storage cluster may experience simultaneous changes, leading to multiple nodes accessing the hard drive concurrently. This simultaneous modification of data in the same area on the hard drive by multiple nodes can easily result in data corruption. Therefore, there is an urgent need for an access control method to prevent conflicts in modifying critical data within the cluster from causing data corruption. Summary of the Invention
[0004] To address at least one of the problems mentioned in the background art, this application provides a hard disk access control method, system, electronic device, and medium that can set corresponding permissions for nodes that need to access the target hard disk, allowing only nodes with the corresponding permissions to read and write to the disk; and after completing the access, the access permission to the target hard disk is released through a logout operation, thereby facilitating access to the target hard disk by other nodes.
[0005] The specific technical solutions provided in this application are as follows:
[0006] Firstly, a method for controlling hard disk access permissions is provided, applied to nodes within a storage cluster accessing a target hard disk, wherein the storage cluster comprises several nodes, and the method includes:
[0007] Receive a registration request from at least one node, and perform a registration operation on the target hard disk requested by the node according to the registration request;
[0008] The node that has completed the registration operation is granted basic permissions on the target hard drive.
[0009] If a subscription request is received from at least one node, and it is confirmed that the node has been registered to the target hard disk, then a subscription operation is performed on the target hard disk according to the subscription request.
[0010] The node that has completed the subscription operation has level 2 permissions on the target hard drive.
[0011] In one specific embodiment, the method further includes:
[0012] Receive a release subscription request from a subscribed node, and execute the release subscription operation of the subscribed node on the target hard disk according to the release subscription request;
[0013] Receive a deregistration request from at least one registered node, execute the deregistration operation of the registered node on the target hard disk according to the deregistration request, and determine whether the node has subscribed to the target hard disk;
[0014] If this node subscribes to the target hard drive, the subscription data is cleared.
[0015] Alternatively, an error message is returned in response to the node not having subscribed to the target hard drive.
[0016] In one specific embodiment, the second-level permission is higher than the first-level permission, specifically including:
[0017] The primary permission refers to the read permission that the node already registered on the target hard drive has on the target hard drive;
[0018] The second-level permission means that nodes that have subscribed to the target hard drive have read and write permissions on the target hard drive.
[0019] In one specific embodiment, after completing the subscription release operation, the method further includes:
[0020] Send unsubscribe notifications to all nodes except those that sent the release subscription request;
[0021] This allows other nodes to initiate registration or subscription commands to the target hard drive;
[0022] After completing the deregistration process, the method further includes:
[0023] Send a deregistration notification to all nodes except those that sent the deregistration request;
[0024] This allows other nodes to initiate registration or subscription commands to the target hard drive.
[0025] In one specific embodiment, performing a registration operation on the target hard disk requested by the node according to the registration request specifically includes:
[0026] The registration request includes a node identifier, a key value, and the target hard disk serial number;
[0027] Within the target hard drive corresponding to the target hard drive serial number, determine whether the node identifier is matched in the target hard drive registration chain;
[0028] If so, then this node has been registered to the target hard drive;
[0029] Alternatively, if this node is not registered to the target hard drive, the node identifier and key value are recorded in the registration list of the target hard drive to complete the registration operation.
[0030] In one specific embodiment, performing a subscription operation on the target hard disk according to the subscription request specifically includes:
[0031] The subscription request includes a node identifier, subscription type, key value, and target hard disk serial number;
[0032] Determine if the data pointer of the target hard drive is equal to the address of the registered data structure of the node that sent the subscription request;
[0033] If so, the node that sent the subscription request has already subscribed to the target hard drive;
[0034] Alternatively, if the target hard drive has already been subscribed to by other nodes, then the return disk has been subscribed to incorrectly.
[0035] Alternatively, if the node sending the subscription request is not registered with the target hard disk, the subscription type, the key value, and the node's data pointer are recorded in the subscription data structure of the target hard disk to complete the subscription operation.
[0036] In one specific embodiment, after the node sending the subscription request has subscribed to the target hard disk, the process further includes:
[0037] Determine whether the subscription type matches the subscription type in the data pointer of the current target hard disk;
[0038] If the subscription type matches the subscription type of the current target hard drive, the subscription ends.
[0039] Alternatively, in response to the subscription type not matching the subscription type in the data pointer of the current target hard disk, an error message is returned to the node that sent the subscription request;
[0040] When the same node subscribes to the target hard drive repeatedly, the subscription type in the subscription request matches the subscription type in the target hard drive.
[0041] Secondly, a hard disk access control system is provided, applied to nodes within a storage cluster accessing a target hard disk, wherein the storage cluster comprises several nodes, and the system includes:
[0042] A registration unit is configured to receive a registration request from at least one node and perform a registration operation on the target hard disk requested by the node according to the registration request;
[0043] The first setting unit is used to set the node that has completed the registration operation to have basic permissions on the target hard disk;
[0044] The subscription unit is used to receive subscription requests from at least one node, confirm that the node has been registered to the target hard disk, and then perform a subscription operation on the target hard disk according to the subscription request.
[0045] The second setting unit is used to set the node that has completed the subscription operation to have level 2 permissions on the target hard disk.
[0046] Thirdly, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0047] Step A: Receive a registration request from at least one node, and perform a registration operation on the target hard drive requested by the node according to the registration request;
[0048] Step B: Configure the node that has completed the registration operation to have basic permissions on the target hard drive;
[0049] Step C: Receive a subscription request from at least one node, confirm that the node has been registered to the target hard disk, and then perform a subscription operation on the target hard disk according to the subscription request;
[0050] Step D: Configure the node that has completed the subscription operation to have level 2 permissions on the target hard drive.
[0051] Fourthly, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed by a processor, performs the following steps:
[0052] Step A: Receive a registration request from at least one node, and perform a registration operation on the target hard drive requested by the node according to the registration request;
[0053] Step B: Configure the node that has completed the registration operation to have basic permissions on the target hard drive;
[0054] Step C: Receive a subscription request from at least one node, confirm that the node has been registered to the target hard disk, and then perform a subscription operation on the target hard disk according to the subscription request;
[0055] Step D: Configure the node that has completed the subscription operation to have level 2 permissions on the target hard drive.
[0056] The embodiments of this application have the following beneficial effects:
[0057] 1. The hard disk access permission control method provided in this application embodiment is applied to nodes in a storage cluster accessing a target hard disk. The storage cluster includes several nodes. Specifically, the method includes a node sending a registration request to the target hard disk, receiving the registration request from the node, performing a registration operation on the target hard disk requested by the node according to the registration request, and setting the node that has completed the registration operation to have basic permissions on the target hard disk. It also includes receiving a subscription request from the node, confirming that the node has completed registration on the target hard disk, and then performing a subscription operation on the target hard disk according to the subscription request, and setting the node that has completed the subscription operation to have read and write permissions on the target hard disk. Through the above scheme, different permissions can be set for nodes that need to access the target hard disk. That is, nodes that have completed registration can read data on the target hard disk, while nodes that have completed subscription can perform read and write processes on the target hard disk. Furthermore, a target hard disk can accept registrations from multiple nodes simultaneously, but a target hard disk can only accept subscriptions from one node, thereby limiting the access process to the target hard disk and ensuring the security of the data on the disk.
[0058] 2. For nodes that have completed the read / write process, the system can also execute the release subscription operation on the target hard drive by receiving a release subscription request from a subscribed node, and execute the deregistration operation on the target hard drive by receiving a deregistration request from a registered node. Through the above scheme, the permissions of nodes that have completed the read / write process can be released. That is, by releasing the subscription operation, other nodes can initiate registration or subscription instructions to the target hard drive, and by deregistering, other nodes can initiate registration or subscription instructions to the target hard drive, thereby facilitating node access to the target hard drive.
[0059] 3. Since a target hard drive can only be associated with one node, after receiving subscription requests from multiple nodes, the node that first receives the subscription request from the controller will be selected in order, and the subscription operation on the target hard drive will be executed on that node. Other nodes will fail to subscribe. When the subscription space of the target hard drive is released, the controller will send a notification to the registered nodes again, and the nodes will send a subscription request to the target hard drive again after receiving the notification. Attached Figure Description
[0060] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0061] Figure 1 A schematic diagram illustrating the application environment according to this application is shown;
[0062] Figure 2 A schematic diagram illustrating the registration and subscription steps according to the hard disk access control method in this application;
[0063] Figure 3 A schematic diagram illustrating the specific process of the registration operation according to this application;
[0064] Figure 4 A schematic diagram illustrating the specific process of the subscription operation according to this application;
[0065] Figure 5 A schematic diagram illustrating the steps of deregistering and releasing a subscription according to the hard disk access control method in this application;
[0066] Figure 6 A schematic diagram illustrating the specific process of releasing the subscription operation according to this application;
[0067] Figure 7 A schematic diagram illustrating the specific process of deregistration according to this application;
[0068] Figure 8 A schematic diagram of the hard disk access control system according to this application is shown;
[0069] Figure 9 A schematic diagram of a computer device according to this application is shown. Detailed Implementation
[0070] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0071] The hard disk access permission control method provided in this application can be applied to, for example... Figure 1 The application environment shown is as follows. The storage cluster includes several nodes, such as node 1, node 2, node 3, and node 4. Each node in the head unit is connected to an expansion cabinet via links. Several solid-state drives (SSDs) are inserted into the expansion cabinet, providing the head unit with additional data storage capacity. The storage cluster needs to update its information on the SSDs in the expansion cabinets. This updated information is used to rebuild and recover the cluster in case of damage. The expansion cabinets also contain a controller, which ensures that only one node can modify critical data on a SSD at any given time.
[0072] Example 1
[0073] like Figure 2 As shown, a method for controlling hard disk access permissions is provided, applied to nodes within a storage cluster accessing a target hard disk. The storage cluster comprises several nodes. This method is applied to... Figure 1 Taking the controller in the hard drive as an example, the explanation includes the following steps:
[0074] Step S1: Receive a registration request from at least one node, and perform a registration operation on the target hard disk requested by the node according to the registration request;
[0075] Step S2: Configure the node that has completed the registration operation to have basic permissions on the target hard drive.
[0076] When a node needs to write cluster data to or read data from a target hard drive on the expansion cabinet, it needs to obtain basic permissions. First, it needs to register with the target hard drive. All nodes to be registered send a registration request to the target hard drive. The controller receives the registration requests from the nodes and performs the registration operation on the target hard drive requested by the node. The registration request includes a node identifier, a key value, and the target hard drive serial number information, specifically including:
[0077] Step S1.1: Obtain the target hard drive based on the target hard drive serial number, and determine whether the node identifier is matched in the target hard drive registration chain within the target hard drive corresponding to the target hard drive serial number;
[0078] Step S1.2: If yes, then this node has been registered to the target hard drive;
[0079] Step S1.3: If not, this node is not registered to the target hard disk, then record the node identifier and key value to the registration list of the target hard disk to complete the registration operation.
[0080] In a specific embodiment, such as Figure 3 As shown, based on the target hard drive ID, the system checks whether the node that sent the registration request has already registered with the target hard drive in the corresponding data structure. This is done by checking if the node identifier can be matched in the registration list of the data structure. If a match is found, the system continues to match the key value. Specifically, it checks if the key value in the registration request is the same as the key value registered in the current disk's data structure. If they are the same, the node is registered with the target hard drive, and the registration process ends. If they are different, a "registration conflict" error is returned to the node that sent the registration request. Furthermore, if the node identifier is not matched in the registration list of the data structure, the node is not registered with the target hard drive. In this case, the node's hostid and key value are recorded, and this data is added to the registration list of the data structure corresponding to the target hard drive, ending the registration operation.
[0081] In one specific embodiment, the same node carrying the same node identifier and key value can be repeatedly registered to the same disk without reporting an error; and, several nodes can be registered to the same disk at the same time.
[0082] It should be noted that the node identifier is the node's host id. Specifically, the host id is a unique identifier for the head unit node during the registration process. It is represented by 16 bytes and consists of "head unit cluster information + rack number where the head unit is located + node number". The cluster information occupies 15 bytes, the rack number occupies 4 bits, and the node number occupies 4 bits. The key value occupies 8 bytes and can be represented by the 8th byte of the host id.
[0083] In one specific embodiment, by registering nodes to the target hard drive and setting nodes that have completed the registration operation to have basic permissions on the target hard drive, that is, nodes registered on the target hard drive can read data on the target hard drive, and the target hard drive is not locked at this time.
[0084] Step S3: Receive a subscription request from at least one node, confirm that the node has been registered to the target hard disk, and then perform a subscription operation on the target hard disk according to the subscription request;
[0085] Step S4: Configure the node that has completed the subscription operation to have level 2 permissions on the target hard drive.
[0086] In one specific embodiment, secondary permissions are higher than primary permissions, wherein the primary permissions include read permissions for nodes registered on the target hard drive; and the secondary permissions include read and write permissions for nodes subscribed to on the target hard drive.
[0087] When a node needs to write cluster data to a target hard drive on the expansion cabinet, it needs to obtain level 2 permissions. First, it registers with the target hard drive. After registration, the node needs to subscribe to the target hard drive. Only nodes that have subscribed to the target hard drive can perform write operations on it. At this point, the node to be subscribed sends a subscription request to the target hard drive. The controller receives the subscription request from the node and executes the subscription operation on the target hard drive requested by the node. The subscription request includes a node identifier, subscription type, key value, and target hard drive serial number, specifically including:
[0088] Step S3.1: Determine whether the data pointer of the target hard disk is equal to the address of the registered data structure of the node that sent the subscription request;
[0089] Step S3.2: If yes, then the node that sent the subscription request has subscribed to the target hard drive;
[0090] Step S3.3: If not, and the target hard disk has already been subscribed to by other nodes, then the returned disk has been subscribed to error;
[0091] Step S3.4: If not, and the node sending the subscription request is not registered to the target hard disk, then record the subscription type, the key value, and the node's data pointer into the subscription data structure of the target hard disk to complete the subscription operation.
[0092] In one specific embodiment, the node corresponding to the first subscription request to arrive at the controller is obtained, and the subscription operation of this node on the target hard disk is executed; wherein, a target hard disk subscribes to only one node at a time, and if the target hard disk has already been subscribed to by this node, it will no longer accept subscriptions from other nodes.
[0093] Specifically, since there are multiple nodes sending subscription requests, a first-come, first-served principle is followed. The node corresponding to the first subscription request to reach the controller is selected, and its subscription operation on the target hard drive is executed. Furthermore, a target hard drive can only subscribe to one node. After receiving subscription requests from multiple nodes, the node corresponding to the first subscription request to reach the controller is selected in sequence, and its subscription operation on the target hard drive is executed. Other nodes will fail to subscribe. Once the subscription space on the target hard drive is released, the controller will send a notification to the registered nodes again, and the nodes will then send another subscription request to the target hard drive.
[0094] like Figure 4 As shown, the controller receives subscription requests from nodes, which include host ID, subscription type, key value, and target hard disk ID. Based on the target hard disk ID, the controller retrieves the corresponding target hard disk and checks whether the node sending the subscription request has already registered with the target hard disk in its data structure. This is done by checking if the node identifier can be matched in the registration list of the data structure. If a match is found, the controller continues to match the key value, checking if the key value in the registration request is the same as the key value registered in the current disk's data structure. If they are the same, the node is already registered with the target hard disk, and the controller continues to check if the node has subscribed. If the key values do not match, a "registration conflict" error is returned to the node that sent the subscription request.
[0095] The system determines whether a node has subscribed to the target hard drive by comparing the data pointer in the subscription data structure with the address of the node's registered data structure. If the addresses are equal, the node that sent the subscription request has subscribed to the target hard drive. If the target hard drive has been subscribed to, but the subscriber is not this node, the system returns a "disk already subscribed" error to the node that sent the subscription request. If the target hard drive has not been subscribed to, the subscription type, key value, and address of the registered data structure are all recorded in the subscription data structure to complete the subscription operation.
[0096] It should be noted that the node identifier is the node's host ID. Specifically, the host ID is a unique identifier for the head unit node during the registration operation. It is represented by 16 bytes and consists of "head unit cluster information + rack number where the head unit is located + node number". The cluster information occupies 15 bytes, the rack number occupies 4 bits, and the node number occupies 4 bits. The subscription type indicates the type of subscription currently being made. This member can be expanded to include more types in the future to facilitate other operations. The key value occupies 8 bytes and can be represented by the 8th byte of the host ID, which is the same as the key value in the registration operation. The data pointer points to the data structure of successfully subscribed nodes. If the data pointer is null, it means that no node has been subscribed.
[0097] In one specific embodiment, after the node that sent the subscription request has subscribed to the target hard drive, the method further includes:
[0098] Determine whether the subscription type matches the subscription type in the data pointer of the current target hard drive; if the subscription type matches the subscription type of the current target hard drive, then terminate the subscription;
[0099] Alternatively, in response to the subscription type not matching the subscription type in the data pointer of the current target hard disk, an error message is returned to the node that sent the subscription request;
[0100] When the same node subscribes to the target hard drive repeatedly, the subscription type in the subscription request matches the subscription type in the target hard drive.
[0101] It's important to note that when the subscription type is "Exclusive Write," only nodes that have successfully subscribed to the target hard drive have secondary permissions (write permissions) on the target hard drive. Other nodes only have primary permissions (read permissions). Specifically, write commands include: space reclamation commands, write commands, format commands, write-to-zero commands, and flush commands. These commands can be executed on the subscribing node, but will be refused by registered and unregistered nodes. Read commands include: read commands, comparison commands, and verification commands. These commands are allowed to execute on subscribing, registered, and unregistered nodes. Registration commands are also included; they are allowed on subscribing and registered nodes, but will be refused by unregistered nodes. Other commands are allowed to execute on subscribing, registered, and unregistered nodes.
[0102] It's important to note that the exclusive write access permissions described above only take effect if the node has subscribed to the target hard drive. If the node has only registered to the target hard drive, the instruction restrictions shown in the diagram will not apply. After a node subscribes to the target hard drive, the controller will allow all instructions from that node to be passed to the target hard drive. If a node has only registered to the target hard drive but has not subscribed to it, the expansion enclosure controller will block write instructions from that node to the target hard drive. If a node has not registered to the target hard drive, the expansion enclosure controller will refuse to subscribe to any instructions.
[0103] The above scheme allows for setting different permissions for nodes that need to access the target hard drive. Registered nodes can read data from the target hard drive, while subscribed nodes can read and write data. A target hard drive can accept registrations from multiple nodes simultaneously, but can only accept subscriptions from one node. This restricts access to the target hard drive to ensure the security of the data on the drive.
[0104] Once a node completes its read / write operations on the target hard drive, it releases its subscription and registration to the target hard drive to allow other nodes to access it. Figure 5 As shown, the specific steps include:
[0105] Step S5: Receive a release subscription request from the subscribed node, and execute the release subscription operation of the subscribed node on the target hard disk according to the release subscription request;
[0106] Specifically, the subscribed node sends a release subscription request to the target hard drive. The release subscription request includes the host id, subscription type, key value, and target hard drive id information.
[0107] like Figure 6 As shown, the target hard disk is obtained based on the target hard disk ID, and the node that sent the release subscription request is checked in the corresponding data structure to see if it has been registered to the target hard disk. The criterion for judgment is the node's host ID. If the node's host ID can be matched in the registration list of the data structure, it means that the node has been registered to the target hard disk. Then, the key value is matched. If the key value matches, the node is checked to see if it has subscribed. If the key value does not match, a "registration conflict" error is returned to the node that sent the instruction.
[0108] Continuing, if the key value matches, the system checks whether the node has subscribed to the target hard drive. If the "data pointer" in the subscription data structure is equal to the address of the node's registered data structure, it means that the node that sent the release subscription request has subscribed to the disk. If the target hard drive has been subscribed to, but the subscriber is not this node, a "node not subscribed" error is returned to the node that sent the release subscription request command. If the node that sent the release subscription request has subscribed to the disk, the system checks whether the "subscription type" in the command matches the type in the subscription data structure. If they do not match, a "subscription type mismatch" error is returned to the node that sent the release subscription request. If they match, the key value and subscription type in the subscription data structure are cleared, and the data pointer is cleared. At this point, the target hard drive is released and displayed as unsubscribed.
[0109] In one specific embodiment, after completing the release subscription operation, the method further includes: sending an unsubscribe notification to other nodes besides those that sent the release subscription request; so that other nodes can initiate registration or subscription instructions to the target hard disk.
[0110] Step S6: Receive a deregistration request from at least one registered node, execute the deregistration operation of the registered node on the target hard disk according to the deregistration request, and determine whether the node has subscribed to the target hard disk;
[0111] Step S7: If this node has subscribed to the target hard disk, then clear the subscription data; or, if this node has not subscribed to the target hard disk, then return an error message.
[0112] like Figure 7 As shown, a registered node sends a deregistration request to the target hard drive, and the target hard drive performs a deregistration operation based on the received deregistration request. Specifically, the deregistration request carries the host ID, subscription type, key value, and target hard drive ID information. Based on the target hard drive ID, the system checks whether the node sending the command has already registered with the target hard drive in the corresponding data structure. If the node's host ID can be matched in the registration list of the data structure, it means the node has already registered with the target hard drive; if no node is matched, a "registration conflict" error is returned to the node sending the deregistration request. After finding a matching node, the system continues to match the key value. If the key value does not match, a "registration conflict" error is returned to the node sending the command; if the key value matches, it means the node sending the deregistration request has already registered with the target hard drive. Then, it checks whether the node is subscribed to the target hard drive. The criterion is that the data pointer of the subscription data structure is equal to the address of the corresponding level data structure. If the node's subscription on this disk has not been cancelled, the subscription on this disk needs to be released. The release operation includes clearing the subscription type, key value, and data pointer.
[0113] In one specific embodiment, after the deregistration operation is completed, the method further includes: sending a deregistration notification to other nodes besides those that sent the deregistration request; so that other nodes can initiate registration or subscription instructions to the target hard drive.
[0114] The above scheme can release the permissions of nodes that have completed the read and write process. That is, by releasing the subscription operation, other nodes can initiate registration or subscription instructions to the target hard drive. Similarly, by deregistering, other nodes can initiate registration or subscription instructions to the target hard drive, thereby facilitating node access to the target hard drive.
[0115] The above-mentioned hard disk access control method, combined with the technical features in claim 1, is reasonably derived to achieve the beneficial effect of solving the technical problems raised in the background art.
[0116] It should be understood that, although Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0117] Example 2
[0118] In one embodiment, such as Figure 8 As shown, a hard disk access permission control system is provided, applied to nodes within a storage cluster accessing a target hard disk. The storage cluster includes several nodes, and the system includes:
[0119] A registration unit is configured to receive a registration request from at least one node and perform a registration operation on the target hard disk requested by the node according to the registration request;
[0120] The first setting unit is used to set the node that has completed the registration operation to have basic permissions on the target hard disk;
[0121] The subscription unit is used to receive subscription requests from at least one node, confirm that the node has been registered to the target hard disk, and then perform a subscription operation on the target hard disk according to the subscription request.
[0122] The second setting unit is used to set the node that has completed the subscription operation to have level 2 permissions on the target hard disk.
[0123] In one specific embodiment, it further includes a release unit and a deregistration unit. The release unit is used to receive a release subscription request from the subscribed node and perform a release subscription operation on the target hard disk according to the release subscription request.
[0124] The deregistration unit is used to receive deregistration requests from at least one registered node, perform deregistration operations on the target hard disk by the registered node according to the deregistration request, and determine whether the node has subscribed to the target hard disk;
[0125] The unregistration unit is also used to clear the subscription data in response to the node subscribing to the target hard disk; or to return an error message in response to the node not subscribing to the target hard disk.
[0126] In one specific embodiment, the subscription unit further includes a sorting module, which is used to obtain the node corresponding to the first subscription request that arrives at the controller, and execute the subscription operation of this node on the target hard disk; wherein, a target hard disk subscribes to a node;
[0127] In one specific embodiment, the secondary permission is higher than the primary permission, and the primary permission includes the node registered on the target hard disk having read permission on the target hard disk;
[0128] The secondary permissions include read and write permissions on the target hard drive for nodes that have subscribed to it.
[0129] In one specific embodiment, a notification unit is further included. The notification unit includes a first notification module and a second notification module. The first notification module is used to send a release subscription notification to other nodes except those that sent the release subscription request after the release subscription operation is completed, so that other nodes can initiate registration or subscription instructions to the target hard disk. The second notification module is used to send a deregistration notification to other nodes except those that sent the deregistration request after the deregistration operation is completed, so that other nodes can initiate registration or subscription instructions to the target hard disk.
[0130] In one specific embodiment, the registration request includes a node identifier, a key value, and a target hard disk serial number; the registration unit is specifically used to determine whether the node identifier is matched in the target hard disk registration list corresponding to the target hard disk serial number; if yes, then this node has been registered to the target hard disk; or, if no, this node has not been registered to the target hard disk, then the node identifier and key value are recorded in the target hard disk registration list to complete the registration operation.
[0131] In one specific embodiment, the subscription request includes a node identifier, a subscription type, a key value, and a target hard disk serial number. The subscription unit is specifically used to determine whether the data pointer of the target hard disk is equal to the registered data structure address of the node that sent the subscription request. If yes, the node that sent the subscription request has subscribed to the target hard disk. Alternatively, if no, and the target hard disk has been subscribed to by other nodes, the return disk has been incorrectly subscribed to. Alternatively, if no, and the node that sent the subscription request has not registered to the target hard disk, the subscription type, the key value, and the node's data pointer are recorded in the subscription data structure of the target hard disk to complete the subscription operation.
[0132] In one specific embodiment, the subscription unit further includes a matching module and a response module. The matching module is used to determine whether the subscription type matches the subscription type in the data pointer of the current target hard disk after the subscription request node has subscribed to the target hard disk.
[0133] The response module is configured to terminate the subscription if the subscription type matches the subscription type of the current target hard disk; or to return an error message to the node that sent the subscription request if the subscription type does not match the subscription type in the data pointer of the current target hard disk.
[0134] When the same node subscribes to the target hard drive repeatedly, the subscription type in the subscription request matches the subscription type in the target hard drive.
[0135] For specific limitations regarding the disk access control system, please refer to the limitations on hard drive access control methods mentioned above, which will not be repeated here. Each module in the aforementioned disk access control system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0136] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores critical information data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a hard disk access control method.
[0137] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0138] Example 3
[0139] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0140] Step 101: Receive a registration request from at least one node, and perform a registration operation on the target hard disk requested by the node according to the registration request;
[0141] Step 102: Configure the node that has completed the registration operation to have basic permissions on the target hard drive;
[0142] Step 103: Receive a subscription request from at least one node, confirm that the node has been registered to the target hard disk, and then perform a subscription operation on the target hard disk according to the subscription request;
[0143] Step 104: Configure the node that has completed the subscription operation to have level 2 permissions on the target hard drive.
[0144] In one specific embodiment, the processor performs the following steps when executing a computer program:
[0145] Step 105: Receive a release subscription request from the subscribed node, and execute the release subscription operation of the subscribed node on the target hard disk according to the release subscription request;
[0146] Step 106: Receive a deregistration request from at least one registered node, perform the deregistration operation of the registered node on the target hard drive according to the deregistration request, and determine whether the node has subscribed to the target hard drive; if the node has subscribed to the target hard drive, clear the subscription data; or, if the node has not subscribed to the target hard drive, return an error message.
[0147] In one specific embodiment, the secondary permissions are higher than the primary permissions. The primary permissions include read permissions for nodes registered on the target hard drive; the secondary permissions include read and write permissions for nodes subscribed to on the target hard drive.
[0148] In one specific embodiment, after receiving a subscription request from at least one node in step 103, the method further includes: obtaining the node corresponding to the first subscription request to arrive at the controller, and performing a subscription operation on the target hard disk for that node; wherein, a target hard disk subscribes to a node.
[0149] In one specific embodiment, after completing the release subscription operation in step 105, the method further includes:
[0150] Send unsubscribe notifications to nodes other than those that sent the release subscription request, so that other nodes can initiate registration or subscription instructions to the target hard drive.
[0151] In one specific embodiment, after completing the deregistration operation in step 106, the method further includes: sending a deregistration notification to other nodes besides those that sent the deregistration request; so that other nodes can initiate registration or subscription instructions to the target hard drive.
[0152] In a specific embodiment, step 101, which involves performing a registration operation on the target hard drive requested by the node, specifically includes: the registration request includes a node identifier, a key value, and a target hard drive serial number; within the target hard drive corresponding to the target hard drive serial number, determining whether the node identifier is matched in the target hard drive registration list; if yes, then this node has been registered to the target hard drive; or, if no, this node has not been registered to the target hard drive, then recording the node identifier and key value in the target hard drive registration list to complete the registration operation.
[0153] In a specific embodiment, step 102, which involves performing a subscription operation on the target hard disk based on the subscription request, specifically includes: the subscription request including a node identifier, subscription type, key value, and target hard disk serial number; determining whether the data pointer of the target hard disk is equal to the registered data structure address of the node sending the subscription request; if yes, then the node sending the subscription request has subscribed to the target hard disk; or, if no, and the target hard disk has been subscribed to by other nodes, then the return disk has been incorrectly subscribed to; or, if no, and the node sending the subscription request has not registered to the target hard disk, then the subscription type, the key value, and the node's data pointer are recorded in the subscription data structure of the target hard disk to complete the subscription operation.
[0154] In one specific embodiment, after the node sending the subscription request has subscribed to the target hard disk, the method further includes: determining whether the subscription type matches the subscription type in the data pointer of the current target hard disk; if the subscription type matches the subscription type of the current target hard disk, then ending the subscription; or, if the subscription type does not match the subscription type in the data pointer of the current target hard disk, then returning an error message to the node sending the subscription request.
[0155] In one specific embodiment, when the same node repeatedly subscribes to the target hard drive, the subscription type in the subscription request matches the subscription type in the target hard drive.
[0156] Example 4
[0157] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0158] Step 201: Receive a registration request from at least one node, and perform a registration operation on the target hard disk requested by the node according to the registration request;
[0159] Step 202: Configure the node that has completed the registration operation to have basic permissions on the target hard drive;
[0160] Step 203: Receive a subscription request from at least one node, confirm that the node has been registered to the target hard disk, and then perform a subscription operation on the target hard disk according to the subscription request;
[0161] Step 204: Configure the node that has completed the subscription operation to have level 2 permissions on the target hard drive.
[0162] In one specific embodiment, the processor performs the following steps when executing a computer program:
[0163] Step 205: Receive a release subscription request from the subscribed node, and execute the release subscription operation of the subscribed node on the target hard disk according to the release subscription request;
[0164] Step 206: Receive a deregistration request from at least one registered node, perform the deregistration operation of the registered node on the target hard disk according to the deregistration request, and determine whether the node has subscribed to the target hard disk; if the node has subscribed to the target hard disk, clear the subscription data; or, if the node has not subscribed to the target hard disk, return an error message.
[0165] In one specific embodiment, the secondary permissions are higher than the primary permissions. The primary permissions include read permissions for nodes registered on the target hard drive; the secondary permissions include read and write permissions for nodes subscribed to on the target hard drive.
[0166] In one specific embodiment, after receiving a subscription request from at least one node in step 203, the method further includes: obtaining the node corresponding to the first subscription request to arrive at the controller, and performing a subscription operation on the target hard disk for that node; wherein, a target hard disk subscribes to a node.
[0167] In one specific embodiment, after completing the release subscription operation in step 205, the method further includes:
[0168] Send unsubscribe notifications to nodes other than those that sent the release subscription request, so that other nodes can initiate registration or subscription instructions to the target hard drive.
[0169] In one specific embodiment, after completing the deregistration operation in step 206, the method further includes: sending a deregistration notification to other nodes besides those that sent the deregistration request; so that other nodes can initiate registration or subscription instructions to the target hard drive.
[0170] In a specific embodiment, step 201, which involves performing a registration operation on the target hard drive requested by the node, specifically includes: the registration request includes a node identifier, a key value, and a target hard drive serial number; within the target hard drive corresponding to the target hard drive serial number, determining whether the node identifier is matched in the target hard drive registration list; if yes, then this node has been registered to the target hard drive; or, if no, this node has not been registered to the target hard drive, then recording the node identifier and key value in the target hard drive registration list to complete the registration operation.
[0171] In a specific embodiment, step 202, which involves performing a subscription operation on the target hard disk based on the subscription request, specifically includes: the subscription request including a node identifier, subscription type, key value, and target hard disk serial number; determining whether the data pointer of the target hard disk is equal to the registered data structure address of the node sending the subscription request; if yes, then the node sending the subscription request has subscribed to the target hard disk; or, if no, and the target hard disk has been subscribed to by other nodes, then the return disk has been incorrectly subscribed to; or, if no, and the node sending the subscription request has not registered to the target hard disk, then the subscription type, the key value, and the node's data pointer are recorded in the subscription data structure of the target hard disk to complete the subscription operation.
[0172] In one specific embodiment, after the node sending the subscription request has subscribed to the target hard disk, the method further includes: determining whether the subscription type matches the subscription type in the data pointer of the current target hard disk; if the subscription type matches the subscription type of the current target hard disk, then ending the subscription; or, if the subscription type does not match the subscription type in the data pointer of the current target hard disk, then returning an error message to the node sending the subscription request.
[0173] In one specific embodiment, when the same node repeatedly subscribes to the target hard drive, the subscription type in the subscription request matches the subscription type in the target hard drive.
[0174] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0175] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0176] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for controlling hard disk access permissions, applied to nodes within a storage cluster accessing a target hard disk, wherein the storage cluster comprises several nodes, characterized in that... The method includes: Receive a registration request from at least one node, and perform a registration operation on the target hard disk requested by the node according to the registration request; The node that has completed the registration operation is granted basic permissions on the target hard drive. Receive a subscription request from at least one node, confirm that the node has been registered to the target hard disk, and then perform a subscription operation on the target hard disk according to the subscription request; The node that has completed the subscription operation has level 2 permissions on the target hard drive; The secondary permissions are higher than the primary permissions. The primary permissions include read permissions for nodes registered on the target hard drive; the secondary permissions include read and write permissions for nodes subscribed to on the target hard drive.
2. The hard disk access permission control method according to claim 1, characterized in that, The method further includes: Receive a release subscription request from a subscribed node, and execute the release subscription operation of the subscribed node on the target hard disk according to the release subscription request; Receive a deregistration request from at least one registered node, execute the deregistration operation of the registered node on the target hard disk according to the deregistration request, and determine whether the node has subscribed to the target hard disk; If this node subscribes to the target hard drive, the subscription data is cleared. Alternatively, an error message is returned in response to the node not having subscribed to the target hard drive.
3. The hard disk access permission control method according to claim 2, characterized in that, After completing the subscription release operation, the method further includes: Send unsubscribe notifications to all nodes except those that sent the release subscription request; This allows other nodes to initiate registration or subscription commands to the target hard drive; After completing the deregistration process, the method further includes: Send a deregistration notification to all nodes except those that sent the deregistration request; This allows other nodes to initiate registration or subscription commands to the target hard drive.
4. The hard disk access permission control method according to claim 1 or 2, characterized in that, Performing a registration operation on the target hard drive requested by the node according to the registration request specifically includes: The registration request includes a node identifier, a key value, and the target hard disk serial number; Within the target hard drive corresponding to the target hard drive serial number, determine whether the node identifier is matched in the target hard drive registration chain; If so, then this node has been registered to the target hard drive; Alternatively, if this node is not registered to the target hard drive, the node identifier and key value are recorded in the registration list of the target hard drive to complete the registration operation.
5. The hard disk access permission control method according to claim 1 or 2, characterized in that, Performing a subscription operation on the target hard drive according to the subscription request specifically includes: The subscription request includes a node identifier, subscription type, key value, and target hard disk serial number; Determine if the data pointer of the target hard drive is equal to the address of the registered data structure of the node that sent the subscription request; If so, the node that sent the subscription request has already subscribed to the target hard drive; Alternatively, if the target hard drive has already been subscribed to by other nodes, then the return disk has been subscribed to incorrectly. Alternatively, if the node sending the subscription request is not registered to the target hard disk, the subscription type, the key value, and the node's data pointer are recorded in the subscription data structure of the target hard disk to complete the subscription operation.
6. The hard disk access permission control method according to claim 5, characterized in that, After the node sending the subscription request has subscribed to the target hard drive, the process further includes: Determine whether the subscription type matches the subscription type in the data pointer of the current target hard disk; If the subscription type matches the subscription type of the current target hard drive, the subscription ends. Alternatively, in response to the subscription type not matching the subscription type in the data pointer of the current target hard disk, an error message is returned to the node that sent the subscription request; When the same node subscribes to the target hard drive repeatedly, the subscription type in the subscription request matches the subscription type in the target hard drive.
7. A hard disk access control system based on the method of any one of claims 1 to 6, applied to accessing a target hard disk by nodes within a storage cluster, wherein the storage cluster comprises a plurality of nodes, characterized in that, The system includes: A registration unit is configured to receive a registration request from at least one node and perform a registration operation on the target hard disk requested by the node according to the registration request; The first setting unit is used to set the node that has completed the registration operation to have basic permissions on the target hard disk; The subscription unit is used to receive subscription requests from at least one node, confirm that the node has been registered to the target hard disk, and then perform a subscription operation on the target hard disk according to the subscription request. The second setting unit is used to set the node that has completed the subscription operation to have level 2 permissions on the target hard disk.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Solid hard disk and access protection method of the same
CN101441604A
Cache coherent control system
US20020083275A1