[go: up one dir, main page]

CN113986855B - Method, system, equipment and medium for locking files by network file system - Google Patents

Method, system, equipment and medium for locking files by network file system Download PDF

Info

Publication number
CN113986855B
CN113986855B CN202111090435.6A CN202111090435A CN113986855B CN 113986855 B CN113986855 B CN 113986855B CN 202111090435 A CN202111090435 A CN 202111090435A CN 113986855 B CN113986855 B CN 113986855B
Authority
CN
China
Prior art keywords
file
lock
locking
record
list
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
Application number
CN202111090435.6A
Other languages
Chinese (zh)
Other versions
CN113986855A (en
Inventor
刘相乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202111090435.6A priority Critical patent/CN113986855B/en
Publication of CN113986855A publication Critical patent/CN113986855A/en
Application granted granted Critical
Publication of CN113986855B publication Critical patent/CN113986855B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • G06F16/1767Concurrency control, e.g. optimistic or pessimistic approaches
    • G06F16/1774Locking methods, e.g. locking methods for file systems allowing shared and concurrent access to files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • G06F16/1824Distributed file systems implemented using Network-attached Storage [NAS] architecture
    • G06F16/183Provision of network file services by network file servers, e.g. by using NFS, CIFS
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明提出了一种网络文件系统对文件加锁的方法、系统、设备和介质。该方法包括接收文件加锁请求,生成加锁记录;如果根据加锁记录查询原始文件锁列表中即不具有相同和相同范围的加锁记录,也不具有冲突锁;则将加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁。该方法包括对文件解锁、文件修复和文件共享。基于该方法,还提出了一种网络文件系统对文件加锁的系统、设备和介质。本发明中根据数据库中记录的数据恢复之前的锁状态,保持锁状态的连续性,提高NFS网络文件系统的使用体验,使得NFS进程可以对所有的文件锁请求实现故障恢复,提高了NFS的稳定性和可靠性。

The invention proposes a method, system, equipment and medium for locking files in a network file system. The method includes receiving a file locking request and generating a locking record; if the original file lock list queried according to the locking record does not have the same and same range of locking records, nor does it have conflicting locks; then add the locking record to Obtain the first file lock list from the original file lock list, and write the first file lock list into the database; then perform file locking. This method includes file unlocking, file repair and file sharing. Based on this method, a system, device and medium for locking files in a network file system are also proposed. The present invention restores the previous lock status based on the data recorded in the database, maintains the continuity of the lock status, improves the use experience of the NFS network file system, enables the NFS process to realize fault recovery for all file lock requests, and improves the stability of the NFS. performance and reliability.

Description

一种网络文件系统对文件加锁的方法、系统、设备和介质A method, system, device and medium for locking files in a network file system

技术领域Technical field

本发明属于文件存储技术领域,特别涉及一种网络文件系统对文件加锁的方法、系统、设备和介质。The invention belongs to the technical field of file storage, and in particular relates to a method, system, equipment and medium for locking files in a network file system.

背景技术Background technique

NFS(Network File System)即网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间共享资源。在NFS的应用中,本地NFS的客户端应用可以透明地读写位于远端NFS服务器上的文件,就像访问本地文件一样。NFS共享服务是NAS集群存储系统中提供文件共享的服务进程,存储的特性要求这类进程必需长期稳定的运行,尤其是对双控存储系统。NFS (Network File System) is a network file system. It is one of the file systems supported by FreeBSD. It allows resources to be shared between computers on the network. In NFS applications, local NFS client applications can transparently read and write files located on the remote NFS server, just like accessing local files. NFS sharing service is a service process that provides file sharing in NAS cluster storage systems. The characteristics of storage require that such processes must run stably for a long time, especially for dual-control storage systems.

在NFS-server进程出现故障重行启动或者存储节点出现故障以后,之前客户端通过NFS网络文件系统对文件加的锁状态信息都会丢失,导致存储节点和客户端上实际的锁状态,导致客户端的NFS应用出现问题。After the NFS-server process fails and is restarted or the storage node fails, the lock status information previously added to the file by the client through the NFS network file system will be lost, resulting in the actual lock status on the storage node and client, causing the client's NFS There is a problem with the application.

发明内容Contents of the invention

为了解决上述技术问题,本发明提出了一种网络文件系统对文件加锁的方法、系统、设备和介质。实现了文件加锁,以及克服文件加锁的缺陷,使得网络文件系统进程可以对所有的文件锁请求实现故障恢复,提高了网络文件系统的稳定性和可靠性。In order to solve the above technical problems, the present invention proposes a method, system, device and medium for locking files in a network file system. It realizes file locking and overcomes the defects of file locking, so that the network file system process can realize fault recovery for all file lock requests, which improves the stability and reliability of the network file system.

为实现上述目的,本发明采用以下技术方案:In order to achieve the above objects, the present invention adopts the following technical solutions:

一种网络文件系统对文件加锁的方法,包括以下步骤:A method for locking files in a network file system, including the following steps:

接收文件加锁请求,生成加锁记录;Receive file locking requests and generate locking records;

如果根据加锁记录查询原始文件锁列表中即不具有相同和相同范围的加锁记录,也不具有冲突锁;则将所述加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁。If the original file lock list queried based on the lock record does not have the same and same range of lock records, nor does it have conflicting locks; then add the lock record to the original file lock list to obtain the first file lock list, And write the first file lock list into the database; then perform file locking.

进一步的,所述方法还包括对文件解锁;所述文件解锁的过程为:Further, the method also includes unlocking the file; the process of unlocking the file is:

接收文件解锁请求;生成解锁记录;Receive file unlocking request; generate unlocking record;

将所述解锁记录从第一文件锁列表中删除得到第二文件锁列表,执行文件解锁,并将第二文件锁列表同步至数据库中。Delete the unlocking record from the first file lock list to obtain a second file lock list, perform file unlocking, and synchronize the second file lock list to the database.

进一步的,所述方法还包括:Further, the method also includes:

遍历第二文件锁列表;判断是否还需要继续对文件加锁;如第二文件锁列表不为空,则从所述第二文件锁列表头部获取一个加锁记录,执行文件加锁。Traverse the second file lock list; determine whether the file still needs to be locked; if the second file lock list is not empty, obtain a lock record from the head of the second file lock list and perform file locking.

进一步的,所述方法还包括:Further, the method also includes:

在文件加锁后网络文件系统进程重启,首先使网络文件系统进入静默状态;After the file is locked, the network file system process is restarted, and the network file system is first put into a silent state;

在静默状态下,如果文件需要恢复加锁状态,则从数据库中读取所述第一文件锁列表,根据加锁记录初始化文件结构;In the silent state, if the file needs to be restored to the locked state, the first file lock list is read from the database, and the file structure is initialized according to the lock record;

遍历所有的加锁记录,对曾经加锁的记录进行恢复;Traverse all locked records and restore previously locked records;

恢复完成后退出静默状态。Exit the quiescent state after the recovery is complete.

进一步的,所述方法还包括:Further, the method also includes:

如果当前节点出现故障,则将当前节点的网络文件系统共享资源切换至备用节点;If the current node fails, the network file system shared resources of the current node are switched to the backup node;

判断切换至备用节点后,判断文件是否需要恢复加锁状态,如果需要恢复加锁状态,则使网络文件系统进入静默状态,然后从数据库中读取当前节点对应的文件锁记录,并根据需要恢复的文件结构,进行恢复,恢复完成后退出静默状态。After switching to the standby node, determine whether the file needs to be restored to the locked state. If the locked state needs to be restored, make the network file system enter a silent state, then read the file lock record corresponding to the current node from the database, and restore it as needed file structure, perform recovery, and exit the silent state after the recovery is completed.

进一步的,所述查询原始文件锁列表中即不具有相同和相同范围的加锁记录的方法包括:Further, the method of querying the original file lock list for lock records that do not have the same and the same range includes:

根据加锁记录查询原始文件锁列表中是都具有相同的加锁记录,如果具有相同的加锁记录,则直接返回不进行加锁;According to the lock record, query whether the original file lock list has the same lock record. If it has the same lock record, it will return directly without locking;

根据加锁记录中文件锁范围查询原始文件锁列表中是否存在覆盖所述范围的文件锁,如果具有,则直接返回不进行加锁。According to the file lock range in the lock record, query whether there is a file lock covering the range in the original file lock list, and if so, return directly without locking.

进一步的,所述冲突锁包括:Further, the conflicting locks include:

存在与加锁记录中相同文件锁范围的排他锁;There is an exclusive lock with the same file lock range as in the lock record;

存在与加锁记录中相同文件锁范围的共享锁,且当前需要加锁的为排他锁。There is a shared lock with the same file lock range as in the lock record, and the current lock needs to be an exclusive lock.

本发明还提出了一种网络文件系统对文件加锁的系统,所述系统包括接收模块和加锁模块;The invention also proposes a system for locking files in a network file system. The system includes a receiving module and a locking module;

所述接收模块用于接收文件加锁请求,生成加锁记录;The receiving module is used to receive file locking requests and generate locking records;

所述加锁模块用于如果根据加锁记录查询原始文件锁列表中即不具有相同和相同范围的加锁记录,也不具有冲突锁;则将所述加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁。The locking module is used to add the locking record to the original file lock list if the original file lock list does not have the same and same range of lock records or conflicting locks according to the lock record query. Obtain the first file lock list and write the first file lock list into the database; then perform file locking.

本发明还提出了一种设备,包括:The invention also proposes a device, including:

存储器,用于存储计算机程序;Memory, used to store computer programs;

处理器,用于执行所述计算机程序时实现所述的方法步骤。A processor configured to implement the method steps when executing the computer program.

本发明还提出了一种可读存储介质,所述可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现所述的方法步骤。The present invention also proposes a readable storage medium. A computer program is stored on the readable storage medium. When the computer program is executed by a processor, the method steps are implemented.

发明内容中提供的效果仅仅是实施例的效果,而不是发明所有的全部效果,上述技术方案中的一个技术方案具有如下优点或有益效果:The effects provided in the summary of the invention are only the effects of the embodiments, rather than all the effects of the invention. One of the above technical solutions has the following advantages or beneficial effects:

本发明提出了一种网络文件系统对文件加锁的方法、系统、设备和介质。该方法包括接收文件加锁请求,生成加锁记录;如果根据加锁记录查询原始文件锁列表中即不具有相同和相同范围的加锁记录,也不具有冲突锁;则将加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁。该方法包括对文件解锁;文件解锁的过程为:接收文件解锁请求;生成解锁记录;将解锁记录从第一文件锁列表中删除得到第二文件锁列表,执行文件解锁,并将第二文件锁列表同步至数据库中。基于一种网络文件系统对文件加锁的方法,还提出了一种网络文件系统对文件加锁的系统、设备和介质。本发明中文件锁列表写入数据库,数据库为Ctdb数据库,即分布式数据库,不仅可以保存数据,还可以做到多个节点之间的数据同步。这样可以保证在当前节点重启或者故障导致网络文件系统共享切换到其他节点以后,文件锁的信息是同步的,故障之前所加的文件锁在故障之后或节点切换之后同样有效,不会因为文件锁的状态不一致导致网络文件系统客户端应用出现文件访问的问题。使得对文件的所有未完成的锁操作都可以持久化的记录,从而在NFS-server进程发生故障重启或者进程所在节点发生故障共享资源切换到其他节点以后,可以根据数据库ctdb中记录的数据恢复之前的锁状态,保持锁状态的连续性,提高NFS网络文件系统的使用体验。The invention proposes a method, system, equipment and medium for locking files in a network file system. The method includes receiving a file locking request and generating a locking record; if the original file lock list queried according to the locking record does not have the same and same range of locking records, nor does it have conflicting locks; then add the locking record to Obtain the first file lock list from the original file lock list, and write the first file lock list into the database; then perform file locking. The method includes unlocking a file; the process of file unlocking is: receiving a file unlocking request; generating an unlocking record; deleting the unlocking record from the first file lock list to obtain a second file lock list, performing file unlocking, and locking the second file The list is synchronized to the database. Based on a method of locking files in a network file system, a system, device and medium for locking files in a network file system are also proposed. In the present invention, the file lock list is written into a database, and the database is a Ctdb database, that is, a distributed database, which can not only save data, but also achieve data synchronization between multiple nodes. This ensures that after the current node restarts or a failure causes the network file system sharing to switch to other nodes, the file lock information is synchronized. The file locks added before the failure are still valid after the failure or after the node switch, and will not be affected by the file lock. The inconsistent status causes file access problems in network file system client applications. All unfinished lock operations on files can be recorded persistently, so that after the NFS-server process fails and restarts or the node where the process is located fails and the shared resource is switched to other nodes, it can be restored based on the data recorded in the database ctdb. lock status, maintain the continuity of the lock status, and improve the user experience of the NFS network file system.

附图说明Description of the drawings

如图1为本发明实施例1一种网络文件系统对文件加锁的方法流程图;Figure 1 is a flow chart of a method for locking files in a network file system according to Embodiment 1 of the present invention;

如图2为本发明实施例1一种网络文件系统对文件解锁的方法流程图;Figure 2 is a flow chart of a method for unlocking files in a network file system according to Embodiment 1 of the present invention;

如图3为本发明实施例1一种网络文件系统故障修复的方法流程图;Figure 3 is a flow chart of a method for repairing network file system faults in Embodiment 1 of the present invention;

如图4为本发明实施例1一种网络文件系统故障共享的方法流程图;Figure 4 is a flow chart of a network file system fault sharing method according to Embodiment 1 of the present invention;

如图5为本发明实施例2一种网络文件系统对文件加锁的系统示意图。Figure 5 is a schematic diagram of a network file system locking files according to Embodiment 2 of the present invention.

具体实施方式Detailed ways

为能清楚说明本方案的技术特点,下面通过具体实施方式,并结合其附图,对本发明进行详细阐述。下文的公开提供了许多不同的实施例或例子用来实现本发明的不同结构。为了简化本发明的公开,下文中对特定例子的部件和设置进行描述。此外,本发明可以在不同例子中重复参考数字和/或字母。这种重复是为了简化和清楚的目的,其本身不指示所讨论各种实施例和/或设置之间的关系。应当注意,在附图中所图示的部件不一定按比例绘制。本发明省略了对公知组件和处理技术及工艺的描述以避免不必要地限制本发明。In order to clearly explain the technical features of this solution, the present invention will be described in detail below through specific implementation modes and in conjunction with the accompanying drawings. The following disclosure provides many different embodiments or examples for implementing different structures of the invention. In order to simplify the disclosure of the present invention, the components and arrangements of specific examples are described below. Furthermore, the present invention may repeat reference numbers and/or letters in different examples. This repetition is for purposes of simplicity and clarity and does not by itself indicate a relationship between the various embodiments and/or arrangements discussed. It should be noted that components illustrated in the figures are not necessarily to scale. Descriptions of well-known components and processing techniques and processes are omitted to avoid unnecessarily limiting the invention.

实施例1Example 1

本发明实施例1提出了一种网络文件系统对文件加锁的方法,本发明给出了网络文件系统文件锁请求的接收和处理,以及异常情况下网络文件系统文件锁的恢复。Embodiment 1 of the present invention proposes a method for locking files in a network file system. The present invention provides the reception and processing of file lock requests in a network file system, and the recovery of file locks in a network file system under abnormal circumstances.

如图1给出了本发明实施例1一种网络文件系统对文件加锁的方法流程图Figure 1 shows a flow chart of a method for locking files in a network file system according to Embodiment 1 of the present invention.

在步骤S101中,接收文件加锁请求,生成加锁记录;In step S101, receive the file lock request and generate a lock record;

NFS-server接收加锁请求,生成lock记录,其中lock记录中包括客户端标识、文件句柄、文件锁的起始位置、文件锁的范围、文件锁的类型和文件锁状态。初始的文件锁状态为unlock状态。NFS-server receives the lock request and generates a lock record, which includes the client identifier, file handle, starting position of the file lock, file lock range, file lock type, and file lock status. The initial file lock state is unlocked.

在步骤S102中,如果根据加锁记录查询原始文件锁列表中即不具有相同和相同范围的加锁记录,也不具有冲突锁;则将所述加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁。In step S102, if the original file lock list is queried according to the lock record and does not have the same and same range of lock records, nor does it have conflicting locks; then the lock record is added to the original file lock list to obtain the third Create a file lock list and write the first file lock list into the database; then perform file locking.

首先,根据lock记录查询lock列表中是否有相同的lock记录,如果有相同的lock记录说明是重复的锁直接返回;First, check whether there is the same lock record in the lock list based on the lock record. If there is the same lock record, it means that it is a duplicate lock and is returned directly;

根据lock记录中的文件锁的范围查询lock列表中是否已经有能覆盖这一范围的锁存在,如果有也直接返回。According to the file lock range in the lock record, query whether there is a lock that can cover this range in the lock list, and if so, it will be returned directly.

根据lock列表中的lock记录,逐一对比是否有冲突的文件锁。冲突的情况有两种,一是已经有一个文件锁在相同范围内加了一个排他锁,当前要处理的文件锁无论是共享锁还是排他锁都跟已经存在的这个锁冲突。二是已经有一个文件锁在相同范围内加了一个共享锁,如果当前要处理的文件锁是排他锁,那么这两个锁就产生了冲突。如果有冲突的情况,需要将当前的文件锁lock记录的状态修改为block状态,其中block状态为阻塞状态。如果没有冲突,需要将当前的文件锁lock记录状态修改为locking状态,执行文件加锁。According to the lock records in the lock list, compare one by one whether there are conflicting file locks. There are two situations of conflict. One is that there is already a file lock that adds an exclusive lock in the same range. The file lock currently being processed, whether it is a shared lock or an exclusive lock, conflicts with the existing lock. The second is that there is already a file lock that adds a shared lock in the same range. If the file lock currently to be processed is an exclusive lock, then the two locks will conflict. If there is a conflict, the state of the current file lock record needs to be changed to the block state, where the block state is the blocking state. If there is no conflict, you need to change the current file lock record status to the locking status and perform file locking.

将当前的lock记录插入到文件结构(file_entry)的lock列表中。将文件的lock列表同步写入ctdb数据库中Insert the current lock record into the lock list of the file structure (file_entry). Synchronously write the lock list of the file into the ctdb database

在文件加锁完成之后,本发明实施例1还提出了文件解锁的方法。如图2为本发明实施例1一种网络文件系统对文件解锁的方法流程图。After the file locking is completed, Embodiment 1 of the present invention also proposes a file unlocking method. Figure 2 is a flow chart of a method for unlocking files in a network file system according to Embodiment 1 of the present invention.

在步骤S201中,接收文件解锁请求;生成解锁记录;In step S201, receive a file unlocking request; generate an unlocking record;

NFS-server接收解锁请求,根据NFS-client传过来的参数找到lock记录。NFS-server receives the unlock request and finds the lock record based on the parameters passed by NFS-client.

在步骤S202中,将所述解锁记录从第一文件锁列表中删除得到第二文件锁列表,执行文件解锁,并将第二文件锁列表同步至数据库中。In step S202, the unlocking record is deleted from the first file lock list to obtain a second file lock list, the file is unlocked, and the second file lock list is synchronized to the database.

将lock记录从文件的lock列表中删除,对文件执行unlock操作,将lock列表同步到ctdb数据库中。Delete the lock record from the file's lock list, perform an unlock operation on the file, and synchronize the lock list to the ctdb database.

遍历文件的lock列表,判断是否需要继续对文件加锁。如果lock列表不为空,从lock列表头部取一个lock记录,修改该lock记录的状态为locking状态,对文件进行实际的加锁操作,将lock同步到ctdb数据库中。Traverse the file's lock list to determine whether the file needs to continue to be locked. If the lock list is not empty, take a lock record from the head of the lock list, modify the status of the lock record to the locking state, perform the actual locking operation on the file, and synchronize the lock to the ctdb database.

如图3为本发明实施例1中网络文件系统故障修复的方法流程图;Figure 3 is a flow chart of a method for repairing network file system faults in Embodiment 1 of the present invention;

在步骤S301中,在文件加锁后网络文件系统进程重启,首先使网络文件系统进入静默状态;In step S301, after the file is locked, the network file system process is restarted, and the network file system is first put into a silent state;

NFS-server进程启动,NFS-server必要的初始化流程,并试进程进入静默状态,在静默状态进程不接受加解锁和文件修改类的请求,避免造成不一致。The NFS-server process starts, the necessary initialization process of NFS-server, and the trial process enters a silent state. In the silent state, the process does not accept requests for unlocking and file modification to avoid inconsistencies.

在步骤S302中,在静默状态下,如果文件需要恢复加锁状态,则从数据库中读取所述第一文件锁列表,根据加锁记录初始化文件结构。In step S302, in the silent state, if the file needs to be restored to the locked state, the first file lock list is read from the database, and the file structure is initialized according to the lock record.

根据对NFS-server的配置,确定是否需要恢复lock状态。因为并不是所有的应用环境中都需要在故障后恢复lock状态,比如故障时间已经很长,恢复lock状态已经没有意义了,则NFS-server进程退出静默状态。Based on the configuration of NFS-server, determine whether the lock state needs to be restored. Because not all application environments need to restore the lock state after a failure. For example, if the failure time has been long and it is meaningless to restore the lock state, the NFS-server process exits the silent state.

从ctdb数据库中读取lock列表,因为此时进程刚启动,进程中并没有所有文件的file_entry(文件结构),所以需要根据lock记录的需要初始化file_entry(文件结构)。Read the lock list from the ctdb database. Because the process has just started at this time, there is no file_entry (file structure) for all files in the process, so the file_entry (file structure) needs to be initialized according to the needs of the lock record.

在步骤S303中,遍历所有的加锁记录,对曾经加锁的记录进行恢复;遍历所有的lock记录,对状态为locking的记录进行恢复,即对对应的文件按lock记录中的内容进行加锁In step S303, all lock records are traversed and the records that have been locked are restored; all lock records are traversed and records with a locked status are restored, that is, the corresponding files are locked according to the content in the lock record.

步骤S304中,恢复完成后退出静默状态。In step S304, exit the silent state after the recovery is completed.

遍历所有的lock记录,对状态为locking的记录进行恢复,即对对应的文件按lock记录中的内容进行加锁。如图4为本发明实施例1中网络文件系统共享的方法流程图。Traverse all lock records and restore the records with locked status, that is, lock the corresponding files according to the contents in the lock record. Figure 4 is a flow chart of a method for sharing a network file system in Embodiment 1 of the present invention.

在步骤S401中,如果当前节点出现故障,则将当前节点的网络文件系统共享资源切换至备用节点;In step S401, if the current node fails, the network file system shared resources of the current node are switched to the backup node;

节点故障以后,文件系统以及NFS共享资源切换到其他节点,比如node2。本发明中所说的文件系统都是单节点而不是分布式文件系统,也就是一个文件系统同时只会挂载到一个节点上。Node2上的集群通知本节点上的NFS-server进程发生节点切换。After a node failure, the file system and NFS shared resources are switched to other nodes, such as node2. The file systems mentioned in the present invention are all single-node rather than distributed file systems, that is, a file system can only be mounted on one node at a time. The cluster on Node2 notifies the NFS-server process on this node that a node switch has occurred.

在步骤S402中,判断切换至备用节点后,判断文件是否需要恢复加锁状态,如果需要恢复加锁状态,则使网络文件系统进入静默状态,然后从数据库中读取当前节点对应的文件锁记录,并根据需要恢复的文件结构,进行恢复,恢复完成后退出静默状态。In step S402, it is determined whether the file needs to be restored to the locked state after switching to the standby node. If the locked state needs to be restored, the network file system is put into a silent state, and then the file lock record corresponding to the current node is read from the database. , and perform restoration according to the file structure that needs to be restored, and exit the silent state after the restoration is completed.

根据对NFS-server的配置,确定是否需要恢复lock状态;According to the configuration of NFS-server, determine whether the lock state needs to be restored;

如果需要恢复lock状态,NFS-server进程进入部分静默状态,即此时接受到的所有的请求都需要判断是对应哪个文件系统的,如果是对应刚切换过来的文件系统那么会对这个请求直接丢弃;If the lock state needs to be restored, the NFS-server process enters a partially silent state, that is, all requests received at this time need to be determined which file system they correspond to. If they correspond to the file system that has just been switched, the request will be discarded directly. ;

NFS-server进程从ctdb数据库中读取发生故障的节点对应的lock数据,并根据需要恢复文件结构(file_entry),根据lock记录进行锁状态的恢复;The NFS-server process reads the lock data corresponding to the failed node from the ctdb database, restores the file structure (file_entry) as needed, and restores the lock status based on the lock record;

Lock状态恢复完成以后,NFS-server进程退出部分静默状态。After the Lock state recovery is completed, the NFS-server process exits the partially silent state.

本发明针对NFS服务在存储系统中对文件加锁的缺陷,设计了一种改进的NFS对文件加锁的实现方法,使得NFS进程可以对所有的文件锁请求实现故障恢复和共享,提高了NFS的稳定性和可靠性。Aiming at the defect of NFS service in locking files in the storage system, the present invention designs an improved method for NFS to lock files, so that the NFS process can realize fault recovery and sharing for all file lock requests, and improves the efficiency of NFS. stability and reliability.

实施例2Example 2

基于本发明实施例1提出的一种网络文件系统对文件加锁的方法,还提出了一种网络文件系统对文件加锁的系统。如图5为本发明实施例2一种网络文件系统对文件加锁的系统示意图。该系统包括接收模块和加锁模块;Based on the method for locking files in a network file system proposed in Embodiment 1 of the present invention, a system for locking files in a network file system is also proposed. Figure 5 is a schematic diagram of a network file system locking files according to Embodiment 2 of the present invention. The system includes a receiving module and a locking module;

接收模块用于接收文件加锁请求,生成加锁记录;The receiving module is used to receive file locking requests and generate locking records;

加锁模块用于如果根据加锁记录查询原始文件锁列表中即不具有相同和相同范围的加锁记录,也不具有冲突锁;则将加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁。The locking module is used to query the original file lock list based on the locking record and there is no locking record of the same and the same range, nor does it have conflicting locks; then add the locking record to the original file lock list to obtain the first file lock list, and write the first file lock list into the database; then perform file locking.

其中查询原始文件锁列表中即不具有相同和相同范围的加锁记录的方法包括:根据加锁记录查询原始文件锁列表中是都具有相同的加锁记录,如果具有相同的加锁记录,则直接返回不进行加锁;根据加锁记录中文件锁范围查询原始文件锁列表中是否存在覆盖所述范围的文件锁,如果具有,则直接返回不进行加锁。The method of querying the original file lock list for locking records that do not have the same and the same range includes: querying the original file lock list according to the locking records to see if they all have the same locking records. If there are the same locking records, then Directly return without locking; query the original file lock list according to the file lock range in the lock record to see if there is a file lock covering the range. If so, directly return without locking.

其中冲突锁包括存在与加锁记录中相同文件锁范围的排他锁;存在与加锁记录中相同文件锁范围的共享锁,且当前需要加锁的为排他锁。Conflict locks include exclusive locks with the same file lock range as in the lock record; shared locks with the same file lock range as the lock record, and the current lock is an exclusive lock.

该系统还包括解锁模块、修复模块和共享模块;The system also includes unlocking, repairing and sharing modules;

所述解锁模块用于接收文件解锁请求;生成解锁记录;将所述解锁记录从第一文件锁列表中删除得到第二文件锁列表,执行文件解锁,并将第二文件锁列表同步至数据库中。The unlocking module is used to receive a file unlocking request; generate an unlocking record; delete the unlocking record from the first file lock list to obtain a second file lock list, perform file unlocking, and synchronize the second file lock list to the database. .

所述修复模块用于在文件加锁后网络文件系统进程重启,首先使网络文件系统进入静默状态;在静默状态下,如果文件需要恢复加锁状态,则从数据库中读取所述第一文件锁列表,根据加锁记录初始化文件结构;遍历所有的加锁记录,对曾经加锁的记录进行恢复;恢复完成后退出静默状态。The repair module is used to restart the network file system process after the file is locked. First, the network file system enters a silent state; in the silent state, if the file needs to be restored to the locked state, the first file is read from the database. Lock list, initialize the file structure according to the lock record; traverse all the lock records, restore the records that have been locked; exit the silent state after the restoration is completed.

所述共享模块用于如果当前节点出现故障,则将当前节点的网络文件系统共享资源切换至备用节点;判断切换至备用节点后,判断文件是否需要恢复加锁状态,如果需要恢复加锁状态,则使网络文件系统进入静默状态,然后从数据库中读取当前节点对应的文件锁记录,并根据需要恢复的文件结构,进行恢复,恢复完成后退出静默状态。The sharing module is used to switch the network file system shared resources of the current node to the backup node if the current node fails; after judging whether the file needs to be restored to the locked state after switching to the backup node, if the file needs to be restored to the locked state, Then the network file system enters the silent state, and then reads the file lock record corresponding to the current node from the database, and restores it according to the file structure that needs to be restored, and exits the silent state after the recovery is completed.

实施例3Example 3

本发明还提出了一种设备,包括:The invention also proposes a device, including:

存储器,用于存储计算机程序;Memory, used to store computer programs;

处理器,用于执行所述计算机程序时实现方法步骤如下:The processor is used to implement the method steps when executing the computer program as follows:

如图1给出了本发明实施例1一种网络文件系统对文件加锁的方法流程图Figure 1 shows a flow chart of a method for locking files in a network file system according to Embodiment 1 of the present invention.

在步骤S101中,接收文件加锁请求,生成加锁记录;In step S101, receive the file lock request and generate a lock record;

NFS-server接收加锁请求,生成lock记录,其中lock记录中包括客户端标识、文件句柄、文件锁的起始位置、文件锁的范围、文件锁的类型和文件锁状态。初始的文件锁状态为unlock状态。NFS-server receives the lock request and generates a lock record, which includes the client identifier, file handle, starting position of the file lock, file lock range, file lock type, and file lock status. The initial file lock state is unlocked.

在步骤S102中,如果根据加锁记录查询原始文件锁列表中即不具有相同和相同范围的加锁记录,也不具有冲突锁;则将所述加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁。In step S102, if the original file lock list is queried according to the lock record and does not have the same and same range of lock records, nor does it have conflicting locks; then the lock record is added to the original file lock list to obtain the third Create a file lock list and write the first file lock list into the database; then perform file locking.

首先,根据lock记录查询lock列表中是否有相同的lock记录,如果有相同的lock记录说明是重复的锁直接返回;First, check whether there is the same lock record in the lock list based on the lock record. If there is the same lock record, it means that it is a duplicate lock and is returned directly;

根据lock记录中的文件锁的范围查询lock列表中是否已经有能覆盖这一范围的锁存在,如果有也直接返回。According to the file lock range in the lock record, query whether there is a lock that can cover this range in the lock list, and if so, it will be returned directly.

根据lock列表中的lock记录,逐一对比是否有冲突的文件锁。冲突的情况有两种,一是已经有一个文件锁在相同范围内加了一个排他锁,当前要处理的文件锁无论是共享锁还是排他锁都跟已经存在的这个锁冲突。二是已经有一个文件锁在相同范围内加了一个共享锁,如果当前要处理的文件锁是排他锁,那么这两个锁就产生了冲突。如果有冲突的情况,需要将当前的文件锁lock记录的状态修改为block状态,其中block状态为阻塞状态。如果没有冲突,需要将当前的文件锁lock记录状态修改为locking状态,执行文件加锁。According to the lock records in the lock list, compare one by one whether there are conflicting file locks. There are two situations of conflict. One is that there is already a file lock that adds an exclusive lock in the same range. The file lock currently being processed, whether it is a shared lock or an exclusive lock, conflicts with the existing lock. The second is that there is already a file lock that adds a shared lock in the same range. If the file lock currently to be processed is an exclusive lock, then the two locks will conflict. If there is a conflict, the state of the current file lock record needs to be changed to the block state, where the block state is the blocking state. If there is no conflict, you need to change the current file lock record status to the locking status and perform file locking.

将当前的lock记录插入到文件结构(file_entry)的lock列表中。将文件的lock列表同步写入ctdb数据库中Insert the current lock record into the lock list of the file structure (file_entry). Synchronously write the lock list of the file into the ctdb database

在文件加锁完成之后,本发明实施例1还提出了文件解锁的方法。如图2为本发明实施例1一种网络文件系统对文件解锁的方法流程图。After the file locking is completed, Embodiment 1 of the present invention also proposes a file unlocking method. Figure 2 is a flow chart of a method for unlocking files in a network file system according to Embodiment 1 of the present invention.

在步骤S201中,接收文件解锁请求;生成解锁记录;In step S201, receive a file unlocking request; generate an unlocking record;

NFS-server接收解锁请求,根据NFS-client传过来的参数找到lock记录。NFS-server receives the unlock request and finds the lock record based on the parameters passed by NFS-client.

在步骤S202中,将所述解锁记录从第一文件锁列表中删除得到第二文件锁列表,执行文件解锁,并将第二文件锁列表同步至数据库中。In step S202, the unlocking record is deleted from the first file lock list to obtain a second file lock list, the file is unlocked, and the second file lock list is synchronized to the database.

将lock记录从文件的lock列表中删除,对文件执行unlock操作,将lock列表同步到ctdb数据库中。Delete the lock record from the file's lock list, perform an unlock operation on the file, and synchronize the lock list to the ctdb database.

遍历文件的lock列表,判断是否需要继续对文件加锁。如果lock列表不为空,从lock列表头部取一个lock记录,修改该lock记录的状态为locking状态,对文件进行实际的加锁操作,将lock同步到ctdb数据库中。Traverse the file's lock list to determine whether the file needs to continue to be locked. If the lock list is not empty, take a lock record from the head of the lock list, modify the status of the lock record to the locking state, perform the actual locking operation on the file, and synchronize the lock to the ctdb database.

如图3为本发明实施例1中网络文件系统故障修复的方法流程图;Figure 3 is a flow chart of a method for repairing network file system faults in Embodiment 1 of the present invention;

在步骤S301中,在文件加锁后网络文件系统进程重启,首先使网络文件系统进入静默状态;In step S301, after the file is locked, the network file system process is restarted, and the network file system is first put into a silent state;

NFS-server进程启动,NFS-server必要的初始化流程,并试进程进入静默状态,在静默状态进程不接受加解锁和文件修改类的请求,避免造成不一致。The NFS-server process starts, the necessary initialization process of NFS-server, and the trial process enters a silent state. In the silent state, the process does not accept requests for unlocking and file modification to avoid inconsistencies.

在步骤S302中,在静默状态下,如果文件需要恢复加锁状态,则从数据库中读取所述第一文件锁列表,根据加锁记录初始化文件结构。In step S302, in the silent state, if the file needs to be restored to the locked state, the first file lock list is read from the database, and the file structure is initialized according to the lock record.

根据对NFS-server的配置,确定是否需要恢复lock状态。因为并不是所有的应用环境中都需要在故障后恢复lock状态,比如故障时间已经很长,恢复lock状态已经没有意义了,则NFS-server进程退出静默状态。Based on the configuration of NFS-server, determine whether the lock state needs to be restored. Because not all application environments need to restore the lock state after a failure. For example, if the failure time has been long and it is meaningless to restore the lock state, the NFS-server process exits the silent state.

从ctdb数据库中读取lock列表,因为此时进程刚启动,进程中并没有所有文件的file_entry(文件结构),所以需要根据lock记录的需要初始化file_entry(文件结构)。Read the lock list from the ctdb database. Because the process has just started at this time, there is no file_entry (file structure) for all files in the process, so the file_entry (file structure) needs to be initialized according to the needs of the lock record.

在步骤S303中,遍历所有的加锁记录,对曾经加锁的记录进行恢复;遍历所有的lock记录,对状态为locking的记录进行恢复,即对对应的文件按lock记录中的内容进行加锁In step S303, all lock records are traversed and the records that have been locked are restored; all lock records are traversed and records with a locked status are restored, that is, the corresponding files are locked according to the content in the lock record.

步骤S304中,恢复完成后退出静默状态。In step S304, exit the silent state after the recovery is completed.

遍历所有的lock记录,对状态为locking的记录进行恢复,即对对应的文件按lock记录中的内容进行加锁。如图4为本发明实施例1中网络文件系统共享的方法流程图。Traverse all lock records and restore the records with locked status, that is, lock the corresponding files according to the contents in the lock record. Figure 4 is a flow chart of a method for sharing a network file system in Embodiment 1 of the present invention.

在步骤S401中,如果当前节点出现故障,则将当前节点的网络文件系统共享资源切换至备用节点;In step S401, if the current node fails, the network file system shared resources of the current node are switched to the backup node;

节点故障以后,文件系统以及NFS共享资源切换到其他节点,比如node2。本发明中所说的文件系统都是单节点而不是分布式文件系统,也就是一个文件系统同时只会挂载到一个节点上。Node2上的集群通知本节点上的NFS-server进程发生节点切换。After a node failure, the file system and NFS shared resources are switched to other nodes, such as node2. The file systems mentioned in the present invention are all single-node rather than distributed file systems, that is, a file system can only be mounted on one node at a time. The cluster on Node2 notifies the NFS-server process on this node that a node switch has occurred.

在步骤S402中,判断切换至备用节点后,判断文件是否需要恢复加锁状态,如果需要恢复加锁状态,则使网络文件系统进入静默状态,然后从数据库中读取当前节点对应的文件锁记录,并根据需要恢复的文件结构,进行恢复,恢复完成后退出静默状态。In step S402, it is determined whether the file needs to be restored to the locked state after switching to the standby node. If the locked state needs to be restored, the network file system is put into a silent state, and then the file lock record corresponding to the current node is read from the database. , and perform restoration according to the file structure that needs to be restored, and exit the silent state after the restoration is completed.

根据对NFS-server的配置,确定是否需要恢复lock状态;According to the configuration of NFS-server, determine whether the lock state needs to be restored;

如果需要恢复lock状态,NFS-server进程进入部分静默状态,即此时接受到的所有的请求都需要判断是对应哪个文件系统的,如果是对应刚切换过来的文件系统那么会对这个请求直接丢弃;If the lock state needs to be restored, the NFS-server process enters a partially silent state, that is, all requests received at this time need to be determined which file system they correspond to. If they correspond to the file system that has just been switched, the request will be discarded directly. ;

NFS-server进程从ctdb数据库中读取发生故障的节点对应的lock数据,并根据需要恢复文件结构(file_entry),根据lock记录进行锁状态的恢复;The NFS-server process reads the lock data corresponding to the failed node from the ctdb database, restores the file structure (file_entry) as needed, and restores the lock status based on the lock record;

Lock状态恢复完成以后,NFS-server进程退出部分静默状态。After the Lock state recovery is completed, the NFS-server process exits the partially silent state.

本发明针对NFS服务在存储系统中对文件加锁的缺陷,设计了一种改进的NFS对文件加锁的实现方法,使得NFS进程可以对所有的文件锁请求实现故障恢复和共享,提高了NFS的稳定性和可靠性。Aiming at the defect of NFS service in locking files in the storage system, the present invention designs an improved method for NFS to lock files, so that the NFS process can realize fault recovery and sharing for all file lock requests, and improves the efficiency of NFS. stability and reliability.

需要说明:本发明技术方案还提供了一种电子设备,包括:通信接口,能够与其它设备比如网络设备等进行信息交互;处理器,与通信接口连接,以实现与其它设备进行信息交互,用于运行计算机程序时,执行上述一个或多个技术方案提供的一种网络文件系统对文件加锁的方法,而所述计算机程序存储在存储器上。当然,实际应用时,电子设备中的各个组件通过总线系统耦合在一起。可理解,总线系统用于实现这些组件之间的连接通信。总线系统除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。本申请实施例中的存储器用于存储各种类型的数据以支持电子设备的操作。这些数据的示例包括:用于在电子设备上操作的任何计算机程序。可以理解,存储器可以是易失性存储器或非易失性存储器,也可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(ROM,Read Only Memory)、可编程只读存储器(PROM,Programmable Read-Only Memory)、可擦除可编程只读存储器(EPROM,Erasable Programmable Read-Only Memory)、电可擦除可编程只读存储器(EEPROM,Electrically Erasable Programmable Read-Only Memory)、磁性随机存取存储器(FRAM,ferromagnetic random access memory)、快闪存储器(FlashMemory)、磁表面存储器、光盘、或只读光盘(CD-ROM,Compact Disc Read-Only Memory);磁表面存储器可以是磁盘存储器或磁带存储器。易失性存储器可以是随机存取存储器(RAM,Random AccessMemory),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(SRAM,Static Random Access Memory)、同步静态随机存取存储器(SSRAM,Synchronous Static Random Access Memory)、动态随机存取存储器(DRAM,Dynamic Random Access Memory)、同步动态随机存取存储器(SDRAM,SynchronousDynamic Random Access Memory)、双倍数据速率同步动态随机存取存储器(DDRSDRAM,Double Data Rate Synchronous Dynamic Random Access Memory)、增强型同步动态随机存取存储器(ESDRAM,Enhanced Synchronous Dynamic Random AccessMemory)、同步连接动态随机存取存储器(SLDRAM,SyncLink Dynamic Random AccessMemory)、直接内存总线随机存取存储器(DRRAM,Direct Rambus Random Access Memory)。本申请实施例描述的存储器旨在包括但不限于这些和任意其它适合类型的存储器。上述本申请实施例揭示的方法可以应用于处理器中,或者由处理器实现。处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器、DSP(Digital Signal Processing,即指能够实现数字信号处理技术的芯片),或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。处理器可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤,可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于存储介质中,该存储介质位于存储器,处理器读取存储器中的程序,结合其硬件完成前述方法的步骤。处理器执行所述程序时实现本申请实施例的各个方法中的相应流程,为了简洁,在此不再赘述。It should be noted that the technical solution of the present invention also provides an electronic device, including: a communication interface capable of information interaction with other devices such as network equipment; a processor connected to the communication interface to realize information interaction with other devices. When running a computer program, a method for locking files in a network file system provided by one or more of the above technical solutions is executed, and the computer program is stored in the memory. Of course, in practical applications, various components in electronic equipment are coupled together through a bus system. It can be understood that the bus system is used to implement connection communication between these components. In addition to the data bus, the bus system also includes a power bus, a control bus and a status signal bus. The memory in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program used to operate on an electronic device. It can be understood that the memory can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM, Read Only Memory), a programmable read-only memory (PROM, Programmable Read-Only Memory), an erasable programmable read-only memory (EPROM, Erasable Programmable Read-Only Memory). Only Memory), Electrically Erasable Programmable Read-Only Memory (EEPROM, Electrically Erasable Programmable Read-Only Memory), Magnetic Random Access Memory (FRAM, ferromagnetic random access memory), Flash Memory (FlashMemory), Magnetic Surface Memory, Optical disk, or CD-ROM (Compact Disc Read-Only Memory); magnetic surface memory can be magnetic disk storage or tape storage. Volatile memory may be random access memory (RAM, Random Access Memory), which is used as an external cache. By way of illustration, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory Memory (DRAM, Dynamic Random Access Memory), synchronous dynamic random access memory (SDRAM, SynchronousDynamic Random Access Memory), double data rate synchronous dynamic random access memory (DDRSDRAM, Double Data Rate Synchronous Dynamic Random Access Memory), enhanced Synchronous dynamic random access memory (ESDRAM, Enhanced Synchronous Dynamic Random Access Memory), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), direct memory bus random access memory (DRRAM, Direct Rambus Random Access Memory). The memories described in the embodiments of the present application are intended to include, but are not limited to, these and any other suitable types of memories. The methods disclosed in the above embodiments of the present application can be applied in a processor or implemented by the processor. The processor may be an integrated circuit chip that has signal processing capabilities. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor. The above-mentioned processor can be a general-purpose processor, DSP (Digital Signal Processing, which refers to a chip that can implement digital signal processing technology), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor can implement or execute each method, step, and logical block diagram disclosed in the embodiments of this application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, and the storage medium is located in a memory. The processor reads the program in the memory and completes the steps of the foregoing method in conjunction with its hardware. When the processor executes the program, the corresponding processes in each method of the embodiment of the present application are implemented. For the sake of simplicity, they will not be described again here.

