CN116010355A - File processing method and device - Google Patents

File processing method and device Download PDF

Info

Publication number
CN116010355A
CN116010355A CN202310111601.9A CN202310111601A CN116010355A CN 116010355 A CN116010355 A CN 116010355A CN 202310111601 A CN202310111601 A CN 202310111601A CN 116010355 A CN116010355 A CN 116010355A
Authority
CN
China
Prior art keywords
file
state
instruction
target file
locking
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.)
Pending
Application number
CN202310111601.9A
Other languages
Chinese (zh)
Inventor
林守强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Macrosan Technologies Co Ltd
Original Assignee
Macrosan Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Macrosan Technologies Co Ltd filed Critical Macrosan Technologies Co Ltd
Priority to CN202310111601.9A priority Critical patent/CN116010355A/en
Publication of CN116010355A publication Critical patent/CN116010355A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

In the embodiment of the invention, 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-time writing and multiple-time reading is realized in ZFS. And by setting a lock expiration time for the target file in the locked state, when the lock expiration time is reached, canceling the locked state of the target file. This achieves protection of the data in the target file from tampering for a fixed period of time when the target file is in a locked state.

Description

File processing method and device
Technical Field
The present disclosure relates to document processing technologies, and in particular, to a method and an apparatus for processing a document.
Background
The dynamic file system ZFS (Zettabyte File System) has the advantages of storage pool design, large capacity, COW transaction model, end-to-end data security (RAIDZ, checksum check, multi-copy data redundancy), efficient snapshot function, adaptive byte order function (nvlist), efficient cache management, variable block size, data deduplication, and the like.
However, with the progress of science and technology and the development of society, information is explosively increased, and problems of secure access and application of data, such as medical data, financial security data, etc., are increasingly emphasized, and these important data can only be read and cannot be modified within a specified time period according to legal regulations. There is a need for tamper-proof protection of such data.
WORM (Write Once Read Many) is a write-once and read-many technology, that is, after the writing of a file is completed, the file can be set to enter a read-only state, in which the file can only be read and cannot be deleted, modified or renamed. By protecting the stored data using WORM technology, it is prevented from being modified by accident, which guarantees the enterprise or organization's need for secure storage of some important salesman data, which is not implemented in ZFS.
Disclosure of Invention
In view of this, the present application provides a method and apparatus for file processing to implement WORM technology in ZFS and protect the security of data in a file system.
The technical scheme provided by the embodiment of the application comprises the following steps:
a file processing method applied to a dynamic file system ZFS, the method comprising:
receiving file processing information, and determining a target file according to a file identifier in the file processing information;
when the instruction in the file processing information is a locking instruction, determining whether the target file is in a writing state;
if so, setting the file state of the target file as a locking state, and enabling the target file not to be deleted or modified when the file processing information containing the deleting or writing instruction is received.
Optionally, the setting the file state of the target file to the locked state includes:
determining a locking expiration time of a target file through a preset locking duration and a current system time, and setting the target file into a locking state when the locking expiration time does not reach;
and when the lock expiration time arrives, canceling the lock state of the target file.
Optionally, when the file processing information including the deletion or writing instruction is received, the method for deleting or modifying the target file includes:
when a file operation request containing a writing instruction is received, determining whether the target file is in a locking state, and if so, not executing the writing instruction;
when a file operation request containing a deleting instruction is received, determining whether the target file is in a locking state, and if so, not executing the deleting instruction.
Optionally, the method further comprises:
when the instruction in the file processing information is a file creation instruction, executing the file creation instruction to create a target file, and setting the state of the target file to an initial state.
Optionally, the method further comprises:
and if the state of the target file is set to be the initial state and fails, deleting the target file.
Optionally, the method further comprises:
when the instruction in the file processing information is a file opening instruction and the state of the target file is a locking state, acquiring the locking expiration time of the target file and comparing the locking expiration time with the current time of the system;
if the current time of the system is smaller than the locking expiration time, executing the file opening instruction and opening the target file;
if the current time of the system is greater than the locking expiration time, modifying the state of the target file into an expiration state;
and when the instruction in the file processing information is a file opening instruction and the state of the target file is an unlocked state, executing the file opening instruction and opening the target file.
The embodiment of the application also provides a file processing device, which is applied to the dynamic file system ZFS, and comprises:
a receiving unit: the method comprises the steps of receiving file processing information, and determining a target file according to a file identifier in the file processing information;
a determination unit: for determining whether the target file is in a written state when an instruction in the file processing information is a lock instruction;
a locking unit: when the instruction in the file processing information is determined to be a locking instruction, setting the file state of the target file to be a locking state, so that the target file cannot be deleted or modified when the file processing information containing a deleting or writing instruction is received.
Optionally, the setting, by the locking unit, the file state of the target file to the locked state includes:
determining a locking expiration time of a target file through a preset locking duration and a current system time, and setting the target file into a locking state when the locking expiration time does not reach;
and when the lock expiration time arrives, canceling the lock state of the target file.
Optionally, the locking unit makes the target file unable to be deleted or modified when the file processing information including the deletion or writing instruction is received, including:
when a file operation request containing a writing instruction is received, determining whether the target file is in a locking state, and if so, not executing the writing instruction;
when a file operation request containing a deleting instruction is received, determining whether the target file is in a locking state, and if so, not executing the deleting instruction.
Optionally, the apparatus further includes:
and a creation unit configured to execute the file creation instruction to create a target file and set a state of the target file to an initial state when the instruction in the file processing information is a file creation instruction.
Optionally, the apparatus further includes:
the opening unit is used for acquiring the locking expiration time of the target file and comparing the locking expiration time with the current time of the system when the instruction in the file processing information is a file opening instruction and the state of the target file is a locking state;
if the current time of the system is smaller than the locking expiration time, executing the file opening instruction and opening the target file;
if the current time of the system is greater than the locking expiration time, modifying the state of the target file into an expiration state;
and when the instruction in the file processing information is a file opening instruction and the state of the target file is an unlocked state, executing the file opening instruction and opening the target file.
According to the technical scheme, when the file processing interface in the dynamic file system ZFS receives the file processing request, the file state of the 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-time writing and multiple-time reading is realized in ZFS.
Further, the method and the device set the lock expiration time for the target file in the locked state, and cancel the locked state of the target file when the lock expiration time is reached. The method and the device realize that the data in the target file is protected from being tampered in a fixed time period when the target file is in a locking state, so that the data can be recorded and archived.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following description will briefly introduce the drawings that are required to be used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings may also be obtained according to these drawings for a person having ordinary skill in the art.
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flow chart of a method provided in an embodiment of the present application;
FIG. 2 is a flow chart of a write interface provided in an embodiment of the present application;
FIG. 3 is a flowchart of a delete interface provided in an embodiment of the present application;
FIG. 4 is a flowchart of an open interface provided in an embodiment of the present application;
FIG. 5 is a block diagram of an apparatus according to an embodiment of the present application;
fig. 6 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various devices, these information should not be limited by these terms. These terms are only used to distinguish one device from another of the same type. For example, a first device could also be termed a second device, and, similarly, a second device could also be termed a first device, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
In order to better understand the technical solutions provided by the embodiments of the present application and make the above objects, features and advantages of the embodiments of the present application more obvious, the technical solutions in the embodiments of the present application are described in further detail below with reference to the accompanying drawings.
Because there may be a great difference between the implementation modes of the bottom layers of different file systems on Linux, in order to support various file systems, linux introduces an abstract Layer VFS (virtual File System) between a user process and a file system instance, by providing a common component and a unified framework, an application Layer may not pay attention to the implementation of the bottom Layer, and a ZPL (ZFS POSIX Layer) module in ZFS is a module of an operation interface for implementing file reading and writing.
Therefore, when the files in the ZFS of the dynamic file system are read and written, the application layer can call the file read-write operation interface in the ZPL module through the VFS.
Referring to fig. 1, a flowchart of a file processing method is shown, and the method is applied to a dynamic file system ZFS.
As shown in fig. 1, the process may include the steps of:
step S101, receiving file processing information, and determining a target file according to a file identifier in the file processing information.
In this embodiment, the file processing information may include a file identifier and a file operation instruction for determining a target file.
Step S102, when the instruction in the file processing information is a locking instruction, determining whether the target file is in a writing state.
Step S103, if the target file is determined, setting the file state of the target file to be a locking state.
In the present embodiment, the following 4 file states can be set for files in the dynamic file system ZFS: initial state, write state, lock state, expiration state.
Taking the file system as an example, the file system comprises a create, open, write, unlink, setattr file operation interface, when the interface receives a file processing instruction, the file state of the target file needs to be judged first, and then whether the instruction is executed is determined according to the file state. The specific file operation interface determines whether the instruction needs to be executed according to the file state as follows:
1. the file in the initial state refers to a newly created file without writing, namely, a file just created by create, and at the moment, the file is in a readable and writable state, but the file in the initial state cannot be set to be in a locking state. When the open, write, unlink interface receives a file operation instruction that the target file is in an initial state, the instruction can be directly executed to perform operations such as opening, modifying, deleting and the like on the target file. And when the setattr receives a locking instruction that the target file is in an initial state, the locking instruction is not executed.
2. The file in the writing state refers to a file with writing data, and when the open, write, unlink, setattr interface receives a file operation instruction that the target file is in the writing state, the instruction can be directly executed so as to perform operations such as opening, modifying, deleting, locking and the like on the target file. Thus, the file in the written state is in a readable, writable, and erasable state, and can be arbitrarily changed.
3. A locked file refers to a file that cannot be modified, deleted, or renamed by ordinary users and system administrators, but can only be read and viewed for attributes. When the open interface receives the file operation instruction that the target file is in the locked state, the open instruction is executed, and when the other write, unlink, setattr interfaces receive the file operation instruction, the corresponding operation instruction is not executed.
4. An expired state file refers to a file that can be deleted, read, and viewed by ordinary users and system administrators, but cannot be modified and renamed. The expiration state is a state introduced after the file system has preset a lock expiration time. When the open, unlink, setattr interface receives a file operation instruction that the target file is in an expired state, the corresponding operation instruction may be executed. Only when the write interface receives a write instruction that the target file is in an expired state, the write instruction is not executed.
In another embodiment, when receiving the file processing information including the delete or write instruction, failing to delete or modify the target file includes:
when a file operation request containing a writing instruction is received, determining whether the target file is in a locking state, and if so, not executing the writing instruction;
when a file operation request containing a deleting instruction is received, determining whether the target file is in a locking state, and if so, not executing the deleting instruction.
In this embodiment, the setattr interface receives the locking instruction, and after determining that the state of the target file is the writing state, sets the state of the target file to the locking state, so that the target file can only be read, but cannot be modified and deleted.
As shown in fig. 2 and 3, in this embodiment, when the target file corresponding to the instruction received by the unlink interface is in the locked state, an error is returned, and the corresponding operation instruction is not executed.
And when the target file corresponding to the instruction received by the write interface is in a locked state or an expired state, returning an error, and not executing the corresponding operation instruction.
Thus, the flow shown in fig. 1 is completed.
As can be seen from the flow shown in fig. 1, in this embodiment, when the file processing interface in the file system receives the file processing request, it is necessary to determine the file state of the target file first, and then determine whether to execute the file processing request according to the file state. By setting the target file to be in the locking state, the target file can only be read and cannot be deleted or modified, so that write-once and read-many WORM technology is realized in ZFS, and the data in the target file in the locking state is ensured not to be tampered.
In another embodiment, setting the file state of the target file to the locked state includes:
determining a locking expiration time of a target file through a preset locking duration and a current system time, and setting the target file into a locking state when the locking expiration time does not reach;
and when the lock expiration time arrives, canceling the lock state of the target file.
In this embodiment, a time parameter may be set when the ZFS is created, and the time parameter is used as a preset locking duration, for example, a file system is created by a ZFS create-w time fs command, where time is the preset locking duration, and fs is the name of the file system. And storing the configuration file stored with the preset locking time on a root directory of the file system. When the setattr interface sets the target file to be in a locking state, reading the configuration file on the root directory, obtaining preset locking duration, and determining the locking expiration time of the target file according to the current time of the system. If the preset locking time is 24 hours, the current time of the system is 2020-1, 8:00:00, the lock expiration time of the target file is 2020-1-2,8:00:00. at 2020-1, 8:00:00 to 2020-1-2,8:00: during the period of 00, the target file is in a locked state.
It should be noted that, by setting the time parameter when creating the ZFS, only one implementation manner of determining the locking duration is not limited by the application, and there are many ways of specifically implementing the determination of the locking duration, for example, directly creating a file with the locking duration recorded on the directory, and directly reading the file to obtain the locking duration when the setattr interface sets the file to the locked state. Or modifying the setattr interface to directly obtain a fixed time when the file is set to be in a locking state, so that the locking duration can be determined.
In the present embodiment, by setting a lock expiration time for a target file in a locked state, when the lock expiration time is reached, the locked state of the target file is canceled. This achieves that the data in the target file can be protected from tampering for a fixed period of time. When the protection time is exceeded, the target file can be deleted, so that the problem that the target file is always in a locked state and cannot be deleted is avoided, a large amount of memory is occupied, and the performance of equipment is affected.
In another embodiment, the method further comprises:
when the instruction in the file processing information is a file creation instruction, executing the file creation instruction to create a target file, and setting the state of the target file to an initial state.
In this embodiment, since the file in the initial state cannot be set to the locked state, after the create interface creates the target file according to the file creation instruction, the state of the target file needs to be set to the initial state to avoid that the locked file is an empty file that has just been created.
In the above embodiment, if the state of the target file is set to the initial state and fails, the target file is deleted.
Since there may be a case where there is space when creating a file, but there is insufficient space when setting a file state, this may cause the setting of the file state to fail due to insufficient space. At this time, the created target file is not set to the initial state, so that the subsequent interface cannot judge according to the file state when processing the target file. In this embodiment, therefore, the target file that is set to the initial state failure can be deleted. To solve the above problems.
In another embodiment, the method further comprises:
when the instruction in the file processing information is a file opening instruction and the state of the target file is a locking state, acquiring the locking expiration time of the target file and comparing the locking expiration time with the current time of the system;
if the current time of the system is smaller than the locking expiration time, executing the file opening instruction and opening the target file;
if the current time of the system is greater than the locking expiration time, modifying the state of the target file into an expiration state;
and when the instruction in the file processing information is a file opening instruction and the state of the target file is an unlocked state, executing the file opening instruction and opening the target file.
In this embodiment, as shown in fig. 4, when the target file corresponding to the instruction received by the open interface is in the locked state, the current time of the system is compared with the lock expiration time to determine whether the target file has exceeded the protection period. When the target file has exceeded the protection period, it is set to an expired state. So that the user can delete it. So as to avoid excessive locked files and occupy the memory of the equipment.
In the application, the plurality of locked target files can be monitored in real time, so that when the locked target files reach the locking expiration time, the locked target files are modified into an expiration state. However, if multiple locked target files are monitored in real time to determine whether they reach the lock expiration time, system performance will be greatly affected. And to modify a file, the open interface must be called first to open it. Therefore, the method and the device do not need to monitor whether the locked file reaches the locking time in real time, and only detect whether the locked file is out of date when the locked file is opened. So as to avoid the problem that the system performance is affected due to the real-time monitoring of a plurality of locked target files.
Thus, the description of all the method embodiments of the present application is completed.
Referring to fig. 5, fig. 5 is a block diagram of an apparatus according to an embodiment of the present application. The apparatus corresponds to the flow shown in fig. 1. As shown in fig. 5, the apparatus may include:
the receiving unit 501: the method comprises the steps of receiving file processing information, and determining a target file according to a file identifier in the file processing information;
the determination unit 502: for determining whether the target file is in a written state when an instruction in the file processing information is a lock instruction;
a locking unit 503: when the instruction in the file processing information is determined to be a locking instruction, setting the file state of the target file to be a locking state, so that the target file cannot be deleted or modified when the file processing information containing a deleting or writing instruction is received.
Optionally, the setting, by the locking unit 503, the file state of the target file to the locked state includes:
determining a locking expiration time of a target file through a preset locking duration and a current system time, and setting the target file into a locking state when the locking expiration time does not reach;
and when the lock expiration time arrives, canceling the lock state of the target file.
Optionally, the locking unit 503 may disable deletion or modification of the target file when the file processing information including the deletion or writing instruction is received, including:
when a file operation request containing a writing instruction is received, determining whether the target file is in a locking state, and if so, not executing the writing instruction;
when a file operation request containing a deleting instruction is received, determining whether the target file is in a locking state, and if so, not executing the deleting instruction.
Optionally, the apparatus further includes:
a creating unit 504, configured to execute the file creating instruction to create a target file and set a state of the target file to an initial state when the instruction in the file processing information is a file creating instruction.
Optionally, the apparatus further includes:
an opening unit 505, configured to obtain a lock expiration time of the target file and a current system time for comparison when the instruction in the file processing information is a file opening instruction and the state of the target file is a locked state;
if the current time of the system is smaller than the locking expiration time, executing the file opening instruction and opening the target file;
if the current time of the system is greater than the locking expiration time, modifying the state of the target file into an expiration state;
and when the instruction in the file processing information is a file opening instruction and the state of the target file is an unlocked state, executing the file opening instruction and opening the target file.
The embodiment of the application also provides a hardware structure of the device shown in fig. 5. Referring to fig. 6, fig. 6 is a block diagram of an electronic device according to an embodiment of the present application. As shown in fig. 6, the hardware structure may include: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; the processor is configured to execute the machine-executable instructions to implement the methods disclosed in the above examples of the present application.
Based on the same application concept as the above method, the embodiments of the present application further provide a machine-readable storage medium, where a number of computer instructions are stored, where the computer instructions can implement the method disclosed in the above example of the present application when executed by a processor.
By way of example, the machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, and the like. For example, a machine-readable storage medium may be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, a storage drive (e.g., hard drive), a solid state drive, any type of storage disk (e.g., optical disk, dvd, etc.), or a similar storage medium, or a combination thereof.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present application.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may 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, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Moreover, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.

