A file processing method and apparatus

By introducing a file state management mechanism into ZFS, a locking state and expiration time mechanism are implemented, which solves the problem that WORM technology cannot be implemented in ZFS, and ensures the security and integrity of data within a specified time.

CN116010355BActive Publication Date: 2026-07-21MACROSAN TECH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MACROSAN TECH
Filing Date
2023-01-16
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

The existing dynamic file system ZFS does not implement the Write-once-Read-Many (WORM) technology, and therefore cannot effectively protect the security and integrity of important data within a specified time.

Method used

ZFS introduces a file state management mechanism, which uses a locking state and lock expiration time mechanism to ensure that a file can only be read after it has been written, and cannot be modified or deleted until the lock expires.

Benefits of technology

It implements the Write-once-Read-Many (WORM) function in ZFS to ensure that important data is not tampered with within a specified time, thus meeting the requirements for secure data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116010355B_ABST
    Figure CN116010355B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a file processing method and device, in the embodiment of the present application, when a file processing interface of a file system receives a file processing request, the file state of a target file needs to be judged first, and then whether the file processing request is executed is determined according to the file state. And by setting the target file to a locked state, the target file can only be read, and cannot be deleted or modified, so that the WORM technology of one write and multiple reads is realized in ZFS. And by setting the lock expiration time for the target file in the locked state, when the lock expiration time is reached, the locked state of the target file is cancelled. This realizes the protection of the data in the target file from being tampered with within a fixed time period when the target file is in the locked state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to document processing technology, and in particular to a document processing method and apparatus. Background Technology

[0002] The dynamic file system ZFS (Zettabyte File System) has advantages such as storage pool design, large capacity, COW transaction model, end-to-end data security (RAIDZ, checksum verification, multi-replica data redundancy), efficient snapshot function, adaptive byte order function (nvlist), efficient cache management, variable block size, and data deduplication.

[0003] However, with the advancement of science and technology and social development, information is growing explosively, and the issue of secure access to and application of data is gradually gaining attention. For example, medical data and financial securities data are important data that, according to legal regulations, can only be read and not modified within a specified time period. Therefore, it is necessary to protect such data from tampering.

[0004] WORM (Write Once Read Many) refers to a technology that allows data to be written once and read many times. Once a file is written, it can be set to read-only mode, meaning it can only be read and cannot be deleted, modified, or renamed. By using WORM technology to protect stored data, it prevents accidental modification, thus ensuring the secure storage of important business data for enterprises or organizations. However, ZFS does not implement WORM technology. Summary of the Invention

[0005] In view of this, this application provides a file processing method and apparatus to implement WORM technology in ZFS and protect the security of data in the file system.

[0006] The technical solutions provided in the embodiments of this application include:

[0007] A file processing method applied to the dynamic file system ZFS, the method comprising:

[0008] Receive file processing information and determine the target file based on the file identifier in the file processing information;

[0009] When the instruction in the file processing information is a lock instruction, determine whether the target file is in a write state;

[0010] If confirmed, the target file's file status is set to locked, preventing deletion or modification of the target file when file processing information containing deletion or write instructions is received.

[0011] Optionally, setting the file status of the target file to a locked state includes:

[0012] The lock expiration time of the target file is determined by the preset lock duration and the current system time. If the lock expiration time has not been reached, the target file is set to a locked state.

[0013] When the lock expires, the lock status of the target file is released.

[0014] Optionally, the inability to delete or modify the target file upon receiving file processing information containing deletion or write instructions includes:

[0015] When a file operation request containing a write instruction is received, it is determined whether the target file is locked. If it is, the write instruction is not executed.

[0016] When a file operation request containing a deletion command is received, it is determined whether the target file is locked. If so, the deletion command is not executed.

[0017] Optionally, the method further includes:

[0018] When the instruction in the file processing information is a file creation instruction, the file creation instruction is executed to create the target file, and the state of the target file is set to the initial state.

[0019] Optionally, the method further includes:

