IO request timeout processing method, device and electronic device
By detecting IO request processing timeouts in kernel mode and disabling IO requests in user mode, combined with hard disk status detection and power-on and power-off processing, the storage system reliability issue caused by hard disk IO timeouts is resolved, achieving efficient and accurate processing of hard disk IO requests and improving system reliability.
Patent Information
- Application Number
- CN202411907730.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-12-23
AI Technical Summary
Hard disk IO processing timeouts reduce storage system reliability, affect the successful issuance of IO requests for multiple hard disks, and cause upper-layer business exceptions or interruptions.
If the IO request processing timeout is detected in the kernel state, the IO request is prohibited from being sent to the target hard disk through the IO processing timeout event in the user state. When the conditions are met, power is turned on and off, and the faulty hard disk is repaired or isolated in combination with the hard disk status detection.
This improves the reliability of the storage system, reduces the mishandling of non-faulty hard disks, ensures efficient and accurate processing of IO requests, and avoids a decrease in the reliability of the storage system.
Smart Images

Figure CN119847431B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method, device, and electronic device for processing an input / output (IO) request timeout. Background Art
[0002] In storage systems, hard disks, such as Small Computer System Interface (SCSI) disks, are widely used for data storage and processing. However, in practical applications, hard disks often experience IO processing timeouts due to reasons such as hard disk failure. When a hard disk IO processing timeout occurs and is not processed in a timely manner, it may have a chain reaction on other hard disks under the hard disk controller, resulting in the failure to successfully issue IO requests to multiple hard disks. This can cause abnormalities or interruptions in upper-layer services, thereby affecting the reliability of the storage system. Here, IO processing timeout refers to the storage system's failure to successfully process an IO request issued by the upper layer within the predetermined time. Summary of the Invention
[0003] In view of this, the present application provides an IO request timeout processing method, device and electronic device to avoid the problem of reduced reliability of the storage system due to the failure to promptly handle the IO processing timeout of the hard disk.
[0004] An embodiment of the present application provides a method for processing an IO request timeout, which is applied to an electronic device and includes:
[0005] If the processing time of a received IO request is detected to have timed out in the kernel state of the electronic device, it is determined that an IO processing timeout exists in the target hard disk corresponding to the IO request, and further it is determined whether a preset IO processing timeout event reporting condition is currently met so that the user state of the electronic device prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event. If so, the IO processing timeout event is reported; if not, it waits until the preset IO processing timeout event reporting condition is currently met, and then the IO processing timeout event is reported so that the user state prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event.
[0006] If it is found in user mode that other hard disks have IO processing timeouts besides the target hard disk, the target hard disk will be powered on and off if the number of power-on and power-off cycles of the target hard disk does not exceed the set number threshold.
[0007] If it is found in user mode that only the target hard disk has an IO processing timeout, the disk status information of the target hard disk is obtained. If the disk status information of the target hard disk indicates that the target hard disk is abnormal, the target hard disk is powered on and off when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold.
[0008] An embodiment of the present application further provides an IO request timeout processing device, which is applied to an electronic device and includes:
[0009] a detection module configured to, if it is detected in the kernel state of the electronic device that the processing time of a received IO request has timed out, determine that an IO processing timeout exists in the target hard disk corresponding to the IO request, and further determine whether a preset IO processing timeout event reporting condition is currently satisfied so that the user state of the electronic device prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event; if so, report the IO processing timeout event; if not, wait until the preset IO processing timeout event reporting condition is currently satisfied, then report the IO processing timeout event so that the user state prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event;
[0010] a processing module configured to detect, in user mode, that other hard disks have IO processing timeouts in addition to the target hard disk, and then power on and off the target hard disk if the number of power-on and power-off cycles of the target hard disk does not exceed a set number threshold;
[0011] If it is found in user mode that only the target hard disk has an IO processing timeout, the disk status information of the target hard disk is obtained. If the disk status information of the target hard disk indicates that the target hard disk is abnormal, the target hard disk is powered on and off when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold.
[0012] An embodiment of the present application further provides an electronic device, comprising:
[0013] processor; and
[0014] A computer-readable storage medium stores computer program instructions, which, when executed by a processor, cause the processor to execute the steps of the above method.
[0015] An embodiment of the present application further provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the processor is caused to execute the steps in the above method.
[0016] As can be seen from the above technical solution, in the embodiment of the present application, the processing time of the received IO request is detected in the kernel state, which does not affect the processing thread of the received IO request. This not only reduces the impact on the processing of the IO request, but also enables efficient and accurate IO processing timeout detection for all hard disks in the device. Based on this, in the user state, based on the IO processing timeout event, the target hard disk corresponding to the IO processing timeout event is prohibited from sending IO requests to the target hard disk, and the target hard disk is powered on and off to repair the hard disk in time, so as to avoid the problem of reduced reliability of the storage system due to the failure to handle the IO processing timeout of the hard disk in time, and further reduce the mishandling of non-faulty hard disks through the disk status detection of the hard disk. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] Figure 1 A schematic diagram of the method flow provided in an embodiment of the present application.
[0019] Figure 2 A flowchart of another method provided in an embodiment of the present application.
[0020] Figure 3 A flowchart of another method provided in an embodiment of the present application.
[0021] Figure 4 A schematic diagram of the structure of the device provided in an embodiment of the present application.
[0022] Figure 5 A schematic diagram of the electronic device structure provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application are further described in detail below with reference to the accompanying drawings.
[0024] See also Figure 1 , Figure 1 This is a flow chart of a method provided in an embodiment of the present application. As an embodiment, the method is applied to an electronic device, which may be a server or other device, but is not specifically limited in this embodiment.
[0025] Based on this, Figure 1 As shown, the process may include the following steps:
[0026] Step 101: If it is detected in the kernel state of the electronic device that the processing time of the received IO request has timed out, it is determined that an IO processing timeout exists in the target hard disk corresponding to the IO request, and it is further determined whether the preset IO processing timeout event reporting condition is currently met so that the user state of the electronic device prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event. If so, the IO processing timeout event is reported; if not, wait until the preset IO processing timeout event reporting condition is currently met, and then the IO processing timeout event is reported so that the user state prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event.
[0027] In this embodiment, as an example, an IO timeout detection program can be pre-loaded in the kernel state of the electronic device, and an IO timeout processing program can be pre-loaded in the user state of the electronic device to detect and process IO processing timeouts. Based on this, the IO timeout detection program loaded in the kernel state can detect whether the processing time of a received IO request has timed out; and the IO timeout processing program loaded in the user state can handle IO processing timeout events reported in the kernel state, that is, prohibiting the issuance of IO requests to the target hard disk based on the reported IO processing timeout event.
[0028] In this embodiment, the IO timeout detection program is a pre-set program for detecting IO processing timeouts. The IO timeout processing program is a pre-set program for processing IO processing timeouts.
[0029] The processing time of an IO request refers to the duration between the time the IO request is received and the current time. If the processing time of an IO request exceeds this time, it means that the hard disk corresponding to the IO request may be faulty, resulting in the IO request being delayed. Based on this, if the IO timeout detection program detects in kernel mode that the processing time of a received IO request has exceeded this time, it is determined that an IO processing timeout has occurred on the target hard disk corresponding to the IO request.
[0030] In this embodiment, as an example, the above-mentioned determination that an IO processing timeout has occurred on the target hard disk corresponding to the IO request may include, for example, determining in kernel mode that an IO processing timeout has occurred on the target hard disk corresponding to the IO request when a timer started upon receipt of the IO request has reached a first set duration. The first set duration can be flexibly set based on actual application requirements, such as 5 seconds or 10 seconds, and is not specifically limited in this embodiment.
[0031] In this embodiment, the timer is used to detect whether the processing time of a received IO request has timed out. Based on this, if it is detected that the IO request has been processed, and if the timer has not expired, it means that the processing time of the IO request has not timed out and there is no need to continue timing, so the timer can be controlled to expire. It is understood that the timer will automatically expire after the task is completed, that is, the timer reaches the first set time.
[0032] In this embodiment, when it is determined that the target hard disk corresponding to the received IO request has an IO processing timeout, in order to avoid the impact of the IO processing timeout on the IO processing performance of the target hard disk and other hard disks except the target hard disk, it can be further determined whether the preset IO processing timeout event reporting conditions are currently met so that the IO processing timeout event is prohibited from being sent to the target hard disk based on the reported IO processing timeout event through the loaded IO timeout handler in the user state. If so, the IO processing timeout event is reported; if not, wait until the preset IO processing timeout event reporting conditions are currently met and the IO processing timeout event is reported so that the IO processing timeout event is prohibited from being sent to the target hard disk based on the reported IO processing timeout event through the loaded IO timeout handler in the user state.
[0033] In this embodiment, as an example, the above-mentioned determination of whether the preset IO processing timeout event reporting condition is currently met may include, for example, when it is found that the above-mentioned IO request has not been processed, checking in kernel mode whether the difference between the time when the IO request was received and the current time is greater than or equal to a second set time length. If so, determining whether the preset IO processing timeout event reporting condition is currently met. The first set time length is less than or equal to the second set time length; for example, the second set time length can be 10 seconds, 20 seconds, or 30 seconds, etc., which is not specifically limited in this embodiment.
[0034] Step 102: If it is found in the user state that other hard disks have IO processing timeouts in addition to the target hard disk, the target hard disk is powered on and off when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold.
[0035] In this embodiment, as described above, when this embodiment detects the IO processing timeout event reported above through the loaded IO timeout handler in user mode, if it is found that in addition to the IO processing timeout of the target hard disk, there are other hard disks with IO processing timeouts, then it means that the target hard disk may have a fault causing the IO processing timeout, and the IO processing timeout of other hard disks may be caused by the IO processing timeout of the target hard disk. Therefore, the target hard disk can be repaired at this time. Specifically, when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold, the target hard disk is powered on and off to achieve fault repair of the target hard disk.
[0036] The above-mentioned threshold of the number of settings can be flexibly set based on actual application requirements, for example, it can be 3 times, 4 times, or 5 times, etc., and this embodiment does not specifically limit it.
[0037] In this embodiment, as an example, the above-mentioned power-on and power-off processing of the target hard disk can be implemented as follows: first, the baseboard management controller (BMC) controls the target hard disk to power off based on a specified power-off duration; after the target hard disk is powered off, the BMC controls the target hard disk to power on; thus, the power-on and power-off processing of the target hard disk is completed. Here, the specified power-off duration can be flexibly set based on actual application requirements, such as 3 seconds or 5 seconds, and is not specifically limited in this embodiment.
[0038] Based on the above description, in this embodiment, as an embodiment, when the number of power-on and power-off of the target hard disk exceeds the set number threshold, it means that the fault of the target hard disk cannot be repaired by powering on and off. At this time, the BMC can be used to control the target hard disk to power off to achieve isolation of the target hard disk, so as to avoid the target hard disk from affecting other hard disks; and output an indication that the target hard disk is a faulty hard disk, so as to prompt relevant technicians to replace the target hard disk.
[0039] Step 103: If it is found in the user state that only the target hard disk has timed out, the disk status information of the target hard disk is obtained. If the disk status information of the target hard disk indicates that the target hard disk is abnormal, the target hard disk is powered on and off when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold.
[0040] In this embodiment, as described above, this embodiment finds that only the target hard disk has timed out through the loaded IO timeout handler in the user state, which means that the target hard disk may not be a faulty hard disk, and the IO processing timeout of the target hard disk may be due to other reasons such as an abnormal data transmission link. At this time, in order to avoid mishandling of the target hard disk, the disk status information of the target hard disk can be obtained. If the disk status information of the target hard disk indicates that the target hard disk is abnormal, when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold, the target hard disk is powered on and off to achieve fault repair of the target hard disk.
[0041] Based on the above description, as an embodiment, if the target hard drive's disk status information indicates that the target hard drive is normal, it indicates that the target hard drive is not a faulty hard drive. At this time, there is no need to power on or off the target hard drive, and IO requests can be issued to the target hard drive, thus lifting the aforementioned prohibition on issuing IO requests to the target hard drive. In this embodiment, as an embodiment, when the target hard drive's disk status information indicates that the target hard drive is normal, issuing IO requests to the target hard drive can be resumed immediately, or it can wait for a set time (such as 20 seconds, 30 seconds, etc.) before issuing IO requests to the target hard drive. This embodiment is not specifically limited to this.
[0042] In this embodiment, as an embodiment, the above-mentioned acquisition of the disk status information of the target hard disk can be implemented as follows: a disk status query instruction is sent to the target hard disk through the hard disk controller, so that the query result returned by the target hard disk in response to the disk status query instruction is used as the disk status information of the target hard disk.
[0043] So far, completed Figure 1 The process shown.
[0044] pass Figure 1 As can be seen from the process shown, in the embodiment of the present application, the processing time of the received IO request is detected in the kernel state, which does not affect the processing thread of the received IO request. This not only reduces the impact on the processing of the IO request, but also enables efficient and accurate IO processing timeout detection for all hard disks in the device. Based on this, in the user state, based on the IO processing timeout event, the target hard disk corresponding to the IO processing timeout event is prohibited from sending IO requests to the target hard disk, and the target hard disk is powered on and off to repair the hard disk in time, so as to avoid the problem of reduced reliability of the storage system due to the failure to handle the IO processing timeout of the hard disk in time, and further reduce the mishandling of non-faulty hard disks through the disk status detection of the hard disk.
[0045] The above step 101 is further described below:
[0046] In this embodiment, as an example, when it is determined that the processing time of an IO request has timed out, IO information related to the IO request is recorded in a disk information linked list. This embodiment does not specifically limit the IO information related to the IO request, and may include, for example, the timestamp of the IO request (e.g., the time when the IO request was received), the target hard disk corresponding to the IO request, and the cache address information of the IO request in kernel mode. Based on this, when it is detected that the IO request has been processed, the IO information related to the IO request in the disk information linked list may be deleted.
[0047] Based on the above description, as an embodiment, when it is determined that the target hard disk corresponding to the IO request has an IO processing timeout, it is possible to check whether the disk information linked list contains IO information that matches the target hard disk. If not, it means that all IO requests with processing timeouts corresponding to the target hard disk have been processed. At this time, it can be determined that the target hard disk does not have an IO processing timeout. If so, return to the step of checking whether the disk information linked list contains IO information that matches the target hard disk.
[0048] The following is a further description of the process after the target hard disk is powered on and off:
[0049] In this embodiment, as an embodiment, after the target hard disk is powered on and off, in order to further detect whether the target hard disk has recovered, the disk status information of the target hard disk can be obtained; if the disk status information of the target hard disk indicates that the target hard disk is normal, it means that the target hard disk has recovered to normal after the power on and off processing, and at this time an IO request can be issued to the target hard disk; if the disk status information of the target hard disk indicates that the target hard disk is abnormal, it means that the target hard disk has not recovered after the power on and off processing, and at this time, when the number of power on and off of the target hard disk does not exceed the set number threshold, the target hard disk can be powered on and off again until the number of power on and off of the target hard disk exceeds the set number threshold.
[0050] In order to facilitate understanding of the specific implementation process of the above-mentioned IO request timeout processing method, the following is described by way of examples using specific embodiments.
[0051] First, the loading process of the above IO timeout detection program and IO timeout handling program is described:
[0052] In this embodiment, as an example, the loading of the IO timeout detection program may include, for example, the following steps during specific implementation: first, when the operating system is started, the IO timeout detection program is loaded into the kernel state of the electronic device using the modprobe tool; second, all hard disks in the electronic device are scanned, the system disk is filtered out, and the disk information of the remaining hard disks after filtering out the system disk is recorded in the disk information linked list of the kernel state. The disk information here may include information such as hard disk identification (such as drive letter, etc.), which is not specifically limited in this embodiment; then, a timer module is set and a callback function is registered; thereafter, a network link (NETLINK) resource is registered for communication between the kernel state IO timeout detection program and the user state IO timeout handler; finally, an IO timeout detection thread is created and started. At this point, the loading of the IO timeout detection program is completed, and the IO request is waiting for issuance.
[0053] In this embodiment, the kernel state can directly access the hardware resources of the device, such as the hard disk. Based on this, by loading the IO timeout detection program in the kernel state, it is possible to efficiently and accurately detect whether the processing time of the IO request has timed out, thereby improving the accuracy and reliability of IO processing timeout detection.
[0054] In this embodiment, as an embodiment, the loading of the IO timeout handler can be implemented in detail, for example, including: first, installing a pre-prepared installation package containing an initial service configuration file (i.e., a service file) and an executable file, and creating a target service file for the IO timeout handling service after the installation package is installed, and starting the IO timeout handling process (i.e., the IO timeout handler corresponding to the installation package) through the target service file; wherein, in the case of restarting the operating system, the IO timeout handling process can also be automatically started through the above-mentioned target service file; thereafter, creating and starting a listening thread for receiving IO processing timeout events reported by the kernel state, and a processing thread for handling IO processing timeout events in the above-mentioned IO timeout handling process.
[0055] In this embodiment, by using different threads, namely, a listening thread and a processing thread, to execute corresponding tasks, namely, the receiving task and the processing task of the IO processing timeout event, in parallel, the processing efficiency can be effectively improved.
[0056] It should be noted that this embodiment does not specifically limit the order of loading the above-mentioned IO timeout detection program and loading the above-mentioned IO timeout handling program; for example, the loading of the above-mentioned IO timeout detection program can be executed first, and then the loading of the above-mentioned IO timeout handling program can be executed.
[0057] This completes the description of the loading process of the above IO timeout detection program and IO timeout handling program.
[0058] The following describes the specific implementation process of IO timeout detection using the above IO timeout detection program:
[0059] In this embodiment, as an example, see Figure 2 As shown, the IO timeout detection performed by the above IO timeout detection program may include the following steps in specific implementation:
[0060] Step 201: When an IO request is received in kernel mode through the IO timeout detection program, a timer is set for the IO request through the timer module and the timer is started.
[0061] The timing duration of the timer (ie the first set duration) may be, for example, 10 seconds.
[0062] Step 202: When it is found that the timing duration of the timer reaches the first set duration, it is determined that the processing duration of the IO request has timed out. At this time, the callback function is called to call the callback function to parse the IO request to obtain IO information related to the IO request.
[0063] As for the IO information related to the IO request, please refer to the above description and will not be repeated here.
[0064] Step 203: Record the IO information related to the IO request into the disk information linked list, and mark the target hard disk corresponding to the IO request as a timed-out disk.
[0065] Here, a timed-out disk refers to a hard disk with I / O processing timeout.
[0066] Step 204: When it is found that the IO request has not been processed, check whether the difference between the time when the IO request is received and the current time is greater than or equal to the second set time length. If so, report the IO processing timeout event to the user state.
[0067] Step 205: When it is detected that the IO request has been processed, the IO information related to the IO request in the disk information list is deleted; and when it is detected that the disk information list does not contain IO information matching the above-mentioned target hard disk, the mark of the above-mentioned target hard disk is changed from a timeout disk to a normal disk.
[0068] Here, a normal disk refers to a hard disk without any IO processing timeout.
[0069] The following describes the specific implementation process of IO timeout processing through the above IO timeout handler:
[0070] In this embodiment, as an example, see Figure 3 As shown, the IO timeout processing performed by the above IO timeout detection program may include the following steps in specific implementation:
[0071] Step 301: When an IO processing timeout event is received through a user-mode listening thread, the IO processing timeout event is sent to a user-mode processing thread; wherein the IO processing timeout event indicates that there is a target hard disk with IO processing timeout.
[0072] Step 302: Notify the storage module through the processing thread to prohibit sending IO requests to the target hard disk.
[0073] Here, the storage module may refer to a module in user mode for receiving and managing IO requests issued by an upper layer, wherein the upper layer may refer to a remote device such as a client device that is in communication with the device.
[0074] Step 303: if it is found through the above processing thread that there are other IO processing timeouts besides the above target hard disk, then when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold, the target hard disk is powered on and off, and the disk status information of the target hard disk is obtained through the hard disk controller. If the disk status information of the target hard disk indicates that the target hard disk is abnormal, the process returns to the step when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold. If the disk status information of the target hard disk indicates that the target hard disk is normal, the above storage module is notified after the set time to resume sending IO requests to the target hard disk.
[0075] Step 304: if it is found through the above-mentioned processing thread that only the above-mentioned target hard disk currently has an IO processing timeout, the disk status information of the target hard disk is obtained through the hard disk controller. If the disk status information of the target hard disk indicates that the target hard disk is abnormal, then when the number of power-on and power-off of the target hard disk does not exceed the set number threshold, the target hard disk is powered on and off, and the process returns to the step of obtaining the disk status information of the target hard disk through the hard disk controller. If the disk status information of the target hard disk indicates that the target hard disk is normal, the above-mentioned storage module is notified after the set time to resume sending IO requests to the target hard disk.
[0076] In this embodiment, as described above, when the number of power-on and power-off cycles of the target hard disk exceeds a set threshold, it indicates that the fault of the target hard disk cannot be repaired by powering on and off. At this time, the BMC can be used to control the target hard disk to be powered off to isolate the target hard disk, so as to avoid the target hard disk from affecting other hard disks; and an indication that the target hard disk is a faulty hard disk is output to prompt relevant technicians to replace the target hard disk.
[0077] This completes the description of the method provided in the embodiment of the present application. The following describes the device provided in the embodiment of the present application:
[0078] As an embodiment, this embodiment also provides an IO request timeout processing device. For example, see Figure 4 , Figure 4 This is a structural diagram of an IO request timeout processing device provided by an embodiment of the present application. The IO request timeout processing device is applied to an electronic device, an IO timeout detection program is loaded in the kernel state of the electronic device, and an IO timeout processing program is loaded in the user state of the electronic device. Figure 4 As shown, the IO request timeout processing device 400 includes a detection module 401 and a processing module 402;
[0079] The detection module is configured to, if it is detected in the kernel state of the electronic device that the processing time of a received IO request has timed out, determine that an IO processing timeout exists in the target hard disk corresponding to the IO request, and further determine whether a preset IO processing timeout event reporting condition is currently satisfied so that the user state of the electronic device prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event, and if so, report the IO processing timeout event; if not, wait until the preset IO processing timeout event reporting condition is currently satisfied, and then report the IO processing timeout event so that the user state prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event;
[0080] a processing module configured to detect, in user mode, that other hard disks have IO processing timeouts in addition to the target hard disk, and then power on and off the target hard disk if the number of power-on and power-off cycles of the target hard disk does not exceed a set number threshold;
[0081] If it is found in user mode that only the target hard disk has an IO processing timeout, the disk status information of the target hard disk is obtained. If the disk status information of the target hard disk indicates that the target hard disk is abnormal, the target hard disk is powered on and off when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold.
[0082] As an embodiment, determining whether an IO processing timeout occurs on a target hard disk corresponding to an IO request includes:
[0083] When the kernel checks that the timing duration of the timer started when receiving the IO request reaches the first set duration, it is determined that the target hard disk corresponding to the IO request has an IO processing timeout; wherein, when it is detected that the IO request has been processed, if the timer has not expired, the control timer is invalidated.
[0084] As an embodiment, determining whether a preset IO processing timeout event reporting condition is currently met includes:
[0085] When it is found that the IO request has not been processed, the kernel checks whether the difference between the time when the IO request was received and the current time is greater than or equal to the second set time. If so, it determines whether the preset IO processing timeout event reporting conditions are currently met; wherein the first set time is less than or equal to the second set time.
[0086] As an embodiment, the detection module 401 is further configured to: upon determining that the processing time of the IO request has timed out, record the IO information related to the IO request into the disk information linked list; upon detecting that the IO request has been processed, delete the IO information related to the IO request from the disk information linked list;
[0087] The detection module 401 is further used to: when determining that the target hard disk corresponding to the IO request has an IO processing timeout, check whether the disk information linked list contains IO information that matches the target hard disk; if not, determine that the target hard disk does not have an IO processing timeout; if so, return to the step of checking whether the disk information linked list contains IO information that matches the target hard disk.
[0088] As an embodiment, the processing module 402 is further configured to:
[0089] After the target hard disk is powered on and off, the disk status information of the target hard disk is obtained; if the disk status information of the target hard disk indicates that the target hard disk is normal, an IO request is sent to the target hard disk; if the disk status information of the target hard disk indicates that the target hard disk is abnormal, the target hard disk is powered on and off when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold.
[0090] As an embodiment, powering on and off the target hard disk includes: controlling the target hard disk to be powered off based on a specified power-off duration through the BMC; after the target hard disk is powered off, controlling the target hard disk to be powered on through the BMC;
[0091] Obtaining the disk status information of the target hard disk includes: sending a disk status query instruction to the target hard disk through the hard disk controller, and using the query result returned by the target hard disk in response to the disk status query instruction as the disk status information of the target hard disk.
[0092] As an embodiment, the processing module 402 is further configured to:
[0093] When the number of power-on and power-off cycles of the target hard disk exceeds a set threshold, the target hard disk is powered off through the BMC and an indication that the target hard disk is a faulty hard disk is output.
[0094] So far, completed Figure 4 Structural description of the device shown.
[0095] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0096] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the present application scheme. Those of ordinary skill in the art can understand and implement it without paying any creative work.
[0097] See Figure 5 , is a schematic diagram of the hardware structure of an electronic device provided by an exemplary embodiment of the present application. The electronic device may include a processor 501, a communication interface 502, a computer-readable storage medium 503, and a communication bus 504. The processor 501, the communication interface 502, and the computer-readable storage medium 503 communicate with each other via the communication bus 504. The computer-readable storage medium 503 stores computer program instructions; the processor 501 can execute the steps of the method described in the above embodiment by executing the computer program instructions stored on the computer-readable storage medium 503. The electronic device may also include other hardware according to the actual function of the electronic device, which will not be described in detail.
[0098] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, on which a number of computer program instructions are stored. When the computer program instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.
[0099] Exemplarily, the computer-readable storage medium may be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, and the like. For example, the computer-readable storage medium may be RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, a storage drive (such as a hard disk drive), a solid-state drive, any type of storage disk (such as a CD, DVD, etc.), or similar storage media, or a combination thereof. The processor and memory may be supplemented by or incorporated into dedicated logic circuitry.
[0100] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A method for processing an input / output (IO) request timeout, characterized in that: The method is applied to an electronic device, and the method comprises: If it is detected in the kernel state of the electronic device that the processing time of the received IO request has timed out, it is determined that the target hard disk corresponding to the IO request has an IO processing timeout, and further determined whether the preset IO processing timeout event reporting condition is currently met so that the user state of the electronic device prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event. If so, the IO processing timeout event is reported; if not, wait until the preset IO processing timeout event reporting condition is currently met, and then report the IO processing timeout event so that the user state prohibits the issuance of the IO request to the target hard disk based on the reported IO processing timeout event; If it is found in the user state that in addition to the target hard disk, other hard disks have IO processing timeouts, then when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold, the target hard disk is powered on and off; If it is found in the user state that only the target hard disk has an IO processing timeout, the disk status information of the target hard disk is obtained. If the disk status information of the target hard disk indicates that the target hard disk is abnormal, the target hard disk is powered on and off when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold.
2. The method according to claim 1, characterized in that Determining that an IO processing timeout occurs on the target hard disk corresponding to the IO request includes: When the kernel checks that the timing duration of the timer started when the IO request is received reaches a first set duration, it is determined that an IO processing timeout exists on the target hard disk corresponding to the IO request; wherein, when it is detected that the IO request has been processed, if the timer has not expired, the timer is controlled to expire.
3. The method according to claim 2, characterized in that The determining whether the preset IO processing timeout event reporting condition is currently met includes: When it is found that the IO request has not been processed, the kernel checks whether the difference between the time when the IO request is received and the current time is greater than or equal to a second set time length. If so, it is determined that the preset IO processing timeout event reporting condition is currently met; wherein the first set time length is less than or equal to the second set time length.
4. The method according to claim 1, wherein The method further includes: when it is determined that the processing time of the IO request has timed out, recording IO information related to the IO request into a disk information linked list; when it is detected that the IO request has been processed, deleting the IO information related to the IO request from the disk information linked list; After determining that an IO processing timeout exists on the target hard disk corresponding to the IO request, the method further includes: checking whether the disk information linked list contains IO information that matches the target hard disk; if not, determining that no IO processing timeout exists on the target hard disk; if so, returning to the step of checking whether the disk information linked list contains IO information that matches the target hard disk.
5. The method according to claim 1, wherein After powering on and off the target hard disk, the method further includes: Obtain the disk status information of the target hard disk; if the disk status information of the target hard disk indicates that the target hard disk is normal, send an IO request to the target hard disk; if the disk status information of the target hard disk indicates that the target hard disk is abnormal, power on and off the target hard disk when the number of power on and off of the target hard disk does not exceed the set number threshold.
6. The method according to any one of claims 1 or 5, characterized in that: The power-on and power-off processing of the target hard disk includes: controlling the target hard disk to be powered off based on a specified power-off duration by a baseboard management controller (BMC); and controlling the target hard disk to be powered on after the target hard disk is powered off by the BMC. Obtaining the disk status information of the target hard disk includes: sending a disk status query instruction to the target hard disk through a hard disk controller, and using the query result returned by the target hard disk in response to the disk status query instruction as the disk status information of the target hard disk.
7. The method according to claim 1, characterized in that When the number of power-on and power-off cycles of the target hard disk exceeds a set number threshold, the method further includes: The target hard disk is controlled to be powered off through the BMC, and an indication that the target hard disk is a faulty hard disk is output.
8. An input / output (IO) request timeout processing device, characterized in that: The device is applied to electronic equipment and includes: a detection module configured to, upon detecting in a kernel state of the electronic device that a processing time of a received IO request has timed out, determine that an IO processing timeout exists in a target hard disk corresponding to the IO request, and further determine whether a preset IO processing timeout event reporting condition is currently satisfied so that, in a user state of the electronic device, the IO request is prohibited from being issued to the target hard disk based on the reported IO processing timeout event; if so, report the IO processing timeout event; if not, wait until the preset IO processing timeout event reporting condition is currently satisfied, then report the IO processing timeout event so that, in the user state, the IO request is prohibited from being issued to the target hard disk based on the reported IO processing timeout event; a processing module configured to, when it is discovered in the user state that in addition to the target hard disk, other hard disks have IO processing timeouts, and when the number of power-on and power-off times of the target hard disk does not exceed a set number threshold, power-on and power-off the target hard disk; If it is found in the user state that only the target hard disk has an IO processing timeout, the disk status information of the target hard disk is obtained. If the disk status information of the target hard disk indicates that the target hard disk is abnormal, the target hard disk is powered on and off when the number of power-on and power-off times of the target hard disk does not exceed the set number threshold.
9. An electronic device, characterized in that: The electronic device includes: processor; and A computer-readable storage medium having computer program instructions stored therein, wherein the computer program instructions, when executed by the processor, cause the processor to perform the steps of any one of the methods of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, which, when executed by a processor, enable the processor to perform the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Hard disk failure handling method, apparatus, server, and computer-readable medium
CN109284207A
Disk fault detection method and device
CN113608915A