实施例4Example 4

本发明还提出了一种可读存储介质,可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现方法步骤如下:The present invention also proposes a readable storage medium. A computer program is stored on the readable storage medium. When the computer program is executed by a processor, the method steps are as follows:

如图1给出了本发明实施例1一种网络文件系统对文件加锁的方法流程图Figure 1 shows a flow chart of a method for locking files in a network file system according to Embodiment 1 of the present invention.

在步骤S101中,接收文件加锁请求,生成加锁记录;In step S101, receive the file lock request and generate a lock record;

NFS-server接收加锁请求,生成lock记录,其中lock记录中包括客户端标识、文件句柄、文件锁的起始位置、文件锁的范围、文件锁的类型和文件锁状态。初始的文件锁状态为unlock状态。NFS-server receives the lock request and generates a lock record, which includes the client identifier, file handle, starting position of the file lock, file lock range, file lock type, and file lock status. The initial file lock state is unlocked.

在步骤S102中,如果根据加锁记录查询原始文件锁列表中即不具有相同和相同范围的加锁记录,也不具有冲突锁;则将所述加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁。In step S102, if the original file lock list is queried according to the lock record and does not have the same and same range of lock records, nor does it have conflicting locks; then the lock record is added to the original file lock list to obtain the third Create a file lock list and write the first file lock list into the database; then perform file locking.