[0020] If setting the target file to its initial state fails, then the target file is deleted.

[0021] Optionally, the method further includes:

[0022] When the instruction in the file processing information is a file open instruction, and the target file is in a locked state, the lock expiration time of the target file is obtained and compared with the current system time;

[0023] If the current system time is less than the lock expiration time, then the file open command is executed to open the target file;

[0024] If the current system time is greater than the lock expiration time, then the status of the target file is changed to expired.

[0025] When the instruction in the file processing information is a file open instruction, and the target file is in an unlocked state, the file open instruction is executed to open the target file.

[0026] This application embodiment also provides a file processing apparatus applied to the dynamic file system ZFS, the apparatus comprising:

[0027] Receiving unit: Used to receive file processing information and determine the target file based on the file identifier in the file processing information;

[0028] Determining unit: used to determine whether the target file is in a write state when the instruction in the file processing information is a lock instruction;

[0029] Locking unit: When it is determined that the instruction in the file processing information is a locking instruction, the file status of the target file is set to a locked state, so that when file processing information containing deletion or write instructions is received, the target file cannot be deleted or modified.

[0030] Optionally, the locking unit sets the file status of the target file to a locked state by:

[0031] The lock expiration time of the target file is determined by the preset lock duration and the current system time. If the lock expiration time has not been reached, the target file is set to a locked state.

[0032] When the lock expires, the lock status of the target file is released.

[0033] Optionally, the locking unit prevents the target file from being deleted or modified when file processing information containing deletion or write instructions is received, including:

[0034] When a file operation request containing a write instruction is received, it is determined whether the target file is locked. If it is, the write instruction is not executed.

[0035] When a file operation request containing a deletion command is received, it is determined whether the target file is locked. If so, the deletion command is not executed.

[0036] Optionally, the device further includes:

[0037] The creation unit is configured to execute the file creation instruction to create a target file when the instruction in the file processing information is a file creation instruction, and to set the state of the target file to an initial state.

[0038] Optionally, the device further includes:

[0039] The opening unit is used to compare the lock expiration time of the target file with the current system time when the instruction in the file processing information is a file opening instruction and the target file is in a locked state.

[0040] If the current system time is less than the lock expiration time, then the file open command is executed to open the target file;

[0041] If the current system time is greater than the lock expiration time, then the status of the target file is changed to expired.

[0042] When the instruction in the file processing information is a file open instruction, and the target file is in an unlocked state, the file open instruction is executed to open the target file.

[0043] As can be seen from the above technical solutions, in this application, when the file processing interface in the ZFS dynamic file system receives a file processing request, it needs to first determine the file status of the target file, and then determine whether to execute the file processing request based on the file status. Furthermore, by setting the target file to a locked state, making it readable only and not deletable or modifiable, the Write-once-Read-many (WORM) technology is implemented in ZFS.

[0044] Furthermore, this application sets a lock expiration time for a locked target file, and when the lock expiration time is reached, the lock status of the target file is lifted. This achieves the protection of the data in the target file from tampering during a fixed period when the target file is locked, thus completing the data filing and archiving. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings.

[0046] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0047] Figure 1 A flowchart illustrating the method provided in this application embodiment;

[0048] Figure 2 A flowchart of the write interface provided in this application embodiment;

[0049] Figure 3 A flowchart of the deletion interface provided in this application embodiment;

[0050] Figure 4 A flowchart of the interface opening provided in this application embodiment;

[0051] Figure 5 This is a structural diagram of the device provided in the embodiments of this application;

[0052] Figure 6 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0053] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0054] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0055] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various devices, this information should not be limited to these terms. These terms are only used to distinguish devices of the same type from one another. For example, without departing from the scope of this application, a first device may also be referred to as a second device, and similarly, a second device may also be referred to as a first device. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0056] To enable those skilled in the art to better understand the technical solutions provided in the embodiments of this application, and to make the above-mentioned objectives, features and advantages of the embodiments of this application more apparent and understandable, the technical solutions in the embodiments of this application will be further described in detail below with reference to the accompanying drawings.

[0057] Because the underlying implementations of different file systems on Linux can vary greatly, in order to support a wide variety of file systems, Linux introduces an abstraction layer, VFS (virtual file system), between user processes and file system instances. By providing common components and a unified framework, the application layer can be free from concern about the underlying implementation. The ZPL (ZFS POSIX Layer) module in ZFS is the module that implements the file read and write operation interface.

[0058] Therefore, when reading and writing files in the dynamic file system ZFS, the application layer can call the file read and write operation interface in the ZPL module through VFS. This application implements the WORM technology of ZFS by modifying the file operation interface in ZPL.

[0059] See Figure 1 The above is a flowchart illustrating a file processing method according to an embodiment of the present invention, which is applied to the dynamic file system ZFS.

[0060] like Figure 1 As shown, the process may include the following steps:

[0061] Step S101: Receive file processing information and determine the target file based on the file identifier in the file processing information.

[0062] In this embodiment, the file processing information may include a file identifier and file operation instructions for identifying the target file.

[0063] Step S102: When the instruction in the above file processing information is a lock instruction, determine whether the above target file is in a write state.

[0064] Step S103: If confirmed, set the file status of the target file to locked.

[0065] In this embodiment, the following four file states can be set for files in the ZFS dynamic file system: initial state, write state, locked state, and expired state.

[0066] Taking a file system with file operation interfaces such as create, open, write, unlink, and setattr as an example, when these interfaces receive file processing instructions, they need to first determine the file status of the target file, and then determine whether to execute the instruction based on the file status. The specific cases where file operation interfaces determine whether to execute instructions based on file status are as follows:

[0067] 1. An initial state file refers to a newly created file that has not yet been written to, i.e., a file just created using the `create` command. At this stage, the file is readable and writable, but it cannot be locked. When the `open`, `write`, and `unlink` interfaces receive file operation commands for an initial state file, they can directly execute the commands to open, modify, or delete the target file. However, if `setattr` receives a locking command for an initial state file, it will not execute the locking command.

[0068] 2. A file in a write state refers to a file on which data has been written. When the open, write, unlink, and setattr interfaces receive a file operation command indicating that the target file is in a write state, they can directly execute the command to perform operations such as opening, modifying, deleting, and locking the target file. Therefore, a file in a write state is readable, writable, and deletable, and can be modified arbitrarily.

[0069] 3. A locked file is one that cannot be modified, deleted, or renamed by ordinary users or system administrators; it can only be read and have its attributes viewed. The open interface will only execute the open command when it receives a file operation instruction indicating that the target file is locked. Other write, unlink, and setattr interfaces will not execute the corresponding operation instructions when they receive file operation instructions.

[0070] 4. An expired file is a file that can be deleted, read, and have its attributes viewed by ordinary users and system administrators, but cannot be modified or renamed. The expired state is introduced after the file system has preset a lock expiration time. When the `open`, `unlink`, and `setattr` interfaces receive a file operation command targeting an expired file, they can execute the corresponding operation command. Only when the `write` interface receives a write command targeting an expired file will it not execute that write command.

[0071] In another embodiment, when receiving file processing information containing delete or write instructions, the inability to delete or modify the target file includes:

[0072] When a file operation request containing a write instruction is received, it is determined whether the target file is locked. If it is, the write instruction is not executed.

[0073] When a file operation request containing a deletion command is received, it is determined whether the target file is locked. If so, the deletion command is not executed.

[0074] In this embodiment, the setattr interface receives a locking command. After determining that the target file is in a write state, it sets the target file to a locked state, so that the target file can only be read and cannot be modified or deleted.

[0075] like Figure 2 , Figure 3 As shown in this embodiment, when the target file corresponding to the instruction received by the unlink interface is in a locked state, an error is returned and the corresponding operation instruction is not executed.