Claims (11)

1. A file processing method applied to a dynamic file system ZFS, the method comprising:
receiving file processing information, and determining a target file according to a file identifier in the file processing information;
when the instruction in the file processing information is a locking instruction, determining whether the target file is in a writing state;
if so, setting the file state of the target file as a locking state, so that the target file cannot be deleted or modified when the file processing information containing the deleting or writing instruction is received.
2. The method of claim 1, wherein the setting the file state of the target file to the locked state comprises:
determining a locking expiration time of a target file through a preset locking duration and a current system time, and setting the target file into a locking state when the locking expiration time does not reach;
and when the lock expiration time arrives, canceling the lock state of the target file.
3. The method of claim 1, wherein the inability to delete or modify the target file upon receiving file handling information including a delete or write instruction comprises:
when a file operation request containing a writing instruction is received, determining whether the target file is in a locking state, and if so, not executing the writing instruction;
when a file operation request containing a deleting instruction is received, determining whether the target file is in a locking state, and if so, not executing the deleting instruction.
4. The method according to claim 1, wherein the method further comprises:
when the instruction in the file processing information is a file creation instruction, executing the file creation instruction to create a target file, and setting the state of the target file to an initial state.
5. The method according to claim 4, wherein the method further comprises:
and if the state of the target file is set to be the initial state and fails, deleting the target file.
6. The method according to claim 2, wherein the method further comprises:
when the instruction in the file processing information is a file opening instruction and the state of the target file is a locking state, acquiring the locking expiration time of the target file and comparing the locking expiration time with the current time of the system;
if the current time of the system is smaller than the locking expiration time, executing the file opening instruction and opening the target file;
if the current time of the system is greater than the locking expiration time, modifying the state of the target file into an expiration state;
and when the instruction in the file processing information is a file opening instruction and the state of the target file is an unlocked state, executing the file opening instruction and opening the target file.
7. A file processing apparatus for use in a dynamic file system ZFS, the apparatus comprising:
a receiving unit: the method comprises the steps of receiving file processing information, and determining a target file according to a file identifier in the file processing information;
a determination unit: for determining whether the target file is in a written state when an instruction in the file processing information is a lock instruction;
a locking unit: when the instruction in the file processing information is determined to be a locking instruction, setting the file state of the target file to be a locking state, so that the target file cannot be deleted or modified when the file processing information containing a deleting or writing instruction is received.
8. The apparatus of claim 7, wherein the locking unit setting the file state of the target file to a locked state comprises:
determining a locking expiration time of a target file through a preset locking duration and a current system time, and setting the target file into a locking state when the locking expiration time does not reach;
and when the lock expiration time arrives, canceling the lock state of the target file.
9. The apparatus according to claim 7, wherein the lock unit disabling deletion or modification of the target file upon receiving file processing information including a deletion or write instruction comprises:
when a file operation request containing a writing instruction is received, determining whether the target file is in a locking state, and if so, not executing the writing instruction;
when a file operation request containing a deleting instruction is received, determining whether the target file is in a locking state, and if so, not executing the deleting instruction.
10. The apparatus of claim 7, wherein the apparatus further comprises:
and a creation unit configured to execute the file creation instruction to create a target file and set a state of the target file to an initial state when the instruction in the file processing information is a file creation instruction.
11. The apparatus of claim 7, wherein the apparatus further comprises:
the opening unit is used for acquiring the locking expiration time of the target file and comparing the locking expiration time with the current time of the system when the instruction in the file processing information is a file opening instruction and the state of the target file is a locking state;
if the current time of the system is smaller than the locking expiration time, executing the file opening instruction and opening the target file;
if the current time of the system is greater than the locking expiration time, modifying the state of the target file into an expiration state;
and when the instruction in the file processing information is a file opening instruction and the state of the target file is an unlocked state, executing the file opening instruction and opening the target file.
CN202310111601.9A 2023-01-16 2023-01-16 File processing method and device Pending CN116010355A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310111601.9A CN116010355A (en) 2023-01-16 2023-01-16 File processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310111601.9A CN116010355A (en) 2023-01-16 2023-01-16 File processing method and device