首先,根据lock记录查询lock列表中是否有相同的lock记录,如果有相同的lock记录说明是重复的锁直接返回;First, check whether there is the same lock record in the lock list based on the lock record. If there is the same lock record, it means that it is a duplicate lock and is returned directly;

根据lock记录中的文件锁的范围查询lock列表中是否已经有能覆盖这一范围的锁存在,如果有也直接返回。According to the file lock range in the lock record, query whether there is a lock that can cover this range in the lock list, and if so, it will be returned directly.

根据lock列表中的lock记录,逐一对比是否有冲突的文件锁。冲突的情况有两种,一是已经有一个文件锁在相同范围内加了一个排他锁,当前要处理的文件锁无论是共享锁还是排他锁都跟已经存在的这个锁冲突。二是已经有一个文件锁在相同范围内加了一个共享锁,如果当前要处理的文件锁是排他锁,那么这两个锁就产生了冲突。如果有冲突的情况,需要将当前的文件锁lock记录的状态修改为block状态,其中block状态为阻塞状态。如果没有冲突,需要将当前的文件锁lock记录状态修改为locking状态,执行文件加锁。According to the lock records in the lock list, compare one by one whether there are conflicting file locks. There are two situations of conflict. One is that there is already a file lock that adds an exclusive lock in the same range. The file lock currently being processed, whether it is a shared lock or an exclusive lock, conflicts with the existing lock. The second is that there is already a file lock that adds a shared lock in the same range. If the file lock currently to be processed is an exclusive lock, then the two locks will conflict. If there is a conflict, the state of the current file lock record needs to be changed to the block state, where the block state is the blocking state. If there is no conflict, you need to change the current file lock record status to the locking status and perform file locking.

