CN111131224B - Method for maintaining connection and storage device - Google Patents
Method for maintaining connection and storage device Download PDFInfo
- Publication number
- CN111131224B CN111131224B CN201911329419.0A CN201911329419A CN111131224B CN 111131224 B CN111131224 B CN 111131224B CN 201911329419 A CN201911329419 A CN 201911329419A CN 111131224 B CN111131224 B CN 111131224B
- Authority
- CN
- China
- Prior art keywords
- data
- kernel
- data packet
- serial number
- memory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/161—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
- H04L69/162—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer And Data Communications (AREA)
Abstract
The application provides a method for maintaining connection and a storage device, comprising the following steps: starting a business process and setting an auxiliary process for the business process; establishing a network connection between the business process and the attached process and a host, wherein the business process and the attached process are allocated to the same link in the established network connection; when the business process fails, the link is maintained uninterrupted by the attached process. According to the method for maintaining the connection, the connection between the storage device and the host can be ensured to be continuous under the condition that the storage service process is in failure or upgraded, so that the normal operation of the storage service is ensured, and good storage experience is brought to a user.
Description
Technical Field
The present application relates to the field of computer storage, and more particularly, to a method of maintaining a connection and a storage device.
Background
Currently, the Internet Small Computer System Interface (iSCSI) technology is a method for transmitting Small Computer System Interface (SCSI) commands and data by using transmission control protocol/internet protocol (TCP/IP). iSCSI utilizes Ethernet to construct an IP storage local area network, overcomes the limitation of direct connection of storage equipment, can realize the sharing of storage resources across different servers, and can expand the storage capacity in a non-stop state.
In a conventional iSCSI-based storage system, if a business process in a storage device is interrupted, the kernel of the storage device will reclaim the resources of the process. In this case, the TCP connection carrying iSCSI traffic is disconnected. This TCP disconnect results in a disconnect of the iSCSI connection between the host and the storage device. When traffic resumes, the host and storage device take a longer time to resume the iSCSI connection, which can result in a disruption of guest traffic.
Disclosure of Invention
The application provides a method for maintaining connection and a storage device, which can ensure that the connection between the storage device and a host is continuous under the condition that the process of a storage service is interrupted, thereby ensuring the normal operation of the storage service.
In a first aspect, a method for maintaining connection is provided, which is applied to a storage device, and includes: starting a business process and setting an auxiliary process for the business process; establishing a network connection between the business process and the attached process and a host, wherein the business process and the attached process are allocated to the same link in the established network connection; and when the business process is interrupted, the link is maintained to be uninterrupted through the auxiliary process.
According to the method for maintaining continuous connection, under the condition that the service process is interrupted, the connection corresponding to the service process can be maintained without interruption through the auxiliary process, so that the storage service is ensured not to be interrupted, and good storage experience is brought to a user.
With reference to the first aspect, in some implementations of the first aspect, the establishing a network connection between the service process and the attached process and the host includes: distributing the same socket for the business process and the affiliated process, and setting the reference count corresponding to the socket to be a value larger than 1; after the business process is interrupted, maintaining the link uninterrupted by the attached process comprises: and when the service process is interrupted, modifying the reference count corresponding to the socket, wherein the modified reference count is not zero.
Based on the technical scheme, under the condition that the service process is interrupted, the value of the reference count of the socket corresponding to the service process is not cleared, so that the connection corresponding to the service process is not interrupted.
With reference to the first aspect, in certain implementations of the first aspect, the storage device includes a kernel memory and a shared memory, where the kernel memory is accessed by a kernel process of the storage device, and the shared memory is accessed by the service process; the method further comprises the following steps: when a read request is received, executing the read request, acquiring data read by the read request, dividing the data into at least one data packet, distributing a read serial number for each data packet in the at least one data packet, sending the data packet to a host through the kernel process and the service process, and respectively storing the read serial numbers of the sent data packets to the kernel memory and the shared memory; when the service process is interrupted, the kernel process continuously sends the data packet to the host, and stores the read serial number of the sent data packet into the kernel memory; when the service process is recovered, the service process acquires a first serial number from the kernel process and a second serial number from the shared memory, wherein the first serial number is the serial number with the largest read serial number value in the kernel process when the service process is recovered, and the second serial number is the serial number with the largest read serial number value in the shared process when the service process fails; and determining a data sending mode after the service process is recovered according to the difference value of the first sequence number and the second sequence number.
Based on the technical scheme, the method for recovering data transmission provided by the embodiment of the application can rapidly recover data transmission between the host and the storage device when the service process is interrupted, so that a user cannot perceive that the service process is interrupted once, and good storage experience is brought to the user.
With reference to the first aspect, in some implementations of the first aspect, the determining, according to the difference between the first sequence number and the second sequence number, that the data is sent after the service process is resumed includes: when the difference value between the first sequence number and the second sequence number is zero, determining whether the data sent by the business process before the business process is interrupted is a data head, if so, continuing to send a data packet comprising the data head, and if not, sending the data which is sent by the current data packet together with the unsent data after zero padding; and when the difference value between the first sequence number and the second sequence number is not zero, determining whether the data sent by the kernel process is a data header or not when the service process is recovered, if so, continuing to send a data packet including the data header, and if not, continuing to send the data sent by the kernel process in the currently sent data packet after zero padding.
With reference to the first aspect, in certain implementations of the first aspect, the storage device includes a kernel memory and a shared memory, where the kernel memory is accessed by a kernel process of the storage device, and the shared memory is accessed by the service process; the method further comprises the following steps: when a write request is received, executing the write request, acquiring at least one data packet written by the write request, wherein each data packet in the at least one data packet comprises a write sequence number, receiving the data packet from a host through the kernel process and the service process, and respectively storing the write sequence number of the received data packet to the kernel memory and the shared memory; when the service process is interrupted, the kernel process continues to receive the data packet from the host and stores the write sequence number of the received data packet into the kernel memory; when the service process is recovered, the service process acquires a first serial number from the kernel process and a second serial number from the shared memory, wherein the first serial number is a serial number with the largest written serial number value in the kernel process when the service process is recovered, and the second serial number is a serial number with the largest written serial number value in the shared process when the service process is interrupted; and determining target data according to the difference value of the first serial number and the second serial number, and indicating the host to send the target data.
In a second aspect, a storage device is provided, which is configured to perform the method in the first aspect or any possible implementation manner of the first aspect, and specifically, the apparatus includes a module configured to perform the method in the first aspect or any possible implementation manner of the first aspect.
In a third aspect, an embodiment of the present application provides an apparatus, including: a memory and a processor. Wherein the memory is configured to store instructions and the processor is configured to execute the instructions stored by the memory, and when the processor executes the instructions stored by the memory, the execution causes the processor to perform the first aspect or the method of any possible implementation manner of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer-readable medium for storing a computer program including instructions for executing the method of the first aspect or any possible implementation manner of the first aspect.
In a fifth aspect, the present application further provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the method of the first aspect or any possible implementation manner of the first aspect.
In a sixth aspect, a chip is provided that includes at least one processor and an interface; the at least one processor is configured to invoke and run a computer program, so that the chip is configured to execute the method in the first aspect or any possible implementation manner of the first aspect.
Drawings
FIG. 1 is a schematic diagram of a networked storage system based on iSCSI technology;
FIG. 2 is a schematic diagram of a protocol architecture for iSCSI;
FIG. 3 is a format of an iSCSI packet;
FIG. 4 is a block diagram of a system architecture suitable for use in the methods provided by embodiments of the present application;
FIG. 5 is a schematic flow chart diagram of a method 500 for maintaining continuity of a connection according to an embodiment of the present application;
FIG. 6 is a schematic flow chart diagram of a method 600 for a storage device to send data to a host after a business process is resumed according to an embodiment of the present application;
FIG. 7 is a schematic flow chart diagram of a method 700 for a host to send data to a storage device after a business process is resumed according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a storage device 800 according to an embodiment of the present application.
Detailed Description
The technical solution in the present application will be described below with reference to the accompanying drawings.
FIG. 1 illustrates a schematic diagram of a networked storage system based on iSCSI technology. The network storage system includes a host 110, a storage device 120, a storage device 121, and a storage device 123.
The network storage system based on iSCSI technology as shown in fig. 1 includes one host and a plurality of storage devices. Other network storage systems based on iSCSI technology may include one or more hosts and one or more storage devices.
FIG. 2 illustrates a schematic diagram of the protocol architecture for iSCSI.
The protocol architecture of iSCSI includes a client host side and a storage device side. The client host end encapsulates the SCSI instructions and data into TCP/IP packets, sends the TCP/IP packets through the network, and transmits the SCSI instructions and data to the storage device end. After receiving the TCP/IP packet, the storage device restores the TCP/IP packet into SCSI instructions and data and executes the SCSI instructions and data, and after completion, the returned SCSI instructions and data are re-encapsulated into the TCP/IP packet and transmitted back to the client host. The following details the functionality of each layer in the iSCSI protocol architecture:
SCSI layer: for sending Command Description Blocks (CDBs) and data to the iSCSI layer, and for receiving and processing CDBs from the iSCSI layer. Where the CDB performs the task of reading or writing data blocks from the disks of the storage device.
iSCSI layer: the functions of establishing iSCSI connection and carrying out iSCSI session management are mainly completed. The iSCSI layer sends and receives iSCSI Protocol Data Units (PDUs), encapsulates SCSI commands, status, and data, and establishes iSCSI sessions between client hosts and storage devices.
A TCP layer: the communication between the host and the storage device may be established over one or more TCP connections that accomplish reliable data segment transfers.
IP layer: the network layer is responsible for providing communication for hosts on the internet. At the network layer, the transmission unit of data is a packet. The network layer is responsible for routing, so that data segments transmitted by the TCP layer of the client host can find a target host according to a network address.
Data Link (Link) layer: the task of the data link layer is to transmit data in units of frames on a line between two adjacent nodes without errors. Each frame includes data and necessary control information. These control information include synchronization information, two-layer address information, error control information, and the like.
FIG. 3 illustrates a format of an iSCSI packet.
The ethernet header field may carry information such as a source MAC address, a destination MAC address, etc.
The IP header field may carry information such as a source IP address, a destination IP address, etc.
The TCP header field may carry TCP sequence number, data length information, etc.
The iSCSI PDU field may be used to carry SCSI commands and I/O requests. SCSI commands, CDB. The I/O requests are read/write operations of data from/to the storage device for the client host.
Fig. 4 shows a system structural block diagram suitable for the method provided by the embodiment of the present application.
As depicted in fig. 4, the system includes a storage device 400 and a host 460.
In an embodiment of the present application, storage device 400 includes a memory 410, a processor 420, a communication interface 430, and a bus 440. The memory 410, the processor 420 and the communication interface 430 are connected to each other through a bus 440.
The memory 410 includes a process memory 401, a shared memory 402, and a kernel memory 403. The memory 410 may be a Read Only Memory (ROM), a static memory device, a dynamic memory device, or a Random Access Memory (RAM). The memory 410 may store programs and data, and the processor 420 is configured to perform the steps of the method of maintaining a connection of the embodiments of the present application when the programs stored in the memory 410 are executed by the processor 420.
The processor 420 may be a general-purpose Central Processing Unit (CPU), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits, and is configured to execute related programs to implement the method for maintaining connection according to the embodiment of the present application.
Processor 420 may also be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the method for maintaining a connection according to the embodiment of the present application may be implemented by instructions or program codes in the form of hardware integrated logic circuits or software in the processor 420.
The processor 420 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 410, and the processor 420 reads the information in the memory 410 and completes the functions required to be performed by the units included in the storage device 400 in the embodiment of the present application in combination with the hardware thereof.
The communication interface 430 may enable communication between the storage device 400 and other devices or communication networks using, but not limited to, transceiver means such as transceivers. For example, the communication interface 430 may enable data communication between the storage device 400 and the host 450.
Bus 440 may provide a pathway for information transfer between various components (e.g., memory 410, processor 420, communication interface 430) within storage device 400.
It should be understood that the processor in the embodiments of the present application may be a Central Processing Unit (CPU), and the processor may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will also be appreciated that the memory in the embodiments of the subject application can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. Volatile memory can be Random Access Memory (RAM), which acts as external cache memory. By way of example, but not limitation, many forms of Random Access Memory (RAM) are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct bus RAM (DR RAM).
The method of maintaining constant connectivity provided by the practice of the present application is described below in conjunction with fig. 5 and 7.
Fig. 5 is a schematic flow chart of a method 500 for maintaining continuity of a connection according to an embodiment of the present application.
And 510, starting the business process and setting an auxiliary process for the business process.
The starting of the service process and the setting of the auxiliary process for the service process may be establishing the service process in the storage device and establishing the auxiliary process of the service process under the condition that the storage device is powered on.
For example, in the case of a power-on of the storage device, a business process is established first, and then an attached process to the business process is established. Or, under the condition that the storage device is powered on, the business process and the affiliated process of the business process are simultaneously established.
In the embodiment of the present application, the number of attached processes is not particularly limited.
In one implementation, an attached process to the business process may be established in the storage device.
In another implementation, N backup processes of the business process may be established in the storage device, where N is a positive integer greater than or equal to 2.
A network connection between the business process and the adjunct process and the host is established 520, wherein the business process and the adjunct process are assigned the same link in the established network connection.
The network connection between the business process and the attached process and the host may be an iSCSI session between the storage device and the host. The iSCSI session is based on TCP connections.
The storage device and the host establish the iSCSI session based on the TCP connection, which can be realized by the following modes: the host is provided with an iSCSI Initiator (Initiator), and the storage device is provided with an iSCSI Target (Target). The specific process of establishing an iSCSI session may be implemented by an iSCSI initiator and an iSCSI target. After the storage device establishes an iSCSI session over a TCP connection with the host, the host may send a read or write request to the storage device.
In the established network connection, the business process and the affiliated process are allocated to the same link (namely, the same TCP connection), namely, the link can be maintained by the business process and the affiliated process together, and the link is disconnected when the business process and the affiliated process in the link are interrupted.
Establishing the network connection between the service process and the attached process and the host further comprises: and allocating the same socket for the business process and the affiliated process, and setting the reference count corresponding to the socket to be a value larger than 1.
It should be understood that after the service process and the attached process establish a network connection with the host, the storage device allocates the same socket to the service process and the attached process, sets the reference count corresponding to the socket to a value greater than 1, and stores the value of the reference count of the socket into the process memory of the storage device.
In some embodiments, the value of the reference count corresponding to a socket is in a one-to-one relationship with the number of processes.
It should be understood that the process includes a business process and an attached process. The one-to-one relationship between the value of the reference count corresponding to the socket and the number of processes may be that, every time a process is established in the storage device, the value of the reference count corresponding to the socket of the process is increased by 1. If the storage device has established K processes, the value of the reference count for the socket is set to K, where K is a positive integer greater than or equal to 2.
For example, according to step 510, when the storage device establishes a service process and an attached process of the service process, and establishes an iSCSI session based on a TCP connection with the host, the value of the reference count of the socket corresponding to the service process is set to 2, and the value of the reference count of the socket is stored in the process memory of the storage device.
For example, according to step 510, when the storage device establishes an iSCSI session based on a TCP connection with the host, the storage device sets the value of the reference count of the socket corresponding to the service process to 3, and stores the value of the reference count of the socket in the process memory of the storage device.
In other embodiments, the value of the reference count for a socket is Y to 1, where Y is an integer greater than or equal to 2.
The relation that the value of the reference count of the socket and the number of processes in the TCP connection are Y to one may mean that every time a process is established in the storage device, Y is added to the value of the reference count corresponding to the socket of the process. If the storage device has K processes established, the value of the reference count for the socket is set to Y K, where K is a positive integer greater than or equal to 2.
For example, according to step 510, when the storage device establishes a service process and an attached process of the service process, and establishes an iSCSI session based on a TCP connection with the host, the value of the reference count of the socket corresponding to the service process is set to 4, and the value of the reference count of the socket is stored in the process memory of the storage device.
For example, according to step 510, when the storage device establishes a service process and two subordinate processes of the service process, and establishes an iSCSI session based on a TCP connection with the host, the value of the reference count of the socket corresponding to the service process is set to 9, and the value of the reference count of the socket is stored in the process memory of the storage device.
At 530, when the business process is interrupted, the link is maintained through the attached process.
When the business process is interrupted, the link is maintained uninterrupted by the attached process, comprising the following steps: and when the service process is interrupted, modifying the reference count corresponding to the socket, wherein the modified reference count is not zero.
It should be understood that the interruption of the service process may refer to the failure of the service process or the upgrade of the service process.
For example, before the service process is interrupted, the value of the reference count of the socket stored in the process memory of the storage device is 2, and when the service process fails, the kernel of the storage device releases the reference count of the socket corresponding to the service process, that is, the reference count of the socket stored in the process memory is subtracted by 1. At this time, the reference count of the socket stored in the process memory becomes 1, and is not cleared. In this case, the TCP connection between the storage device and the host remains constant.
In this embodiment, in the case that the execution of the read or write request between the host and the storage device is completed, the host may send a message requesting to end the session to the storage device, and the storage device may close the iSCSI session with the host after receiving the message.
In one implementation, when the iSCSI session ends, the business process and the attached processes end. And after the business process and the attached process are finished, the value of the reference count corresponding to the socket stored in the process memory is 0. For example, assuming that K attached processes are established in step 520, the reference count and number of processes for a socket are in a one-to-one relationship. In this case, the value held by the process memory is N. If the service process is finished, subtracting 1 from the value of the reference count corresponding to the socket stored in the process memory; and if one of the K attached processes is finished, subtracting 1 from the value of the reference count corresponding to the socket stored in the process memory. Thus, if the business process and the K attached processes are all finished, the value of the reference count corresponding to the socket stored in the process memory is 0. For example, assuming that K attached processes are established in step 520, the reference count and number of processes for a socket are Y to one. In this case, the value of the reference count corresponding to the socket stored in the process memory is N. If the business process is finished, subtracting Y from the value stored in the process memory; and if one of the K attached processes is finished, subtracting Y from the value of the reference count corresponding to the socket stored in the process memory. Thus, if the business process and the K attached processes are all finished, the value of the reference count corresponding to the socket stored in the process memory is 0.
In another implementation, the value stored in the process memory is cleared when the iSCSI session ends. In other words, the value saved by the process memory may be set to 0 directly after the iSCSI session is determined to be over.
By way of example and not limitation, when the storage device establishes a TCP connection with the host, the value of the reference count of the socket stored in the process memory of the storage device is the sum of the reference count of the socket of the business process and the reference count of the socket of the process affiliated to the business process. For example, assuming that K attached processes are established, the reference count of the socket and the number of processes are in a one-to-one relationship. In this case, when the service process in the iSCSI session ends, the value of the reference count of the socket in the attached process is decremented by K, and at this time, the value of the reference count of the socket stored in the process memory is cleared, the TCP is disconnected, and the iSCSI session ends. For example, assuming that K attached processes are established, the reference count and number of processes for a socket are Y to one relationship. In this case, when the service process in the iSCSI session ends, the value of the reference count of the socket in the attached process is decremented by Y × K, and at this time, the value of the reference count of the socket stored in the process memory is cleared, the TCP is disconnected, and the iSCSI session ends.
According to the method for maintaining continuous connection provided by the embodiment of the application, under the condition that the service process is interrupted, the value of the reference count of the socket corresponding to the service process is not cleared, and the TCP connection corresponding to the service process is not interrupted. In this case, the iSCSI connection corresponding to the service process is not interrupted, thereby ensuring that the storage service is not interrupted and bringing a good storage experience to the user.
In the present application, the host may read the data stored in the storage device using the iSCSI session established in step 520 over the TCP connection.
The storage device also comprises a kernel memory and a shared memory, wherein the kernel memory is accessed by a kernel process of the storage device, and the shared memory is accessed by a service process.
When the storage device receives a read request sent by the host, the storage device executes the read request, acquires data read by the read request, divides the data into at least one data packet, and allocates a read sequence number to each data packet. And the storage equipment sends the data packet corresponding to the read request to the host, and stores the read serial number into the kernel memory and the shared memory respectively.
The sending, by the storage device, the data packet corresponding to the read request to the host, and storing the read sequence number in the kernel memory and the shared memory respectively may include: the storage device sends the data packet to the host through the kernel process and the service process, and stores the read sequence number to the kernel memory and the shared memory respectively.
And the kernel process writes the sequence number of the data packet corresponding to the read request stored in the kernel memory and the length information of the data packet into the shared memory through mapping.
For example, the kernel process generates a character device. The character device is used for copying a read sequence number of a data packet sent to the host and a data length in the data packet to a business process. And the service process writes the acquired read sequence number and the acquired data length into the shared memory. The business process generates a descriptor fd corresponding to the character device. The kernel process may copy, to the service process, the read sequence number of the packet sent to the host in the kernel memory of the storage device and the data length in the packet through the mapping function mmap and the fd. And the service process writes the acquired read sequence number and the data length in the data packet into a shared memory of the storage device.
And when the service process is interrupted, the kernel process continuously sends the data packet to the host and stores the serial number of the sent data packet into the kernel memory.
It should be appreciated that after the interruption of the business process, the kernel process may continue to send data packets to the host since the TCP connection between the host and the storage device is maintained. In this case, the kernel process may write the read sequence number of the transmitted packet into the kernel memory, and the kernel memory may store the read sequence number of the transmitted packet.
And when the service process is recovered, the service process acquires the first sequence number from the kernel process and acquires the second sequence number from the shared memory. The first sequence number is the time when the service process is recovered and the read sequence number value in the kernel process is the maximum, and the second sequence number is the time when the service process fails and the read sequence number value in the shared process is the maximum.
The method for determining the data sending mode after the service process is recovered according to the difference value of the first sequence number and the second sequence number by the storage device comprises the following steps: when the difference value between the first sequence number and the second sequence number is zero, determining whether the data sent by the business process before the business process is interrupted is a data head, if so, continuing to send a data packet comprising the data head, and if not, sending the data which is sent by the current data packet together with the unsent data after zero padding; and when the difference value between the first sequence number and the second sequence number is not zero, determining whether the data sent by the kernel process is a data header or not when the service process is recovered, if so, continuing to send a data packet including the data header, and if not, continuing to send the data sent by the kernel process in the currently sent data packet after zero padding.
It should be understood that the data header includes an ethernet header, an IP header, and a TCP header as shown in fig. 3.
It should be understood that the transmission is continued after zero padding, which may include the following cases:
1. when the first sequence number is larger than the second sequence number, the storage device sends preset data with the length T to the host, wherein T is the difference between the first length and the length of data in the sent first data packet, the first length is the length of the first data packet, the read sequence number of the first data packet is the first sequence number, and T is a positive integer which is larger than or equal to 1 and smaller than or equal to the first length.
It should be understood that the preset data with the length T may be T0, T1, or other preset data with the length T, and this is not specifically limited in this application.
2. And under the condition that the second sequence number is equal to the first sequence number, the storage device sends preset data with the length of K to the host, wherein K is the difference between the second length and the length of data in the sent second data packet, the second length is the length of the second data packet, the read sequence number of the second data packet is the second sequence number, and K is a positive integer which is greater than or equal to 1 and smaller than or equal to the second length.
It should be understood that the preset data with the length K may be K0 s, K1 s, or other preset data with the length K, and this application is not limited to this specifically.
Next, referring to fig. 6, data sent by the storage device to the host after the service process is resumed will be described.
FIG. 6 illustrates a schematic flow chart diagram of a method 600 for a storage device to send data to a host after a business process is resumed.
A first TCP sequence number (i.e., an instance of the first sequence number) and a second TCP sequence number (i.e., an instance of the second sequence number) are obtained 610.
In this embodiment of the present application, the first sequence number is a sequence number with a largest read sequence number value in the kernel process when the service process is recovered. The second sequence number is the sequence number with the maximum read sequence number value in the shared process at the moment of interruption of the service process.
In some embodiments, in the event of an interruption in the service process, the storage device sends one or more data packets to the host, and saves the TCP sequence numbers of the one or more data packets to the kernel memory. In this case, the first TCP sequence number is not the same as the second TCP sequence number.
For example, when the business process interruption time is long, the storage device may send one or more data packets to the host during this process.
In some embodiments, when the service process is interrupted, the storage device continues to send data in a data packet sent before the interruption to the host, and at the time of resuming the service process, the data in the data packet is not sent completely. In this case, the first TCP sequence number is the same as the second TCP sequence number.
In some embodiments, the storage device does not send one or more data packets to the host in the event of an interruption to the business process. In this case, the first TCP sequence number is the same as the second TCP sequence number.
It is determined 620 whether the first TCP sequence number (i.e., an instance of the first sequence number) and the second TCP sequence number (i.e., an instance of the second sequence number) are the same.
If the first TCP sequence number is not the same as the second TCP sequence number, step 630 is performed.
If the first TCP sequence number is the same as the second TCP sequence number, step 640 is executed.
And 630, determining data to be sent to the host according to the first length and the data in the first data packet which is sent before the business process is recovered.
In some embodiments, in the case that the first TCP sequence number is greater than the second TCP sequence number, the storage device sends zero data with a length T to the host, where T is a difference between the first length and a length of data in the first data packet that has already been sent, the first length is a length of the first data packet, the read sequence number of the first data packet is the first TCP sequence number, and T is a positive integer greater than or equal to 1 and less than or equal to the first length.
For example, after the storage device receives a read request sent by the host, the storage device needs to send data of the read request to the host, the data is sent through a data packet 1, the length of the data packet 1 is 200 bytes, and the read sequence number of the data packet 1 is 12000.
Before the interruption of the service process, the storage device sends 100 bytes of data in packet 1 to the host. In the process of interruption of the service process, the storage device continues to send 120 bytes of data to the host, 100 bytes of data in the 120 bytes of data are data that have not been sent before interruption in data packet 1, and 20 bytes of data in the 120 bytes of data are data in data packet 2. The data packet 2 is the next data packet sent by the storage device after the data packet 1 is sent to the host, and the length of the data carried by the data packet 2 is 100.
In this case, at the time of recovering the service process, the first TCP sequence number stored in the kernel memory is 12200, and the second TCP sequence number stored in the shared memory is 12000. After the business process is resumed, the storage device should send 800 s to the host.
In some embodiments, in the case that the first TCP sequence number is greater than the second TCP sequence number, the storage device determines that the data header of the first data packet is being sent by the storage device at the time when the service process is interrupted. In this case, after the interruption of the service process is resumed, the storage device continues to send the data (i.e. iSCSI PDU in fig. 3) of the payload portion of the first packet to the host, and the read sequence number of the first packet is the first TCP sequence number.
For example, after the storage device receives a read request sent by the host, the storage device needs to send data of the read request to the host, the data is carried by a data packet 1, the storage device sends the data in the data packet 1 to the host before interruption, during the interruption of the service process, the storage device sends all the remaining data that is not sent before interruption in the data packet 1 to the host, and sends a data header of a data packet 2 to the host, where the data packet 2 is a next data packet sent after the storage device sends the data packet 1 to the host. In this case, at the time of recovering the service process, the first TCP sequence number stored in the kernel memory is greater than the second TCP sequence number stored in the shared memory. After the service process is recovered, the storage device should send data following the data header in the data packet 2 to the host.
And 640, determining data to be sent to the host according to the second length and the data in the second data packet which is sent before the business process is recovered.
In some embodiments, in the case that the second TCP sequence number is equal to the first TCP sequence number, the storage device sends zero data with a length of K to the host, where K is a difference between the second length and a length of data in the second data packet that has already been sent, the second length is a length of the second data packet, the read sequence number of the second data packet is the second TCP sequence number, and K is a positive integer greater than or equal to 1 and less than or equal to the second length.
For example, after the storage device receives a read request sent by the host, the storage device needs to send data of the read request to the host, the data is sent through a data packet 1, the length of the data packet 1 is 200 bytes, and the read sequence number of the data packet 1 is 12000.
Before the interruption of the service process, the storage device sends 60 bytes of data in packet 1 to the host. During the interruption of the service process, the storage device continues to send 40 bytes of data in packet 1 to the host.
In this case, at the time of recovering the service process, the first TCP sequence number stored in the kernel memory is 12000, and the second TCP sequence number stored in the shared memory is 12000. After the business process is resumed, the storage device should send 100 0 s to the host.
In some embodiments, in the case that the second TCP sequence number is equal to the first TCP sequence number, the storage device determines that the data header of the second data packet is being sent by the storage device at the time of the interruption of the service process. In this case, after the interruption of the service process is resumed, the storage device continues to send the data of the second data packet to the host, and the read sequence number of the second data packet is the second TCP sequence number.
For example, after the storage device receives a read request sent by the host, the storage device needs to send data of the read request to the host, the data is carried by the data packet 1, the storage device sends a data header of the data packet 1 to the host before interruption, and the storage device does not send data that is not sent out in the data packet 1 to the host in the process of service process interruption. In this case, at the time of recovering the service process, the first TCP sequence number stored in the kernel memory is equal to the second TCP sequence number stored in the shared memory. After the service process is recovered, the storage device should send data following the data header in the data packet 1 to the host.
According to the method for recovering data transmission provided by the embodiment of the application, under the condition that the service process is interrupted, the data transmission between the host and the storage device can be rapidly recovered, so that a user cannot perceive that the service process is interrupted once, and good storage experience is brought to the user.
In the present application implementation, the host may also write data to the storage device using the iSCSI session established in step 520 over the TCP connection.
When the storage device receives a write request sent by a host, the storage device executes the write request, and obtains at least one data packet written by the write request, wherein each data packet in the at least one data packet comprises a write sequence number. The storage device receives the data packet from the host through the kernel process and the service process, and respectively stores the write sequence number of the received data packet to the kernel memory and the shared memory.
And when the service process is interrupted, the kernel process continues to receive the data packet from the host and stores the sequence number of the received data packet into the kernel memory.
It should be understood that after the service process is interrupted, since the TCP connection between the host and the storage device is maintained continuously, the kernel of the storage device may continue to receive the data packet sent by the host, and store the write sequence number of the data packet in the kernel memory.
When the service process is recovered, the service process acquires a first serial number from the kernel process and a second serial number from the shared memory, wherein the first serial number is the time when the service process is recovered and the serial number with the maximum value of the written serial number in the kernel process, and the second serial number is the time when the service process is interrupted and the serial number with the maximum value of the written serial number in the shared process;
determining a processing mode of a received data packet after the service process is recovered according to a difference value of the first sequence number and the second sequence number, wherein the processing mode comprises the following steps: and determining target data according to the difference value of the first serial number and the second serial number, and indicating the host to send the target data.
It should be understood that, in the embodiment of the present application, saving the received data packet may refer to saving data carried by the received data packet.
It should be understood that the data header includes an ethernet header, an IP header, and a TCP header as shown in fig. 3.
It should be understood that determining the target data according to the difference between the first sequence number and the second sequence number and instructing the host to send the target data includes the following cases:
1. and when the difference value between the first sequence number and the second sequence number is zero, determining that the target data is the data in the second data packet which is not received, wherein the second length is the length of the second data packet, and the writing sequence number of the second data packet is the second sequence number.
2. And when the difference value between the first sequence number and the second sequence number is not zero, determining that the target data is data in a first data packet, wherein the first length is the length of the first data packet, and the writing sequence number of the first data packet is the first sequence number.
Next, referring to fig. 7, the storage device receives data sent by the host after the service process is resumed.
Fig. 7 is a schematic flow chart of a method 700 for sending data to a storage device by a host after a business process is recovered according to an embodiment of the present application.
A first TCP sequence number (i.e., an instance of the first sequence number) and a second TCP sequence number (i.e., an instance of the second sequence number) are obtained 710.
In this embodiment of the present application, the first sequence number is a sequence number with a largest value of a write sequence number in the kernel process when the business process is recovered. The second sequence number is the sequence number with the maximum writing sequence number value in the shared process at the moment of interruption of the service process.
In some embodiments, in the case of an interruption in the service process, the storage device receives one or more data packets sent by the host, and stores the TCP sequence numbers of the one or more data packets in the kernel memory. In this case, the first TCP sequence number is not the same as the second TCP sequence number.
For example, when the business process interruption time is long, the host may send one or more data packets to the storage device during this process.
In some embodiments, the storage device does not receive one or more data packets sent by the host in the event of an interruption in the business process. In this case, the first TCP sequence number is the same as the second TCP sequence number.
In some embodiments, when the service process is interrupted, the host continues to send data in a data packet before the interruption of the service process to the storage device, and at the time of resuming the service process, the data in the data packet is not sent yet. In this case, the first TCP sequence number is the same as the second TCP sequence number.
It is determined 720 whether the first TCP sequence number (i.e., an instance of the first sequence number) and the second TCP sequence number (i.e., an instance of the second sequence number) are the same.
If the first TCP sequence number is not the same as the second TCP sequence number, step 730 is performed.
If the first TCP sequence number is the same as the second TCP sequence number, step 740 is performed.
And 730, determining target data according to the difference value of the first TCP sequence number and the second length, and indicating the host to send the target data.
Determining target data according to the difference value between the first TCP sequence number and the second length, including: and under the condition that the difference value of the first TCP sequence number and the second TCP sequence number is equal to a second length, determining that the target data is a first data packet, wherein the second length is the length of a second data packet, the write sequence number of the second data packet is a second TCP sequence number, and the first data packet is the next data packet of the second data packet received by the storage device.
For example, after the storage device receives a write request sent by the host, the host needs to send data of the write request to the storage device, the data is sent through a data packet 1, the length of the data packet 1 is 200 bytes, and the read sequence number of the data packet 1 is 12000.
Before the interruption of the service process, the host sends 100 bytes of data in packet 1 to the storage device. During the interruption of the business process, the host continues to send 100 bytes of data to the storage device.
In this case, at the time of recovering the service process, the first TCP sequence number stored in the kernel memory is 12200, and the second TCP sequence number stored in the shared memory is 12000. After the service process is recovered, the storage device receives the data in the data packet 2 sent by the host.
Determining target data according to the difference value between the first TCP sequence number and the second length, including: and under the condition that the difference value between the first TCP sequence number and the second TCP sequence number is greater than the second length, determining that the target data is the data in the first data packet which is not received, wherein the first length is the length of the first data packet, and the writing sequence number of the first data packet is the first TCP sequence number.
For example, after the storage device receives a write request sent by the host, the host needs to send data of the write request to the storage device, the data is sent through a data packet 1, the length of the data packet 1 is 200 bytes, and the read sequence number of the data packet 1 is 12000.
Before the interruption of the service process, the host sends 100 bytes of data in packet 1 to the storage device. In the process of interruption of the service process, the host continues to send 120 bytes of data to the storage device, 100 bytes of data in the 120 bytes of data are data that have not been sent before interruption in data packet 1, and 20 bytes of data in the 120 bytes of data are data in data packet 2. The data packet 2 is the next data packet sent by the host after the data packet 1 is sent to the storage device, and the length of the data carried by the data packet 2 is 40.
In this case, at the time of recovering the service process, the first TCP sequence number stored in the kernel memory is 12200, and the second TCP sequence number stored in the shared memory is 12000. After the service process is recovered, the storage device receives the data of the remaining 20 bytes in the data packet 2 sent by the host, and after the storage device receives the data packet 2, the storage device deletes the data packet 2.
740, determining that the target data is the data in the second data packet which is not received, and instructing the host to send the target data.
And when the difference value between the first TCP serial number and the second TCP serial number is zero, determining that the target data is the data in the second data packet which is not received, wherein the second length is the length of the second data packet, and the writing serial number of the second data packet is the second TCP serial number.
For example, after the storage device receives a write request sent by the host, the host sends data of the write request to the storage device, the data is sent through a data packet 1, the length of the data packet 1 is 200 bytes, and the read sequence number of the data packet 1 is 12000.
Before the service process is interrupted, the host sends 160 bytes of data in packet 1 to the storage device. During the interruption of the service process, the host does not send the data in the data packet 1 to the storage device.
In this case, at the time of recovering the service process, the first TCP sequence number stored in the kernel memory is 12000, and the second TCP sequence number stored in the shared memory is 12000. After the service process is recovered, the storage device receives the remaining 40 bytes of data in the data packet 1 sent by the host.
According to the method for recovering data transmission provided by the embodiment of the application, under the condition that the service process is interrupted, the data transmission between the host and the storage device can be rapidly recovered, so that a user cannot perceive that the service process is interrupted once, and good storage experience is brought to the user.
It should be understood that, in the various embodiments of the present application, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
It should also be understood that these steps or operations are merely examples, and that other operations or variations of the various operations may be performed by embodiments of the present application. Further, the various steps may be performed in a different order presented in the above-described embodiments, and it is possible that not all of the operations in the above-described embodiments are performed.
An embodiment of the apparatus of the present application is described in detail below in conjunction with fig. 8. It is to be understood that the description of the method embodiments corresponds to the description of the apparatus embodiments, and therefore reference may be made to the preceding method embodiments for parts which are not described in detail.
Fig. 8 shows a schematic structural diagram of a storage device 800 according to an embodiment of the present application. As shown in fig. 8, the storage device 800 includes: a communication unit 801, a storage unit 802, a processing unit 803.
The memory cell 802: for storing instructions and data;
a processing unit 803, configured to start a service process and set an attach process for the service process;
the processing unit 803 is further configured to establish a network connection between the service process and the attached process and the host through the communication unit 801, wherein the service process and the attached process are assigned a same link in the established network connection;
the processing unit 803 is further configured to maintain the link uninterrupted by the attached process.
It should be understood that the units in the device for maintaining connection 800 are respectively used for executing the steps of the method for maintaining connection according to the embodiment of the present application. Here, detailed description thereof is omitted in order to avoid redundancy.
The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product comprises one or more computer instructions or computer programs. The procedures or functions according to the embodiments of the present application are wholly or partially generated when the computer instructions or the computer program are loaded or executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more collections of available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. The semiconductor medium may be a solid state disk.
It should be understood that the term "and/or" herein is merely one type of association relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone, wherein A and B can be singular or plural. In addition, the "/" in this document generally indicates that the former and latter associated objects are in an "or" relationship, but may also indicate an "and/or" relationship, which may be understood with particular reference to the former and latter text.
In the present application, "at least one" means one or more, "a plurality" means two or more. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or multiple.
It should be understood that, in the various embodiments of the present application, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (11)
1. A method for maintaining connection, applied to a storage device, is characterized by comprising the following steps:
starting a business process and setting an auxiliary process for the business process;
establishing a network connection between the business process and the host, wherein the network connection comprises the steps of distributing the same sockets for the business process and the auxiliary process, and setting a reference count corresponding to the sockets to be a value larger than 1, wherein the business process and the auxiliary process are distributed with the same link in the established network connection;
and when the service process is interrupted, maintaining the link uninterrupted and storing the service uninterrupted through the auxiliary process, wherein the step of modifying the reference count corresponding to the socket is included, and the modified reference count is not zero.
2. The method of claim 1, wherein the storage device comprises a kernel memory and a shared memory, the kernel memory being accessed by a kernel process of the storage device, the shared memory being accessed by the business process; the method further comprises the following steps:
when a read request is received, executing the read request, acquiring data read by the read request, dividing the data into at least one data packet, distributing a read serial number for each data packet in the at least one data packet, sending the data packet to a host through the kernel process and the service process, and respectively storing the read serial numbers of the sent data packets to the kernel memory and the shared memory;
when the service process is interrupted, the kernel process continuously sends the data packet to the host, and stores the read serial number of the sent data packet into the kernel memory;
when the service process is recovered, the service process acquires a first serial number from the kernel memory and a second serial number from the shared memory, wherein the first serial number is a serial number with the largest read serial number value in the kernel memory at the time when the service process is recovered, and the second serial number is a serial number with the largest read serial number value in the shared memory at the time when the service process fails;
and determining a data sending mode after the service process is recovered according to the difference value of the first sequence number and the second sequence number.
3. The method of claim 2, wherein the determining the manner in which the data is sent after the service process is resumed according to the difference between the first sequence number and the second sequence number comprises:
when the difference value between the first sequence number and the second sequence number is zero, determining whether the data sent by the business process before the business process is interrupted is a data header, if so, continuing to send a data packet comprising the data header, and if not, sending the data which is sent in the currently sent data packet together with the data which is not sent after zero padding;
and when the difference value between the first sequence number and the second sequence number is not zero, determining whether the data sent by the kernel process is a data header or not when the service process is recovered, if so, continuing to send a data packet including the data header, and if not, continuing to send the data sent by the kernel process in the currently sent data packet after zero padding.
4. The method of claim 1, wherein the storage device comprises a kernel memory and a shared memory, the kernel memory being accessed by a kernel process of the storage device, the shared memory being accessed by the business process; the method further comprises the following steps:
when a write request is received, executing the write request, acquiring at least one data packet written by the write request, wherein each data packet in the at least one data packet comprises a write sequence number, receiving the data packet from a host through the kernel process and the service process, and respectively storing the write sequence numbers of the received data packets to the kernel memory and the shared memory;
when the service process is interrupted, the kernel process continues to receive the data packet from the host and stores the write sequence number of the received data packet into the kernel memory;
when the service process is recovered, the service process acquires a first serial number from the kernel memory and a second serial number from the shared memory, wherein the first serial number is a serial number with the largest written serial number value in the kernel memory at the time when the service process is recovered, and the second serial number is a serial number with the largest written serial number value in the shared memory at the time when the service process is interrupted;
and determining target data according to the difference value of the first serial number and the second serial number, and indicating the host to send the target data.
5. A storage device, comprising:
the processing unit is used for starting a business process and setting an auxiliary process for the business process;
the processing unit is further configured to establish a network connection between the service process and the attached process and a host through a communication unit, specifically, to allocate the same socket to the service process and the attached process, and set a reference count corresponding to the socket to a value greater than 1; wherein the business process and the affiliated process are assigned the same link in the established network connection;
the processing unit is further configured to maintain the link uninterrupted through the attached process, and store the service uninterrupted, and specifically, modify the reference count corresponding to the socket after the service process is interrupted, where the modified reference count is not zero.
6. The storage device of claim 5,
the processing unit is also used for running a kernel process and a service process,
the storage device further comprises a storage unit, which is used for including a kernel memory and a shared memory, wherein the kernel memory is accessed by the kernel process, and the shared memory is accessed by the service process;
the processing unit is further to:
when a read request is acquired through the communication unit, executing the read request, acquiring data read by the read request, dividing the data into at least one data packet, allocating a read sequence number to each data packet in the at least one data packet, sending the data packet to a host through the kernel process and the service process, and respectively storing the read sequence numbers of the sent data packets to the kernel memory and the shared memory;
when the service process is interrupted, the kernel process continuously sends the data packet to the host, and stores the read sequence number of the sent data packet into the kernel memory;
when the service process is recovered, the service process acquires a first serial number from the kernel memory and a second serial number from the shared memory, wherein the first serial number is a serial number with the largest read serial number value in the kernel memory at the time when the service process is recovered, and the second serial number is a serial number with the largest read serial number value in the shared memory at the time when the service process is interrupted;
and determining a data sending mode after the service process is recovered according to the difference value of the first sequence number and the second sequence number.
7. The storage device according to claim 6, wherein the processing unit is specifically configured to determine, when the difference between the first sequence number and the second sequence number is zero, whether data sent by the service process before the service process is interrupted is a data header, if the data is the data header, continue sending a data packet including the data header, and if the data is not the data header, send the data packet together with unsent data after zero padding data already sent in the currently sent data packet;
and when the difference value between the first sequence number and the second sequence number is not zero, determining whether the data sent by the kernel process is a data header or not when the service process is recovered, if so, continuing to send a data packet including the data header, and if not, continuing to send the data sent by the kernel process in the currently sent data packet after zero padding.
8. The storage device of claim 5, wherein the processing unit is further to run a kernel process and a business process,
the storage device further comprises a storage unit, which is used for including a kernel memory and a shared memory, wherein the kernel memory is accessed by the kernel process, and the shared memory is accessed by the service process;
the processing unit is further to:
when a write request is acquired through the communication unit, executing the write request, acquiring at least one data packet written by the write request, wherein each data packet in the at least one data packet comprises a write sequence number, receiving data from a host through the kernel process and the service process, and respectively storing the write sequence numbers to the kernel memory and the shared memory;
when the service process is interrupted, the kernel process continues to receive the data packet from the host and stores the serial number of the received data packet into a kernel memory;
when the service process is recovered, the service process acquires a first serial number from the kernel memory and a second serial number from the shared memory, wherein the first serial number is a serial number with the largest written serial number value in the kernel memory at the time when the service process is recovered, and the second serial number is a serial number with the largest written serial number value in the shared memory at the time when the service process is interrupted;
and determining target data according to the difference value of the first serial number and the second serial number, and indicating the host to send the target data.
9. An apparatus, comprising: a processor and a memory, the memory for storing a program and data, the processor for invoking and running the program from the memory to perform the method of any one of claims 1 to 4.
10. A computer-readable storage medium, comprising a computer program which, when run on a computer, causes the computer to perform the method of any one of claims 1 to 4.
11. A chip comprising a processor and a data interface, the processor reading instructions stored on a memory through the data interface to perform the method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911329419.0A CN111131224B (en) | 2019-12-20 | 2019-12-20 | Method for maintaining connection and storage device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911329419.0A CN111131224B (en) | 2019-12-20 | 2019-12-20 | Method for maintaining connection and storage device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111131224A CN111131224A (en) | 2020-05-08 |
CN111131224B true CN111131224B (en) | 2022-08-09 |
Family
ID=70501020
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911329419.0A Active CN111131224B (en) | 2019-12-20 | 2019-12-20 | Method for maintaining connection and storage device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111131224B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113905105B (en) * | 2021-09-30 | 2024-03-15 | 阿里巴巴(中国)有限公司 | Method and device for establishing application dependency relationship |
CN114928899B (en) * | 2022-07-18 | 2022-10-28 | 荣耀终端有限公司 | Physical link establishment method and electronic equipment |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100464522C (en) * | 2007-05-17 | 2009-02-25 | 华为技术有限公司 | Process upgrading method and system |
CN102508713B (en) * | 2011-10-12 | 2015-01-28 | 杭州华三通信技术有限公司 | Progress starting method, kernel and progress |
-
2019
- 2019-12-20 CN CN201911329419.0A patent/CN111131224B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN111131224A (en) | 2020-05-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108701004B (en) | System, method and corresponding device for data processing | |
US8954785B2 (en) | Redundancy and load balancing in remote direct memory access communications | |
KR100754308B1 (en) | Remote direct memory access enabled network interface controller switchover and switchback support | |
CN105556930A (en) | NVM EXPRESS controller for remote memory access | |
CN111131224B (en) | Method for maintaining connection and storage device | |
US20220244861A1 (en) | Data Access Method and Apparatus, and First Computing Device | |
WO2015096548A1 (en) | Priority-based flow control (pfc) method, transmitting device and receiving device | |
KR100464195B1 (en) | Method and apparatus for providing a reliable protocol for transferring data | |
US20170220255A1 (en) | Write request processing method, processor, and computer | |
CN104750428A (en) | Block storage access and gateway module, storage system and method, and content delivery apparatus | |
WO2014056367A1 (en) | Aggregation port id allocation method and device | |
US10284645B1 (en) | Backup from network attached storage to sequential access media in network data management protocol environments | |
EP3261302B1 (en) | Storage network element discovery method and device | |
CN110325958B (en) | Data storage method and device in distributed block storage system and computer readable storage medium | |
WO2016135919A1 (en) | Storage device | |
JP5605847B2 (en) | Server, client, backup system having these, and backup method therefor | |
KR20050002865A (en) | A method for providing redundancy for channel adapter failure | |
US20220217093A1 (en) | Sequence Number Synchronization Method and Apparatus | |
KR20180099143A (en) | Apparatus and method for recovering tcp-session | |
CN113391759B (en) | Communication method and equipment | |
CN109039680B (en) | Method and system for switching main Broadband Network Gateway (BNG) and standby BNG and BNG | |
US10855610B2 (en) | Information processing apparatus, information processing system, information processing method, and storage medium | |
US9529549B2 (en) | Data processing method for storing data and restoration information and data processing system | |
CN116760850B (en) | Data processing method, device, equipment, medium and system | |
JP5320571B2 (en) | Internode data response system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |