A multi-path object link state detection method and device and a storage medium
By acquiring the execution result data of customer business IO, switching detection types, and combining kernel callbacks and random reading of backend storage data, the accuracy and reliability issues of multi-path link status detection are solved, ensuring the high reliability of the storage system.
Patent Information
- Application Number
- CN202111617625.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Existing multipath link status detection methods have shortcomings in terms of detection accuracy and thread blocking, especially under high load or storage anomaly conditions, which can lead to inaccurate path status check results and potential blocking of detection threads.
By acquiring the execution result data of customer business IO, the link status of the target multipath object is determined, and the detection type is switched to general or enhanced based on the status. The kernel callback function and netlink notification mechanism are used in combination with random reading of backend storage data to ensure the accuracy and reliability of link status detection.
It enables timely and accurate detection of link status under various business I/O scenarios, avoiding problems such as inaccurate path status check results and detection thread blocking after storage anomalies, thus ensuring the high reliability of the storage system.
Smart Images

Figure CN114443383B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to a multi-path object link state detection method and device and a storage medium, and belongs to the technical field of multi-path object link state detection. BACKGROUND
[0002] In the field of cloud computing storage, multi-path objects are being applied more and more widely because of their excellent performance such as load balancing, fault migration, IO suspension, etc. In order to ensure the normal operation of the fault migration function, the path detection result of the multi-path must be relied on.
[0003] At present, the most widely used method in multi-path mainly includes the following methods:
[0004] <1> directio: judging whether the path is available by reading the first sector of the block device, which is no longer recommended because it may cause false path failure detection results under high load; <2> tur: sending a TEST UNIT READY SCSI instruction to the device to query, which is the default path checking method at present; <3> rbd: checking whether the path is in the Ceph blacklist, and if so, remapping the path; <4> emc_clariion, hp_sw and cciss_tur: all are path detection methods strongly related to specific hardware, and lack of universality.
[0005] Based on the limitations or other defects of other multi-path link state detection methods, in actual application, the tur method as the default multi-path link state detection method can meet most application scenarios, however, there are still cases of inaccurate path state detection results and blocked detection threads after the storage backend is abnormal.
[0006] In summary, the multi-path link state detection method in the prior art has some deficiencies in the accuracy of detection, and a new path detection method is needed to accurately detect the link state in the multi-path, and then meet the application requirements of customers for high reliability of the storage subsystem. SUMMARY
[0007] The application provides a multi-path object link state detection method and device and a storage medium to solve the technical problem.
[0008] In a first aspect, the application provides a multi-path object link state detection method for detecting the link state of a target multi-path, wherein the method comprises:
[0009] Obtaining execution result data of the client IO, determining a link state of the target multi-path object based on the obtained execution result data of the client IO; the link state is normal or congested;
[0010] If it is determined that the link state is normal and the detection type of the target multi-path is a general detection type, then:
[0011] After the callback function of the kernel device-mapper is called by the client IO, the execution result of the current client IO is determined based on the callback function; if the current client IO fails, the fail_path function is called to notify the user state of the failure state; if the current client IO succeeds and the interval time reaches the preset value, the kernel notifies the user state through netlink to update the path state to normal and update the response update_time attribute.
[0012] If it is determined that the link state is blocked, the path detection mode is determined and switched to an enhanced detection type.
[0013] In one embodiment, the method further comprises:
[0014] At a preset time interval, the kernel sends a path_up event to the user state through netlink, so that the user state updates the path state path.state and the path state update time path.update_time of the target multi-path according to the current received path_up event.
[0015] In one embodiment, the method further comprises:
[0016] If it is determined and the path detection mode is switched to the enhanced detection type, whether the client IO is blocked due to the abnormality of the back-end storage is determined according to the data return condition of any random position on the disk corresponding to the back-end storage read;
[0017] The number of times no_return_cnt that the link state of the target multi-path is not successfully detected after the last successful detection is obtained and updated;
[0018] If the updated number of times no_return_cnt is greater than the set threshold, the link state of the target multi-path is set to "unavailable", and the value of the hang flag bit is set to true.
[0019] In one embodiment, the method further comprises:
[0020] After it is determined that the abnormality of the back-end storage is restored to available, the number of times is cleared to zero, and the value of the hang flag bit is set to false.
[0021] In one embodiment, when it is determined that the link state detection type of the target multi-path is the enhanced detection type, the method further comprises:
[0022] For each multi-path object, a path checker class is constructed;
[0023] The path checker class includes the following members: a hang flag bit of the target multi-path object, a number of times no_return_cnt that the target multi-path has not been successfully updated since the last time it was successfully detected, a time update_time when the link state of the target multi-path was last updated, and a link state detection type check_type currently adopted by the target multi-path.
[0024] In one embodiment, the method further comprises:
[0025] When it is determined that the updated number of times no_return_cnt is greater than a set threshold, the method further comprises:
[0026] A log of IO blocking of the target path is recorded;
[0027] In the thread for the link state of the target multi-path, a thread that has not received a feedback result is closed;
[0028] The state of the target multi-path is set to failed;
[0029] And the number of times no_return_cnt is set to zero.
[0030] In a second aspect, a multi-path object link state detection device is provided for detecting the link state of a target multi-path, and the device comprises:
[0031] An acquisition module is configured to acquire execution result data of a customer business IO, and determine the link state of a target multi-path object based on the acquired execution result data of the customer business IO; the link state is normal or congested;
[0032] A first processing module is configured to, if it is determined that the link state is normal and the detection type of the target multi-path is a general detection type, determine the execution result of the current customer business IO based on a callback function after the callback function of the customer business IO calling a kernel device-mapper; if the current customer business IO fails to execute, a fail_path function is called to notify the user state of the invalid state; if the current customer business IO successfully executes and the interval time reaches a preset value, the kernel notifies the user state through a netlink that the path state is updated to normal and the response update_time attribute is updated;
[0033] The detection type determining module is configured to determine and switch the path detection mode to an enhanced detection type if it is determined that the link state is blocked.
[0034] In one embodiment, the device further comprises a third processing module configured to determine and switch the path detection mode to an enhanced detection type, determine whether the backend storage is abnormal if it is determined that the backend storage is abnormal according to the data return condition of any random position on the corresponding disk of the backend storage, obtain and update the number of times no_return_cnt of unsuccessfully detecting the target multipath link state after the last successful detection, and set the link state of the target multipath to "unavailable" and set the value of the hang flag to true when the updated number of times no_return_cnt is greater than a set threshold.
[0035] In a third aspect, a device for detecting a link state of a multipath object is provided, and the device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program is loaded and executed by the processor to implement any of the above methods for detecting a link state of a multipath object.
[0036] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, wherein the computer program is executed by a processor to implement any of the above methods for detecting a link state of a multipath object.
[0037] The application has the following beneficial effects:
[0038] To sum up, the embodiment of the present application provides a multi-path object link state detection method, device and storage medium, which is used for detecting the link state of a target multi-path, determining the link state of the target multi-path object according to the execution result data of the acquired customer service IO; the link state is normal or congested; and then if the link state is normal and the detection type of the target multi-path is a general detection type, after the callback function of the customer service IO calling the kernel device-mapper, the execution result data of the current customer service IO is determined based on the callback function; if the current customer service IO fails to execute, the fail_path function is called to notify the user state of the invalid state; if the current customer service IO executes successfully and the interval time reaches the preset value, the kernel notifies the user state through netlink to update the path state to normal and update the response update_time attribute; if it is determined that the link state is blocked, the path detection mode is determined and switched to an enhanced detection type. The scheme determines to use the corresponding detection mode to detect the link state of the target multi-path based on the acquired customer service IO data, which can be applied to all application scenarios of the coming and going of business IO data, and the scheme uses the enhanced detection mode when the back-end storage is abnormal, which can effectively avoid the occurrence of the conditions that the path state check result is inaccurate and the detection thread may be blocked after the storage back-end is abnormal.
[0039] The above description is only a summary of the technical scheme of the present application. In order to more clearly understand the technical means of the present application, and to implement the content of the description, the following will be described in detail with the preferred embodiments of the present application and with the help of the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0040] Figure 1 is a flow chart of a multi-path object link state detection method provided by an embodiment of the present application;
[0041] Figure 2 is a partial algorithm diagram of the multi-path object link state detection process in an embodiment of the present application after the enhanced detection mode is selected;
[0042] Figure 3 is an algorithm diagram of the switching of the general detection mode and the enhanced detection mode in the multi-path object link state detection process in an embodiment of the present application;
[0043] Figure 4 is an algorithm diagram of updating the target path link state according to the path_up event in the general detection mode in an embodiment of the present application;
[0044] Figure 5 is a detailed algorithm diagram in the enhanced detection mode in an embodiment of the present application;
[0045] Figure 6 is a flow chart of a multi-path object link state detection method provided by another embodiment of the present application;
[0046] Figure 7 is a module diagram of a multi-path object link state detection device provided by an embodiment of the present application;
[0047] Figure 8 is a block diagram of a multi-path object link state detection device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following embodiments are used to illustrate the present application, but not to limit the scope of the present application.
[0049] The present application provides a multi-path object link state detection method, which determines the link state of a target multi-path object according to the execution result data of a client business IO, and then performs link state detection using a detection type corresponding to the determined link state. This scheme can timely and accurately detect the link state of the multi-path object of the backend storage, ensure the normal operation of the fault switching function, and ensure the safe operation of the client business, which can effectively solve the problem of inaccurate multi-path link state detection results and the possibility of being blocked for a long time of the detection thread when the load of the backend storage is too high or the backend storage is abnormal.
[0050] The present application provides a multi-path object link state detection method for detecting the link state of a target multi-path object, as shown in Figure 1 The method comprises the following steps:
[0051] In step S12, the execution result data of the client business IO is obtained, and the link state of the target multi-path object is determined based on the obtained execution result data of the client business IO; the link state is normal or congested.
[0052] In the embodiment of the present application, the link state of the target multi-path object is first determined according to the running state of the current client host and the backend storage, and the link state can be normal or congested. The client host can run in user mode and kernel mode, and can write data into the backend storage through the client business IO, or read previously stored data from the backend storage based on the client business IO. It is pointed out here that the linux system is divided into kernel mode and user mode, and the operating system has the privilege to directly access hardware resources in kernel mode; while the user mode is generally an application such as app, and has lower permissions than the kernel mode, and some operations need to be completed through the kernel. The backend storage is used as a space to store client data. The client host can be a computer based on the linux system, which communicates business data with the backend storage through the client business IO.
[0053] In the embodiment of the present application, step S12 can be attributed to the user-mode multipath daemon multipathd of the Linux system.
[0054] Step S14, if it is determined that the link state is normal and the detection type of the target multipath is the general detection type, then: after the callback function of the kernel device-mapper is invoked by the client service IO, the execution result of the current client service IO is determined based on the callback function; if the current client service IO fails, the fail_path function is invoked to notify the user mode of the failure state; if the current client service IO succeeds and the interval time reaches the preset value, the kernel notifies the user mode through netlink to update the path state to normal and update the response update_time attribute.
[0055] In the embodiment of the present application, when it is determined that there is service IO data between the client host and the backend storage and the backend storage is normal, it is determined that the link state of the target multipath is normal through the execution result data of the client service IO. The kernel device-mapper periodically (such as every 20 seconds, 30 seconds or 40 seconds) notifies the user mode of the path state through the callback function returned by the IO. After the callback function of the kernel device-mapper is invoked by the client service IO, the execution result data of the current client service IO is determined based on the callback function; if the current client service IO fails, the fail_path function is invoked to notify the user mode of the failure state; and if the current client service IO succeeds and the interval time reaches the preset value, the kernel notifies the user mode through netlink to update the path state to normal and update the response update_time attribute. If the general detection type fails to update the path state within the preset time, the path is set to a blocked state.
[0056] Step S16, if it is determined that the link state is blocked, the path detection mode is switched to the enhanced detection type.
[0057] In the embodiment of the present application, if it is determined that the link state of the target path is blocked according to the execution result data of the client service IO, data at any position on the disk corresponding to the backend storage is randomly read, and the link state of the target multipath is updated according to the query result of the randomly read data. At this time, either the service IO data is blocked or no execution result data of the client service IO is accepted, at this time, data at any position on the disk corresponding to the backend storage is randomly read, and the link state of the target multipath is updated according to the query result of the randomly read data, which can be referred to in detail in the following Figure 2 .
[0058] In the embodiment of the present application, the switching of the link detection mode is involved, which can be referred to in detail in the following Figure 3As shown, after the path detection cycle thread check_path is started, it is judged whether the update_time of the target multi-path exceeds the set threshold. If not, the decision ends; if it exceeds the set threshold, it is judged whether the link state detection type (check_type) currently selected by the target path is the general mode. If yes, the link state detection type (check_type) is changed to the enhanced mode; if the kernel event loop kernel event processing thread is running, the user state receives the path_up event of the target path notified by the kernel state dm, it is judged whether the link state detection type (check_type) of the target path is the general mode. If yes, the decision ends, otherwise the link state detection type (check_type) of the target path is set to the general mode. Here, it is pointed out that the general mode means that after the callback function of the kernel device-mapper is called by the customer business IO, the execution result of the customer business IO this time is determined based on the callback function; if the customer business IO this time fails, the fail_path function is called to notify the user state of the invalid state; and the enhanced mode mainly includes randomly reading any position data on the corresponding disk of the rear-end storage, and updating the link state of the target multi-path according to the data query result of the random reading.
[0059] In the embodiment of the present application, referring to Figure 4 As shown, if it is determined that the link state is normal and the detection type of the target multi-path is the general detection type, it further includes:
[0060] At a preset time interval, the kernel sends a path_up event to the user state through netlink, so that the user state updates the path state path.state and the path state update time path.update_time of the target multi-path according to the path_up event received this time.
[0061] In the embodiment of the present application, the kernel sends a path_up event to the user state at a preset time interval, and the time interval is generally 20s, and the user can also set it according to actual needs. After receiving the path_up event, the user state processes it, and through the processing, the path state path.state and the path state update time path.update_time of the target multi-path carried in the path_up event received this time can be obtained.
[0062] In the embodiment of the present application, the method further includes:
[0063] If it is determined and the path detection mode is switched to the enhanced detection type, it is determined whether the client service IO is blocked due to the abnormality of the backend storage according to the data return condition of any random position on the disk corresponding to the backend storage.
[0064] When the link state update time update_time of the target path exceeds a set threshold, the number of times no_return_cnt that the link state of the target multi-path is not successfully detected after the last successful detection is obtained and updated.
[0065] If the updated number of times no_return_cnt is greater than the set threshold, the link state of the target multi-path is set to "unavailable", and the value of the hang flag is set to true.
[0066] It is pointed out that the data return condition is divided into data return and no data return. If there is data return, it indicates that the backend storage and the link are normal. When the data on any random position on the disk corresponding to the backend storage cannot be read, it is further determined whether the client service IO is blocked due to the abnormality of the backend storage.
[0067] In an embodiment, the method further comprises:
[0068] After it is determined that the abnormality of the backend storage is recovered to be available, the number of times is cleared, and the value of the hang flag is set to false. Here, when the link state of the target path is not failed, it is determined that the abnormal data of the backend storage is recovered.
[0069] In the embodiment of the application, each time the target multi-path link state is detected, if this time the detection is not successful, the number of times no_return_cnt that the target multi-path link state is not successfully detected after the last successful detection is updated. After each time the target path state is not successfully detected, the operation of no_return_cnt++ is performed, that is, the operation of the number of times no_return_cnt is incremented by 1.
[0070] In the embodiment of the application, a threshold is set for the number of times formed after the number of times no_return_cnt that the target multi-path link state is not successfully detected after the last successful detection is updated. When the updated number of times no_return_cnt is greater than the set threshold, for example, the set threshold is 3, the link state of the target multi-path is set to "unavailable", and the value of the hang flag is set to 1. The hang is a Boolean variable, when the value is "0", it is false, and when the value is "1", it indicates that the value is true.
[0071] In the embodiment of the present application, when the link state detection type of the target multi-path is determined to be the enhanced detection type, the method further comprises:
[0072] In step S11, a path checker class is constructed for each multi-path object.
[0073] The path checker class includes the following members: a hang flag of the target multi-path object, a number of times no_return_cnt that the target multi-path has not been successfully updated since the last time it was successfully detected, a time update_time when the link state of the target multi-path was last updated, and a link state detection type check_type currently used by the target multi-path.
[0074] In the embodiment of the present application, a path object class path checker named double_checker is added, and a flag hang is added to the path object path checker to indicate whether the path is blocked. If the value of the flag hang is 1, it indicates that the path is blocked, otherwise, it indicates that the path is not blocked. A no_return_cnt is added to indicate the number of times that the path state has not been updated for more than a threshold since the last time the path state was successfully updated. An update_time is added to indicate the time when the path state was last updated. A check_type is added to indicate the current path detection mode (general detection mode or enhanced detection mode, wherein the general mode is the default mode).
[0075] In the embodiment of the present application, the method further comprises:
[0076] In the enhanced detection mode, when the updated number of times no_return_cnt is greater than a set threshold, the method further comprises:
[0077] 1) recording the log of the target path appearing IO blocking;
[0078] 2) closing the thread that has not received the feedback result in the thread for the link state of the target multi-path;
[0079] 3) setting the state of the target multi-path to failed;
[0080] 4) and setting the number of times no_return_cnt to zero.
[0081] The following is a specific embodiment of the link detection type being the enhanced detection type.
[0082] Referring to Figure 5As shown, when the link detection type of the target multi-path is determined to be the enhanced detection type, it is judged whether the value of the hang flag is 1 or 0. If it is 1, it is further judged whether the link state of the target path is failed. If yes, the current detection is ended.
[0083] If the link state is not failed, the link state of the target multi-path is restored to available, which specifically includes: setting the value of the flag hang back to 0, setting the number of times no_return_cnt that the detection time is not successfully updated after being successfully detected for the last time to 0, and recording the hang release log of the target multi-path link; and then it is judged whether the update_time exceeds the set threshold (20s, etc.) and the subsequent steps are executed.
[0084] Further, it is judged whether the update_time exceeds the set threshold (20s, etc.) and the subsequent steps, which include: judging whether the update_time exceeds the set threshold (20s, etc.). If not, the current detection is ended. If yes, it is further judged whether the number of times no_return_cnt that the detection time is not successfully updated after being successfully detected for the last time exceeds the set threshold (3 times, etc.). If not, the operation of no_return_cnt+1 is executed, and any position data on the corresponding disk of the backend storage is randomly read. The link state of the target multi-path is updated according to the query result of the randomly read data, and the current detection is ended. If the number of times no_return_cnt that the detection time is not successfully updated after being successfully detected for the last time exceeds the set threshold (3 times, etc.), the IO blocking log of the target multi-path is recorded, the detection thread with no return result is forcibly closed (forcibly killed), the state of the path is set to failed, the hang flag of the target path is set to 1, and the number of times no_return_cnt is set to 0.
[0085] In summary, the embodiment of the present application provides a multi-path object link state detection method, device and storage medium, which is used for detecting the link state of a target multi-path, determining the link state of the target multi-path object through the acquired customer service IO data; the link state is normal or congested; and then if the link state is normal and the detection type of the target multi-path is a general detection type, then: after the callback function of the customer service IO calling the kernel device-mapper, the execution result of the current customer service IO is determined based on the callback function; if the current customer service IO fails to execute, the fail_path function is called to notify the user state of the invalid state; if it is determined that the link state is blocked, an enhanced detection type is used, at least including randomly reading data at any position on the corresponding disk of the back-end storage, and updating the link state of the target multi-path according to the query result of the randomly read data. The scheme is based on the execution result data of the acquired customer service IO to determine the corresponding detection mode for detecting the link state of the target multi-path, which can be applied to all application scenarios with the execution result data of the customer service IO, and the enhanced detection mode is used when the back-end storage is abnormal, which can effectively avoid the occurrence of the inaccurate path state checking result and the blocking of the detection thread.
[0086] Figure 7 is a block diagram of a multi-path object link state detection device provided by an embodiment of the present application. The embodiment takes the multi-path object link state detection device shown in Figure 1 as an example for description. The device at least includes the following modules:
[0087] The acquisition module 71 is used for acquiring the execution result data of the customer service IO, and determining the link state of the target multi-path object based on the acquired execution result data of the customer service IO; the link state is normal or congested.
[0088] The first processing module 72 is used for determining the link state as normal and the detection type of the target multi-path as a general detection type, then determining the execution result of the current customer service IO based on the callback function after the callback function of the customer service IO calling the kernel device-mapper; if the current customer service IO fails to execute, the fail_path function is called to notify the user state of the invalid state; if the current customer service IO executes successfully and the interval time reaches the preset value, the kernel notifies the user state through the netlink to update the path state as normal and update the response update_time attribute.
[0089] The detection type determination module 73 is used for determining and switching the path detection mode to an enhanced detection type if it is determined that the link state is blocked.
[0090] In the embodiment of the present application, the second processing module is further configured to determine and switch the path detection mode to an enhanced detection type, determine whether the client service IO is blocked due to the abnormal backend storage according to the data return condition of any random position on the disk corresponding to the backend storage, obtain and update the number of times no_return_cnt that the target multipath link state is not successfully detected after the last successful detection, and set the link state of the target multipath to "unavailable" and set the value of the hang flag to true when the updated number of times no_return_cnt is greater than the set threshold.
[0091] The embodiment of the present application provides a multipath object link state detection device for detecting the link state of a target multipath. The link state of the target multipath object is determined by the client service IO data obtained by the obtaining module. The link state is normal or congested. If the link state is normal and the detection type of the target multipath is a general detection type, the first processing module determines the execution result data of the current client service IO based on the callback function after the callback function of the client service IO calling the kernel device-mapper. If the current client service IO fails, the fail_path function is called to notify the user state of the invalid state. If the current client service IO is successful and the interval time reaches the preset value, the kernel notifies the user state through the netlink to update the path state to normal and update the response update_time attribute. If the link state is determined to be blocked, the enhanced detection type is used, and the second processing module performs operations including randomly reading any position data on the disk corresponding to the backend storage, and updating the link state of the target multipath according to the data query result of the random reading. The present scheme determines to use the corresponding detection mode to detect the link state of the target multipath based on the execution result data of the obtained client service IO, which can be applied to all application scenarios with business IO data, and the present scheme uses the enhanced detection mode when the backend storage is abnormal, which can effectively avoid the occurrence of inaccurate path state checking results and the blocking of detection threads.
[0092] The multipath object link state detection device provided by the embodiment of the present application can be used in the method executed by the service application system in the above embodiment, and the related details are referred to the above method embodiment, which has similar implementation principles and technical effects, and will not be described here.
[0093] Figure 8is a block diagram of a multi-path object link state detection device provided by an embodiment of the present application. The multi-path object link state detection device can be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The device can include, but is not limited to, a processor and a memory. The multi-path object link state detection device includes at least the processor and the memory. The memory stores a computer program, which can be run on the processor. When the processor executes the computer program, the steps in the multi-path object link state detection method embodiment described above are implemented, for example Figure 1 or Figure 6 the steps of the multi-path object link state detection method shown in any of the figures. Alternatively, when the processor executes the computer program, the functions of the modules in the multi-path object link state detection device embodiment described above are implemented.
[0094] For example, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present application. The one or more modules can be a series of computer program instruction segments that can complete a specific function, which are used to describe the execution process of the computer program in the multi-path object link state detection device. For example, the computer program can be divided into a sending module and a first receiving module, and the specific functions of the modules are as follows:
[0095] The obtaining module is configured to obtain execution result data of the customer service IO, and determine the link state of the target multi-path object based on the obtained execution result data of the customer service IO. The link state is normal or congested.
[0096] The first processing module is configured to, if it is determined that the link state is normal and the detection type of the target multi-path object is a general detection type, determine the execution result of the current customer service IO based on a callback function after a callback function of a kernel device-mapper is called. If the current customer service IO fails to execute, a fail_path function is called to notify the user state of the invalid state. If the current customer service IO successfully executes and the interval time reaches a preset value, the kernel notifies the user state through a netlink to update the path state to normal and update the response update_time attribute.
[0097] The detection type determining module is configured to, if it is determined that the link state is blocked, determine and switch the path detection mode to an enhanced detection type.
[0098] The processor can include one or more processing cores, such as a 4-core processor, a 6-core processor, etc. The processor can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), a PLA (Programmable Logic Array). The processor can also include a main processor and a coprocessor, the main processor being a processor for processing data in an awake state, also referred to as a CPU (Central Processing Unit), and the coprocessor being a low-power processor for processing data in a standby state. In some embodiments, the processor can also include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning. The processor is the control center of the multi-path object link state detection device, and connects various parts of the entire multi-path object link state detection device through various interfaces and lines.
[0099] The memory can be used to store the computer programs and / or modules, and the processor realizes various functions of the multi-path object link state detection device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required by a function, etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.) and the like. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a memory device, or other volatile solid-state memory devices.
[0100] Those skilled in the art can understand that the device described in the embodiment is only an example of the multi-path object link state detection device, and does not constitute a limitation on the multi-path object link state detection device. In other embodiments, more or fewer components can also be included, or some components can be combined, or different components, for example, the multi-path object link state detection device can also include an input and output device, a network access device, a bus, and the like. The processor, the memory and the peripheral device interface can be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface through a bus, a signal line or a circuit board. Illustratively, the peripheral device includes, but is not limited to, a radio frequency circuit, a touch display screen, an audio circuit, a power supply and the like.
[0101] Of course, the multi-path object link state detection device can also include fewer or more components, which are not limited in the embodiment.
[0102] Optionally, the application also provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the multi-path object link state detection method.
[0103] Optionally, the application also provides a computer product, the computer product includes a computer readable storage medium, and the computer readable storage medium stores a program, the program is loaded and executed by a processor to implement the steps of the multi-path object link state detection method embodiment.
[0104] Each technical feature of the above-described embodiments can be combined arbitrarily, and to make the description concise, each technical feature in the above-described embodiments is not described all possible combinations, however, as long as the combination of the technical features does not exist contradictory, it should be considered that it is within the scope of the present application.
[0105] The above-described embodiments only express several implementation manners of the application, the description is more specific and detailed, but it should not be understood as a limitation on the patent scope of the application. It should be pointed out that for those skilled in the art, without departing from the concept of the application, a number of modifications and improvements can be made, which are within the scope of the application. Therefore, the patent protection scope of the application should be subject to the appended claims.
Claims
1. A multi-path object link state detection method for detecting a link state of a target multi-path, characterized by, The method comprises: Obtaining the execution result data of the customer service IO, and determining the link state of the target multi-path object based on the obtained execution result data of the customer service IO; the link state is normal or congested; If it is determined that the link state is normal and the detection type of the target multi-path is a general detection type, then: After the callback function of the kernel device-mapper is called by the customer service IO, the execution result of the current customer service IO is determined based on the callback function; if the current customer service IO fails to execute, the fail_path function is called to notify the user state of the invalid state; If it is determined that the link state is blocked, the path detection mode is determined and switched to an enhanced detection type; If the path detection mode is determined and switched to the enhanced detection type, it is determined whether the customer service IO is blocked due to an abnormal back-end storage based on the data return condition of any random position on the disk corresponding to the back-end storage; When the link state update time update_time of the target path exceeds a set threshold, the number of times no_return_cnt that the link state of the target multi-path is not successfully detected after the last successful detection is obtained and updated; If the updated number of times no_return_cnt is greater than the set threshold, the link state of the target multi-path is set to "unavailable", and the value of the hang flag bit is set to true; The data return condition includes data return and no data return. If there is data return, it indicates that the back-end storage and the link are normal. If the data on any random position on the disk corresponding to the back-end storage cannot be read, it is determined that the customer service IO is blocked due to an abnormal back-end storage.
2. The method of claim 1, wherein, The method further comprises: At a preset time interval, the kernel is controlled to send a path_up event to the user state through netlink, so that the user state updates the path state path.state and the path state update time path.update_time of the target multi-path according to the current received path_up event.
3. The method of claim 1, wherein, The method further comprises: After it is determined that the abnormality of the back-end storage is restored to be available, the number of times is cleared, and the value of the hang flag bit is set to false.
4. The method of claim 1, wherein, When it is determined that the link state detection type of the target multi-path is an enhanced detection type, the method further comprises: For each multi-path object, a path checker class is constructed; The path checker class includes the hang flag bit of the target multi-path object, the number of times no_return_cnt that the target multi-path has not been successfully updated since the last successful detection, the last time update_time that the link state of the target multi-path was updated, and the current link state detection type check_type of the target multi-path.
5. The method of claim 1, wherein, Further comprising: When it is determined that the updated number of times no_return_cnt is greater than the set threshold, the method further comprises: Logging the IO blocking of the target path; In the thread of the link state of the target multipath, the thread without receiving feedback result is closed; The state of the target multipath is set as failed; And the number of times no_return_cnt is set to zero.
6. A multi-path object link state detection apparatus for detecting a link state of a target multi-path, characterized by, The device comprises: An acquisition module, configured to acquire execution result data of customer service IO, and determine a link state of a target multipath object based on the acquired execution result data of customer service IO; the link state is normal or congested; A first processing module, configured to, if it is determined that the link state is normal and the detection type of the target multipath is a general detection type, determine the execution result of the current customer service IO based on a callback function after the callback function of the kernel device-mapper is called by the customer service IO; and if the current customer service IO fails to execute, call a fail_path function to notify the user state of the failure state; A detection type determination module, configured to, if it is determined that the link state is blocked, determine and switch the path detection mode to an enhanced detection type; A second processing module, configured to, if it is determined and the path detection mode is switched to the enhanced detection type, determine whether the customer service IO is blocked due to the abnormality of the back-end storage according to the data return condition of any random position on the disk corresponding to the back-end storage; and If the updated number of times no_return_cnt is greater than the set threshold value, the link state of the target multipath is set as "unavailable", and the value of the hang flag bit is set to true. The data return condition comprises data return and no data return; if there is data return, it indicates that the back-end storage and the link are normal; and if the data on any random position on the disk corresponding to the back-end storage cannot be read, it is determined that the customer service IO is blocked due to the abnormality of the back-end storage. The computer program is loaded and executed by the processor to implement the multipath object link state detection method according to any one of claims 1-5.
7. A multipath object link state detection apparatus, the apparatus comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein, The computer program is loaded and executed by the processor to implement the multipath object link state detection method according to any one of claims 1-5.
8. A computer-readable storage medium storing a computer program, the computer-readable storage medium comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 7.
Citation Information
Patent Citations
ARP (Address Resolution Protocol) interaction based method and equipment for detecting and recovering link fault
CN102035676A
Storage system, control apparatus, and computer-readable recording medium having stored therein control program
US20150242351A1