[0076] If the target file corresponding to the instruction received by the write interface is locked or expired, an error will be returned and the corresponding operation instruction will not be executed.

[0077] This concludes the process. Figure 1 The process is shown below.

[0078] pass Figure 1 As shown in the flowchart, in this embodiment, when the file processing interface in the file system receives a file processing request, it needs to first determine the file status of the target file, and then determine whether to execute the file processing request based on the file status. By setting the target file to a locked state, making the target file readable but not deletable or modifiable, the Write-once-Read-many (WORM) technology is implemented in ZFS, ensuring that the data in the locked target file will not be tampered with.

[0079] In another embodiment, setting the file status of the aforementioned target file to a locked state includes:

[0080] The lock expiration time of the target file is determined by the preset lock duration and the current system time. If the lock expiration time has not been reached, the target file is set to a locked state.

[0081] When the lock expires, the lock status of the target file is released.

[0082] In this embodiment, a time parameter can be set when creating a ZFS file system, serving as the preset lock duration. For example, the file system can be created using the command `zfs create -w time fs`, where `time` is the preset lock duration and `fs` is the file system name. A configuration file containing the preset lock duration is stored in the root directory of the file system. When the `setattr` interface sets the target file to a locked state, it reads the configuration file in the root directory to obtain the preset lock duration and determines the lock expiration time of the target file based on the current system time. For example, if the preset lock duration is 24 hours and the current system time is 2020-01-01, 08:00:00, then the lock expiration time of the target file is 2020-01-02, 08:00:00. During the time period from 2020-01-01, 08:00:00 to 2020-01-02, 08:00:00, the target file is in a locked state.

[0083] It should be noted that setting a time parameter when creating a ZFS file is only one way to determine the lock duration and should not be considered a limitation of this application. There are many ways to determine the lock duration, such as creating a file in the root directory that records the lock duration, and then directly reading that file to obtain the lock duration when the setattr interface sets the file to a locked state. Alternatively, the setattr interface can be modified to directly obtain a fixed time when the file is set to a locked state; both methods can achieve the goal of determining the lock duration.

[0084] In this embodiment, a lock expiration time is set for a locked target file. When the lock expiration time is reached, the lock status of the target file is lifted. This protects the data in the target file from tampering for a fixed period of time. When the protection time expires, the target file can be deleted to avoid the target file remaining locked and unable to be deleted, which would consume a large amount of memory and affect the performance of the device.

[0085] In another embodiment, the above method further includes:

[0086] When the instruction in the file processing information is a file creation instruction, the file creation instruction is executed to create the target file, and the state of the target file is set to the initial state.

[0087] In this embodiment, since the file in its initial state cannot be set to a locked state, after the create interface creates the target file according to the file creation instructions, the state of the target file needs to be set to the initial state to avoid the locked file being a newly created empty file.

[0088] In the above embodiments, if setting the state of the target file to the initial state fails, the target file is deleted.

[0089] Because there might be space available when creating a file, but insufficient space when setting its status, the file status setting might fail due to insufficient space. In this case, the created target file is not set to its initial state, making it impossible for subsequent interfaces to determine its status based on the file. Therefore, in this embodiment, the target file that failed to be set to its initial state can be deleted to solve the above problem.

[0090] In another embodiment, the above method further includes:

[0091] When the instruction in the file processing information is a file open instruction, and the target file is in a locked state, the lock expiration time of the target file is obtained and compared with the current system time;

[0092] If the current system time is less than the lock expiration time, then the file open command is executed to open the target file;

[0093] If the current system time is greater than the lock expiration time, then the status of the target file is changed to expired.

[0094] When the instruction in the file processing information is a file open instruction, and the target file is in an unlocked state, the file open instruction is executed to open the target file.

[0095] like Figure 4 As shown in this embodiment, when the target file corresponding to the instruction received by the open interface is in a locked state, the system's current time and the lock expiration time are compared to determine whether the target file has exceeded its protection period. If the target file has exceeded its protection period, it is set to an expired state so that the user can delete it. This avoids having too many locked files, which would consume device memory.

