Path group updating method and apparatus
By generating path group update information and configuring the update status in the multipath kernel module, the I/O interruption problem caused by the reduction of available paths to zero during multipath topology updates is solved, and business continuity is achieved during the path group update process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2026-06-30
- Publication Date
- 2026-07-31
AI Technical Summary
When a multi-path topology is updated, the number of available paths decreases to zero, causing I/O interruptions and affecting customer business continuity.
By responding to changes in the isolation status or priority of a path, path group update information is generated, and the path group update status is configured in the multipath kernel module to block path status modification operations that are not part of this update, ensuring that path topology updates are performed only when available paths exist.
During the path group update process, I/O interruptions were avoided, ensuring the continuity of customer services. Business continuity was maintained through multiple aspects, including triggering conditions, update process, and results.
Smart Images

Figure CN122489014A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for updating path groups. Background Technology
[0002] Storage multipathing technology establishes multiple physical or logical input / output (I / O) paths between servers and storage devices to achieve redundant management and load balancing of storage access. In the event of a storage controller failure, path priorities change, requiring modifications to the multipath group information in the kernel.
[0003] In related technologies, multipath topology updates in the kernel are implemented through multipath overloading. If the number of available paths decreases to zero during a multipath topology update, it will cause I / O interruption and lead to abnormal customer services. Summary of the Invention
[0004] This application provides a path group update method and device to at least solve the problem in related technologies where multi-path topology updates in the kernel via multi-path overloading result in I / O interruptions and abnormal customer services if the number of available paths is reduced to zero during multi-path topology updates.
[0005] This application provides a path group update method, comprising: in response to any path's isolation state change or priority change, obtaining and generating path group update information based on the path's priority information; sending the path group update information to a multipath kernel module, configuring the multipath kernel module to be in a path group update state; sending an overloaded multipath instruction to the multipath kernel module, updating the path topology in the multipath kernel module; if the overloaded multipath instruction executes successfully, constructing path group update completion information, sending the path group update completion information to the multipath kernel module, configuring the multipath kernel module to be in a path group update completion state, wherein if there is an isolation state change, a priority change, the multipath kernel module being in a path group update state, or the overloaded multipath instruction executes successfully, there are available paths in the path group.
[0006] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the path group update methods described above when executing the computer program.
[0007] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the path group update methods described above.
[0008] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the path group update methods described above.
[0009] By configuring isolation state changes and priority change trigger conditions, path group updates are triggered when available paths exist. Configuring the multipath kernel module to be in path group update state can block path state modification operations that are not part of the current update, ensuring available paths exist during the path group update process. If the overloaded multipath instruction executes successfully, it indicates the existence of available paths, thus eliminating I / O interruptions. This solves the technical problem of I / O interruptions caused by reducing available paths to zero during multipath topology updates implemented in the kernel via multipath overloading, leading to abnormal customer services. It achieves the technical effect of maintaining customer service continuity while updating path group information from multiple aspects, including trigger conditions, update process, and update results. Attached Figure Description
[0010] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the 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.
[0011] Figure 1 A flowchart illustrating the path group update method provided in this application is shown; Figure 2 Another flowchart of the path group update method provided in this application is shown; Figure 3 This illustrates yet another flowchart of the path group update method provided in this application; Figure 4 A schematic diagram of the composition structure of the path group update device provided in this application is shown; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0013] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0014] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0015] Storage multipathing is a technology that improves the availability and performance of storage systems. It aggregates multiple I / O connection paths at the host operating system level, forming a unified logical device to ensure the continuity and reliability of data access. In real-world production environments, multipathing is a standard feature of enterprise-level storage architectures. It is widely used in mission-critical systems such as virtualization platforms, database clusters, and cloud platform infrastructure to ensure business continuity. Whether it's traditional Storage Area Network (SAN) storage or modern hyperconverged infrastructure, multipathing plays an irreplaceable role, becoming a cornerstone technology for building reliable Information Technology (IT) infrastructure. By implementing storage multipathing, enterprises can achieve significant improvements in high availability at a relatively low cost, providing a robust protective barrier for critical business data in real-world environments where hardware failures are unavoidable.
[0016] SAN (Storage Area Network) is used to characterize a single data storage network formed by connecting several storage servers through a specific interconnection method. I / O (Input / Output) characterizes the process of reading and writing data between memory and processor in a computer system. It specifically refers to the complete data exchange operation of reading data from storage media (disks, solid-state drives, etc.) into memory, or writing data from memory into storage media.
[0017] In related technologies, when updating the multipath topology in the kernel, after a fly-through I / O operation returns (i.e., after an incomplete I / O operation returns normally or returns an error), the kernel releases the blocked I / O flag. At this point, if the number of available paths is reduced to zero, I / O will no longer be blocked, allowing the path group update of the multipath to be completed. Specifically, for fly-through I / O, normally completed I / O returns a normal return; normally incomplete I / O returns an error, such as an error code, timeout error, or unknown error.
[0018] Specifically, multipath devices have multiple paths. By default, all paths are configured to be unavailable, blocking I / O at the multipath level for a period of time, such as 600 seconds. Upper-layer services experience lag and return a busy state. This I / O blocking can be achieved using a blocking I / O flag. During this blocking period, if only one path is restored, multipath I / O is no longer blocked, and upper-layer services resume without lag. If no path is restored, the busy state is no longer returned; an error code is reported, and service is interrupted. Releasing the blocking I / O flag means that blocking I / O actions are no longer performed; normal I / O operations directly return "I / O normal," and abnormal operations directly return "Exception."
[0019] In related technologies, changes to multipath path group information in the kernel are achieved through multipath reloading. That is, in these technologies, path groups and path policies are managed by the kernel. When the path group configuration changes, it cannot dynamically take effect; multipath reloading is required to reload and update the path group information in the kernel for the configuration to take effect. However, this method has a problem: if the path group is updated and the number of available paths is reduced to zero, the path group update can cause I / O interruptions, leading to service disruptions for customers. For example, storage controller failures, storage controller failure recovery, link failure isolation, or link failure isolation recovery can all cause I / O interruptions and service disruptions for customers.
[0020] It should be noted that for a given disk, if path group 1 of a storage controller has a higher priority than path group 2 of another storage controller, I / O will be preferentially sent to path group 1. Different paths will be assigned to different path groups, which can be distinguished by priority. I / O is preferentially sent to the storage controller with higher priority. If all paths in the storage controller with higher priority are unavailable, I / O will be sent to the storage controller with lower priority.
[0021] The following situations will cause path group updates: First, a new path is added to the isolated path group, and the priority of the isolated path group is lower than that of the normal path group; Second, a path is removed from the isolated path group; Third, a storage controller fails, and the path group priority changes. For example, in the case of four storage controllers (controller 1, controller 2, controller 3, and controller 4), for volume A, controller 1 is optimal, and controllers 2, 3, and 4 are non-optimal. If controller 1 fails, the path group priority for volume A changes, controller 2 becomes optimal, and controllers 3 and 4 remain non-optimal; Fourth, the storage controller recovers from the failure, and the path group priority changes. Using the example from the third situation, if controller 1 recovers from the failure, the path group priority changes, and for volume A, controller 1 becomes optimal, and controllers 2, 3, and 4 become non-optimal.
[0022] The embodiments of this application provide a path group update method that can be applied to large-scale volume scenarios on host cloud platforms. Figure 1 A flowchart illustrating the path group update method provided in this application is shown, as follows: Figure 1 As shown, the path group update method provided in this application includes: Step S101: In response to any path's isolation status change or priority change, obtain and generate path group update information based on the path's priority information.
[0023] A change in the isolation status of any path indicates that the path has joined or left an isolation path group. A change in the priority of any path indicates a change in path priority due to storage controller failure or failure recovery. Path group update information is used to represent data containing the latest priorities and isolation status of all paths. Path priority change information can be obtained from the storage device via the Small Computer System Interface (SCIC) protocol or the Non-Volatile Memory Express (NVMe) specification.
[0024] Specifically, in step S101, when the periodic probing thread of the user-space multipath driver detects a change in the isolation status of a path, or if the isolation status of a path remains unchanged but a change in the priority of a path is detected, the priority information of all paths is reacquired, and path group update information is generated based on the reacquired priority information. The configuration of the trigger condition of a change in the isolation status of any path ensures that isolation of a path is only allowed if the traffic of any path can be migrated to other available paths, i.e., if the number of available paths is greater than or equal to one. If there is no change in the isolation status of a path, but there is a priority adjustment of a path, it also indicates that at least one path is in an available state.
[0025] The user-space multipath-driven periodic probing thread is used to characterize a thread running within a user process that performs link inspections at fixed time intervals to detect multipath reliability. Path isolation can only be triggered if the path meets the isolation conditions, which are determined by the existence of other non-isolated available paths—meaning that even after isolating the path, there are still paths handling I / O. If there are no other available paths, the path will not be isolated, and naturally, no isolation state change will be triggered. Priority adjustment only changes the path forwarding order and does not remove any paths. Before adjustment, the system will default to verifying that at least one path is active or available; otherwise, the priority change is meaningless and will not trigger a priority update.
[0026] Step S102: Send the path group update information to the multipath kernel module and configure the multipath kernel module to be in the path group update state.
[0027] The multipath kernel module represents a dedicated program module running in the operating system kernel mode, serving as the core entity for kernel-level multipath I / O management. This module is capable of maintaining a path topology table, receiving and executing overloaded multipath instructions, managing path isolation status and priority, and providing feedback on instruction execution results. It is the core execution entity in the path group update process, responsible for receiving update information, updating path topology, and managing update status, and runs in kernel mode. The path group update status, indicating that the multipath kernel module is updating the path group, can be configured using update flags.
[0028] Once the multipath kernel module enters the path group update state, it will block all path modification operations that are not part of this update. Even if a path suddenly fails during the update process, the module will first configure the I / O strategy to return to the upper layer instead of directly removing the path, ensuring that the number of available paths will not drop to zero during the update. In other words, the available path pool is locked during the update process, and the topology can only be updated based on existing available paths. It will not be interrupted by external operations or exceptions, causing the number of available paths to drop to zero.
[0029] Specifically, the user-mode multipath-driven periodic probing thread sends the path group update information generated in step S101 to the multipath kernel module, which then parses the path group update information.
[0030] Step S103: Send the reloaded multipath instruction to the multipath kernel module and update the path topology in the multipath kernel module.
[0031] The overloaded multipath instructions represent the topology update commands that the multipath kernel module can execute, and can be used to trigger path topology recalculation. The path topology represents the multipath forwarding rule table recorded in the multipath kernel module, which includes path priority, availability status, and forwarding mapping relationships.
[0032] Specifically, the user-mode multipath-driven periodic probing thread constructs overloaded multipath instructions in user mode and sends the overloaded multipath instructions to the multipath kernel module, where the multipath kernel module updates the multipath topology based on the overloaded multipath instructions.
[0033] Step S104: If the reloaded multipath instruction is executed successfully, construct path group update completion information, send the path group update completion information to the multipath kernel module, and configure the multipath kernel module to be in the path group update completion state. If there is an isolation state change, priority change, the multipath kernel module is in the path group update state, or the reloaded multipath instruction is executed successfully, there is an available path in the path group.
[0034] In this step, the path group update completion information is a notification indicating that the path topology update operation has been successfully executed. The path group update completion status indicates that the multipath kernel module has marked the path group update as complete, and normal path management can proceed. If the number of available paths in the updated path topology is greater than or equal to one, it is determined whether the overloaded multipath instruction has been executed successfully.
[0035] Specifically, if the user-space multipath-driven periodic probe thread confirms that the overloaded multipath instruction has been executed successfully, it constructs a path group update completion message and sends it to the multipath kernel module. The multipath kernel module parses the path group update completion message and switches itself from the path group update state to the path group update complete state. If the overloaded multipath instruction fails to execute, it will not send a path group update completion message. The multipath kernel module will maintain the original topology, and I / O will still be forwarded according to the original topology without interruption.
[0036] In this way, by configuring the isolation state change and priority change trigger conditions, the path group update is triggered when an available path exists, avoiding the situation where an update is initiated when no path is available. Configuring the multipath kernel module to be in the path group update state can block path state modification operations that are not part of the current update, ensuring that an available path exists during the path group update process. If the overloaded multipath instruction executes successfully, it indicates that an available path exists, thus eliminating I / O interruptions. From the trigger conditions, update process, and update results, the continuity of customer services can be maintained while updating path group information.
[0037] Path group updates in related technologies are a black-box process, making it impossible to determine whether the update is in progress, completed, or failed. If problems arise during the update, it is difficult to pinpoint the cause.
[0038] In some optional implementations, the aforementioned path group update method further includes: configuring a path isolation status change flag, wherein if the path isolation status changes, the path isolation status change flag is configured to true; configuring a first path group update flag, wherein when path group update information is generated, the first path group update flag is configured to true, and after the multipath kernel module is configured to be in a path group update completed state, the first path group update flag is configured to false; configuring a second path group update flag, wherein after the path group update information is sent to the multipath kernel module, the second path group update flag is configured to true, and when the multipath kernel module is configured to be in a path group update completed state, the second path group update flag is configured to false.
[0039] In this implementation, the user-space multipath-driven periodic probing thread pre-configures an isolation status change flag for each path, which can be represented by the letter A. During initialization, the isolation status change flag for each path is set to false. When the isolation status of a path changes, i.e., a path is isolated or de-isolated, its isolation status change flag is set to true.
[0040] The user-space multi-path driven periodic probing thread can globally configure a path group update flag in user space. This flag, represented by the letter B, is set to true when a path group update is in progress and false when the update is complete. This facilitates management of the user-space path group update process and prevents concurrent conflicts caused by a previous update not being completed before a subsequent update is initiated.
[0041] The user-space multipath-driven periodic probing thread can configure a second path group update flag within the multipath kernel module. This flag, represented by the letter 'S', is set to true after the multipath kernel module receives path group update information, thus blocking path modification operations not related to the current update. If the path group update fails while the flag is true, the update operation will still be performed even if subsequent path isolation state or priority changes no longer meet the requirements. When the multipath kernel module switches to a path group update complete state, the flag is set to false. This allows for management of the path update execution process within the multipath kernel module.
[0042] In this way, by using the status (true / false) of the isolation state change flag, the first path group update flag, and the second path group update flag, it is possible to detect in real time whether an isolation change has been triggered and whether the multi-path kernel module is performing path updates. In case of an update anomaly, the specific step can be quickly located. For example, if the second path group update flag is always true, it means that the process is stuck in the multi-path kernel module. The use of multiple flags can ensure the serial execution of the update process and avoid the problems that are prone to occur when the multi-path kernel module has no flags or only the multi-path kernel module has configured flags, such as multiple update commands being initiated at the same time or the multi-path kernel module being interrupted by other operations during the update. The update path group can be implemented safely and simply.
[0043] In some optional implementations, the aforementioned path group update method further includes: if the kernel-mode multipath driver's input / output completion processing module detects an anomaly in the target path during the path topology update process, configuring the multipath input / output processing strategy to return to the upper layer; determining whether the anomaly is repairable, and if it is determined that the anomaly is repairable, configuring the multipath input / output processing strategy to re-queue and configuring the target path as invalid; if it is determined that the anomaly is not repairable, performing input / output path statistics; if the number of available paths is zero and the blocked input / output flag is false, obtaining the second path group update flag, and determining the second... Check if the path group update flag is false; if the second path group update flag is false, configure the multi-path input / output processing strategy to return to the upper layer; if the second path group update flag is true, obtain and determine the path group update time based on the current time and the path group update start time. If the path group update time is greater than a preset time threshold, configure the multi-path input / output processing strategy to return to the upper layer. If the path group update time is less than or equal to the preset time threshold, perform input / output path statistics. If the number of available paths is not zero or the blocked input / output flag is true, perform input / output path statistics.
[0044] The kernel-mode multipath-driven I / O completion processing module is used to obtain the I / O execution results of each physical path and distinguish between normal I / O completion and link failure.
[0045] Figure 2 Another flowchart illustrating the path group update method provided in this application is shown. Figure 2 As shown, the path group update method provided in this application also includes the following steps that can be executed by the kernel-mode multipath-driven I / O completion processing module: Step S201: Configure the multipath input / output processing strategy to return to the upper layer.
[0046] Step S202: Determine whether it is an unrecoverable error. If yes, proceed to step S212; otherwise, proceed to step S203.
[0047] Step S203: Determine whether it is a recoverable error. If yes, proceed to step S204; otherwise, proceed to step S212.
[0048] Step S204: Configure the multi-path input / output processing strategy to re-queue, and proceed to step S205.
[0049] Step S205: Configure the target path as invalid, then proceed to step S206.
[0050] Step S206: Determine if the number of available paths is zero and the blocked input / output flag is false. If yes, proceed to step S207; otherwise, proceed to step S212.
[0051] Step S207: Obtain the second path group update flag, then proceed to step S208.
[0052] Step S208: Determine whether the update flag of the second path group is false. If yes, proceed to step S211; otherwise, proceed to step S209.
[0053] Step S209: Obtain and determine the time elapsed for path group update based on the current time and path group update start time, then proceed to step S210.
[0054] Step S210: Determine whether the time used for path group update is greater than the preset time threshold. If yes, proceed to step S211; otherwise, proceed to step S212.
[0055] Step S211: Configure the multipath input / output processing strategy to return to the upper layer.
[0056] Step S212: Perform input / output path statistics.
[0057] In this implementation, if the kernel-mode multi-path driven I / O completion processing module detects an anomaly in the target path during path topology updates, the multi-path I / O processing strategy is configured to directly return to the upper layer. That is, the anomaly is returned to the calling business program, preventing it from directly propagating to the business layer. Differential processing is performed based on whether the anomaly is repairable. If the anomaly is repairable, the I / O processing strategy is configured to re-queue, waiting for the anomaly to be repaired before retrying. Simultaneously, the target path is marked as invalid to prevent subsequent tasks from continuing to be sent to the target path. If the anomaly is irreparable, I / O path statistics are performed, recording the abnormal path and the number of I / O failures.
[0058] When the number of available paths is zero, it will directly cause an I / O interruption. We can first check the kernel's path group update status. If the second path group update flag is false, it means that there is no ongoing update operation, and the zeroing of available paths is a real fault. We can directly configure the I / O policy to return to the upper layer so that the upper layer business can detect and handle it in time. If the second path group update flag is true, it means that the zeroing of available paths may be a temporary state during the update process, and we need to further determine the update duration.
[0059] If the elapsed time exceeds the preset time threshold, the update has timed out and is deemed a failure. The I / O strategy is then configured to return to the upper layer. If the elapsed time is less than or equal to the preset time threshold, the update is still within a reasonable timeframe. I / O path statistics are then performed, and the system continues to wait for the update to complete. This distinguishes between temporary path zeroing during the update and path zeroing due to actual failures, preventing unnecessary I / O interruptions caused by misjudgments.
[0060] If the available path data is not zero or the blocked I / O flag is true, it indicates that there is no risk of interruption or the system is actively blocking I / O, and I / O path statistics can be performed.
[0061] In this way, the kernel-mode multi-path driven I / O completion processing module first configures the I / O strategy to return to the upper layer when an exception occurs, so that the upper layer business can receive feedback and process it in a timely manner, eliminating the problem of I / O unresponsiveness; the differentiated handling of exceptions can improve the success rate of I / O retry and reduce system resource consumption; and the distinction between zeroing temporary paths during updates and zeroing paths due to real faults can avoid misjudgment that leads to unnecessary I / O interruptions.
[0062] In some optional implementations, determining whether an anomaly is repairable includes: identifying the anomaly type of the target path; if the anomaly type indicates that input / output operations cannot be performed through other paths, determining that the anomaly is unrepairable; if the anomaly type indicates that there is an alternative path to perform input / output operations, determining that the anomaly is repairable.
[0063] In this implementation, input / output operations cannot be performed through other paths; that is, access will result in an error regardless of the path used, indicating an unrecoverable anomaly. Examples include the backend storage volume being unresponsive, offline, or having a faulty storage medium. Alternative paths exist for performing input / output operations; that is, even if the target path is inaccessible, other paths remain accessible. For example, the backend storage volume may be functioning correctly, but it may be inaccessible via the target path.
[0064] In this way, the existence of alternative paths represented by the anomaly type is used as a criterion to determine the recoverability of the anomaly. After identifying the anomaly type of the target path, if the anomaly type indicates that there are no other paths to perform I / O operations, the anomaly is determined to be unrecoverable; if the anomaly type indicates that there are alternative paths to perform I / O operations, the anomaly is determined to be recoverable. With multi-path I / O service continuity as the core, efficient decision-making on anomaly recoverability is achieved through simple single-step judgment, avoiding invalid repair operations and ensuring I / O processing efficiency.
[0065] In some optional implementations, the aforementioned path group update method further includes: a periodic probing thread driven by user-space multipaths traversing the paths; for any traversed path, determining whether it is within the path detection period; if within the path detection period, determining whether the traversed path is active; if active, determining whether the traversed path meets the isolation condition; if the traversed path meets the isolation condition, determining whether the isolation flag of the traversed path is false; if the isolation flag of the traversed path is false, configuring the isolation flag of the traversed path to true; if the isolation flag of the traversed path is true, determining whether the isolation state change flag of the traversed path is true; if the isolation state change flag of the traversed path is true, configuring the first path group update flag to true.
[0066] In this implementation, the user-space multi-path driven periodic detection thread performs a traversal operation on all paths based on a preset path detection period, checking the status of each path one by one. For example, abnormal paths are checked every five seconds, and normal paths are checked every twenty seconds. For any traversed path, it first checks whether its own detection period has expired. If it is within its detection period, it continues to check whether the path is active, that is, whether the path is carrying services or whether it is in a forwardable I / O state. If the path is active, it checks whether it meets the isolation conditions. If the path meets the isolation conditions, it first checks whether its isolation flag is false. If so, it sets the isolation flag to true and marks it as pending isolation. If the path isolation flag is already true (isolated), it further checks whether its isolation status change flag is true, which can avoid duplicate isolation. If the path isolation status change flag is true, that is, it is confirmed that the isolation status has changed, the first path group update flag can be set to true, which can avoid meaningless update operations.
[0067] At least one of the following conditions can be used as isolation criteria: two errors or timeouts occur within 120 seconds; I / O latency is significantly greater than other paths or the average latency; the proportion of distributed time window errors exceeds a certain threshold over a period of time, etc. If a path meets the isolation criteria, it indicates that the path is currently available but is in the process of deterioration, for example, due to optical attenuation or jitter in the fiber optic link medium. If a path does not meet the isolation criteria, it indicates that the minor fault in the path has been resolved or the path fault has been eliminated.
[0068] In this way, by using multiple layers of filtering, including detection cycle verification, activity status verification, and isolation condition verification, subsequent operations are only performed on paths that are within the detection cycle, active, and isolable. This reduces invalid detection operations and significantly lowers system load. In addition, the first path group update flag is only triggered when the isolation flag changes from false to true and the isolation status change flag is true. This ensures that a true and effective isolation status change will trigger subsequent updates, avoiding frequent triggering of the update process and improving system stability.
[0069] In some optional implementations, the aforementioned path group update method further includes: if the isolation condition is not met, the periodic probing thread driven by the user-space multipath determines whether the isolation flag of any traversed path is true; if the isolation flag of any traversed path is true, the periodic probing thread driven by the user-space multipath configures the isolation flag of any traversed path to false and configures the isolation status change flag of any traversed path to true.
[0070] In this implementation, if a traversed path is verified to be within the detection period and in an active state, but does not meet the isolation conditions (e.g., the path load drops below a threshold, link jitter recovers, or isolation is unnecessary), the isolation flag of the path is first determined to be true, i.e., whether it is currently in an isolated state. If the path isolation flag is true (currently isolated), the isolation flag is configured to false, the isolation state of the path is lifted, and the path is allowed to re-enter the available path pool to take over business traffic, thus avoiding the waste of resources caused by the long-term isolation of effective paths.
[0071] After the recovery operation, setting the isolation state change flag to true will trigger the first path group update flag mentioned above to true, thereby starting the path group update process. This means that after the path is restored, the topology in the kernel will be updated synchronously, and the newly restored path will be immediately included in the traffic forwarding policy. This avoids the problem that the path has been restored but the topology has not been updated, and traffic still does not pass through the path, thus ensuring policy consistency.
[0072] In this way, when the isolation condition disappears, the isolation flag is automatically checked and reset, making the path available again. For example, if a path is isolated due to short-term high load, the isolation is immediately lifted after the load is restored, and the traffic is taken over, avoiding waste of path resources. This not only realizes the automatic reuse of effective paths and improves the utilization rate of multi-path resources, but also triggers topology updates through state change flags to ensure that the forwarding policy takes effect synchronously after the path is restored, avoiding response delays and state confusion caused by manual intervention.
[0073] In some optional implementations, the aforementioned path group update method further includes: if the isolation state change flag of any traversed path is false, the periodic probe thread driven by the user-space multipath determines whether there is a priority change; if there is a priority change, the first path group update flag is configured to be true; if there is no priority change, it is determined whether the first path group update flag is true; if the first path group update flag is true, an overloaded multipath instruction is constructed.
[0074] In this implementation, after traversing the paths and completing the isolation status change verification, the priority change verification begins. If a priority change is detected, the first path group update flag is set to true. If there is no priority change, it is further determined whether the first path group update flag is true, i.e., whether it has been set due to an isolation change. As long as the flag is true, regardless of whether it is triggered by isolation or a priority change, an overloaded multipath instruction is constructed. Instructions are only constructed when it is confirmed that an update is needed, avoiding meaningless instruction construction and issuance, and reducing system overhead.
[0075] In this way, by verifying isolation changes and priority changes in multiple dimensions, updates can be triggered regardless of whether it is path isolation, storage controller recovery, or priority adjustment, ensuring that all path policy adjustments can be synchronized to the kernel topology. At the same time, by mapping isolation state changes and priority changes to a unified signal that the first path group update flag is true, the subsequent construction of overloaded multipath instructions to the kernel update topology process does not need to distinguish the trigger source, which can greatly simplify the complexity of the update process and reduce development and maintenance costs.
[0076] Figure 3 This illustrates another flowchart of the path group update method provided in this application, such as... Figure 3 As shown, another step in the path group update method provided in this application includes the following steps executed by a periodic probing thread driven by user-space multipath: Step S301: Set the isolation status change flag of each path to false.
[0077] Step S302: Traverse all paths and determine whether the current traversed path has reached the path detection period. If yes, proceed to step S303; otherwise, proceed to step S325.
[0078] Step S303: Determine whether the current traversal path is active. If yes, proceed to step S304; otherwise, proceed to step S309.
[0079] Step S304: Determine whether the current traversal path meets the isolation condition. If yes, proceed to step S305; otherwise, proceed to step S307.
[0080] Step S305: Determine whether the isolation flag of the current traversal path is false. If yes, proceed to step S306; otherwise, proceed to step S309.
[0081] Step S306: Set the isolation flag of the current traversal path to true, set the update flag of the first path group to true, and proceed to step S309.
[0082] Step S307: Determine whether the isolation flag of the current traversal path is true. If yes, proceed to step S308; otherwise, proceed to step S309.
[0083] Step S308: Set the isolation flag of the current traversal path to false, set the isolation status change flag of the current traversal path to true, and proceed to step S309.
[0084] Step S309: Determine whether the isolation status flag of the current traversal path is true. If yes, proceed to step S312; otherwise, proceed to step S310.
[0085] Step S310: Determine whether the priority of the path has changed. If yes, proceed to step S312; otherwise, proceed to step S311.
[0086] Step S311: Determine if the first path group update flag is true. If yes, proceed to step S317; otherwise, proceed to step S325.
[0087] Step S312: Configure the first path group update flag to true, then proceed to step S313.
[0088] Step S313: Reacquire the priority information of all paths and update the path group information, then proceed to step S314.
[0089] Step S314: Construct path group priority change information, send it to the multipath kernel module, and proceed to step S315.
[0090] Step S315: The multipath kernel module parses the path group priority change information, sets the second path group update flag to true, and proceeds to step S316.
[0091] Step S316: Obtain the current time and assign it to the path group update start time. Configure the path group update timeout threshold and proceed to step S317.
[0092] Step S317: Construct overloaded multipath instructions and send them to the multipath kernel module, then proceed to step S318.
[0093] In step S318, the multipath kernel module waits for the flight input / output task processing to complete before proceeding to step S319.
[0094] Step S319: The multipath kernel module updates the multipath topology, then proceeds to step S320.
[0095] Step S320: Determine whether the overloaded multipath instruction was executed successfully. If yes, proceed to step S321; otherwise, proceed to step S325.
[0096] Step S321: Construct path group update completion information, send the path group update completion information to the multipath kernel module, and proceed to step S322.
[0097] Step S322: The multipath kernel module parses the path group update completion information, sets the second path group update flag to false, and proceeds to step S323.
[0098] Step S323: Set the path group update start time to an invalid value, and proceed to step S324.
[0099] Step S324: Set the first path group update flag to false, and proceed to step S325.
[0100] Step S325, End.
[0101] In this way, by identifying scenarios of isolation state change or priority change, when such scenarios are identified, the isolation state change flag, the first path group update flag, and the second path group update flag are passed to the multi-path kernel module. The multi-path kernel module will, based on the received flag values and preset thresholds, perform a re-queueing action for path group update scenarios. The path group update task will wait or fail after timeout. To avoid the failure of the multi-path kernel module's path group update, which would cause the user space to miss the opportunity to determine whether the path group needs to be updated and thus be unable to perform the multi-path kernel module's path group update again, a judgment on whether the multi-path kernel module's path group update is completed is added during the path detection cycle. This ensures that the multi-path kernel module's path group update is completed asynchronously, updates path group information, ensures the continuity of customer business, and enhances system availability.
[0102] In some optional implementations, if the periodic probing thread driven by the user-space multipath detects that any traversal path meets the isolation condition, it includes: if there are other non-isolated available paths, not selecting any traversal path for input / output; if there are no other non-isolated available paths, selecting any traversal path for input / output.
[0103] In this implementation, if any traversed path meets the isolation condition, and there exists an unisolated path that can normally handle I / O tasks, then the path is determined to meet the isolation condition, and the I / O operation is not performed on that path. If any traversed path meets the isolation condition, but there are no other available paths, then the traversed path is determined not to meet the final isolation condition, and the I / O operation is still performed on that path.
[0104] The existence of other non-isolated available paths is used as the core criterion for determining path isolation. If other non-isolated available paths exist, the path is deemed to meet the isolation condition, and I / O is not performed on that path. If no other non-isolated available paths exist, the path is deemed not to meet the isolation condition, and I / O is performed on that path. This approach fundamentally avoids I / O interruption issues caused by isolating only one available path, balances path exception handling with business continuity, and uses a simple, quantifiable, easy-to-implement, and unambiguous criterion.
[0105] In this way, using the existence of a backup path as the criterion for path isolation can ensure business continuity and reduce interruptions to input and output tasks. At the same time, if there is a backup path, the abnormal path is isolated and traffic is switched to the backup path, which can handle path anomalies without affecting business. If there is no backup path, isolation is abandoned and the path is used to continue to protect business. Isolation is triggered again after the backup path is restored, which can balance path anomaly handling and business continuity.
[0106] In some optional implementations, the user-space multipath-driven periodic probing thread sends reloaded multipath instructions to the multipath kernel module, and updates the path topology in the multipath kernel module, including: constructing reloaded multipath instructions based on isolation state change information and priority change information; if the flight input / output task processing is completed in the multipath kernel module, updating the path topology in the multipath kernel module based on the reloaded multipath instructions.
[0107] In this embodiment, the overloaded multipath instructions are specifically constructed based on the isolation status change information and priority change information of this update, including specific information such as which paths are isolated / restored, which paths have priority adjustments, and new path forwarding rules; instructions can be constructed for the changed paths, reducing the processing overhead of the multipath kernel module, while ensuring that the instructions accurately match the requirements of this update.
[0108] After receiving the reload instruction, the multipath kernel module does not update the topology immediately. Instead, it waits for all flight I / O tasks to be completed. After confirming that there are no incomplete I / O tasks, it updates the path topology based on the change information in the reload instruction. This avoids modifying the topology during I / O execution. If there is still flight I / O when the topology is updated, it may cause I / O requests to be sent to isolated paths or forwarded according to the old priority, resulting in I / O failure and data corruption.
[0109] In this way, by constructing targeted overloaded multi-path instructions based on isolation or priority change information, and waiting for the multi-path kernel module to complete flight I / O to update the topology execution logic, the kernel resource consumption caused by general overloaded instructions is avoided, and I / O anomalies and data corruption caused by incomplete flight I / O during the update process are eliminated. At the same time, atomic and seamless updates of the path topology are achieved, ensuring the consistency of business data and the smoothness of updates.
[0110] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0111] Embodiments of this application also provide a path group update apparatus. Figure 4A schematic diagram of the composition structure of the path group update device provided in this application is shown, as follows: Figure 4 As shown, the path group update device includes: The first module 401 is used to obtain and generate path group update information based on the priority information of any path in response to a change in isolation status or priority of any path.
[0112] The second module 402 is used to send path group update information to the multipath kernel module and configure the multipath kernel module to be in path group update state.
[0113] The third module 403 is used to send overloaded multipath instructions to the multipath kernel module, where the path topology is updated.
[0114] The fourth module 404 is used to construct path group update completion information if the overloaded multipath instruction is executed successfully, send the path group update completion information to the multipath kernel module, and configure the multipath kernel module to be in the path group update completion state. If there is an isolation state change, priority change, the multipath kernel module is in the path group update state, or the overloaded multipath instruction is executed successfully, there is an available path in the path group.
[0115] In some optional embodiments, the aforementioned path group update device further includes: a fifth module, configured to configure a path isolation status change flag, wherein if the path isolation status changes, the path isolation status change flag is configured to true; configure a first path group update flag, wherein when path group update information is generated, the first path group update flag is configured to true, and after the multipath kernel module is configured to be in a path group update completed state, the first path group update flag is configured to false; and configure a second path group update flag, wherein after the path group update information is sent to the multipath kernel module, the second path group update flag is configured to true, and when the multipath kernel module is configured to be in a path group update completed state, the second path group update flag is configured to false.
[0116] In some optional embodiments, the aforementioned path group update device further includes: a sixth module, configured to: if an anomaly occurs in the target path during the path topology update process, configure the multi-path input / output processing strategy to return to the upper layer; determine whether the anomaly is repairable; if the anomaly is repairable, configure the multi-path input / output processing strategy to re-queue and configure the target path as invalid; if the anomaly is unrepairable, perform input / output path statistics; if the number of available paths is zero and the blocked input / output flag is false, obtain a second path group update flag and determine whether the second path group update flag is false; if the second path group update flag is false, configure the multi-path input / output processing strategy to return to the upper layer; if the second path group update flag is true, obtain and determine the path group update elapsed time based on the current time and the path group update start time; if the path group update elapsed time is greater than a preset time threshold, configure the multi-path input / output processing strategy to return to the upper layer; if the path group update elapsed time is less than or equal to the preset time threshold, perform input / output path statistics; if the number of available paths is not zero or the blocked input / output flag is true, perform input / output path statistics.
[0117] In some optional implementations, the sixth module includes a first unit for identifying the anomaly type of the target path; if the anomaly type indicates that input / output operations cannot be performed through other paths, the anomaly is determined to be unrepairable; if the anomaly type indicates that there is an alternative path for performing input / output operations, the anomaly is determined to be repairable.
[0118] In some optional implementations, the aforementioned path group update device further includes: a seventh module, configured to perform a path traversal operation, and for any traversed path, determine whether it is within a path detection period; if within a path detection period, determine whether any traversed path is active; if active, determine whether any traversed path meets the isolation condition; if any traversed path meets the isolation condition, determine whether the isolation flag of any traversed path is false; if the isolation flag of any traversed path is false, configure the isolation flag of any traversed path to true; if the isolation flag of any traversed path is true, determine whether the isolation status change flag of any traversed path is true; if the isolation status change flag of any traversed path is true, configure the first path group update flag to true.
[0119] In some optional implementations, the aforementioned path group update device further includes: an eighth module, configured to determine whether the isolation flag of any traversed path is true if the isolation condition is not met; if the isolation flag of any traversed path is true, configure the isolation flag of any traversed path as false and configure the isolation status change flag of any traversed path as true.
[0120] In some optional implementations, the aforementioned path group update device further includes: a ninth module, configured to determine whether there is a priority change if the isolation status change flag of any traversed path is false; if there is a priority change, configure the first path group update flag to true; if there is no priority change, determine whether the first path group update flag is true; if the first path group update flag is true, construct an overloaded multipath instruction.
[0121] In some optional implementations, the seventh module includes a first unit of the seventh module, configured to, if other non-isolated available paths exist, not select any traversal path for input and output; and if no other non-isolated available paths exist, select any traversal path for input and output.
[0122] In some optional implementations, the third module includes: a first unit of the third module, used to construct overloaded multipath instructions based on isolation state change information and priority change information; if the flight input / output task processing is completed in the multipath kernel module, the path topology is updated in the multipath kernel module based on the overloaded multipath instructions.
[0123] For a description of the features in the embodiment corresponding to the path group update device, please refer to the relevant description in the embodiment corresponding to the path group update method, which will not be repeated here.
[0124] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0125] The following is a detailed reference. Figure 5 The diagram illustrates a structural schematic suitable for implementing the electronic device described in the embodiments of this application. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from memory 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the electronic device. The processor 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0126] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0127] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 509, or installed from memory 508, or installed from ROM 502. When the computer program is executed by processor 501, it performs the functions defined in the path group update method of embodiments of this application.
[0128] Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0129] Embodiments of this application also provide a computer-readable storage medium storing a computer program configured to execute the steps in any of the above-described path group update method embodiments at runtime.
[0130] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0131] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described path group update method embodiments.
[0132] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in any of the above-described path group update method embodiments.
[0133] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0134] The path group update method and device provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of this application.
Claims
1. A path group update method, characterized in that, The method includes: In response to any change in isolation status or priority of a path, obtain and generate path group update information based on the path's priority information; The path group update information is sent to the multipath kernel module, and the multipath kernel module is configured to be in the path group update state. The overloaded multipath instruction is sent to the multipath kernel module, and the path topology is updated in the multipath kernel module; If the overloaded multipath instruction is executed successfully, path group update completion information is constructed and sent to the multipath kernel module. The multipath kernel module is then configured to be in the path group update completion state. If there is an isolation state change, a priority change, the multipath kernel module is in the path group update state, or the overloaded multipath instruction is executed successfully, there is an available path in the path group.
2. The path group update method according to claim 1, characterized in that, The method further includes: Configure the isolation status change flag of the path. If the isolation status of the path changes, configure the isolation status change flag of the path to true. Configure a first path group update flag. When the path group update information is generated, the first path group update flag is configured to true. After the multi-path kernel module is configured to be in the path group update completed state, the first path group update flag is configured to false. Configure a second path group update flag. After sending the path group update information to the multipath kernel module, configure the second path group update flag of the multipath kernel module to true. When the multipath kernel module is configured to be in the path group update completed state, configure the second path group update flag to false.
3. The path group update method according to claim 2, characterized in that, The method further includes: If an anomaly occurs in the target path during the path topology update process, configure the multi-path input / output processing strategy to return to the upper layer. Determine whether the anomaly is repairable. If the anomaly is repairable, configure the multi-path input / output processing strategy to re-queue and configure the target path as invalid. If the anomaly is not repairable, perform input / output path statistics. If the number of available paths is zero and the blocked input / output flag is false, obtain the second path group update flag and determine whether the second path group update flag is false; If the update flag of the second path group is determined to be false, the multi-path input / output processing strategy is configured to return to the upper layer; If the second path group update flag is true, the path group update time is obtained and determined based on the current time and the path group update start time. If the path group update time is greater than a preset time threshold, the multi-path input / output processing strategy is configured to return to the upper layer. If the path group update time is less than or equal to the preset time threshold, the input / output path statistics are performed. If the number of available paths is not zero or the blocked input / output flag is true, perform the input / output path statistics.
4. The method according to claim 3, characterized in that, The determination of whether the anomaly is repairable includes: Identify the anomaly type of the target path; If the anomaly type cannot be represented by other paths to perform input / output operations, the anomaly is determined to be unrepairable. If the exception type indicates that there is an alternative path to perform the input / output operation, the exception is determined to be repairable.
5. The path group update method according to claim 2, characterized in that, The method further includes: The path is traversed, and for any traversed path, it is determined whether it is within the path detection period. If, within the path detection period, it is determined whether any traversed path is in an active state, and if it is in an active state, it is determined whether any traversed path meets the isolation condition. If any of the traversal paths satisfies the isolation condition, determine whether the isolation flag of any of the traversal paths is false; If the isolation flag of any traversal path is false, configure the isolation flag of any traversal path to true; if the isolation flag of any traversal path is true, determine whether the isolation status change flag of any traversal path is true. If the isolation status change flag of any of the traversed paths is true, configure the first path group update flag to be true.
6. The path group update method according to claim 5, characterized in that, The method further includes: If the isolation condition is not met, determine whether the isolation flag of any traversal path is true; If the isolation flag of any traversal path is true, configure the isolation flag of any traversal path to false, and configure the isolation status change flag of any traversal path to true.
7. The path group update method according to claim 5, characterized in that, The method further includes: If the isolation status change flag of any of the traversed paths is false, determine whether there is a priority change. If there is a priority change, configure the first path group update flag to true; if there is no priority change, determine whether the first path group update flag is true. If the first path group update flag is true, construct the overloaded multipath instruction.
8. The path group update method according to claim 5, characterized in that, The condition that any traversal path satisfies the isolation condition includes: If other non-isolated available paths exist, do not select any of the traversal paths for input and output; If no other non-isolated available path exists, select any of the traversal paths for the input and output.
9. The path group update method according to claim 1, characterized in that, The step of sending the overloaded multipath instruction to the multipath kernel module and updating the path topology in the multipath kernel module includes: The overloaded multipath instruction is constructed based on the isolation status change information and priority change information; If the flight input / output task processing is completed in the multipath kernel module, the path topology is updated in the multipath kernel module based on the overloaded multipath instruction.
10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the path group update method as described in any one of claims 1 to 9 when executing the computer program.