File lock management method for distributed file system, and device and medium
By adopting a file lock manager with byte-level granularity in the distributed file system, different users are allowed to write to different locations of the same file, which solves the problem of performance degradation caused by file lock competition and conflicts in the existing technology, and improves efficiency. IO performance.
Patent Information
- Application Number
- PCT/CN2024/078839
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-13
- Filing Date
- 2024-02-27
- Publication Date
- 2024-09-19
AI Technical Summary
Under high concurrent IO load, the performance of the existing distributed file system is degraded due to file lock competition and conflicts. It is impossible for different users to write data to different locations of the same file at the same time, which affects IO performance.
Using a byte-level granularity file lock manager, it obtains the user's read and write operation requests, determines the target file range, obtains and sends byte-level granularity file locks, and allows multiple users to read and write the same file at different locations at the same time. operation to improve IO performance.
It enables different users to write to different locations of the same file simultaneously under high concurrency conditions, reducing performance degradation caused by file lock conflicts and improving IO performance.
Smart Images

Figure CN2024078839_19092024_PF_FP_ABST
Abstract
Description
File lock management method, device and medium for distributed file system
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on March 13, 2023, with application number 202310232841.4, entitled “File lock management method, device and medium for distributed file system”, the entire contents of which are incorporated by reference into this application. Technical Field
[0003] Embodiments of the present application relate to the field of distributed storage technology, and in particular to a file lock management method for a distributed file system, an electronic device, and a computer non-volatile readable storage medium. Background Art
[0004] Distributed storage file systems need to be compatible with the POSIX (Portable Operating System Interface) protocol, which requires that file system read and write operations must meet data consistency and atomicity. A common mechanism for achieving data consistency and atomicity is file locking. When a process on a distributed storage client is updating data within a file, the file locking mechanism prevents multiple processes from updating the file simultaneously, potentially leading to data loss, or preventing the file from being read before the update is complete, potentially causing subsequent problems. For network shared files, it also prevents different processes from simultaneously reading and writing the same file, which could lead to read and write errors and data corruption.
[0005] Distributed file systems generally utilize caching technology to accelerate data access. This technology stores recently accessed file data in the cache. The next time the same file data is accessed, it can be retrieved directly from the cache, without having to access the slower disk. This results in higher I / O (Input / Output) speeds. In distributed file systems based on the client / server (C / S) model, caching exacerbates issues with concurrent I / O consistency and atomicity. This necessitates providing a consistent view for all file system clients within the distributed storage system, addressing multi-client concurrent access control and cache consistency and atomicity.
[0006] Currently, file locks in distributed file systems are used to ensure cache consistency across distributed clients. File locks also serve as a mutual exclusion mechanism, ensuring that multiple processes can safely read and write to the same file. Controlling these multi-process operations is necessary because the scheduling of these processes is unpredictable. This unpredictable timing can lead to contention for access to the same file resource, resulting in unexpected results. Consequently, file locks can severely degrade performance when performing parallel writes under highly concurrent workloads.
[0007] The Common Internet File System (CIFS), a typical distributed file system client for file sharing between network devices, implements an oplock (a mechanism for collaboration on shared files), also known as an opportunistic lock, to ensure client cache consistency. Locks are applied at a per-file granularity, supporting concurrent access by multiple readers for a single writer. Many distributed file systems use locking protocols similar to CIFS, providing only coarse-grained concurrent access to files. Only one client is allowed to write to a file at any one time, even if other clients are writing to different parts of the same file. This impacts I / O performance.
[0008] In view of this, how to provide a file lock management method for a distributed file system, an electronic device, and a computer non-volatile readable storage medium that solve the above technical problems has become a problem that needs to be solved by those skilled in the art.
[0009] Summary of the Invention
[0010] The purpose of the embodiments of the present application is to provide a file lock management method, electronic device and computer non-volatile readable storage medium for a distributed file system, which can enable different users to write data to different locations of the same file at the same time during use, thereby improving IO performance.
[0011] To solve the above technical problems, an embodiment of the present application provides a file lock management method for a distributed file system, which is applied to a server, including: obtaining current read and write operation requests corresponding to multiple users; for each current read and write operation request, obtaining a corresponding byte-level granularity file lock based on the read and write operation request; the file lock includes a target file range; and sending the file lock to the current client corresponding to the current read and write operation request.
[0012] Optionally, before sending the file lock to the current client corresponding to the current read and write operation request, it also includes: when the current read and write operation request is a write operation request, determining whether the current read and write operation request conflicts with the read and write operation request of the authorized client; if the current read and write operation request conflicts with the read and write operation request of the authorized client, revoking the authorized file lock corresponding to the authorized client, and executing the step of sending the file lock to the current client corresponding to the current read and write operation request after the revocation is completed; if the current read and write operation request does not conflict with the read and write operation request of the authorized client, directly executing the step of sending the file lock to the current client corresponding to the current read and write operation request.
[0013] Optionally, revoking the authorized file lock corresponding to the authorized client includes: sending a lock conflict revocation notification to the authorized client; receiving a lock conflict revocation response message returned by the authorized client before data is flushed; and revoking the authorized file lock of the authorized client.
[0014] Optionally, revoking the authorized file lock of the authorized client includes: changing the state identifier of the authorized file lock of the authorized client to a revoked state.
[0015] Optionally, sending the file lock to the current client corresponding to the current read / write operation request includes: adding a status identifier to the file lock; and sending the file lock carrying the status identifier to the current client corresponding to the current read / write operation request.
[0016] Optionally, the status identifier is a reuse identifier or a revocation identifier.
[0017] Optionally, before sending the file lock to the current client corresponding to the current read and write operation request, it also includes: determining whether the current read and write operation request conflicts with other read and write operation requests in the request queue; if the current read and write operation request conflicts with other read and write operation requests in the request queue, returning a lock cancellation request notification to the current client.
[0018] Optionally, obtaining a file lock with byte-level granularity corresponding to the current read and write operation request includes: determining the file lock type based on the request type of the current read and write operation request and preset selection rules; and obtaining a file lock with byte-level granularity corresponding to the current read and write operation request based on the file lock type.
[0019] Optionally, file lock types include protecting write lock, blocking write lock, non-blocking write lock, and protecting read lock.
[0020] Optionally, the file lock type is determined based on the request type of the current read / write operation request and preset selection rules, including: when the request type of the current read / write operation request is a read operation, the file lock type is a protection read lock; when the request type of the current read / write operation request is a write operation involving implicit read, the file lock type is a protection write lock; when the request type of the current read / write operation request is an atomic write operation across multiple resources, the file lock type is a blocking write lock; when the request type of the current read / write operation request is other types, the file lock type is a non-blocking write lock.
[0021] Optionally, different file lock types have different restriction levels.
[0022] Optionally, after determining the file lock type based on the request type of the current read and write operation request and the preset selection rules, it also includes: judging whether the file lock type conflicts with the file lock type of the authorized file lock of the user corresponding to the current client; if the file lock type conflicts with the file lock type of the authorized file lock of the user corresponding to the current client, the file lock type is upgraded to a file lock type with a higher restriction level.
[0023] Optionally, sending the file lock to the current client corresponding to the current read / write operation request includes sending a new file lock corresponding to the upgraded file lock type to the current client so that the current client merges the authorized file lock and the new file lock.
[0024] Optionally, before sending the file lock to the current client corresponding to the current read / write operation request, it also includes: if the file lock type of the file lock is not a non-blocking write lock and there is a conflicting authorized client, downgrading the authorized file lock of the conflicting authorized client.
[0025] Optionally, before sending the file lock to the current client corresponding to the current read / write operation request, the method includes: adding a serial number to the file lock.
[0026] Optionally, adding a serial number to the file lock includes: obtaining the current serial number of the lock resource corresponding to the target file; when the current read / write operation request is a read request operation, assigning the current serial number to the file lock; when the current read / write operation request is a write request operation, adding one to the current serial number to obtain a new serial number, and assigning the new serial number to the file lock.
[0027] Optionally, after sending the file lock to the current client corresponding to the current read / write operation request, the method further includes: adding the file lock to the cache of the current client.
[0028] An embodiment of the present application also provides a file lock management method for a distributed file system, which is applied to a client, including: responding to current read and write operations of multiple users; generating a current read and write operation request corresponding to each current read and write operation; sending the current read and write operation requests corresponding to each of the multiple users to a server, so that the server obtains a corresponding file lock with byte-level granularity for each current read and write operation request; the file lock includes a target file range; and receiving the file lock corresponding to each user sent by the server.
[0029] An embodiment of the present application also provides a file lock management device for a distributed file system, which is applied to a server, and includes: a first acquisition module, configured to obtain current read and write operation requests corresponding to multiple users; a second acquisition module, configured to obtain a corresponding byte-level granularity file lock based on the read and write operation request for each current read and write operation request; the file lock includes a target file range; and a first sending module, configured to send the file lock to the current client corresponding to the current read and write operation request.
[0030] An embodiment of the present application also provides a file lock management device for a distributed file system, which is applied to a client and includes: a response module, configured to respond to current read and write operations of multiple users; a generation module, configured to generate a current read and write operation request corresponding to each current read and write operation; a second sending module, configured to send the current read and write operation requests corresponding to each of the multiple users to a server, so that the server obtains a corresponding file lock with byte-level granularity for each current read and write operation request; the file lock includes a target file range; and a receiving module, configured to receive the file lock corresponding to each user sent by the server.
[0031] An embodiment of the present application further provides an electronic device, comprising: a memory configured to store a computer program; and a processor configured to implement the steps of the above-mentioned distributed file system file lock management method when executing the computer program.
[0032] An embodiment of the present application further provides a computer non-volatile readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the file lock management method of the distributed file system are implemented.
[0033] An embodiment of the present application provides a file lock management method for a distributed file system, an electronic device, and a computer non-volatile readable storage medium. The method includes: obtaining current read and write operation requests corresponding to multiple users; for each current read and write operation request, obtaining a corresponding byte-level granularity file lock based on the read and write operation request; the file lock includes a target file range; and sending the file lock to the current client corresponding to the current read and write operation request.
[0034] It can be seen that in the embodiment of the present application, when multiple users perform read and write operations on different parts of the same file, after the server obtains the current read and write operation requests corresponding to each of the multiple users, for each current read and write operation request, it can determine the target file range based on the current read and write operation request, and then obtain a byte-level granularity file lock including the target file range, and send the file lock to the corresponding current client, so that multiple users can perform read and write operations on the corresponding files based on their respective file locks, which can enable different users to write data to different locations of the same file at the same time, thereby improving IO performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the prior art and the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0036] FIG1 is a schematic diagram of the system architecture of a file lock management method using a distributed file system provided in an embodiment of the present application;
[0037] FIG2 is a flow chart of a file lock management method for a distributed file system provided in an embodiment of the present application;
[0038] FIG3 is a schematic diagram of an application scenario of a file lock management method for a distributed file system provided by an embodiment of the present application;
[0039] FIG4 is a schematic diagram comparing the process of revoking a file lock in the present application with the process of revoking a file lock in the prior art;
[0040] FIG5 is a schematic diagram of a file lock type selection process provided in an embodiment of the present application;
[0041] FIG6 is a schematic diagram of a file lock type restriction level and upgrade and downgrade provided in an embodiment of the present application;
[0042] FIG7 is a schematic diagram of a process for reducing the restriction level of a file lock provided by an embodiment of the present application;
[0043] FIG8 is a flow chart of another method for managing file locks in a distributed file system according to an embodiment of the present application;
[0044] FIG9 is a schematic structural diagram of a file lock management device for a distributed file system provided in an embodiment of the present application;
[0045] FIG10 is a schematic diagram of the structure of another distributed file system file lock management device provided in an embodiment of the present application;
[0046] FIG11 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0047] FIG12 is a schematic structural diagram of a computer non-volatile readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The embodiments of the present application provide a file lock management method, electronic device, and computer non-volatile readable storage medium for a distributed file system, which can enable different users to write data to different locations of the same file simultaneously during use, thereby improving IO performance.
[0049] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0050] It should be noted that currently distributed storage file systems all use file locks to ensure client cache consistency and atomicity. A typical approach to distributed file lock management technology is as follows: the distributed file system client CIFS implements an oplock file lock mechanism, also known as an opportunistic lock mechanism, to ensure client cache consistency. The lock granularity is per file, supporting concurrent access to a file by a single writer and multiple readers. Many distributed file systems use locking protocols similar to CIFS, providing only coarse-grained concurrent access to files. Only one client is allowed to write to a file at any time, even if other clients are writing to different parts of the same file. Distributed storage servers typically grant a single writer a mutual exclusion lock to maintain client cache consistency. This allows clients to read, write, and cache dirty data. When the server revokes the authorized mutex lock, the client will refresh and abolish the cache. When multiple clients access a file simultaneously, if they are all reading, the server can grant the client a shared read lock. Each client can cache the read data, but cannot write dirty data. If there is a write request, the server needs to revoke the locks on all accessed files, clear the client buffer, and the file is processed in Direct I / O (direct input / output) mode. All data needs to be flushed to the underlying storage server. When a large area of cache fails, it needs to be flushed to the underlying disk. This process will cause cache avalanche and storage performance will drop sharply. It is worth noting that write locks are usually released involuntarily. The lock holder will hold the lock for as long as possible until another client initiates a request for a conflicting lock, and then proceed to the next step. This process is the key to affecting storage IO performance.
[0051] This application targets the IO model of the above-mentioned typical distributed storage file system. In order to solve the performance degradation problem caused by file lock competition and lock conflict when performing parallel writing under high concurrent IO load and ensure the consistency of distributed client cache, this application proposes a file lock management method for a distributed file system. In the distributed storage file system dynamic interface library API (Application Program Interface), a distributed file lock manager LM (Lock Manager) with byte-level granularity is designed. After obtaining the current read and write operation request, the distributed file lock manager LM can determine the target file range based on the current read and write operation request, and then obtain a file lock with byte-level granularity including the target file range, and send the file lock to the corresponding current client. Since the obtained file lock is at byte-level granularity, it can meet the needs of different clients to write data to different locations of the same file at the same time, thereby improving IO performance.
[0052] It should be noted that the system architecture of an application scenario of the file lock management method of the distributed file system provided by this application is shown in Figure 1. In which, the top layer uses an external distributed file system, such as NFS (Network File System) to provide distributed client access to storage data services. The client application IO forwarding software request is forwarded to the NFS server through RPC (Remote Procedure Call Protocol) remote procedure call, and then the request interface is called. The file lock processing is managed by the Libfs-LM (also known as the distributed file lock manager) module of this application, which maintains file locks and data cache at the same time to meet data consistency and atomic operation processes. The Libfs-LM module provides a POSIX-like API that can be dynamically linked into the application for direct use. It is used as the IO forwarding software for the distributed storage underlying data processing module. The low coupling of different modules improves system compatibility and reduces development complexity. Among them, the VFS (virtual file system) layer in Figure 1 is the virtual file system layer, DATA is data, and cache is cache.
[0053] The following is a detailed description and introduction of the file lock management method for a distributed file system provided by this application. For details, please refer to Figure 2, which is a flow chart of a file lock management method for a distributed file system provided by an embodiment of this application. The method includes:
[0054] S110: Obtaining current read and write operation requests corresponding to multiple users;
[0055] It should be noted that when a client needs to perform an IO operation, it initiates a read / write operation request. Optionally, in the embodiments of the present application, a single client may respond to the read / write operations of multiple users, or multiple clients may respond to the read / write operations of one or more users. After responding to the user's read / write operation, the client generates corresponding read / write operation requests and sends each read / write operation request to the server. The file lock manager in the server performs the corresponding file lock management work after obtaining the current read / write operation requests corresponding to the multiple users. In other words, the current read / write operation requests corresponding to the multiple users may be sent to the server by the same client or by different clients, and the embodiments of the present application do not specifically limit this.
[0056] S120: For each current read / write operation request, obtain a corresponding byte-level granularity file lock based on the read / write operation request; the file lock includes a target file range;
[0057] It can be understood that the embodiments of the present application are explained in detail using a current read and write operation request as an example: Optionally, after obtaining the read and write operation request, the target file range targeted by the read and write operation request can be determined based on the target file information, offset information and length information carried in the read and write operation request. The target range of the target file can be determined based on the target file range, so that a file lock containing the target file range can be obtained. This file lock is a file lock at a byte-level granularity, that is, a part of the content in the file can be locked so that the client can perform IO operations, rather than locking the entire file.
[0058] S130: Send the file lock to the current client corresponding to the current read / write operation request.
[0059] Optionally, after obtaining the corresponding file lock, the file lock is sent to the current client that initiates the current read and write operation request, so that the corresponding user of the current client can lock the target file range of the target file through the file lock and perform subsequent IO processing.
[0060] Of course, in actual applications, multiple clients may send current read and write operation requests to the server. The specific application scenario is shown in FIG3 , and the above steps S110 to S130 are executed for each client.
[0061] It can be seen that in the embodiment of the present application, when multiple users perform read and write operations on different parts of the same file, after the server obtains the current read and write operation requests corresponding to each of the multiple users, for each current read and write operation request, it can determine the target file range based on the current read and write operation request, and then obtain a byte-level granularity file lock including the target file range, and send the file lock to the corresponding current client, so that multiple users can perform read and write operations on the same file based on their respective file locks, which can enable different users to write data to different locations of the same file at the same time, thereby improving IO performance.
[0062] It should be noted that after sending the file lock to the current client corresponding to the current read and write operation request, the file lock can also be added to the cache of the current client to correspond to the corresponding user. In addition, the embodiment of the present application takes into account the security issues of multi-concurrent data consistency, such as: one situation is that the data flushing has not been completed during the lock processing of a client, and other write requests perform write operations on the file, resulting in the data in the client cache being modified. Another situation is that the data flushing process of multiple client write requests may arrive at the distributed storage underlying data server out of order, thereby destroying the serialization of writes. In response to these problems, the embodiment of the present application further explains and optimizes the technical solution, as follows:
[0063] Optionally, before sending the file lock to the current client corresponding to the current read / write operation request in S130, the method may further include:
[0064] Add sequence numbers to file locks.
[0065] It should be noted that, in the embodiment of the present application, a sorting mechanism can be used to solve the above problem. Specifically, a serial number can be added to the file lock before sending it to the current client, and the order of each file lock can be determined by the serial number.
[0066] Optionally, when adding a serial number to a file lock, the current serial number of the lock resource corresponding to the target file can be obtained; when the current read / write operation request is a read request operation, the current serial number is assigned to the file lock; when the current read / write operation request is a write request operation, the current serial number is added by one to obtain a new serial number, and the new serial number is assigned to the file lock.
[0067] It is understandable that each lock resource can be maintained using a monotonically increasing serial number. When a file lock needs to be authorized, the lock server assigns the current serial number of the lock resource to the file lock. In the case where the file lock to be authorized is a write lock, the lock server increases the serial number of the lock resource by one based on the current serial number, so that all authorized write locks on the lock resource can be sorted by their unique serial number. In addition, the serial number of the authorized write lock can also be used to mark the data to be written, so that when the lock is added to the client cache, the serial number can be used to distinguish which data is the latest, thereby solving the problem existing in the first case mentioned above, that is, the client can determine the latest data based on the serial number.
[0068] It should also be noted that when flushing data to the distributed storage data server, the flushed data also carries the serial number of the corresponding file lock. The distributed storage data server retains a data block cache to track the serial number of the data it processes, so that the server can use the serial number to correctly write the data to the underlying storage device, thereby solving the second situation and avoiding destroying the write serialization to ensure the correctness of the data file.
[0069] It should be noted that distributed storage IO processing can generally be divided into two phases: the read phase and the write phase, with mixed read and write being rare. Lock conflicts mainly occur during the parallel write phase, and a large number of write lock conflicts limits write performance. To address this technical issue, the embodiments of this application further illustrate and optimize the technical solution, as follows:
[0070] Optionally, before sending the file lock to the current client corresponding to the current read / write operation request in S130, the method may further include:
[0071] In the case that the current read-write operation request is a write operation request, determine whether the current read-write operation request conflicts with the read-write operation request of the authorized client. If the current read-write operation request conflicts with the read-write operation request of the authorized client, revoke the authorized file lock corresponding to the authorized client, and after the revocation is completed, execute the step of sending the file lock to the current client corresponding to the current read-write operation request. If the current read-write operation request does not conflict with the read-write operation request of the authorized client, directly execute the step of sending the file lock to the current client corresponding to the current read-write operation request.
[0072] It should be noted that, based on the type of the current read / write operation request, it can be determined whether the current read / write operation request is a write operation request. If it is determined to be a write operation request, it is further determined whether the current read / write operation request conflicts with the read / write operation request of an authorized client, that is, whether the lock request of the current client conflicts with the lock request of an authorized client, and whether there is an authorized client performing an IO write operation on the target range of the target file. If there is an authorized client with a conflict, the authorized file lock corresponding to the authorized client is revoked, and after the revocation is completed, the file lock corresponding to the current client is sent to the current client so that the current client can perform an IO write operation on the target file range. It should also be noted that the authorized client in the embodiment of the present application can be other users of the current client or other clients. That is, if the other read / write operation request that conflicts with the current read / write operation request is also initiated by other authorized users of the current client, then the authorized client is the current client; if the other read / write operation request that conflicts with the current read / write operation request is initiated by an authorized user of another client, then the authorized client is the other client.
[0073] Optionally, the process of revoking the authorized file lock corresponding to the authorized client may specifically include:
[0074] Send lock conflict revocation notification to authorized clients;
[0075] Receive the lock conflict cancellation response message returned by the authorized client before the data is flushed;
[0076] Revokes the authorized file lock of the authorized client.
[0077] It should be noted that in a distributed storage file system, for an authorized client with an authorized file lock, the authorized file lock is usually cached in the client for future use. When other users request the same lock for read and write operations, a file lock conflict will occur. The solution to file lock conflicts in the prior art is to reclaim the file lock in the cache. Specifically, the distributed storage service sends a lock revocation message to the client holding the lock. The lock will be released only after the client refreshes all cached dirty data to the distributed storage service. After the release, the server can reclaim the lock. Only when the conflicting lock is completely recovered can a new lock be granted. For details, please refer to the authorization lock part of the prior art in Figure 3. It can be seen that the whole process has a long delay. For parallel writing, the time spent waiting for lock conflicts and completing the flush to the storage data server will be seriously backlog, resulting in a decrease in storage IO performance.
[0078] In view of this, in order to further improve the IO performance, in the embodiment of the present application, it is proposed that the authorized file lock of the user corresponding to the authorized client can be actively revoked, that is, the lock can be revoked in advance. Optionally, when there is an authorized client with a conflict, a lock conflict revocation notification is sent to the authorized client, informing the authorized client that its corresponding authorized file lock conflicts with the file lock requested by the subsequent user and that the authorized file lock needs to be revoked. After receiving the lock conflict revocation notification, the client responds to the lock conflict revocation notification in a timely manner and can return a lock conflict revocation response message to the server before the data is flushed. After receiving the lock conflict revocation response message returned by the client, the server immediately revokes the authorized file lock of the authorized client without waiting for the data to be flushed before recycling, and after the revocation is completed, the file lock corresponding to the current client is authorized to the current client, thereby realizing early authorization of the lock, reducing the delay during the conflict process, and helping to improve storage IO performance.
[0079] For example, as shown in Figure 4, client 1 has locked the file during IO processing, and client 2 initiates a lock request for the same position of the file. Based on the above operation, this application can grant a write lock in advance. Optionally, the distributed storage system lock server sends a lock conflict cancellation notification to client 1, and after receiving the lock conflict cancellation response message from client 1, it cancels the write lock LA of client 1. The distributed storage system lock server directly grants the new write lock LB to client 2. It can be seen that compared with the solution in the prior art, the time consumed in the lock cancellation process is greatly shortened.
[0080] Optionally, the process of revoking the authorized file lock of the authorized client may include:
[0081] Changes the status flag of an authorized file lock of an authorized client to revoked.
[0082] It should be noted that, in the embodiment of the present application, two states are set for the authorized file lock. Specifically, when allocating a file lock to a client, a corresponding state identifier can be added to the file lock. The state identifier can optionally include a reuse identifier GRABT or a revocation identifier CANCELING, wherein the GRABT identifier indicates that the lock can be cached and reused, and the CANCELING identifier indicates that the lock cannot be reused. By default, the authorized file lock is in the GRABT state, that is, the state identifier of the authorized file lock is GRABT by default. In the case of a conflicting authorized file lock of an authorized client, when the distributed file lock manager LM receives the lock conflict revocation response message returned by the authorized client before the data is refreshed, it changes the state identifier of the authorized file lock of the corresponding user of the authorized client to a revoked state, so that the authorized client can no longer reuse the authorized file lock.
[0083] Optionally, as shown in Figure 4, after receiving the lock conflict revocation response message from client 1, the distributed storage system lock server can simultaneously change the write lock LA state granted to client 1 to the CANCELING state so that client 1 will not reuse the write lock LA, and grant the new write lock LB to Client 2 (client 2).
[0084] Optionally, the process of sending the file lock to the current client corresponding to the current read / write operation request may include:
[0085] Add status identification to file lock;
[0086] Send the file lock with the status identifier to the current client corresponding to the current read and write operation request.
[0087] It should be noted that after obtaining the file lock corresponding to the current read / write operation request, a status identifier is added to the file lock, and the file lock carrying the status identifier is sent to the corresponding current client, wherein the status identifier is a reuse identifier GRABT or a revocation identifier CANCELING. Optionally, in the default state, a reuse identifier GRABT can be added to the file lock to inform the current client how to handle the file lock after the corresponding user uses the file lock. In which, when it is subsequently determined that the file lock conflicts with a file lock applied for by another user, the status identifier of the file lock can be changed to a revocation identifier CANCELING, thereby facilitating the revocation and management of the file lock.
[0088] It is understandable that the time-consuming overhead of lock revocation cannot be ignored under high-concurrency IO processing. When lock conflict requests (LockA, LockB) from users of two clients or from different users of the same client arrive at the distributed storage system lock server at the same time, after sending an authorization reply to LockA, the lock server finds that LockB conflicts with LockA and immediately sends a callback mechanism for lock revocation to LockA. The lock grant of LockB must wait for at least one RTT (Round-Trip Time) until the revocation lock reply of LockA returns. In the embodiment of the present application, the lock can be revoked in advance to eliminate this delay. Optionally, when a file lock is granted, the file lock is marked with a status identifier to inform the client how to handle the file lock after use, so as to extract and revoke the lock. Among them, round-trip delay is also an important performance indicator in computer networks. It represents the total delay from the start of sending data from the sender to the sender receiving confirmation from the receiver and the receiver sending confirmation immediately after receiving the data.
[0089] Optionally, before sending the file lock to the current client corresponding to the current read / write operation request in S130, the method may further include:
[0090] Determine whether the current read / write operation request conflicts with other read / write operation requests in the request queue. If the current read / write operation request conflicts with other read / write operation requests in the request queue, return a lock cancellation request notification to the current client.
[0091] It is understandable that in high concurrency situations, lock requests corresponding to read and write operation requests need to be queued. Therefore, the current read and write operation request can be obtained from the queue, and before the file lock corresponding to the current client is sent to the current client for authorization, it is possible to further detect whether the file lock to be authorized conflicts with the locks corresponding to other read and write operation requests in the queue, that is, detect whether the current read and write operation request conflicts with other read and write operation requests in the request queue. If the current read and write operation request conflicts with other read and write operation requests in the request queue, a file lock revocation notification is sent to the current client, and authorization permission can be added. After that, a new lock can be safely granted without waiting for the revocation response to be returned.
[0092] Optionally, the process of acquiring a corresponding byte-level granularity file lock based on the current read / write operation request in S120 may specifically include:
[0093] Determine the file lock type based on the request type of the current read / write operation request and the preset selection rules;
[0094] Acquires a byte-level granular file lock corresponding to the current read or write operation request based on the file lock type.
[0095] It should be noted that, in the embodiment of the present application, file locks can be divided into multiple types, that is, they can be divided into file locks for different file types. Optionally, the file lock types in the embodiment of the present application include a protection write lock, a blocking write lock, a non-blocking write lock, and a protection read lock. That is, the embodiment of the present application expands the lock types of file write locks to maintain the traditional semantics of POSIX, and the types of file write locks include a non-blocking write lock, a blocking write lock, and a protection write lock. In actual applications, the present application retains the lock mode of the read request in the prior art, namely the shared read lock, and the holder of the shared read lock can read the shared file resources.
[0096] Optionally, the corresponding file lock type can be determined based on the request type of the current read and write operation request and the preset selection rules, and then the corresponding byte-level granularity file lock is obtained based on the file lock type and sent to the current client for file lock authorization.
[0097] It should be noted that, in the embodiment of the present application, the file lock type of the write lock can be designed in advance, specifically as follows:
[0098] Non-blocking write lock: The lock holder can only write to the shared resource, but not read. In addition, it does not maintain the blocking function of the write lock. Its role is to provide high parallel write performance under high concurrent IO operations.
[0099] Blocking write lock, retaining the blocking function in case of write lock conflict.
[0100] A protection write lock has the same semantics as the write lock in the prior art. The holder of the protection write lock can read and write shared resources.
[0101] Optionally, the process of determining the file lock type based on the request type of the current read / write operation request and a preset selection rule may specifically include:
[0102] When the request type of the current read / write operation request is a read operation, the file lock type is a protection read lock;
[0103] When the request type of the current read / write operation request is a write operation involving implicit read, the file lock type is a protection write lock;
[0104] When the request type of the current read / write operation request is an atomic write operation across multiple resources, the file lock type is a blocking write lock;
[0105] If the request type of the current read / write operation request is other types, the file lock type is a non-blocking write lock.
[0106] It should be noted that, as shown in FIG5 , the file lock type selection rule can be used to select the best file lock type for each read and write operation request based on the selection rule. Optional S201: Determine whether the request type of the current read and write operation request is a write operation. If it is not a write operation, it means it is a read operation, and execute S202. If it is a write operation, execute S203. S202: Determine whether the file lock type is a protection read lock. S203: Determine whether the request type of the current read and write operation request is a write operation involving implicit reading, that is, determine whether it is an overwrite write scenario in a distributed storage IO request. If it is a write operation involving implicit reading, proceed to S204. If it is not a write operation involving implicit reading, Enter S205; S204: determine that the file lock type is a protective write lock; S205: determine whether the request type of the current read / write operation request is an atomic write operation across multiple resources. If the request type of the current read / write operation request is an atomic write operation across multiple resources, enter S206; if the request type of the current read / write operation request is not an atomic write operation across multiple resources, enter S207; S206: determine that the file lock type is a blocking write lock; S207: determine that the file type is a non-blocking write lock. That is, for other situations, a non-blocking write lock is selected. In addition, for common data-related operations in distributed file systems, such as reading, writing, overwriting, appending, etc., a deterministic file lock type can be selected according to the selection rule.
[0107] Optionally, different file lock types in the embodiments of the present application have different restriction levels. Optionally, the file lock types are sorted according to their restriction levels. As shown in FIG5 , the priority selection and conversion of file lock types are shown. The upper-level file lock types are more restrictive than the lower-level file lock types. The protection write lock is the file lock type with the highest restriction level in the write lock of the present application. It can be used to support writes across multiple file resources and update operations for atomically creating files, while the non-blocking write lock with the lowest restriction can only be used for writes in a single file resource. On the other hand, locks with higher restriction levels will reduce the efficiency of storage bottom-level lock contention processing. For example, the protection write lock and the blocking write lock process the data flushing operation of the conflicting lock in serial processing, while the non-blocking write lock can use early authorization and early revocation to obtain high storage IO performance in high-concurrency IO situations. Therefore, selecting the appropriate file write lock type is crucial to distributed storage IO performance.
[0108] Optionally, after determining the file lock type based on the request type of the current read / write operation request and a preset selection rule, the method may further include:
[0109] Determine whether the file lock type conflicts with the authorized file lock type of the user corresponding to the current client. If so, upgrade the file lock type to a file lock type with a higher restriction level.
[0110] It should be noted that embodiments of the present application propose that file lock types can be upgraded or downgraded based on file lock conflicts to better improve IO performance. Optionally, before a user on the current client initiates a current read / write operation request, the current client may already have an authorized file lock corresponding to that user, which is normally performing IO processing. Therefore, to avoid conflicts, after determining the file lock type corresponding to the current IO operation type, it is possible to further determine whether the file lock type conflicts with the file lock type of the authorized file lock of the user on the current client. If the file lock type conflicts with the file lock type of the authorized file lock of the user on the current client, the file lock type determined based on the current read / write operation request and preset selection rules will be upgraded to a file lock type with a higher restriction level, thereby better meeting the needs of the user corresponding to the current client. Of course, after sending the new file lock corresponding to the upgraded file lock type to the current client, the current client can merge the authorized file lock of the corresponding user with the new file lock and uniformly use the new file lock for subsequent IO operations.
[0111] Optionally, in the embodiment of the present application, a lock conflict list may be preset and determined, as shown in Table 1:
[0112] Table 1 is a list of lock conflicts.
[0113] The first row in Table 1 is the authorized file lock type, and the first column is the file lock type in the lock request. N / Y indicates that the lock request conflicts with a granted lock in the GRANT state but is compatible with a lock in the CANCELING state.
[0114] The following embodiment of the present application further illustrates the situation where the restriction level of the file lock type is upgraded:
[0115] When the same user of the same client makes a write lock request for a shared file of the same stripe, according to the above-mentioned file lock type selection rules, the write operation selects a non-blocking write lock; when a read operation is performed, a protective read lock is added. At this time, the protective read lock and the non-blocking write lock conflict, which will lead to frequent lock revocation operations in the same client. The embodiment of the present application solves the problem by raising the priority of the file type (as shown in the solid line part in Figure 6). Once the lock server finds that the lock request conflicts with the authorized file lock of the same user in the same client, it will grant a file lock with a file type with a more stringent restriction substrate. The lock server upgrades the file lock type from a protective read lock to a protective write lock and grants it to the user of the client. When the client receives the lock authorization, the client merges the old conflicting non-blocking write lock in the local cache with the newly authorized protective write lock and uses the protective write lock uniformly. In this way, the time-consuming lock recovery caused by the conflict between the read-write lock corresponding to the same client and the same user is avoided. In addition, subsequent read / write requests can also reuse the granted protective write lock. In other words, the read lock and write lock are maintained and managed with the same protection write lock, which prevents read-write lock conflicts and improves storage IO performance.
[0116] Optionally, before sending the file lock to the current client corresponding to the current read / write operation request, the method may further include:
[0117] If the file lock type of the file lock is not a non-blocking write lock and there is a conflicting authorized client, the authorized file lock of the conflicting authorized client is downgraded.
[0118] It should be noted that when the file lock type of the file lock is not a non-blocking write lock and there is a conflicting authorized client, the authorized file lock of the conflicting authorized client needs to be downgraded. Optionally, as shown in Table 1 above, regardless of the type of file lock request, it conflicts with the authorized blocking write lock or protection write lock in the "GRANT" and "CANCELING" states. Therefore, if the client chooses to add a blocking write lock or protection write lock, or the lock has been upgraded to a blocking write lock or protection write lock, the authorization will be delayed until the blocking write lock or protection write lock is released. In the embodiment of the present application, two clients are used as an example for explanation. Specifically, as shown in the lock down priority processing flow chart in Figure 7, client 1 and client 2 select the blocking write lock according to the lock selection rule of the present application. Due to the blocking mechanism of the blocking write lock, the blocking write lock authorization for client 2 should wait until the data in client 1 is flushed before authorization is performed. After analysis, if client 1 and client 2 do not perform a read operation request, this process is unnecessary. The embodiment of the present application can use file lock type downgrade to solve this problem. When the client starts to cancel the lock, the lock is first downgraded to the least restrictive lock. As shown in Figure 6, after the blocking write lock of Client 1 is unlocked, it is found that the lock is in the CANCELING state. The blocking lock of Client 1 is downgraded to a non-blocking write lock, and a downgrade request is sent to the lock service manager to notify the lock downgrade. After that, Client 1 continues to process the lock cancellation process. After receiving the downgrade request, the lock service manager changes the lock to a non-blocking write lock and then pre-authorizes the blocking write lock to Client 2. Therefore, the lock downgrade process can reduce the high latency caused by lock release in parallel write operations.
[0119] Based on the above embodiment, the present application embodiment further provides a file lock management method for a distributed file system, which is applied to a client. For details, please refer to FIG8 . The method includes:
[0120] S310: responding to current read and write operations of multiple users;
[0121] Optionally, for a client, multiple users may initiate read and write operations through the client, and the client may respond to the current read and write operations of the multiple users.
[0122] S320: Generate a current read / write operation request corresponding to each current read / write operation;
[0123] Optionally, after responding to the current read and write operations of multiple users, the client generates current read and write operation requests corresponding to each current read and write operation.
[0124] S330: Sending the current read / write operation requests corresponding to the multiple users to the server, so that the server obtains a corresponding file lock at byte-level granularity for each current read / write operation request; the file lock includes a target file range;
[0125] Optionally, the client sends the current read and write operation request corresponding to each user to the server. The server obtains the file lock corresponding to the current read and write operation request at the byte level granularity for each current read and write operation request, and returns the file lock to the client.
[0126] S340: Receive the file lock corresponding to each user sent by the server.
[0127] Optionally, the client receives the file lock corresponding to each current read and write operation request returned by the server, so that each user uses the corresponding file lock to perform read and write operations.
[0128] It should be noted that in the embodiment of the present application, the client responds to the current read and write operations of multiple users, and generates a current read and write operation request corresponding to each current read and write operation, and then sends the current read and write operation request corresponding to each of the multiple users to the server. The server obtains the corresponding file lock with byte-level granularity for each current read and write operation request, and returns each file lock to the client. Each user at the client performs read and write operations on the corresponding file based on the corresponding file lock, which enables different users to write data to different locations of the same file at the same time, thereby improving IO performance.
[0129] Based on the above embodiment, the present application embodiment further provides a file lock management device for a distributed file system, as shown in FIG9 . The device comprises:
[0130] A first acquisition module 01 is configured to acquire a current read / write operation request;
[0131] The second acquisition module 02 is configured to acquire a corresponding byte-level granularity file lock based on a read / write operation request; the file lock includes a target file range;
[0132] The sending module 03 is configured to send the file lock to the current client corresponding to the current read / write operation request.
[0133] It should be noted that the file lock management device of the distributed file system provided in the embodiment of the present application has the same beneficial effects as the file lock management method of the distributed file system provided in the above embodiment, and for the specific introduction of the file lock management device of the distributed file system involved in the embodiment of the present application, please refer to the above embodiment, and this application will not repeat it here.
[0134] The present application also provides a file lock management device for a distributed file system, which is applied to a client. For details, please refer to FIG. 10 . The device includes:
[0135] a response module 11, configured to respond to current read and write operations of multiple users;
[0136] A generating module 12 is configured to generate a current read / write operation request corresponding to each current read / write operation;
[0137] The second sending module 13 is configured to send the current read and write operation requests corresponding to the multiple users to the server, so that the server obtains a corresponding file lock with byte-level granularity for each current read and write operation request; the file lock includes a target file range;
[0138] The receiving module 14 is configured to receive the file lock corresponding to each user sent by the server.
[0139] It should be noted that the file lock management device of the distributed file system provided in the embodiment of the present application has the same beneficial effects as the file lock management method of the distributed file system provided in the above embodiment, and for the specific introduction of the file lock management device of the distributed file system involved in the embodiment of the present application, please refer to the above embodiment, and this application will not repeat it here.
[0140] On the basis of the above embodiments, the present application also provides an electronic device, specifically referring to FIG11 , including:
[0141] a memory 20 configured to store computer programs;
[0142] The processor 21 is configured to implement the steps of the above-mentioned file lock management method of the distributed file system when executing the computer program.
[0143] The electronic device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0144] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0145] The memory 20 may include one or more computer non-volatile readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least configured to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the file lock management method of the distributed file system disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include but is not limited to a set offset, etc.
[0146] In some embodiments, the electronic device may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .
[0147] Those skilled in the art will appreciate that the structure shown in FIG11 does not limit the electronic device and may include more or fewer components than shown in the figure.
[0148] It is understandable that if the file lock management method of the distributed file system in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer non-volatile readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a non-volatile readable storage medium and executes all or part of the steps of the various embodiments of the present application. The aforementioned non-volatile readable storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM (Compact Disc Read-Only Memory), magnetic disk or optical disk, etc. Various computer non-volatile readable storage media that can store program code.
[0149] Based on this, as shown in Figure 12, an embodiment of the present application also provides a computer non-volatile readable storage medium, on which a computer program 31 is stored. When the computer program 31 is executed by the processor, the steps of the file lock management method of the distributed file system as described above are implemented.
[0150] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.
[0151] It should also be noted that, in this specification, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
[0152] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0153] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of computer-readable non-volatile storage medium known in the art.
[0154] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A file lock management method for a distributed file system, characterized in that: Applied to the server, including: Obtain the current read and write operation requests corresponding to each of multiple users; For each of the current read / write operation requests, a corresponding byte-level granularity file lock is acquired based on the current read / write operation request; the file lock includes a target file range; The file lock is sent to a current client corresponding to the current read / write operation request.
2. The file lock management method of a distributed file system according to claim 1, characterized in that: Before sending the file lock to the current client corresponding to the current read / write operation request, the method further includes: In the case where the current read-write operation request is a write operation request, determine whether the current read-write operation request conflicts with the read-write operation request of an authorized client; if the current read-write operation request conflicts with the read-write operation request of an authorized client, revoke the authorized file lock corresponding to the authorized client, and after the revocation is completed, execute the step of sending the file lock to the current client corresponding to the current read-write operation request; if the current read-write operation request does not conflict with the read-write operation request of the authorized client, directly execute the step of sending the file lock to the current client corresponding to the current read-write operation request.
3. The file lock management method of a distributed file system according to claim 2, characterized in that: The revoking the authorized file lock corresponding to the authorized client includes: Sending a lock conflict revocation notification to the authorized client; Receiving a lock conflict cancellation response message returned by the authorized client before data is flushed; Revoke the authorized file lock of the authorized client.
4. The file lock management method of a distributed file system according to claim 3, characterized in that: The revoking the authorized file lock of the authorized client includes: The state identifier of the authorized file lock of the authorized client is changed to a revoked state.
5. The file lock management method of a distributed file system according to claim 1, characterized in that: The sending the file lock to the current client corresponding to the current read / write operation request includes: Adding a status identifier to the file lock; The file lock carrying the status identifier is sent to the current client corresponding to the current read / write operation request.
6. The file lock management method of a distributed file system according to claim 5, characterized in that: The state identifier is a reuse identifier or a revocation identifier.
7. The file lock management method of a distributed file system according to claim 1, characterized in that: Before sending the file lock to the current client corresponding to the current read / write operation request, the method further includes: It is determined whether the current read / write operation request conflicts with other read / write operation requests in the request queue, and if the current read / write operation request conflicts with other read / write operation requests in the request queue, a lock cancellation request notification is returned to the current client.
8. The file lock management method of a distributed file system according to claim 1, characterized in that: The acquiring of a corresponding byte-level granularity file lock based on the current read / write operation request includes: Determine the file lock type based on the request type of the current read / write operation request and a preset selection rule; A file lock with byte-level granularity corresponding to the current read / write operation request is acquired based on the file lock type.
9. The file lock management method of a distributed file system according to claim 8, characterized in that: The file lock types include a protection write lock, a blocking write lock, a non-blocking write lock and a protection read lock.
10. The file lock management method of a distributed file system according to claim 9, characterized in that: The determining of the file lock type based on the request type of the current read / write operation request and a preset selection rule includes: When the request type of the current read / write operation request is a read operation, the file lock type is a protection read lock; In a case where the request type of the current read / write operation request is a write operation involving implicit reading, the file lock type is a protection write lock; In a case where the request type of the current read / write operation request is an atomic write operation across multiple resources, the file lock type is a blocking write lock; When the request type of the current read / write operation request is other types, the file lock type is a non-blocking write lock.
11. The file lock management method of a distributed file system according to claim 8, characterized in that: Different file lock types have different levels of restriction.
12. The file lock management method of a distributed file system according to claim 11, characterized in that: After determining the file lock type based on the request type of the current read / write operation request and the preset selection rule, the method further includes: Determine whether the file lock type conflicts with the file lock type of the authorized file lock of the user corresponding to the current client; if the file lock type conflicts with the file lock type of the authorized file lock of the user corresponding to the current client, upgrade the file lock type to a file lock type with a higher restriction level.
13. The file lock management method of a distributed file system according to claim 12, characterized in that: The sending the file lock to the current client corresponding to the current read / write operation request includes: A new file lock corresponding to the upgraded file lock type is sent to the current client so that the current client merges the authorized file lock with the new file lock.
14. The file lock management method of a distributed file system according to claim 11, characterized in that: Before sending the file lock to the current client corresponding to the current read / write operation request, the method further includes: When the file lock type of the file lock is not a non-blocking write lock and there is a conflicting authorized client, the authorized file lock of the conflicting authorized client is downgraded.
15. The file lock management method of a distributed file system according to any one of claims 1 to 14, characterized in that: Before sending the file lock to the current client corresponding to the current read / write operation request, the method includes: Add a sequence number to the file lock.
16. The file lock management method of a distributed file system according to claim 15, characterized in that: The adding a serial number to the file lock comprises: Get the current serial number of the lock resource corresponding to the target file; In a case where the current read / write operation request is a read request operation, assigning the current sequence number to the file lock; In the case that the current read / write operation request is a write request operation, the current sequence number is incremented by one to obtain a new sequence number, and the new sequence number is allocated to the file lock.
17. The file lock management method of a distributed file system according to claim 16, characterized in that: After sending the file lock to the current client corresponding to the current read / write operation request, the method further includes: The file lock is added to the cache of the current client.
18. A file lock management method for a distributed file system, characterized in that: Applied to the client, including: Responding to current read and write operations of multiple users; Generate a current read / write operation request corresponding to each current read / write operation; Sending current read / write operation requests corresponding to each of the plurality of users to the server, so that the server obtains a corresponding file lock at byte level granularity for each current read / write operation request; the file lock includes a target file range; Receive the file lock corresponding to each of the users sent by the server.
19. An electronic device, characterized in that: include: a memory configured to store a computer program; A processor configured to implement the steps of the file lock management method for a distributed file system as described in any one of claims 1 to 17 when executing the computer program; or to implement the steps of the file lock management method for a distributed file system as described in claim 18 when executing the computer program.
20. A computer non-volatile readable storage medium, characterized in that: A computer program is stored on the computer non-volatile readable storage medium, and when the computer program is executed by the processor, the steps of the file lock management method of the distributed file system as described in any one of claims 1 to 17 are implemented; or when the computer program is executed, the steps of the file lock management method of the distributed file system as described in claim 18 are implemented.
Citation Information
Patent Citations
Method, equipment and system for resource synchronization control
CN103716350A
A method and a device for realizing data consistency in a distributed file system
CN109582658A
User mode network file system file lock method, device and equipment
CN109684285A
File lock management method and device of distributed file system and medium
CN115951844A
Lock management for concurrent access to a single file from multiple data mover computers
US20060064554A1
Cited By
File lock management method and device for distributed file system, equipment and medium
CN121705253A