[0096] In this application, multiple locked target files could be monitored in real time, and when a locked target file reaches its lock expiration time, it would be modified to an expired state. However, real-time monitoring of multiple locked target files to see if they have reached their lock expiration time would significantly impact system performance. Furthermore, modifying a file requires first calling the `open` interface to open it. Therefore, this application does not require real-time monitoring of whether locked files have reached their lock time; expiration is only checked when the file is opened. This avoids the performance impact caused by real-time monitoring of multiple locked target files.

[0097] This concludes the description of all method embodiments of this application.

[0098] See Figure 5 , Figure 5 This is a structural diagram of a device provided in an embodiment of this application. The device corresponds to… Figure 1 The process is shown below. Figure 5 As shown, the device may include:

[0099] Receiving unit 501: Used to receive file processing information and determine the target file based on the file identifier in the file processing information;

[0100] Determining unit 502: used to determine whether the target file is in a write state when the instruction in the file processing information is a lock instruction;

[0101] Locking unit 503: When it is determined that the instruction in the file processing information is a locking instruction, the file status of the target file is set to a locked state, so that when file processing information containing deletion or write instructions is received, the target file cannot be deleted or modified.

[0102] Optionally, the locking unit 503 sets the file status of the target file to a locked state by:

[0103] The lock expiration time of the target file is determined by the preset lock duration and the current system time. If the lock expiration time has not been reached, the target file is set to a locked state.

[0104] When the lock expires, the lock status of the target file is released.

[0105] Optionally, the locking unit 503 prevents the target file from being deleted or modified when file processing information containing deletion or write instructions is received, including:

[0106] When a file operation request containing a write instruction is received, it is determined whether the target file is locked. If it is, the write instruction is not executed.

[0107] When a file operation request containing a deletion command is received, it is determined whether the target file is locked. If so, the deletion command is not executed.

[0108] Optionally, the device further includes:

[0109] The creation unit 504 is used to execute the file creation instruction to create a target file when the instruction in the file processing information is a file creation instruction, and to set the state of the target file to the initial state.

[0110] Optionally, the device further includes:

[0111] The opening unit 505 is used to compare the lock expiration time of the target file with the current system time when the instruction in the file processing information is a file opening instruction and the target file is in a locked state.

[0112] If the current system time is less than the lock expiration time, then the file open command is executed to open the target file;

[0113] If the current system time is greater than the lock expiration time, then the status of the target file is changed to expired.

[0114] When the instruction in the file processing information is a file open instruction, and the target file is in an unlocked state, the file open instruction is executed to open the target file.

[0115] This application also provides embodiments that... Figure 5 The hardware structure of the device shown. See also Figure 6 , Figure 6 This is a structural diagram of an electronic device provided in an embodiment of this application. Figure 6 As shown, the hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above example of this application.

[0116] Based on the same application concept as the above method, this application embodiment also provides a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the method disclosed in the above examples of this application.

[0117] For example, the aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, etc. For instance, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.

[0118] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.

[0119] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0120] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0121] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0122] Furthermore, these computer program instructions can also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in the process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0123] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0124] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A file processing method applied to the dynamic file system ZFS, characterized in that, When reading or writing files in the ZFS, the application layer calls the file read / write operation interface in the ZPL module through the abstraction layer VFS. The file read / write operation interface in the ZPL module is a file operation interface modified with the WORM function, and the following methods are executed through the file operation interface modified with the WORM function: The system receives file processing information and determines the target file based on the file identifier in the file processing information. The target file in the ZFS is dynamically set to one of the following four states: initial state, write state, locked state, or expired state. When the instruction in the file processing information is a lock instruction... If the target file is in the initial state, then the locking instruction will not be executed; If the target file is in the write state, then the file state of the target file is set to the locked state, so that when file processing information containing deletion or write instructions is received, the target file cannot be deleted or modified. If the target file is in a locked state or an expired state, the locking instruction is not executed. Specifically, when a file operation request containing a write instruction is received, it is determined whether the target file is in an expired state. If it is determined, the write instruction is not executed.