将当前的lock记录插入到文件结构(file_entry)的lock列表中。将文件的lock列表同步写入ctdb数据库中Insert the current lock record into the lock list of the file structure (file_entry). Synchronously write the lock list of the file into the ctdb database

在文件加锁完成之后,本发明实施例1还提出了文件解锁的方法。如图2为本发明实施例1一种网络文件系统对文件解锁的方法流程图。After the file locking is completed, Embodiment 1 of the present invention also proposes a file unlocking method. Figure 2 is a flow chart of a method for unlocking files in a network file system according to Embodiment 1 of the present invention.

在步骤S201中,接收文件解锁请求;生成解锁记录;In step S201, receive a file unlocking request; generate an unlocking record;

NFS-server接收解锁请求,根据NFS-client传过来的参数找到lock记录。NFS-server receives the unlock request and finds the lock record based on the parameters passed by NFS-client.

在步骤S202中,将所述解锁记录从第一文件锁列表中删除得到第二文件锁列表,执行文件解锁,并将第二文件锁列表同步至数据库中。In step S202, the unlocking record is deleted from the first file lock list to obtain a second file lock list, the file is unlocked, and the second file lock list is synchronized to the database.

将lock记录从文件的lock列表中删除,对文件执行unlock操作,将lock列表同步到ctdb数据库中。Delete the lock record from the file's lock list, perform an unlock operation on the file, and synchronize the lock list to the ctdb database.

