CN111274214A - File lock processing method and device, electronic equipment and storage medium - Google Patents
File lock processing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111274214A CN111274214A CN202010105189.6A CN202010105189A CN111274214A CN 111274214 A CN111274214 A CN 111274214A CN 202010105189 A CN202010105189 A CN 202010105189A CN 111274214 A CN111274214 A CN 111274214A
- Authority
- CN
- China
- Prior art keywords
- file
- lock
- request
- blocking
- file lock
- 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.)
- Granted
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 31
- 230000000903 blocking effect Effects 0.000 claims abstract description 156
- 238000000034 method Methods 0.000 claims abstract description 28
- 238000012545 processing Methods 0.000 claims abstract description 14
- 230000000977 initiatory effect Effects 0.000 claims abstract description 11
- 230000008569 process Effects 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 5
- 230000005236 sound signal Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/176—Support for shared access to files; File sharing support
- G06F16/1767—Concurrency control, e.g. optimistic or pessimistic approaches
- G06F16/1774—Locking methods, e.g. locking methods for file systems allowing shared and concurrent access to files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
- G06F16/1824—Distributed file systems implemented using Network-attached Storage [NAS] architecture
- G06F16/183—Provision of network file services by network file servers, e.g. by using NFS, CIFS
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/52—Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F9/524—Deadlock detection or avoidance
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Storage Device Security (AREA)
Abstract
The application discloses a file lock processing method, a file lock processing device, an electronic device and a computer readable storage medium, wherein the method comprises the following steps: acquiring a blocking lock linked list of a target file system; the blocking lock linked list comprises all file lock requests of a target file system which are currently suspended; judging whether the target file system supports asynchronous blocking locks or not; if not, determining a file lock state corresponding to each file lock request according to the request type of each file lock request; the file lock state comprises a non-blocking lock state and a polling blocking lock state; and returning a blocking state to the client initiating the target file lock request so that the client initiates the target file lock request at preset time intervals until the target file lock request is responded by the server, wherein the target file lock request is a file lock request of which the file lock state is a polling blocking lock state. The file lock processing method improves maintainability of file lock management in a file system.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a file lock processing method and apparatus, an electronic device, and a computer-readable storage medium.
Background
In the mass storage service, the requirements of users on the transmission performance and stability of data are higher and higher, a storage server has a large number of clients, a plurality of clients access the server file at the same time, file conflict is inevitable, and the mutual cooperation of the clients and the guarantee of the file data consistency become the key points of the attention of software users and developers.
The file lock is a mechanism for realizing file synchronization in a multi-task operation scene, so that the consistency of file data is ensured, conflict is prevented, if one process attempts to write a file which is being read by other processes, the process which is performing read operation may read some damaged or incomplete data, and if two processes concurrently perform write operation on the same file, the file may be damaged. Therefore, in order to avoid such a problem, some mechanism must be adopted to solve the synchronization problem when multiple processes concurrently access the same file, thereby creating a file locking technique.
Asynchronous blocking of locks means that a client initiates a lock request, a current thread is suspended, and if a file is occupied, waiting is performed until a Granged message is sent to the client sending the lock request when a call returns, so as to authorize the lock. In the application scenario of the distributed file system, if the file system does not support asynchronous blocking locks, the client side waits all the time, and the maintainability of the file locks is poor.
Therefore, how to improve the maintainability of file locks in a file system is a technical problem to be solved by those skilled in the art.
Disclosure of Invention
The present application aims to provide a file lock processing method, a file lock processing apparatus, an electronic device, and a computer-readable storage medium, which improve maintainability of a file lock in a file system.
In order to achieve the above object, the present application provides a file lock processing method, applied to a server, including:
acquiring a blocking lock linked list of the target file system; wherein the blocking lock linked list comprises all file lock requests that the target file system is currently suspended;
judging whether the target file system supports asynchronous blocking locks or not;
if not, determining a file lock state corresponding to each file lock request according to the request type of each file lock request; wherein the file lock state comprises a non-blocking lock state and a polling blocking lock state;
and returning a blocking state to a client initiating a target file lock request so that the client initiates the target file lock request at preset time intervals until the target file lock request is responded by the server, wherein the target file lock request is a file lock request of which the file lock state is the polling blocking lock state.
Wherein the obtaining of the blocking lock linked list of the target file system includes:
when a file lock request of a target client to a target file in the target file system is received, a blocking lock linked list of the target file system is obtained.
Wherein, still include:
when the target file system supports asynchronous blocking lock, if the file lock request is a read request for the target file, determining a file lock state corresponding to the file lock request as the non-blocking lock state; and if the file lock request comprises a write request for the target file, determining the file lock state corresponding to the file lock request as an asynchronous blocking lock state.
Wherein the obtaining of the blocking lock linked list of the target file system includes:
and acquiring the blocking lock linked list of the target file system at preset time intervals.
Wherein, the determining the file lock state corresponding to each file lock request according to the request type of each file lock request includes:
if the file lock request is a read request for the target file, determining a file lock state corresponding to the file lock request as the non-blocking lock state;
and if the file lock request comprises a write request for the target file, determining the file lock state corresponding to the file lock request as the polling blocking lock state.
Wherein, the determining the file lock state corresponding to each file lock request according to the request type of each file lock request includes:
and creating a thread pool, and traversing the blocking lock linked list by using a target thread in the thread pool so as to determine a file lock state corresponding to each file lock request in the blocking lock linked list according to the request type of each file lock request.
In order to achieve the above object, the present application provides a file lock processing apparatus, including:
the acquisition module is used for acquiring a blocking lock linked list of the target file system; wherein the blocking lock linked list comprises all file lock requests that the target file system is currently suspended;
the judging module is used for judging whether the target file system supports asynchronous blocking locks or not; if not, starting the working process of the first determination module;
the first determining module is configured to determine a file lock state corresponding to each file lock request according to a request type of each file lock request; wherein the file lock state comprises a non-blocking lock state and a polling blocking lock state;
and the return module is used for returning a blocking state to the client side which initiates the target file lock request so that the client side initiates the target file lock request at preset time intervals until the target file lock request is responded by the server, wherein the target file lock request is the file lock request of which the file lock state is the polling blocking lock state.
The obtaining module is specifically a module for obtaining a blocking lock linked list of the target file system when receiving a file lock request of a target client to a target file in the target file system.
To achieve the above object, the present application provides an electronic device including:
a memory for storing a computer program;
and the processor is used for realizing the steps of the file lock processing method when executing the computer program.
To achieve the above object, the present application provides a computer-readable storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the file lock processing method as described above.
According to the scheme, the file lock processing method provided by the application comprises the following steps: acquiring a blocking lock linked list of the target file system; wherein the blocking lock linked list comprises all file lock requests that the target file system is currently suspended; judging whether the target file system supports asynchronous blocking locks or not; if not, determining a file lock state corresponding to each file lock request according to the request type of each file lock request; wherein the file lock state comprises a non-blocking lock state and a polling blocking lock state; and returning a blocking state to a client initiating a target file lock request so that the client initiates the target file lock request at preset time intervals until the target file lock request is responded by the server, wherein the target file lock request is a file lock request of which the file lock state is the polling blocking lock state.
According to the file lock processing method, when the target file system does not support asynchronous blocking locks, the corresponding file lock state is determined based on the request type of each file lock request, and identification of the file lock state of all file lock requests in the blocking lock linked list is achieved. And returning the blocking state to the client initiating the file lock request in the polling blocking lock state, and after receiving the blocking state, the client reinitiating the file lock request at preset intervals until the file lock request is responded by the server. Therefore, the file lock processing method provided by the application improves the maintainability of file lock management in a file system and ensures that the files have high consistency in concurrent services by identifying the file lock state. The application also discloses a file lock processing device, an electronic device and a computer readable storage medium, and the technical effects can be realized.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
FIG. 1 is a flowchart illustrating a file lock processing method in accordance with an exemplary embodiment;
FIG. 2 is a flow diagram illustrating another file lock processing method in accordance with an illustrative embodiment;
fig. 3 is an architecture diagram of a NFS-Ganesha file lock request processing flow;
FIG. 4 is a process flow diagram of a method for identifying asynchronously blocking file locks by polling
FIG. 5 is a block diagram illustrating a file lock handling device in accordance with an exemplary embodiment;
FIG. 6 is a block diagram illustrating an electronic device in accordance with an exemplary embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application discloses a file lock processing method, which improves maintainability of file locks in a file system.
Referring to fig. 1, a flowchart of a file lock processing method according to an exemplary embodiment is shown, as shown in fig. 1, including:
s101: acquiring a blocking lock linked list of the target file system; wherein the blocking lock linked list comprises all file lock requests that the target file system is currently suspended;
the target file system in this embodiment is a distributed file system, for example, an NFS-Ganesha user-mode network file system, and may manage millions of data caches, thereby avoiding the problem of blocking of a bottom-layer file system. NFS-Ganesha can interface with various underlying distributed File systems, the abstract layer of the FSAL (File System abstract layer) File System is a very important module, the FSAL itself provides a general interface for the Inode Cache and the File ContentCache, and a specific FSAL, such as a Virtual File System (VFS), a distributed File System, etc., can be called after receiving a request.
In the specific implementation, when a file lock request of a client to a certain file in a target file system is received, and when the file has a file lock and the file lock is in a non-blocking lock state, the file lock request is suspended, that is, the file lock request is added into a blocking lock linked list. That is, the blocking lock linked list of the target file system stores all file lock requests that are currently pending.
It should be noted that, this embodiment does not limit the trigger condition in this step, for example, when a file lock request of a target client for a target file in the target file system is received, a blocking lock linked list of the target file system is obtained. For another example, the blocking lock linked list of the target file system is obtained at preset time intervals.
S102: judging whether the target file system supports asynchronous blocking locks or not; if not, the step S103 is entered;
when the target file system supports asynchronous blocking lock, if the file requested by the client side has a file lock and the file lock is in a non-blocking lock state, directly responding to the file lock request of the client side, and otherwise, marking the blocking lock state of the file lock request in an asynchronous blocking lock state. Asynchronous blocking of locks means that a client initiates a lock request, a current thread is suspended, and if a file is occupied, waiting is performed until a Granged message is sent to the client sending the lock request when a call returns, so as to authorize the lock.
S103: determining a file lock state corresponding to each file lock request according to the request type of each file lock request; wherein the file lock state comprises a non-blocking lock state and a polling blocking lock state;
when the target file system does not support asynchronous blocking locks, the corresponding file lock state can be determined according to the request type of the file lock request. The file lock state comprises a non-blocking lock state and a polling blocking lock state, the non-blocking lock state means that the client initiates a lock request, the current thread cannot be suspended, the next call is immediately returned to be executed, and if the file is occupied, the next call is immediately returned. The blocking lock state means that the NFS client initiates a lock request, the current thread is suspended, and if the file is occupied, the NFS client waits. Polling the blocked lock state refers to the client initiating a lock request at preset intervals until the lock request is responded to.
In this step, a blocking lock polling function may be defined, and first, a common entity is created to identify four blocking lock STATEs, including an unblocking lock STATE _ BLOCK _ NONE, a blocking lock STATE _ BLOCK _ interval, an asynchronous blocking lock STATE _ BLOCK _ ASYNC, and a polling blocking lock STATE _ BLOCK _ POLL. The concrete structure is as follows:
as a preferred embodiment, the present step comprises: and creating a thread pool, and traversing the blocking lock linked list by using a target thread in the thread pool so as to determine a file lock state corresponding to each file lock request in the blocking lock linked list according to the request type of each file lock request. In the specific implementation, a polling thread is established, a thread pool is initialized, thread parameters are set, in a polling scene, in order to avoid system resource waste, the maximum/minimum number of threads in the thread pool is set to be 1, the time interval of the polling thread is set, and the calling rule of the polling thread processing process is set. The time interval of the polling thread is a thread time interval variable, ranges from 0 to 180s, and polls once by default for 10 s. The polling thread call rule refers to the polling thread looping blocking the lock polling function. The function of the BLOCK lock polling function is to POLL all BLOCK locks of type STATE _ BLOCK _ POLL and circularly traverse the BLOCK locks of type STATE _ BLOCK _ POLL in the double-linked list of STATE BLOCK locks.
S104: and returning a blocking state to a client initiating a target file lock request so that the client initiates the target file lock request at preset time intervals until the target file lock request is responded by the server, wherein the target file lock request is a file lock request of which the file lock state is the polling blocking lock state.
In this step, the blocking state is returned to the client initiating the file lock request polling the blocking lock state, and the client re-initiates the file lock request every preset time after receiving the blocking state until the file lock request is responded by the server. Therefore, when the file system does not support asynchronous blocking lock and the client initiates an asynchronous blocking lock request, the return state is marked as a blocking state, so that the file lock state is not clearly identified and confused under the condition of file lock conflict, and the file lock state is prevented from being misjudged.
According to the file lock processing method provided by the embodiment of the application, when the target file system does not support asynchronous blocking locks, the corresponding file lock state is determined based on the request type of each file lock request, and the file lock state identification of all file lock requests in the blocking lock linked list is realized. And returning the blocking state to the client initiating the file lock request in the polling blocking lock state, and after receiving the blocking state, the client reinitiating the file lock request at preset intervals until the file lock request is responded by the server. Therefore, the file lock processing method provided by the embodiment of the application improves maintainability of file lock management in a file system and ensures high consistency of files in concurrent services by identifying the file lock state.
The embodiment of the application discloses a file lock processing method, and compared with the previous embodiment, the embodiment further explains and optimizes the technical scheme. Specifically, the method comprises the following steps:
referring to fig. 2, a flowchart of another file lock processing method according to an exemplary embodiment is shown, and as shown in fig. 2, includes:
s201: when a file lock request of a target client to a target file in the target file system is received, acquiring a blocking lock linked list of the target file system;
s202: judging whether the target file system supports asynchronous blocking locks or not; if yes, entering S203; if not, entering S204;
s203: if the file lock request is a read request for the target file, determining a file lock state corresponding to the file lock request as the non-blocking lock state; if the file lock request comprises a write request for the target file, determining a file lock state corresponding to the file lock request as an asynchronous blocking lock state;
s204: creating a thread pool, and traversing the blocking lock linked list by using a target thread in the thread pool;
s205: if the file lock request is a read request for the target file, determining a file lock state corresponding to the file lock request as the non-blocking lock state; and if the file lock request comprises a write request for the target file, determining the file lock state corresponding to the file lock request as the polling blocking lock state.
In a specific implementation, if a client requests a write request of a target file, an exclusive lock needs to be allocated to the client because the target file needs to be modified. If the target file has exclusive locks of other clients, the file lock state corresponding to the file lock request needs to be marked as a polling blocking lock state, so that the client polls and sends the file lock request in the subsequent steps until the client is responded.
S206: and returning a blocking state to the client initiating the target file lock request so that the client initiates the target file lock request at preset time intervals until the target file lock request is responded by the server.
Therefore, the construction thread of the embodiment polls the blocking lock linked list, realizes the marking of the file lock state of the file lock request, improves the maintainability of the file lock management in the network file system, and ensures the high consistency of the files in the concurrent service.
An application embodiment provided by the present application is described below, specifically, fig. 3 is an architecture diagram of a processing flow of an NFS-Ganesha file lock request, and fig. 4 is a processing flow of a method for identifying an asynchronous blocking file lock in a polling manner.
And for the condition that different clients initiate read operation on the same file in sequence, the NFS file lock request is defined as a shared read lock, and the file lock state of the file lock request is marked as a non-blocking lock state because the clients do not perform write operation.
For the condition that different clients initiate write operation on the same file in sequence, the NFS file lock request is defined as exclusive write lock, because operations such as modification are performed on the file, the NFS file lock request belongs to a blocking lock, when one client has the write lock, the other client waits, and is in a blocking state, and after receiving a blocking instruction, the server performs two processes: the first is that the bottom distributed file system supports asynchronous blocking lock, when the first client releases the lock, the server side informs the client to release the lock actively, and the second client in the blocking state can be authorized to lock. The second is that when the distributed file system does not support asynchronous blocking lock, the server side performs polling, and the client side passively waits for authorization, so as to realize the asynchronous blocking function of multiple client sides.
For the case that different clients initiate read and write operations on the same file in sequence, the exclusive lock is also included because the write operation is included, which is similar to the above case and is not described herein again. For the condition that different clients initiate read and write operations on different files in sequence, the operations on different files are not affected mutually.
In the following, a file lock processing apparatus provided in an embodiment of the present application is introduced, and a file lock processing apparatus described below and a file lock processing method described above may be referred to each other.
Referring to fig. 5, a block diagram of a file lock handling device according to an exemplary embodiment is shown, as shown in fig. 5, including:
an obtaining module 501, configured to obtain a blocking lock linked list of the target file system; wherein the blocking lock linked list comprises all file lock requests that the target file system is currently suspended;
a judging module 502, configured to judge whether the target file system supports an asynchronous blocking lock; if not, the work flow of the first determining module 503 is started;
the first determining module 503 is configured to determine, according to the request type of each file lock request, a file lock state corresponding to each file lock request; wherein the file lock state comprises a non-blocking lock state and a polling blocking lock state;
a returning module 504, configured to return a blocking status to a client that initiates a target file lock request, so that the client initiates the target file lock request every preset time until the target file lock request is responded by the server, where the target file lock request is a file lock request whose file lock status is the polling blocking lock status.
According to the file lock processing device provided by the embodiment of the application, when the target file system does not support asynchronous blocking locks, the corresponding file lock state is determined based on the request type of each file lock request, and the file lock state identification of all file lock requests in the blocking lock linked list is realized. And returning the blocking state to the client initiating the file lock request in the polling blocking lock state, and after receiving the blocking state, the client reinitiating the file lock request at preset intervals until the file lock request is responded by the server. Therefore, the file lock processing device provided by the embodiment of the application improves maintainability of file lock management in a file system and ensures high consistency of files in concurrent services by identifying the file lock state.
On the basis of the foregoing embodiment, as a preferred implementation manner, the obtaining module 501 is specifically a module that obtains a blocking lock linked list of a target file system when receiving a file lock request of a target client to a target file in the target file system.
On the basis of the above embodiment, as a preferred implementation, the method further includes:
a second determining module, configured to determine, when the target file system supports an asynchronous blocking lock, a file lock state corresponding to the file lock request as the non-blocking lock state if the file lock request is a read request for the target file; and if the file lock request comprises a write request for the target file, determining the file lock state corresponding to the file lock request as an asynchronous blocking lock state.
On the basis of the foregoing embodiment, as a preferred implementation manner, the obtaining module 501 is specifically a module that obtains the blocking lock linked list of the target file system at preset time intervals.
On the basis of the foregoing embodiment, as a preferred implementation, the first determining module 503 includes:
a first determining unit, configured to determine, if the file lock request is a read request for the target file, a file lock state corresponding to the file lock request as the non-blocking lock state;
a second determining unit, configured to determine, if the file lock request includes a write request for the target file, a file lock state corresponding to the file lock request as the polling blocking lock state.
On the basis of the foregoing embodiment, as a preferred implementation manner, the first determining module 503 is specifically a module that creates a thread pool, and traverses the blocking lock linked list by using a target thread in the thread pool, so as to determine a file lock state corresponding to each file lock request in the blocking lock linked list according to a request type of each file lock request.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The present application further provides an electronic device, and referring to fig. 6, a structure diagram of an electronic device 600 provided in an embodiment of the present application may include a processor 11 and a memory 12, as shown in fig. 6. The electronic device 600 may also include one or more of a multimedia component 13, an input/output (I/O) interface 14, and a communication component 15.
The processor 11 is configured to control the overall operation of the electronic device 600, so as to complete all or part of the steps in the file lock processing method. The memory 12 is used to store various types of data to support operation at the electronic device 600, such as instructions for any application or method operating on the electronic device 600 and application-related data, such as contact data, transmitted and received messages, pictures, audio, video, and so forth. The Memory 12 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The multimedia component 13 may include a screen and an audio component. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 12 or transmitted via the communication component 15. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 14 provides an interface between the processor 11 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication module 15 is used for wired or wireless communication between the electronic device 600 and other devices. Wireless communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so that the corresponding communication component 15 may include: Wi-Fi module, bluetooth module, NFC module.
In an exemplary embodiment, the electronic Device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the file lock Processing method described above.
In another exemplary embodiment, there is also provided a computer readable storage medium including program instructions which, when executed by a processor, implement the steps of the file lock processing method described above. For example, the computer readable storage medium may be the memory 12 described above including program instructions that are executable by the processor 11 of the electronic device 600 to perform the file lock processing method described above.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Claims (10)
1. A file lock processing method is applied to a server and comprises the following steps:
acquiring a blocking lock linked list of the target file system; wherein the blocking lock linked list comprises all file lock requests that the target file system is currently suspended;
judging whether the target file system supports asynchronous blocking locks or not;
if not, determining a file lock state corresponding to each file lock request according to the request type of each file lock request; wherein the file lock state comprises a non-blocking lock state and a polling blocking lock state;
and returning a blocking state to a client initiating a target file lock request so that the client initiates the target file lock request at preset time intervals until the target file lock request is responded by the server, wherein the target file lock request is a file lock request of which the file lock state is the polling blocking lock state.
2. The file lock processing method according to claim 1, wherein the obtaining the blocking lock linked list of the target file system comprises:
when a file lock request of a target client to a target file in the target file system is received, a blocking lock linked list of the target file system is obtained.
3. The file lock processing method according to claim 2, further comprising:
when the target file system supports asynchronous blocking lock, if the file lock request is a read request for the target file, determining a file lock state corresponding to the file lock request as the non-blocking lock state; and if the file lock request comprises a write request for the target file, determining the file lock state corresponding to the file lock request as an asynchronous blocking lock state.
4. The file lock processing method according to claim 1, wherein the obtaining the blocking lock linked list of the target file system comprises:
and acquiring the blocking lock linked list of the target file system at preset time intervals.
5. The method according to claim 2, wherein the determining the file lock status corresponding to each file lock request according to the request type of each file lock request comprises:
if the file lock request is a read request for the target file, determining a file lock state corresponding to the file lock request as the non-blocking lock state;
and if the file lock request comprises a write request for the target file, determining the file lock state corresponding to the file lock request as the polling blocking lock state.
6. The method according to claim 1, wherein the determining the file lock status corresponding to each file lock request according to the request type of each file lock request comprises:
and creating a thread pool, and traversing the blocking lock linked list by using a target thread in the thread pool so as to determine a file lock state corresponding to each file lock request in the blocking lock linked list according to the request type of each file lock request.
7. A file lock processing device is applied to a server and comprises:
the acquisition module is used for acquiring a blocking lock linked list of the target file system; wherein the blocking lock linked list comprises all file lock requests that the target file system is currently suspended;
the judging module is used for judging whether the target file system supports asynchronous blocking locks or not; if not, starting the working process of the first determination module;
the first determining module is configured to determine a file lock state corresponding to each file lock request according to a request type of each file lock request; wherein the file lock state comprises a non-blocking lock state and a polling blocking lock state;
and the return module is used for returning a blocking state to the client side which initiates the target file lock request so that the client side initiates the target file lock request at preset time intervals until the target file lock request is responded by the server, wherein the target file lock request is the file lock request of which the file lock state is the polling blocking lock state.
8. The apparatus according to claim 7, wherein the obtaining module is specifically a module that obtains the blocking lock linked list of the target file system when receiving a file lock request from a target client for a target file in the target file system.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the file lock processing method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the file lock processing method according to any one of claims 1 to 6.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010105189.6A CN111274214B (en) | 2020-02-20 | 2020-02-20 | File lock processing method and device, electronic equipment and storage medium |
PCT/CN2020/098005 WO2021164165A1 (en) | 2020-02-20 | 2020-06-24 | File lock processing method and apparatus, electronic device, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010105189.6A CN111274214B (en) | 2020-02-20 | 2020-02-20 | File lock processing method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111274214A true CN111274214A (en) | 2020-06-12 |
CN111274214B CN111274214B (en) | 2022-08-16 |
Family
ID=71002200
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010105189.6A Active CN111274214B (en) | 2020-02-20 | 2020-02-20 | File lock processing method and device, electronic equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111274214B (en) |
WO (1) | WO2021164165A1 (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112130936A (en) * | 2020-09-23 | 2020-12-25 | 平安科技(深圳)有限公司 | Polling-based data calling method, device, equipment and storage medium |
WO2021164165A1 (en) * | 2020-02-20 | 2021-08-26 | 苏州浪潮智能科技有限公司 | File lock processing method and apparatus, electronic device, and storage medium |
CN114116639A (en) * | 2022-01-27 | 2022-03-01 | 苏州浪潮智能科技有限公司 | Method, device, equipment and medium for setting cluster file lock |
CN115934743A (en) * | 2023-03-13 | 2023-04-07 | 浪潮电子信息产业股份有限公司 | File lock management method, system, equipment and computer readable storage medium |
CN115951844A (en) * | 2023-03-13 | 2023-04-11 | 浪潮电子信息产业股份有限公司 | File lock management method, device and medium for distributed file system |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117407182B (en) * | 2023-12-14 | 2024-03-12 | 沐曦集成电路(南京)有限公司 | Process synchronization method, system, equipment and medium based on Poll instruction |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107423454A (en) * | 2017-09-22 | 2017-12-01 | 郑州云海信息技术有限公司 | The processing method of file lock, device and equipment in a kind of distributed file system |
CN109684285A (en) * | 2018-12-13 | 2019-04-26 | 郑州云海信息技术有限公司 | A kind of User space Network File System file lock method, device and equipment |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6925515B2 (en) * | 2001-05-07 | 2005-08-02 | International Business Machines Corporation | Producer/consumer locking system for efficient replication of file data |
US7743039B2 (en) * | 2006-12-11 | 2010-06-22 | Simdesk Technologies, Inc. | File operations with multiple level file locking techniques |
CN107423403A (en) * | 2017-07-27 | 2017-12-01 | 郑州云海信息技术有限公司 | A kind of fusion lock management method and system based on distributed file system |
CN111274214B (en) * | 2020-02-20 | 2022-08-16 | 苏州浪潮智能科技有限公司 | File lock processing method and device, electronic equipment and storage medium |
-
2020
- 2020-02-20 CN CN202010105189.6A patent/CN111274214B/en active Active
- 2020-06-24 WO PCT/CN2020/098005 patent/WO2021164165A1/en active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107423454A (en) * | 2017-09-22 | 2017-12-01 | 郑州云海信息技术有限公司 | The processing method of file lock, device and equipment in a kind of distributed file system |
CN109684285A (en) * | 2018-12-13 | 2019-04-26 | 郑州云海信息技术有限公司 | A kind of User space Network File System file lock method, device and equipment |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021164165A1 (en) * | 2020-02-20 | 2021-08-26 | 苏州浪潮智能科技有限公司 | File lock processing method and apparatus, electronic device, and storage medium |
CN112130936A (en) * | 2020-09-23 | 2020-12-25 | 平安科技(深圳)有限公司 | Polling-based data calling method, device, equipment and storage medium |
CN112130936B (en) * | 2020-09-23 | 2023-12-19 | 平安科技(深圳)有限公司 | Data calling method, device, equipment and storage medium based on polling |
CN114116639A (en) * | 2022-01-27 | 2022-03-01 | 苏州浪潮智能科技有限公司 | Method, device, equipment and medium for setting cluster file lock |
CN115934743A (en) * | 2023-03-13 | 2023-04-07 | 浪潮电子信息产业股份有限公司 | File lock management method, system, equipment and computer readable storage medium |
CN115951844A (en) * | 2023-03-13 | 2023-04-11 | 浪潮电子信息产业股份有限公司 | File lock management method, device and medium for distributed file system |
CN115934743B (en) * | 2023-03-13 | 2023-06-02 | 浪潮电子信息产业股份有限公司 | File lock management method, system, equipment and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111274214B (en) | 2022-08-16 |
WO2021164165A1 (en) | 2021-08-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111274214B (en) | File lock processing method and device, electronic equipment and storage medium | |
CN111756811B (en) | Method, system, device and medium for actively pushing distributed system | |
CN108897628B (en) | Method and device for realizing distributed lock and electronic equipment | |
CA3026781C (en) | A method for tee access control and a mobile terminal for implementing the method | |
WO2019134402A1 (en) | Equipment control method, cluster system, electronic device and readable storage medium | |
CN111258723B (en) | Transaction processing method, device, system, medium and equipment of distributed system | |
CN113094378B (en) | Data processing method, device, electronic equipment and storage medium | |
CN111478781B (en) | Message broadcasting method and device | |
CN109657485B (en) | Authority processing method and device, terminal equipment and storage medium | |
CN110727507B (en) | Message processing method and device, computer equipment and storage medium | |
CN112953815B (en) | Information access control method, device, equipment and storage medium | |
US20220215106A1 (en) | Restricting access to application functionality based upon working status | |
CN112306695A (en) | Data processing method and device, electronic equipment and computer storage medium | |
CN113010238A (en) | Permission determination method, device and system for micro application call interface | |
CN116723242A (en) | Network request cache retransmission method, device, equipment and storage medium | |
CN114374657B (en) | Data processing method and device | |
CN112019452B (en) | Method, system and related device for processing service requirement | |
CN113368494A (en) | Cloud equipment distribution method and device, electronic equipment and storage medium | |
CN113626176A (en) | Service request processing method and device | |
US20140280347A1 (en) | Managing Digital Files with Shared Locks | |
CN110839085A (en) | Instruction management method, instruction management device, electronic equipment and storage medium | |
CN113271229B (en) | Equipment control method and device, storage equipment, safety equipment, switch, router and server | |
CN113873052B (en) | Domain name resolution method, device and equipment of Kubernetes cluster | |
CN114077639B (en) | Data writing method, device, electronic equipment and storage medium | |
CN112804279A (en) | Request processing method and device |
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 |