Publications (1)

Publication Number Publication Date
CN116010355A true CN116010355A (en) 2023-04-25

Family

ID=86025006

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310111601.9A Pending CN116010355A (en) 2023-01-16 2023-01-16 File processing method and device

Country Status (1)

Country Link
CN (1) CN116010355A (en)

Similar Documents

Publication Publication Date Title
US9881013B2 (en) Method and system for providing restricted access to a storage medium
US7861311B2 (en) Apparatus and method of managing hidden area
US8543602B2 (en) Access controller that controls access to files by using access control list
US7571176B2 (en) Selective file erasure using metadata modifications
US7536524B2 (en) Method and system for providing restricted access to a storage medium
US8234477B2 (en) Method and system for providing restricted access to a storage medium
US9639540B2 (en) Retention management in a worm storage system
US6606628B1 (en) File system for nonvolatile memory
US11880335B2 (en) Event based retention of read only files
JP5833754B2 (en) Method and apparatus for cleaning a file system and storage medium thereof
US6928456B2 (en) Method of tracking objects for application modifications
US7620994B2 (en) Data recording system and data access method
US20090119469A1 (en) Procedure for Time-Limited Storage of Data on Storage Media
US7469261B2 (en) Apparatus and method for protecting system data on computer hard-disk
US7895164B1 (en) Efficient checkpoint process
US20100318501A1 (en) Methods and systems for rule-based worm enforcement
CN116010355A (en) File processing method and device
CN112825098A (en) Data protection method and device, computing equipment and storage medium
CN110321740B (en) Data operation method of storage device and storage device
CN114792016A (en) Processing method and electronic equipment
CN103605587A (en) Tape library data backup and filing method
US20240160604A1 (en) Event based retention of read only files
CN111913915B (en) File hiding method and device
CN109344089B (en) Method and device for operating norflash
CN117130995A (en) Data processing method, device, equipment and medium

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