遍历文件的lock列表,判断是否需要继续对文件加锁。如果lock列表不为空,从lock列表头部取一个lock记录,修改该lock记录的状态为locking状态,对文件进行实际的加锁操作,将lock同步到ctdb数据库中。Traverse the file's lock list to determine whether the file needs to continue to be locked. If the lock list is not empty, take a lock record from the head of the lock list, modify the status of the lock record to the locking state, perform the actual locking operation on the file, and synchronize the lock to the ctdb database.

如图3为本发明实施例1中网络文件系统故障修复的方法流程图;Figure 3 is a flow chart of a method for repairing network file system faults in Embodiment 1 of the present invention;

在步骤S301中,在文件加锁后网络文件系统进程重启,首先使网络文件系统进入静默状态;In step S301, after the file is locked, the network file system process is restarted, and the network file system is first put into a silent state;

NFS-server进程启动,NFS-server必要的初始化流程,并试进程进入静默状态,在静默状态进程不接受加解锁和文件修改类的请求,避免造成不一致。The NFS-server process starts, the necessary initialization process of NFS-server, and the trial process enters a silent state. In the silent state, the process does not accept requests for unlocking and file modification to avoid inconsistencies.

在步骤S302中,在静默状态下,如果文件需要恢复加锁状态,则从数据库中读取所述第一文件锁列表,根据加锁记录初始化文件结构。In step S302, in the silent state, if the file needs to be restored to the locked state, the first file lock list is read from the database, and the file structure is initialized according to the lock record.

