IO request timeout processing method and device and electronic equipment
By working together between the kernel state and the user state, we detect that the hard disk IO request processing timeout and prohibit the IO request. Combined with the power-up and down processing technology, the problem of degradation of the storage system's reliability caused by the hard disk IO processing timeout is solved, and efficient and reliable IO processing of the storage system is achieved.
Patent Information
- Application Number
- CN202411907730.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-12-23
AI Technical Summary
The problem of degrading storage system reliability due to the timeout of hard disk IO processing is not processed in time.
In the kernel state, the IO request processing timeout is timed out, and the target hard disk has an IO processing timeout, and in the user state, the IO request is prohibited from issuing an IO request to the target hard disk based on the IO processing timeout event, and power-up and down processing is performed to repair the hard disk.
It effectively avoids the reduction in storage system reliability caused by the timeout of hard disk IO processing. By timely repairing the hard disk, the error handling of non-failed hard disks is reduced.
Smart Images

Figure CN119847431A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to an input / output (IO) request timeout processing method, device and electronic device. 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 actual applications, hard disks often experience IO processing timeouts due to hard disk failures and other reasons. When a hard disk has an IO processing timeout and fails to process it in time, it may have a chain reaction on other hard disks under the hard disk controller except for the hard disk, resulting in the failure of IO requests of multiple hard disks to be successfully issued, which will 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 the 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 process the IO processing timeout of the hard disk.
[0004] The present application provides an IO request timeout processing method, which is applied to an electronic device and includes:
[0005] 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 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 IO requests 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 IO requests to the target hard disk based on the reported IO processing timeout event;
[0006] 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 power-on and power-off times of the target hard disk do not exceed the set number threshold, the target hard disk is powered on and off;
[0007] If it is found in user state that only the target hard disk has 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] The embodiment of the present application also provides an IO request timeout processing device, which is applied to an electronic device, and includes:
[0009] A detection module, for determining that an IO processing timeout exists in a target hard disk corresponding to the IO request if a processing timeout of a received IO request is detected in a kernel state of the electronic device, and further determining whether a preset IO processing timeout event reporting condition is currently satisfied so that the IO request is prohibited from being sent to the target hard disk based on the reported IO processing timeout event in the user state of the electronic device, and if so, reporting the IO processing timeout event; if not, waiting until the preset IO processing timeout event reporting condition is currently satisfied, reporting the IO processing timeout event so that the IO request is prohibited from being sent to the target hard disk based on the reported IO processing timeout event in the user state;
[0010] A processing module, used for finding in a 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 processing is performed on the target hard disk;
[0011] If it is found in user state that only the target hard disk has 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] The present application also provides an electronic device, the 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, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps in the above method.
[0016] It can be seen from the above technical solutions that 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 can not only reduce the impact on the processing of the IO request, but also realize 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 the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.
[0018] Figure 1 A schematic diagram of the method flow provided in an embodiment of the present application.
[0019] Figure 2 Another method flow chart provided in the 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 structure of an electronic device 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 understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.
[0024] See also Figure 1 , Figure 1 The method flow chart provided in the embodiment of the present application is as follows. As an embodiment, the method is applied to an electronic device, and the electronic device may be a server or other device, which is not specifically limited in the present 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 the target hard disk corresponding to the IO request has an IO processing timeout, 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 IO request from being sent 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 IO request from being sent to the target hard disk based on the reported IO processing timeout event.
[0027] In this embodiment, as an embodiment, 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 loaded in the user state of the electronic device for the detection and processing of IO processing timeout. Based on this, the IO timeout detection program loaded in the kernel state can be used to detect whether the processing time of the received IO request has timed out; and the IO timeout processing program loaded in the user state can be used to process the IO processing timeout event reported in the kernel state, that is, based on the reported IO processing timeout event, the IO request is prohibited from being sent to the target hard disk.
[0028] In this embodiment, the IO timeout detection program refers to a pre-set program for IO processing timeout detection. The IO timeout processing program refers to a pre-set program for IO processing timeout processing.
[0029] The processing time of an IO request refers to the time between the moment when the IO request is received and the current moment. If the processing time of an IO request times out, it means that the hard disk corresponding to the IO request may have a fault, resulting in the IO request sent to the hard disk not being processed in time. Based on this, if the IO timeout detection program detects that the processing time of the received IO request has timed out in the kernel state, it is determined that the target hard disk corresponding to the IO request has an IO processing timeout.
[0030] In this embodiment, as an embodiment, the above determination that the target hard disk corresponding to the IO request has an IO processing timeout may include, for example, in a specific implementation: when the kernel state detects that the timing duration of the timer started when the IO request is received reaches a first set duration, it is determined that the target hard disk corresponding to the IO request has an IO processing timeout. The first set duration here can be flexibly set based on actual application requirements, such as 5 seconds, 10 seconds, etc., and this embodiment does not specifically limit it.
[0031] In this embodiment, the timer is used to detect whether the processing time of the received IO request has timed out; based on this, if it is detected that the IO request has been processed, if the timer has not expired at this time, 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 can be understood that the timer will automatically expire after the work is completed, that is, the timing time of 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 timeout handler loaded in the user state prohibits the issuance of IO requests 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 conditions are currently met and the IO processing timeout event is reported so that the IO timeout handler loaded in the user state prohibits the issuance of IO requests to the target hard disk based on the reported IO processing timeout event.
[0033] In this embodiment, as an embodiment, the above determination of whether the preset IO processing timeout event reporting condition is currently met may include, for example, when it is specifically implemented: when it is found that the above IO request has not been processed, checking in the kernel state 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, and if so, determining whether the preset IO processing timeout event reporting condition is currently met. Among them, 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 in addition to the target hard disk, other hard disks have IO processing timeouts, then when the power-on and power-off times of the target hard disk do not exceed the set times threshold, the target hard disk is powered on and off.
[0035] In the present embodiment, as described above, when the present embodiment detects the IO processing timeout event reported above through the loaded IO timeout handler in the user state, 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 timeout, then it means that the target hard disk may have a fault and caused 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 setting number threshold can be flexibly set based on actual application requirements, for example, it can be 3 times, 4 times, or 5 times, etc., which is not specifically limited in this embodiment.
[0037] In this embodiment, as an embodiment, the above-mentioned power-on and power-off processing of the target hard disk can be implemented as follows: first, the target hard disk is powered off based on the specified power-off duration through the baseboard management controller (Baseboard Management Controller, BMC); after the target hard disk is powered off, the target hard disk is powered on through the BMC; 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, 5 seconds, etc., and this embodiment is not specifically limited.
[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 power-off of the target hard disk to isolate the target hard disk to avoid the impact of the target hard disk on other hard disks; and output an indication that the target hard disk is a faulty hard disk to prompt relevant technicians to replace the target hard disk.
[0039] Step 103, in the user state, if it is found 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 abnormal data transmission link, etc. 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, 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 to achieve fault repair of the target hard disk.
[0041] Based on the above description, as an embodiment, 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 is not a faulty hard disk. At this time, there is no need to power on and off the target hard disk, and IO requests can be sent to the target hard disk, that is, the above-mentioned prohibition of sending IO requests to the target hard disk is lifted. In this embodiment, as an embodiment, when the disk status information of the target hard disk indicates that the target hard disk is normal, IO requests can be immediately resumed to the target hard disk, or IO requests can be sent to the target hard disk after waiting for a set time (such as 20 seconds, or 30 seconds, etc.), which is not specifically limited in this embodiment.
[0042] In this embodiment, as an embodiment, the above-mentioned acquisition of the disk status information of the target hard disk can be implemented in detail, for example: sending a disk status query instruction to the target hard disk through the hard disk controller, so as to use 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.
[0043] So far, completed Figure 1 The process shown.
[0044] pass Figure 1 It can be seen from the process shown that 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 can not only reduce the impact on the processing of the IO request, but also achieve 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 embodiment, when it is determined that the processing time of the IO request has timed out, the IO information related to the IO request is recorded in the disk information linked list; wherein, this embodiment does not specifically limit the IO information related to the IO request, for example, it may include the timestamp of the IO request (such as the time when the IO request is received, etc.), the target hard disk corresponding to the IO request, and the cache address information of the IO request in the kernel state, etc. 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 can be checked 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 duration timeout 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 an IO request can be issued to the target hard disk at this time; 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 power on and off times of the target hard disk do not exceed the set times threshold, the target hard disk can be powered on and off again until the power on and off times of the target hard disk exceed the set times threshold.
[0050] In order to facilitate understanding of the specific implementation process of the above IO request timeout processing method, the following is an example description through a specific embodiment.
[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 embodiment, the loading of the IO timeout detection program may include, for example, the following when the specific implementation is performed: first, when the operating system is started, the IO timeout detection program is loaded into the kernel state of the electronic device through 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, where the disk information 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 for communication between the IO timeout detection program in the kernel state and the IO timeout handler in the user state is registered; 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 to be issued.
[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 may include, for example, the following when it is specifically implemented: 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 handling program corresponding to the installation package) through the target service file; wherein, in the case of a restart of the operating system, the IO timeout handling process may also be automatically started through the above-mentioned target service file; thereafter, creating and starting a listening thread for receiving IO handling timeout events reported in the kernel state and a processing thread for handling IO handling timeout events in the above-mentioned IO timeout handling process.
[0055] In this embodiment, by using different threads, namely, the listening thread and the 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 execution of the loading of the above-mentioned IO timeout detection program and the loading of the above-mentioned IO timeout processing 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 processing program is executed.
[0057] This completes the description of the loading process of the above IO timeout detection program and IO timeout processing program.
[0058] The following describes the specific implementation process of IO timeout detection through 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 the kernel state 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 above-mentioned timer reaches the first set duration, it is determined that the processing duration of the IO request has timed out, and at this time, the call of the callback function is triggered 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 related description, which 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, the timed-out disk refers to a hard disk with IO 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, and 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, delete the IO information related to the IO request in the disk information linked list; and when it is detected that the disk information linked list does not contain IO information matching the above-mentioned target hard disk, change the mark of the above-mentioned target hard disk 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 processing program:
[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 sent by an upper layer, wherein the upper layer may refer to a remote device such as a client device that is connected to the device for communication.
[0074] Step 303, if it is found through the above processing thread that in addition to the IO processing timeout of the above target hard disk, there are other IO processing timeouts, then when the power-on and power-off times of the target hard disk do 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, return to the step when the power-on and power-off times of the target hard disk do not exceed the set number threshold. If the disk status information of the target hard disk indicates that the target hard disk is normal, notify the above storage module after the set time to resume sending IO requests to the target hard disk.
[0075] Step 304, if it is found through the above processing thread that only the above 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 power-on and power-off times of the target hard disk do not exceed the set 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 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 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 impact of the target hard disk on 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.
[0077] At this point, the description of the method provided in the embodiment of the present application is completed. The following is a description of 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 The present invention provides a schematic diagram of the structure of an IO request timeout processing device provided in an embodiment of the present invention. 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] Wherein, the detection module is used for, if it is detected in the kernel state of the electronic device that the processing time of the received IO request has timed out, determining that the target hard disk corresponding to the IO request has an IO processing timeout, and further determining whether the preset IO processing timeout event reporting condition is currently met so that the user state of the electronic device prohibits the IO request from being sent to the target hard disk based on the reported IO processing timeout event, and if so, reporting the IO processing timeout event; if not, waiting until the preset IO processing timeout event reporting condition is currently met, reporting the IO processing timeout event so that the user state prohibits the IO request from being sent to the target hard disk based on the reported IO processing timeout event;
[0080] A processing module, used for finding in a 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 processing is performed on the target hard disk;
[0081] If it is found in user state that only the target hard disk has 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 that an IO processing timeout exists in 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 expired.
[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 is 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 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 used to: when 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; when detecting that the IO request has been processed, delete the IO information related to the IO request in the disk information linked list;
[0087] The detection module 401 is further used for: when determining that an IO processing timeout exists in the target hard disk corresponding to the IO request, checking whether the disk information linked list contains IO information matching the target hard disk; if not, determining that an IO processing timeout does not exist in the target hard disk; if yes, returning to the step of checking whether the disk information linked list contains IO information matching 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 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.
[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 number 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, which will not be repeated here.
[0096] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, 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 may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.
[0097] See also 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 through the communication bus 504. Among them, computer program instructions are stored on the computer-readable storage medium 503; 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 may contain or store information, such as executable instructions, data, etc. For example, the computer-readable storage medium may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof. The processor and memory may be supplemented by or incorporated into a dedicated logic circuit.
[0100] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, 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 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 IO requests to the target hard disk based on the reported IO processing timeout event, and if so, reports the IO processing timeout event; if not, wait until the preset IO processing timeout event reporting condition is currently met, and then reports the IO processing timeout event so that the user state prohibits the issuance of IO requests to the target hard disk based on the reported IO processing timeout event; In the user state, if it is found 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 The determining that an IO processing timeout exists in 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 in 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, check in the kernel state 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, determine whether the preset IO processing timeout event reporting conditions are 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, characterized in that: The method further comprises: when it is determined that the processing time of the IO request has timed out, recording the 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 in the disk information linked list; After determining that the target hard disk corresponding to the IO request has an IO processing timeout, the method further includes: checking whether the disk information linked list contains IO information that matches the target hard disk; if not, determining that the target hard disk does not have an IO processing timeout; 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, characterized in that 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, issue 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 power-off times of the target hard disk does not exceed a 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 through a baseboard management controller BMC; after completing the power-off of the target hard disk, controlling the target hard disk to be powered on through 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 times of the target hard disk exceeds a set number threshold, the method further includes: The target hard disk is powered off by controlling 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 comprises: A detection module, for detecting in the kernel state of the electronic device that the processing time of the received IO request has timed out, determining that an IO processing timeout exists in the target hard disk corresponding to the IO request, and further determining 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, reporting the IO processing timeout event; if not, waiting until the preset IO processing timeout event reporting condition is currently satisfied, reporting 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; A processing module, configured to, when it is found 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 execute 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 any one of the methods 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
Hard disk management method, device and equipment and machine readable storage medium
CN114218037A
Hard disk management method and computing device
CN116680104A
Rapid recovery method and device for disk array fault
CN117667480A