2. The method according to claim 1, characterized in that, Setting the file status of the target file to a locked state includes: The lock expiration time of the target file is determined by the preset lock duration and the current system time. If the lock expiration time has not been reached, the target file is set to a locked state. When the lock expires, the lock status of the target file is released.

3. The method according to claim 1, characterized in that, When receiving file processing information containing delete or write instructions, the inability to delete or modify the target file includes: When a file operation request containing a write instruction is received, it is determined whether the target file is locked. If it is, the write instruction is not executed. When a file operation request containing a deletion command is received, it is determined whether the target file is locked. If so, the deletion command is not executed.

4. The method according to claim 1, characterized in that, The method further includes: When the instruction in the file processing information is a file creation instruction, the file creation instruction is executed to create the target file, and the state of the target file is set to the initial state.

5. The method according to claim 4, characterized in that, The method further includes: If setting the target file to its initial state fails, then the target file is deleted.

6. The method according to claim 2, characterized in that, The method further includes: When the instruction in the file processing information is a file open instruction, and the target file is in a locked state, the lock expiration time of the target file is obtained and compared with the current system time; If the current system time is less than the lock expiration time, then the file open command is executed to open the target file; If the current system time is greater than the lock expiration time, then the status of the target file is changed to expired. When the instruction in the file processing information is a file open instruction, and the target file is in an unlocked state, the file open instruction is executed to open the target file.

7. A file processing apparatus, applied to the ZFS dynamic file system, characterized in that, When reading or writing files in ZFS, the application layer calls the file read / write operation interface in the ZPL module through the abstraction layer VFS. The file read / write operation interface in the ZPL module is a file operation interface modified with WORM functionality. The device includes: Receiving unit: used to receive file processing information and determine the target file based on the file identifier in the file processing information; the target file in ZFS is dynamically set to one of the following four states: initial state, write state, locked state, and expired state; Locking unit: used when the instruction in the file processing information is a locking instruction, If the target file is in the initial state, then the locking instruction will not be executed; If the target file is in the write state, then the file state of the target file is set to the locked state, so that when file processing information containing deletion or write instructions is received, the target file cannot be deleted or modified. If the target file is in a locked state or an expired state, the locking instruction is not executed. Specifically, when a file operation request containing a write instruction is received, it is determined whether the target file is in an expired state. If it is determined, the write instruction is not executed.

8. The apparatus according to claim 7, characterized in that, The locking unit sets the file status of the target file to a locked state by: The lock expiration time of the target file is determined by the preset lock duration and the current system time. If the lock expiration time has not been reached, the target file is set to a locked state. When the lock expires, the lock status of the target file is released.

9. The apparatus according to claim 7, characterized in that, The locking unit prevents the target file from being deleted or modified when file processing information containing deletion or write instructions is received, including: When a file operation request containing a write instruction is received, it is determined whether the target file is locked. If it is, the write instruction is not executed. When a file operation request containing a deletion command is received, it is determined whether the target file is locked. If so, the deletion command is not executed.

10. The apparatus according to claim 7, characterized in that, The device further includes: The creation unit is configured to execute the file creation instruction to create a target file when the instruction in the file processing information is a file creation instruction, and to set the state of the target file to an initial state.

11. The apparatus according to claim 7, characterized in that, The device further includes: The opening unit is used to compare the lock expiration time of the target file with the current system time when the instruction in the file processing information is a file opening instruction and the target file is in a locked state. If the current system time is less than the lock expiration time, then the file open command is executed to open the target file; If the current system time is greater than the lock expiration time, then the status of the target file is changed to expired. When the instruction in the file processing information is a file open instruction, and the target file is in an unlocked state, the file open instruction is executed to open the target file.