根据对NFS-server的配置,确定是否需要恢复lock状态。因为并不是所有的应用环境中都需要在故障后恢复lock状态,比如故障时间已经很长,恢复lock状态已经没有意义了,则NFS-server进程退出静默状态。Based on the configuration of NFS-server, determine whether the lock state needs to be restored. Because not all application environments need to restore the lock state after a failure. For example, if the failure time has been long and it is meaningless to restore the lock state, the NFS-server process exits the silent state.

从ctdb数据库中读取lock列表,因为此时进程刚启动,进程中并没有所有文件的file_entry(文件结构),所以需要根据lock记录的需要初始化file_entry(文件结构)。Read the lock list from the ctdb database. Because the process has just started at this time, there is no file_entry (file structure) for all files in the process, so the file_entry (file structure) needs to be initialized according to the needs of the lock record.

在步骤S303中,遍历所有的加锁记录,对曾经加锁的记录进行恢复;遍历所有的lock记录,对状态为locking的记录进行恢复,即对对应的文件按lock记录中的内容进行加锁In step S303, all lock records are traversed and the records that have been locked are restored; all lock records are traversed and records with a locked status are restored, that is, the corresponding files are locked according to the content in the lock record.

步骤S304中,恢复完成后退出静默状态。In step S304, exit the silent state after the recovery is completed.

遍历所有的lock记录,对状态为locking的记录进行恢复,即对对应的文件按lock记录中的内容进行加锁。如图4为本发明实施例1中网络文件系统共享的方法流程图。Traverse all lock records and restore the records with locked status, that is, lock the corresponding files according to the contents in the lock record. Figure 4 is a flow chart of a method for sharing a network file system in Embodiment 1 of the present invention.

在步骤S401中,如果当前节点出现故障,则将当前节点的网络文件系统共享资源切换至备用节点;In step S401, if the current node fails, the network file system shared resources of the current node are switched to the backup node;

节点故障以后,文件系统以及NFS共享资源切换到其他节点,比如node2。本发明中所说的文件系统都是单节点而不是分布式文件系统,也就是一个文件系统同时只会挂载到一个节点上。Node2上的集群通知本节点上的NFS-server进程发生节点切换。After a node failure, the file system and NFS shared resources are switched to other nodes, such as node2. The file systems mentioned in the present invention are all single-node rather than distributed file systems, that is, a file system can only be mounted on one node at a time. The cluster on Node2 notifies the NFS-server process on this node that a node switch has occurred.

在步骤S402中,判断切换至备用节点后,判断文件是否需要恢复加锁状态,如果需要恢复加锁状态,则使网络文件系统进入静默状态,然后从数据库中读取当前节点对应的文件锁记录,并根据需要恢复的文件结构,进行恢复,恢复完成后退出静默状态。In step S402, it is determined whether the file needs to be restored to the locked state after switching to the standby node. If the locked state needs to be restored, the network file system is put into a silent state, and then the file lock record corresponding to the current node is read from the database. , and perform restoration according to the file structure that needs to be restored, and exit the silent state after the restoration is completed.

根据对NFS-server的配置,确定是否需要恢复lock状态;According to the configuration of NFS-server, determine whether the lock state needs to be restored;

如果需要恢复lock状态,NFS-server进程进入部分静默状态,即此时接受到的所有的请求都需要判断是对应哪个文件系统的,如果是对应刚切换过来的文件系统那么会对这个请求直接丢弃;If the lock state needs to be restored, the NFS-server process enters a partially silent state, that is, all requests received at this time need to be determined which file system they correspond to. If they correspond to the file system that has just been switched, the request will be discarded directly. ;

NFS-server进程从ctdb数据库中读取发生故障的节点对应的lock数据,并根据需要恢复文件结构(file_entry),根据lock记录进行锁状态的恢复;The NFS-server process reads the lock data corresponding to the failed node from the ctdb database, restores the file structure (file_entry) as needed, and restores the lock status based on the lock record;

Lock状态恢复完成以后,NFS-server进程退出部分静默状态。After the Lock state recovery is completed, the NFS-server process exits the partially silent state.

本发明针对NFS服务在存储系统中对文件加锁的缺陷,设计了一种改进的NFS对文件加锁的实现方法,使得NFS进程可以对所有的文件锁请求实现故障恢复和共享,提高了NFS的稳定性和可靠性。Aiming at the defect of NFS service in locking files in the storage system, the present invention designs an improved method for NFS to lock files, so that the NFS process can realize fault recovery and sharing for all file lock requests, and improves the efficiency of NFS. stability and reliability.

本申请实施例还提供了一种存储介质,即计算机存储介质,具体为计算机可读存储介质,例如包括存储计算机程序的存储器,上述计算机程序可由处理器执行,以完成前述方法所述步骤。计算机可读存储介质可以是FRAM、ROM、PROM、EPROM、EEPROM、Flash Memory、磁表面存储器、光盘、或CD-ROM等存储器。Embodiments of the present application also provide a storage medium, that is, a computer storage medium, specifically a computer-readable storage medium, such as a memory that stores a computer program. The computer program can be executed by a processor to complete the steps of the foregoing method. The computer-readable storage medium may be memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disk, or CD-ROM.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台电子设备(可以是个人计算机、服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps to implement the above method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, It includes the steps of the above method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks. Alternatively, if the integrated units mentioned above in this application are implemented in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence or those that contribute to the existing technology. The computer software products are stored in a storage medium and include a number of instructions to An electronic device (which may be a personal computer, a server, a network device, etc.) is caused to execute all or part of the methods described in various embodiments of this application. The aforementioned storage media include: mobile storage devices, ROM, RAM, magnetic disks or optical disks and other media that can store program codes.

本申请实施例提供的一种网络文件系统对文件加锁的设备和存储介质中相关部分的说明可以参见本申请实施例1提供的一种网络文件系统对文件加锁的方法中对应部分的详细说明,在此不再赘述。For descriptions of the relevant parts of the device and storage medium for locking files in a network file system provided by the embodiment of the present application, please refer to the details of the corresponding parts of the method of locking files by a network file system provided by Embodiment 1 of the present application. Description will not be repeated here.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。另外,本申请实施例提供的上述技术方案中与现有技术中对应技术方案实现原理一致的部分并未详细说明,以免过多赘述。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that these entities or operations are mutually exclusive. any such actual relationship or sequence exists between them. Furthermore, the terms "comprises," "comprises," or any other variation thereof are intended to cover a non-exclusive inclusion such that elements inherent in a process, method, article, or apparatus include a list of elements. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method, article, or apparatus that includes the stated element. In addition, the parts of the above technical solutions provided by the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art have not been described in detail to avoid excessive redundancy.

上述虽然结合附图对本发明的具体实施方式进行了描述,但并非对本发明保护范围的限制。对于所属领域的技术人员来说,在上述说明的基础上还可以做出其它不同形式的修改或变形。这里无需也无法对所有的实施方式予以穷举。在本发明的技术方案的基础上,本领域技术人员不需要付出创造性劳动即可做出的各种修改或变形仍在本发明的保护范围以内。Although the specific embodiments of the present invention have been described above with reference to the accompanying drawings, this does not limit the scope of the present invention. For those skilled in the art, other modifications or variations may be made based on the above description. An exhaustive list of all implementations is neither necessary nor possible. On the basis of the technical solution of the present invention, various modifications or transformations that can be made by those skilled in the art without creative efforts are still within the protection scope of the present invention.

Claims (8)

1.一种网络文件系统对文件加锁的方法,其特征在于,包括以下步骤:1. A method for locking files in a network file system, which is characterized by including the following steps: 接收文件加锁请求,生成加锁记录;Receive file locking requests and generate locking records; 如果根据加锁记录查询原始文件锁列表中既不具有相同和相同范围的加锁记录,也不具有冲突锁;则将所述加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁;If the original file lock list is queried according to the lock record and has neither the same or the same range of lock records nor conflicting locks; then the lock record is added to the original file lock list to obtain the first file lock list, And write the first file lock list into the database; then execute file locking; 所述方法还包括:在文件加锁后网络文件系统进程重启,首先使网络文件系统进入静默状态;在静默状态下,如果文件需要恢复加锁状态,则从数据库中读取所述第一文件锁列表,根据加锁记录初始化文件结构;遍历所有的加锁记录,对曾经加锁的记录进行恢复;恢复完成后退出静默状态;The method also includes: restarting the network file system process after the file is locked, first making the network file system enter a silent state; in the silent state, if the file needs to be restored to the locked state, reading the first file from the database Lock list, initialize the file structure according to the lock record; traverse all the lock records, restore the records that have been locked; exit the silent state after the restoration is completed; 如果当前节点出现故障,则将当前节点的网络文件系统共享资源切换至备用节点;判断切换至备用节点后,判断文件是否需要恢复加锁状态,如果需要恢复加锁状态,则使网络文件系统进入静默状态,然后从数据库中读取当前节点对应的文件锁记录,并根据需要恢复的文件结构,进行恢复,恢复完成后退出静默状态。If the current node fails, switch the network file system shared resources of the current node to the backup node; after judging the switch to the backup node, judge whether the file needs to be restored to the locked state, and if it needs to be restored to the locked state, make the network file system enter Quiet state, then read the file lock record corresponding to the current node from the database, and perform recovery according to the file structure that needs to be restored, and exit the silent state after the recovery is completed. 2.根据权利要求1所述的一种网络文件系统对文件加锁的方法,其特征在于,所述方法还包括对文件解锁;所述文件解锁的过程为:2. A method for locking files in a network file system according to claim 1, characterized in that the method further includes unlocking the files; the process of unlocking the files is: 接收文件解锁请求;生成解锁记录;Receive file unlocking request; generate unlocking record; 将所述解锁记录从第一文件锁列表中删除得到第二文件锁列表,执行文件解锁,并将第二文件锁列表同步至数据库中。Delete the unlocking record from the first file lock list to obtain a second file lock list, perform file unlocking, and synchronize the second file lock list to the database. 3.根据权利要求2所述的一种网络文件系统对文件加锁的方法,其特征在于,所述方法还包括:3. A method for locking files in a network file system according to claim 2, characterized in that the method further includes: 遍历第二文件锁列表;判断是否还需要继续对文件加锁;如第二文件锁列表不为空,则从所述第二文件锁列表头部获取一个加锁记录,执行文件加锁。Traverse the second file lock list; determine whether the file still needs to be locked; if the second file lock list is not empty, obtain a lock record from the head of the second file lock list and perform file locking. 4.根据权利要求1所述的一种网络文件系统对文件加锁的方法,其特征在于,所述查询原始文件锁列表中既不具有相同和相同范围的加锁记录的方法包括:4. A method for locking files in a network file system according to claim 1, wherein the method of querying the original file lock list for locking records that neither have the same nor the same range includes: 根据加锁记录查询原始文件锁列表中是都具有相同的加锁记录,如果具有相同的加锁记录,则直接返回不进行加锁;According to the lock record, query whether the original file lock list has the same lock record. If it has the same lock record, it will return directly without locking; 根据加锁记录中文件锁范围查询原始文件锁列表中是否存在覆盖所述范围的文件锁,如果具有,则直接返回不进行加锁。According to the file lock range in the lock record, query whether there is a file lock covering the range in the original file lock list, and if so, return directly without locking. 5.根据权利要求4所述的一种网络文件系统对文件加锁的方法,其特征在于,所述冲突锁包括:5. A method for locking files in a network file system according to claim 4, characterized in that the conflict lock includes: 存在与加锁记录中相同文件锁范围的排他锁;There is an exclusive lock with the same file lock range as in the lock record; 存在与加锁记录中相同文件锁范围的共享锁,且当前需要加锁的为排他锁。There is a shared lock with the same file lock range as in the lock record, and the current lock needs to be an exclusive lock. 6.一种网络文件系统对文件加锁的系统,其特征在于,所述系统包括接收模块和加锁模块;6. A system for locking files in a network file system, characterized in that the system includes a receiving module and a locking module; 所述接收模块用于接收文件加锁请求,生成加锁记录;The receiving module is used to receive file locking requests and generate locking records; 所述加锁模块用于如果根据加锁记录查询原始文件锁列表中既不具有相同和相同范围的加锁记录,也不具有冲突锁;则将所述加锁记录增加到原始文件锁列表中得到第一文件锁列表,并将第一文件锁列表写入数据库中;然后执行文件加锁;The locking module is used to add the locking record to the original file lock list if the original file lock list contains neither the same or the same range of lock records nor conflicting locks according to the lock record query. Obtain the first file lock list and write the first file lock list into the database; then execute file locking; 在文件加锁后网络文件系统进程重启,首先使网络文件系统进入静默状态;在静默状态下,如果文件需要恢复加锁状态,则从数据库中读取所述第一文件锁列表,根据加锁记录初始化文件结构;遍历所有的加锁记录,对曾经加锁的记录进行恢复;恢复完成后退出静默状态;After the file is locked, the network file system process is restarted, and the network file system is first put into a silent state; in the silent state, if the file needs to be restored to the locked state, the first file lock list is read from the database, and the file is locked according to the lock state. Record the initialization file structure; traverse all locked records and restore the previously locked records; exit the silent state after the restoration is completed; 如果当前节点出现故障,则将当前节点的网络文件系统共享资源切换至备用节点;判断切换至备用节点后,判断文件是否需要恢复加锁状态,如果需要恢复加锁状态,则使网络文件系统进入静默状态,然后从数据库中读取当前节点对应的文件锁记录,并根据需要恢复的文件结构,进行恢复,恢复完成后退出静默状态。If the current node fails, switch the network file system shared resources of the current node to the backup node; after judging the switch to the backup node, judge whether the file needs to be restored to the locked state, and if it needs to be restored to the locked state, make the network file system enter Quiet state, then read the file lock record corresponding to the current node from the database, and perform recovery according to the file structure that needs to be restored, and exit the silent state after the recovery is completed. 7.一种网络文件系统对文件加锁的设备,其特征在于,包括:7. A device for locking files in a network file system, which is characterized by including: 存储器,用于存储计算机程序;Memory, used to store computer programs; 处理器,用于执行所述计算机程序时实现如权利要求1至5任意一项所述的方法步骤。A processor, configured to implement the method steps of any one of claims 1 to 5 when executing the computer program. 8.一种可读存储介质,其特征在于,所述可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至5任意一项所述的方法步骤。8. A readable storage medium, characterized in that a computer program is stored on the readable storage medium, and when the computer program is executed by a processor, the method steps of any one of claims 1 to 5 are implemented.
CN202111090435.6A 2021-09-17 2021-09-17 Method, system, equipment and medium for locking files by network file system Active CN113986855B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111090435.6A CN113986855B (en) 2021-09-17 2021-09-17 Method, system, equipment and medium for locking files by network file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111090435.6A CN113986855B (en) 2021-09-17 2021-09-17 Method, system, equipment and medium for locking files by network file system

Publications (2)

Publication Number Publication Date
CN113986855A CN113986855A (en) 2022-01-28
CN113986855B true CN113986855B (en) 2023-11-14

Family

ID=79735966

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111090435.6A Active CN113986855B (en) 2021-09-17 2021-09-17 Method, system, equipment and medium for locking files by network file system

Country Status (1)

Country Link
CN (1) CN113986855B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119003472A (en) * 2023-05-19 2024-11-22 华为技术有限公司 Lock recovery method, storage server, client, equipment and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6389420B1 (en) * 1999-09-30 2002-05-14 Emc Corporation File manager providing distributed locking and metadata management for shared data access by clients relinquishing locks after time period expiration
CN101567805A (en) * 2009-05-22 2009-10-28 清华大学 Method for recovering failed parallel file system
CN102651006A (en) * 2011-02-25 2012-08-29 上海网环信息科技有限公司 Database table record locking method and device
CN111708744A (en) * 2020-05-15 2020-09-25 苏州浪潮智能科技有限公司 Method, system, device and medium for maintaining file lock based on stateless protocol
CN112069519A (en) * 2020-09-08 2020-12-11 陕西上讯信息技术有限公司 Method and equipment for outputting encrypted record of information file

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6389420B1 (en) * 1999-09-30 2002-05-14 Emc Corporation File manager providing distributed locking and metadata management for shared data access by clients relinquishing locks after time period expiration
CN101567805A (en) * 2009-05-22 2009-10-28 清华大学 Method for recovering failed parallel file system
CN102651006A (en) * 2011-02-25 2012-08-29 上海网环信息科技有限公司 Database table record locking method and device
CN111708744A (en) * 2020-05-15 2020-09-25 苏州浪潮智能科技有限公司 Method, system, device and medium for maintaining file lock based on stateless protocol
CN112069519A (en) * 2020-09-08 2020-12-11 陕西上讯信息技术有限公司 Method and equipment for outputting encrypted record of information file

Also Published As

Publication number Publication date
CN113986855A (en) 2022-01-28

Similar Documents

Publication Publication Date Title
CN111078667B (en) Data migration method and related device
CN102955720B (en) A kind of method improving ext file system stability
CN111611109A (en) Distributed cluster backup method, system, device and medium
CN110515557B (en) Cluster management method, device and equipment and readable storage medium
US7809898B1 (en) Detecting and repairing inconsistencies in storage mirrors
CN107479823B (en) Data verification method and device in random read-write file test
CN113448938A (en) Data processing method and device, electronic equipment and storage medium
CN105069152B (en) data processing method and device
US20090132534A1 (en) Remote replication synchronizing/accessing system and method thereof
EP4307137A1 (en) Transaction processing method, distributed database system, cluster, and medium
WO2022033269A1 (en) Data processing method, device and system
CN115277145B (en) Distributed storage access authorization management method, system, device and readable medium
CN117591038B (en) Data access method, device, distributed storage system, equipment and medium
CN106293954A (en) A kind of High Availabitity service management based on distributed lock
CN112579550B (en) Metadata information synchronization method and system of distributed file system
CN106528338A (en) Remote data replication method, storage equipment and storage system
CN113986855B (en) Method, system, equipment and medium for locking files by network file system
CN111125002A (en) Data backup filing method and system based on distributed storage
CN117950597B (en) Data modification writing method, data modification writing device, and computer storage medium
CN105653718A (en) Method for ensuring database data consistency after snapshot in storage disk snapshot environment
CN114328020A (en) A data backup method and related device of a cluster file system
CN111176886B (en) Database mode switching method and device and electronic equipment
CN111488247A (en) High-availability method and device for managing and controlling multiple fault tolerance of nodes
CN113656363B (en) A data deduplication method, system, device and storage medium based on HDFS
CN115495286A (en) Test method, system, equipment and storage medium for timed backup of configuration file

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