CN105354102B - A kind of method and apparatus of file system maintenance and reparation - Google Patents

A kind of method and apparatus of file system maintenance and reparation Download PDF

Info

Publication number
CN105354102B
CN105354102B CN201510662628.2A CN201510662628A CN105354102B CN 105354102 B CN105354102 B CN 105354102B CN 201510662628 A CN201510662628 A CN 201510662628A CN 105354102 B CN105354102 B CN 105354102B
Authority
CN
China
Prior art keywords
metadata
mistake
file system
occurs
error
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510662628.2A
Other languages
Chinese (zh)
Other versions
CN105354102A (en
Inventor
齐江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510662628.2A priority Critical patent/CN105354102B/en
Publication of CN105354102A publication Critical patent/CN105354102A/en
Application granted granted Critical
Publication of CN105354102B publication Critical patent/CN105354102B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention provides the method and apparatus of a kind of file system maintenance and reparation, when detecting that mistake occurs for the metadata in the file system, determine whether the metadata of the mistake belongs to isolable metadata, the isolable metadata is after mistake occurs, and file system still can continue to provide the metadata of partial service;When determining that the metadata that mistake occurs belongs to isolable metadata, set read-only or inaccessible for the metadata that mistake occurs.Using technical solution of the present invention, when can make to occur in file system the isolable metadata of metadata of mistake, the metadata isolation of mistake will occur, and file system continues to run, the continuity of the file system work of guarantee, the fault tolerant ability for improving system, improves the performance of whole business.

Description

A kind of method and apparatus of file system maintenance and reparation
Technical field
The present invention relates to file system management technical fields, and in particular to a kind of method of file system maintenance and reparation and Device.
Background technique
The file system of computer is the method for a kind of storage and organizational computing machine data, it to access it and search It becomes easy, file system is made using the abstract logic concept of file and directory tree instead of physical equipments such as hard disk and CDs With the concept of data block.File system carries out tissue and distribution to the space of file-storage device, is responsible for file storage and to depositing The file of storage is protected and is retrieved.In other words, file system be a set of storage for realizing data, it is hierarchically organized, access and The abstract data type of the operations such as acquisition.
File system metadata is the information of the tissue about file data, data field and its relationship.In short, metadata It is exactly the data about data.The metadata of generic-document system is divided into system file (by itself creating when file system format Build, be used for certain administrative purposes) metadata and user file (create) metadata by user.
In some cases, such as software itself mistake, power failure, or the scenes such as controller is abnormal of storage equipment, It may cause metadata to be damaged, i.e., file system can be in inconsistent state.In the prior art, metadata error is found Afterwards, entire file system can be set as to read-only status, i.e. user cannot carry out any write operation to file system.To metadata When being repaired, file system can be unloaded, execute after repair action carry again again.
Conventionally, as entire file system is set as read-only, will lead to business overall performance is unavailable, industry It is bigger that influence face is interrupted in business.Simultaneously as after any single metadata damage, file system will be set as to read-only or not It may have access to, therefore when being repaired, in order to guarantee the integrality repaired, need to be scanned entire file system, find out The metadata of mistake occurs in other, so that repair time is longer.
Summary of the invention
In view of this, the embodiment of the present invention provides the method and device of a kind of file system metadata isolation and reparation, For improving the fault-tolerant ability of file system and the remediation efficiency of file system.
In a first aspect, the embodiment of the present invention provides a kind of method of file system maintenance, when detecting the file system In metadata occur mistake when, determine whether the metadata of the mistake belongs to isolable metadata, it is described isolable Metadata is after mistake occurs, and file system still can continue to provide the metadata of partial service;When determining that the generation is wrong When metadata accidentally belongs to isolable metadata, set read-only or inaccessible for the metadata that mistake occurs. Since the file system after wrong metadata after isolation can still continue offer service, do not have to as in the prior art directly will be whole A file system is set as read-only, to improve the continuity and fault-tolerant ability of file system traffic.
It with reference to first aspect, can be according to the metadata and described that mistake occurs under the first implementation The data type of metadata and whether isolable corresponding relationship, determine it is described occur mistake metadata whether belong to and can be isolated Metadata.
The first implementation with reference to first aspect, under second of implementation, the available generation mistake Metadata data type;It is determined according to the data type of the metadata that mistake occurs and preset meta data category table Whether the metadata that mistake occurs can be isolated, the meta data category table include metadata data type and whether can be every From corresponding relationship.
With reference to first aspect and first, second kind of implementation of first aspect, in third under implementation, After the metadata by the generation mistake is set as read-only or inaccessible, the metadata that mistake occurs is determined Type of error whether be relevance mistake, after the relevance misrepresentation mistake occurs, the metadata phase with the mistake Mistake also has occurred in the metadata of pass;When determining that the type of error is relevance mistake, then by described and mistake member The relevant metadata of data is also set as read-only or inaccessible.Thus, it is possible to after detecting the metadata that mistake occurs, it will Metadata isolation associated with the type of error of the generation mistake metadata, thus the first number for the mistake being more fully isolated According to reducing influence of the associated metadata error for file system, and improve comprehensive when repairing wrong metadata Property.It can guarantee that the associated metadata of relevance mistake is isolated simultaneously, and then file system can be made to continue offer service, Improve the stability of file system.
The third implementation with reference to first aspect judges the member that mistake occurs under the 4th kind of implementation It according to type of error and type of error and whether can be relevance when whether the type of error of data is relevance mistake The corresponding relationship of mistake determines whether the type of error is relevance mistake.
Third or the 4th kind of implementation with reference to first aspect, under the 5th kind of implementation, will it is described with it is described It is described relevant to the metadata of the mistake when the relevant metadata of the metadata of mistake is also set as read-only or inaccessible Metadata includes the metadata of the metadata dependent on the mistake.Since mistake can also occur for the metadata dependent on the mistake Accidentally, therefore, the relevant metadata is also isolated, the stability of file system can be improved.
With reference to first aspect or any one in first to the 5th kind of implementation of first aspect, in the 6th kind of reality Under existing mode, the error message of the mistake is also added in error message list by the embodiment of the present invention, the error listing For the metadata that mistake occurs to be reported to user.By error message list, user can be initiated it is primary repair or File system be set as it is read-only before, all wrong metadata informations that will test are added to error message list, User space When carrying out errors repair, no longer need to carry out error scanning to file system, and can be directly according to error listing in list Generation mistake metadata repaired.Meanwhile the metadata of the generation mistake in file system is not isolable member Before data, the isolable metadata of the generation mistake in file system can be added in error listing, therefore user Disposably multiple metadata can be repaired, improve remediation efficiency.
Second aspect receives user the embodiment of the invention also provides a kind of file system restorative procedure and is determining metadata The instruction for freezing file system sent after mistake occurs, and file system is freezed according to the instruction for freezing file system. The metadata that mistake occurs is repaired in the metadata reparation instruction sent according to user.Receive the defrosting file that user sends The instruction of system, and according to the instruction of the defrosting file system defrosting file system.Freeze text by responding User space Part system, and the metadata that mistake occurs is repaired, the quick reparation to file system may be implemented.
In conjunction with second aspect, in the first implementation, the embodiment of the present invention also to reporting of user error message list, The error message list includes that the error message of the metadata of mistake occurs.Since error message is added to error message column In table, returned to since the relevant information of relevant information and mistake that the metadata of mistake occurs passes through error message list User, user no longer need to carry out error scanning to entire file system when carrying out errors repair, and can be directly according to mistake The metadata of generation mistake in list pairlist is repaired, and the time of errors repair is reduced.
The third aspect, the embodiment of the invention provides a kind of file system maintenance device, described device includes metadata inspection Module and metadata isolation module are surveyed, can also include that module is collected in error message optionally.Described device can be used for executing Method described in the various implementations of first aspect and first aspect.
Fourth aspect, the embodiment of the invention also provides a kind of file system prosthetic device, described device includes file system System freezes module and metadata repair module, can also include information reporting module optionally.Described device can be used for executing Various implementation the methods of second aspect and second aspect.
5th aspect, the present invention also provides a kind of computer system, the computer system includes processor, Yi Jiyu The memory that the processor is connected, wherein the processor calls the instruction stored in the memory for executing institute State first aspect and first various implementations described in method.
6th aspect, the present invention also provides a kind of computer system, the computer system includes processor, Yi Jiyu The memory that the processor is connected, wherein the processor calls the instruction stored in the memory for executing institute State second aspect and second various implementations described in method.
As it can be seen that the method and device provided in the present embodiment when mistake occurs for file system, first determines whether that mistake occurs Metadata whether belong to isolable metadata, if then only setting read-only or can not for the metadata of the generation mistake Access, rather than as the prior art occur it is any mistake when entire file system is all set as read-only or inaccessible, because Even if the continuity that file system work occurs for this certain mistake still is able to be guaranteed, to improve the fault-tolerant of file system Ability improves the continuity of whole business.
Meanwhile isolable metadata occur mistake after, file system can still continue to run, during this period if Still an error has occurred, can be reported together with mistake before to user, such user can be disposably wrong to multiple generations Metadata accidentally is repaired, and is improved remediation efficiency, is increased the comprehensive of reparation.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is a kind of system architecture diagram of file system maintenance device in the embodiment of the present invention.
Fig. 2 is the flow diagram of the method for the first metadata provided in an embodiment of the present invention isolation.
Fig. 3 is the flow diagram of the method for second of metadata isolation provided in an embodiment of the present invention.
Fig. 4 is the flow diagram of the method for the third metadata isolation provided in an embodiment of the present invention.
Fig. 5 is a kind of flow diagram of the restorative procedure of file system metadata provided in an embodiment of the present invention.
Fig. 6 is a kind of structural schematic diagram of file system maintenance device provided in an embodiment of the present invention.
Fig. 7 is a kind of structural schematic diagram of computer system provided in an embodiment of the present invention.
Fig. 8 is a kind of structural schematic diagram of file system prosthetic device provided in an embodiment of the present invention.
Fig. 9 is the structural schematic diagram of another computer system provided in an embodiment of the present invention
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, those skilled in the art's every other implementation obtained without creative efforts Example, shall fall within the protection scope of the present invention.
The embodiment of the present invention provides a kind of method file system metadata isolation and repaired, to realize in file system The isolation and reparation of the metadata of mistake occurs, reduce metadata error influences caused by business, improves the industry of file system Business continuity, and reduce the time of metadata reparation.
The present invention also provides corresponding file system metadata isolating devices, are described in detail separately below.
To facilitate understanding of the present embodiment of the invention, the concept that can be introduced in description of the embodiment of the present invention is introduced herein first.
Isolable metadata: as described in background technique, in some scenes, the metadata of file system can be damaged And lead to mistake.Classification analysis discovery is carried out to file system metadata, the damage of most metadata can not influence The whole business of file system, the i.e. corresponding data of other normal metadata can all continue to provide normal service.Cause This, metadata can be classified, and will will not be impacted to the whole business of file system after above-mentioned appearance mistake, i.e., literary The meta data category that part system can continue to provide service is isolable metadata.Correspondingly, there is mistake in a part of metadata After accidentally, will lead to file system integrally cannot normally provide service, these metadata errors are generally mistake of overall importance, such as space Assignment bit map etc..For this kind of metadata, not isolable metadata can be classified as.It lists in table 1 in linux system In, classification that the metadata of some types is carried out according to the classification method.It should be understood that in different operating system, And under different types of file system, metadata has different type classification.Therefore, the type of metadata with whether can be every It will be different under specific operating system and file system from the corresponding relationship of reparation.
Metadata type Whether reparation can isolate
SuperBlock Reparation can be isolated
GlobalBitmap Reparation can not be isolated
Extent Block Reparation can be isolated
Extent Reparation can be isolated
Chain List Reparation can not be isolated
Chain Group Reparation can not be isolated
Inode Alloc Reparation can be isolated
Local Alloc Reparation can be isolated
Truncate Log Reparation can be isolated
Journal Reparation can be isolated
Inline Data Reparation can be isolated
Inode Reparation can be isolated
Table 1
It is a kind of system architecture diagram of file system maintenance device in the embodiment of the present application in conjunction with Fig. 1.This system framework with For Linux system, it is to be understood that, the thought according to provided by the present embodiment can the present invention is applied in others In operating system.Hardware layer contains system and runs relied on hardware device, including processor, memory, network interface etc.. Client layer (also referred to as user's space or User space) and inner nuclear layer (also referred to as kernel sky are marked off on hardware layer Between or kernel state).Application program in user's operation client layer, is called by system, and user asks the operation of file system It asks and (such as opens, reads and writes and close) and be transmitted to inner nuclear layer.Virtual File System is the abstract of file system, is responsible for passing request Give specific file system.File system can there are many types, such as the third generation to extend file system (Third Extended filesystem, abbreviation Ext3), forth generation extension file system (Fourth extended filesystem, Abbreviation Ext4), second generation Oracle cluster file system (Oracle Cluster File System2, abbreviation OCFS2) etc., The operation requests of User space application program are actually completed by these specific file system.File system and file system pipe The data of reason are stored in the memory of hardware layer.In embodiments of the present invention, it may include in file system as shown in the figure All or part of module, these modules can be used as new module and are integrated in file system, be also possible to existing file system Have in itself in the functional module of system or it is transformed it is made to have mould described in the embodiment of the present invention The function of block.Wherein, metadata detection module is used to detect the metadata that mistake occurs in operation for file system;Metadata Isolation module is used to for the metadata that mistake occurs being isolated;Metadata repair module passes through for responding user in client layer The reparation order that metadata fix tool initiates metadata, and metadata is repaired according to order is repaired;File system Freeze module for responding the file system freeze request of user and freezing to file system;Information reporting module is used for will The metadata error information reporting detected is informed the user that client layer.In the embodiment of the present application, it is also mentioned in client layer Metadata fix tool has been supplied, user can initiate to repair order by metadata fix tool to the metadata that mistake occurs, To call the repair module of the metadata in inner nuclear layer to repair the metadata that mistake occurs.
It should be noted that the embodiment of the present invention can be adapted for the computer equipment under general computer architecture, it can also To be suitable for applying other processing equipments or smart machine that file system principle carries out data management, for example, embedded Equipment, mobile device, private server, intelligent terminal, Intelligent Network Element, intelligent things equipment, intelligent storage equipment etc..
Referring to Fig.2, being the flow diagram of the method for the first file system maintenance provided in an embodiment of the present invention.This hair The method of bright embodiment is applied to the computer equipment under a kind of general computer architecture, also can be applied to apply file system Principle of uniting carries out other processing equipments or smart machine of data management.The equipment includes processor and storage equipment, The data in storage equipment are managed by file system.System architecture cited by the present embodiment combination Fig. 1, by first number The method in the present embodiment is executed according to wrong isolation module, the metadata that mistake occurs in file system is isolated.Certainly, It should be understood that the thought based on the present embodiment, the method in the present embodiment can also be used as the function being attached in file system Can, it is executed by file system itself, to achieve the effect that identical or similar as the present embodiment.
The method of the embodiment of the present invention may include following steps:
S101, when detecting that mistake occurs for metadata in the file system, determine that the metadata of the mistake is No to belong to isolable metadata, the isolable metadata is after mistake occurs, and file system still can continue to provide The metadata of partial service.
After metadata detection module detects that mistake occurs for metadata, different from directly file system is set in the prior art To be read-only or inaccessible, the type for the metadata that mistake occurs can be judged in embodiments of the present invention.According to preceding Metadata can be divided into isolable metadata and not isolable metadata, according to this classification, of the invention real in stating It applies in example, judges whether the metadata that mistake occurs belongs to isolable metadata.
It detects that mistake occurs for metadata, can be believing to metadata error of receiving that file system other modules report Breath, i.e. file system are in the process of running, it was found that the metadata error information reported after metadata error, for example, file system When specific a certain metadata is accessed in system, the failure of metadata access is caused since mistake occurs for metadata, thus on The error message is reported.It may include the metadata mark, metadata type or metadata mistake that mistake occurs in error message Type of error accidentally.
In another case, file system can dispatch metadata detection module or other have the mould of corresponding function Block carries out active detecting to metadata.For example, be scanned to metadata, thus find the metadata of generation mistake, and on It is reporting the wrong metadata with aforementioned similar error message.
Optionally, in one implementation, whether the metadata for judging the generation mistake belongs to isolable Metadata includes: according to the data type that wrong metadata and metadata occurs and whether isolable correspondence is closed System, determines whether the metadata that mistake occurs belongs to isolable metadata.
Specifically, the data type that the metadata of mistake occurs is obtained, according to the data of the metadata that mistake occurs Type and the preset meta data category table determine whether the metadata that mistake occurs can be isolated, the meta data category Table include metadata data type and whether isolable corresponding relationship.
In another concrete implementation mode, the data type of the available metadata that mistake occurs;According to The data type of the metadata that mistake occurs and preset meta data category table determine that the metadata that mistake occurs is It is no to be isolated, the meta data category table include metadata data type and whether isolable corresponding relationship.
Preset meta data category table can be comprising different types of metadata respectively whether can occur mistake after can With the classification information of isolation, i.e., after determining the data type of a metadata, which can be obtained according to the classification chart Whether the metadata of type belongs to isolable metadata;Alternatively, preset meta data category table can be and contain different mistakes The accidentally classification information that can type be isolated, that is, after determining the wrong type of error that a metadata is occurred, according to this Whether the metadata that classification chart can obtain the generation type of error belongs to isolable metadata.
S102, when determine it is described occur mistake metadata belong to isolable metadata when, by it is described occur mistake Metadata is set as read-only or inaccessible.
When metadata is isolable metadata, i.e., when mistake occurs for the metadata, file system still can Offer service is enough provided.Therefore, and in the prior art, read-only mode difference is set by entire file system, the present invention is real It applies in example and only to set read-only or inaccessible for isolable metadata, i.e., for other metadata in file system, Service is still normally provided, and for isolable metadata, then it is set to read-only or inaccessible.When can be isolated Metadata when being set as read-only, user can access to the metadata, but can only carry out reading behaviour to the metadata Make, and write operation cannot be carried out to the metadata;When setting inaccessible for isolable metadata, user cannot It accesses to the metadata, i.e., the user's operation including read operation and write operation is not allowed to.
Specifically, when setting read-only for metadata, can be asked if it is reading by the way that isolated marks are arranged to metadata It asks, i.e. the operation will not bring any update, then be allowed to;Otherwise, error message is directly returned to, i.e. User space application program exists Isolation metadata can not be updated operation before being repaired.When setting inaccessible for metadata, User space application journey Sequence accesses segregate metadata, can return to error message, i.e., User space application program is before isolation metadata is repaired It can not access to the metadata.
As it can be seen that can make to occur in file system by setting read-only or inaccessible for isolable metadata When the metadata of mistake is isolable metadata, file system will not be integrally set as read-only, the file system work of guarantee Continuity, improve the fault tolerant ability of system, improve the continuity of whole business.
It is the flow diagram of the method for second of metadata isolation provided in an embodiment of the present invention refering to Fig. 3.The present invention Embodiment is illustrated in the first aforementioned embodiment, the method for the present embodiment contain S101 in the first embodiment, S102 step, thus with the same or similar description of the step, repeat no more in the present embodiment.
In embodiments of the present invention, further include step S103:
The error message of the mistake is added in error message list, the error message list will be for that will occur mistake Metadata accidentally is reported to user.
After mistake occurs for metadata, the error message of metadata can be added in error message list.Error message It can include but is not limited to the position of the relevant information such as metadata of metadata itself, data type of metadata etc. and first number According to such as wrong type of the relevant information of mistake.Error message notifies user to carry out mistake and repair after can be used for report of user state Multiple, user can repair one by one the metadata that mistake occurs according to error message list.
As it can be seen that since error message to be added in error message list, the related letter of the metadata since mistake occurs The relevant information of breath and mistake passes through error message list and returns to User space, and User space is when carrying out errors repair, nothing Need to again to file system carry out error scanning, and can directly according to error listing in list generation mistake metadata into Row is repaired.Meanwhile before the metadata of the generation mistake in file system is not isolable metadata, in file system The isolable metadata that mistake occurs can be added in error listing, therefore user can be disposably to multiple metadata It is repaired, improves remediation efficiency.
It is the flow diagram of the method for the third metadata isolation provided in an embodiment of the present invention refering to Fig. 4.The present invention Embodiment is illustrated in the first aforementioned embodiment, the method for the present embodiment contain S101 in the first embodiment, S102 step, and may include the S103 step in second of embodiment, thus with the same or similar description of the step, It is repeated no more in the present embodiment.
In embodiments of the present invention further include: S104, determine it is described occur mistake metadata type of error whether be Relevance mistake, after the relevance misrepresentation mistake occurs, metadata relevant to the metadata of the mistake also occurs Mistake;When determining that the type of error is relevance mistake, then by the metadata relevant to the metadata of the mistake Also it is set as read-only or inaccessible.
Relevance mistake, refer to generation mistake often as caused by multiple metadata, or when mistake generation after, It will lead to multiple metadata and mistake occur.That is, when there is relevance mistake, generation mistake relevant to the mistake Metadata is greater than one.Therefore, when the type of error of metadata is relevance mistake, the generation for not only needing will test is wrong Metadata accidentally is isolated, and should will be also isolated in the relevant metadata of relevance mistake.
Specifically, can will be set as read-only or inaccessible in metadata relevant to the relevance mistake, specifically Implementation is similar with method described in previous embodiment, and details are not described herein.
In one implementation, according to type of error and type of error with whether be that the corresponding relationship of relevance mistake obtains It whether is relevance mistake to the type of error.Specifically, according to type of error and type of error and whether being relevance mistake Corresponding relationship accidentally determines whether the type of error is relevance mistake.It is similar with preceding method in one in implementation , the corresponding relationship can be realized by meta data category table.Whether meta data category table can belong to query metadata The meta data category table used in isolable metadata is same table, available according to the meta data category table The data type of the metadata of mistake occurs, or obtains occurring the dislocation type of mistake, so that it is determined that the mistake that metadata occurs Accidentally whether type is relevance mistake.Also it can be used alone the classification chart different from meta data category table above-mentioned, judge Method with it is aforementioned similar.
In one implementation, the metadata relevant to the metadata of the mistake is also set as read-only or can not When access, the metadata relevant to the metadata of the mistake includes the metadata of the metadata dependent on the mistake. For example, in linux system, the metadata error of Extent block or Extent type, the metadata and phase of the type There are dependences between the metadata of pass, therefore when mistake occurs for the metadata for finding this type, associated therewith Mistake can equally occur for metadata.Therefore, it is necessary to the associated metadata dependent on wrong metadata is isolated.
As it can be seen that in the present embodiment, since the relevant metadata of relevance mistake is set as read-only or inaccessible, It can guarantee that the associated metadata of relevance mistake is isolated, and then file system can be allow to continue offer service, together When increase the comprehensive of reparation.
It is a kind of flow diagram of the restorative procedure of file system metadata provided in an embodiment of the present invention refering to Fig. 5. The method of this method combination aforementioned metadata isolation is described, and on the basis of preceding method, increases response User space pair The reparation of metadata operates.Therefore, there is same or similar step in the aforementioned embodiment, in the present embodiment no longer into one Step is described.
The step of cut-off rule is executed the above are User space in figure, it can initiated by user, or by being in User space Application program is initiated.Cut-off rule is once the step of kernel state executes, and is initiated by kernel and is executed.Specific step is as follows:
S501, after detecting that metadata is wrong, judge occur mistake metadata whether be isolable metadata, Preferably, can be judged by tabling look-up.It can be set as read-only with segregate metadata.It optionally, can be to this yuan Isolated marks are arranged in data, the chained list of an isolation metadata are added, and the metadata that mistake occurs is reported to client layer.
When accessing segregate metadata, if it is read request, i.e., the operation will not bring any update, then permitted Perhaps;Otherwise, direct return-EIO, i.e. User space application program can not be updated operation before isolation metadata is repaired.
File system instruction is freezed in the segregate list of meta data that S502, user report according to kernel, initiation, and one by one Segregate metadata is initiated to repair instruction, is completed after all repairing, the instruction of defrosting operating system is initiated.Wherein, reparation refers to It enables and calls the metadata repair module of inner nuclear layer to repair metadata by the metadata fix tool of client layer.For not Same metadata, the mode of reparation is not exactly the same, since the present invention is not related to the specific restorative procedure of metadata, Details are not described herein.
S503, the instruction for freezing file system that user sends after determining metadata generation mistake is received, and according to institute It states and freezes the instruction of file system and freeze file system, keep the coherency state of file system in repair process.
The freeze operation of file system is intended to write all dirty file system metadatas and data disk, generates one With the almost consistent disk image of file system.The operation of any modification file system must just can be carried out after defrosting.Phase For unloading operation, unloading of file system closes all openings firstly the need of the business for stopping all operations in file system Handle, by dirty data brush return disk.And freeze be a kind of temporary suspension operation, therefore the duration freezed is shorter, but Be restore file system time it is also shorter.In the case where having obtained the list that the metadata of mistake occurs, according to list Time used in progress metadata reparation greatly shortens compared with the existing technology, so being more conducive to by the way of freezing Quick reparation to file system.
The metadata that mistake occurs is repaired in S504, the metadata reparation instruction sent according to user, if can be with It is single to repair, directly repair;If being related to the metadata of relevance mistake, need to repair simultaneously and relevance mistake Relevant metadata.
S505, the instruction for receiving the defrosting file system that user sends, and according to the instruction solution of the defrosting file system Freeze the file system.
As it can be seen that in the present embodiment, the metadata for the generation mistake that user can be reported according to kernel be isolated List, state by freezing file system, to occur mistake metadata repair.Due to having been obtained for that mistake occurs The list of metadata carries out error scanning to file system in the prior art without picture, therefore can shorten repair time, reduces The time that file system is hung up, improve the efficiency of system.
It is a kind of structural schematic diagram of file system maintenance device provided in an embodiment of the present invention refering to Fig. 6.Described device It can be performed or for executing the method provided in preceding method embodiment.Therefore it combines same or similar in previous embodiment Description, repeat no more in the present embodiment.Described device can be the computer under general computer architecture or be integrated in Module or equipment in computer, other processing for being readily applicable to apply the progress data management of file system principle are set Standby or smart machine or integrated module or equipment in the apparatus.It is a kind of file in the present embodiment in conjunction with Fig. 2 The possible system architecture diagram of system metadata isolating device, it is aforementioned in the system architecture of the computer equipment is carried out Illustrate, repeats no more here.
The 603 file system maintenance device includes:
601 metadata detection modules, for judging institute when detecting that mistake occurs for the metadata in the file system State occur mistake metadata whether belong to can segregate metadata, the isolable metadata be occur mistake after, text Part system still can continue to provide the metadata of partial service;
602 metadata isolation modules will if belonging to isolable metadata for the metadata that mistake occurs The metadata that mistake occurs is set as read-only or inaccessible.
Optionally, the metadata detection module is also used to: judging the type of error of the metadata that mistake occurs is No is relevance mistake, after the relevance misrepresentation mistake occurs, metadata relevant to the metadata of the mistake Mistake has occurred;The metadata isolation module is also used to:, will described and institute if the type of error is relevance mistake The relevant metadata of metadata for stating mistake is also set as read-only or inaccessible.
Optionally, whether the metadata detection module can also judge the type of error that wrong metadata occurs For relevance mistake, specifically, for judging whether the type of error of the metadata that mistake occurs is relevance mistake When, according to type of error and type of error with whether be that the corresponding relationship of relevance mistake determines whether the type of error is pass Connection property mistake.
Optionally, the metadata isolation module is specifically used for, by first number relevant to the metadata of the mistake When according to being also set as read-only or inaccessible, the metadata relevant to the metadata of the mistake includes depending on the mistake The metadata of metadata accidentally.
Optionally, it can also include that module is collected in error message according to device of calculating in the present embodiment, be used for the mistake Error message be added in error message list.
In the present embodiment, the device can be to execute the side in aforementioned S101, S102, S103 and S104 Method and its corresponding specific or optional implementation.It therefore, can be in conjunction in previous embodiment for described device The description of method is understood.
In one implementation, equipment is stored in computer be stored with the program generation that above-mentioned each functions of modules can be achieved Code, computer processor reads said program code, to realize the concrete function of above-mentioned each module.
As it can be seen that in the present embodiment file system metadata isolating device by by isolable metadata be set as it is read-only or Person is inaccessible, and when can make to occur in file system the isolable metadata of metadata of mistake, file system will not be by Entirety is set as read-only, and the continuity of the file system work of guarantee improves the fault tolerant ability of system, improves whole business Continuity.
Simultaneously as error message is added in error message list, the related letter of the metadata due to sending mistake The relevant information of breath and mistake passes through error message list and returns to User space, and User space is when carrying out errors repair, nothing Need to again to file system carry out error scanning, and can directly according to error listing in list generation mistake metadata into Row is repaired.Meanwhile before the metadata of the generation mistake in file system is not isolable metadata, in file system The isolable metadata that mistake occurs can be added in error listing, therefore user can be disposably to multiple metadata It is repaired, improves remediation efficiency.
Simultaneously as the relevant metadata of relevance mistake is set as read-only or inaccessible, it is ensured that association The associated metadata of property mistake is isolated, and then file system can be allow to continue offer service, while increasing reparation It is comprehensive.
It is a kind of structural schematic diagram of computer system 700 provided in an embodiment of the present invention with reference to Fig. 7.The computer System can execute the method in preceding method embodiment, specifically, the computer system includes:
Processor 701, and the memory 702 being connected with the processor;
Wherein, the processor calls the instruction stored in the memory to be used for:
When detecting that mistake occurs for the metadata in the file system, determine whether the metadata of the mistake belongs to Isolable metadata, the isolable metadata are that file system, which still can continue to provide, partially to be taken after mistake occurs The metadata of business;
If the metadata that mistake occurs belongs to isolable metadata, the metadata that mistake occurs is set It is set to read-only or inaccessible.
It should be understood that memory 702 may include read-only memory and random access memory, and at sensor It manages device 702 and instruction and data is provided.The a part of of memory 702 can also include nonvolatile RAM (NVRAM)。
A kind of system architecture in conjunction with provided in earlier figures 1, in a kind of implementation of the present embodiment, file system with And the data that file system is managed are stored in memory 702, it will of course be understood that, the file system and file The data that system is managed, which also can store, to be in other storage equipment that processor 701 is connected.
In some embodiments, memory 702 stores following element, executable modules or data structures, or Their subset of person or their superset: operating system, include various system programs, such as communication layers, sensor tube Reason system, driving layer etc., for realizing various basic businesses and the hardware based task of processing;And types of applications program.
In an implementation mode, when determining whether the metadata that mistake occurs belongs to isolable metadata, Whether the processor is specifically used for according to the metadata that mistake occurs and the data type of metadata and isolable Corresponding relationship, determines whether the metadata that mistake occurs belongs to isolable metadata.Optionally, determine that the generation is wrong Whether metadata accidentally when belonging to isolable metadata, can be according to the data type of the metadata that mistake occurs and pre- If meta data category table determine it is described occur mistake metadata whether can be isolated, the meta data category table includes metadata Data type and whether isolable corresponding relationship
In an implementation mode, it is described by it is described occur mistake metadata be set as it is read-only or it is inaccessible it Afterwards, the processor is also used to determine whether the type of error of the metadata that mistake occurs is relevance mistake, the pass After connection property misrepresentation mistake occurs, mistake is also had occurred in metadata relevant to the metadata of the mistake;If the mistake Accidentally type is relevance mistake, then the metadata relevant to the metadata of the mistake is also set as read-only or can not visited It asks.Optionally, when whether the type of error for judging the metadata that mistake occurs is relevance mistake, according to mistake Type and type of error with whether be that the corresponding relationship of relevance mistake determines whether the type of error is relevance mistake.It can Choosing, the metadata relevant to the metadata of the mistake includes the metadata of the metadata dependent on the mistake.
In one implementation, the processor is also used to for the error message of the mistake being added to error message column In table, the error message list is used to the metadata that mistake occurs being reported to user.
In the present embodiment, the computer system can be to execute aforementioned S101, S102, S103 and S104 In method and its corresponding specific or optional implementation.Therefore, before being combined for the computer system The description for stating the method in embodiment is understood.
As it can be seen that in the present embodiment file system metadata isolating device by by isolable metadata be set as it is read-only or Person is inaccessible, and when can make to occur in file system the isolable metadata of metadata of mistake, file system will not be by Entirety is set as read-only, and the continuity of the file system work of guarantee improves the fault tolerant ability of system, improves whole business Continuity.
Simultaneously as error message is added in error message list, the related letter of the metadata due to sending mistake The relevant information of breath and mistake passes through error message list and returns to User space, and User space is when carrying out errors repair, nothing Need to again to file system carry out error scanning, and can directly according to error listing in list generation mistake metadata into Row is repaired.Meanwhile before the metadata of the generation mistake in file system is not isolable metadata, in file system The isolable metadata that mistake occurs can be added in error listing, therefore user can be disposably to multiple metadata It is repaired, improves remediation efficiency.
Simultaneously as the relevant metadata of relevance mistake is set as read-only or inaccessible, it is ensured that association The associated metadata of property mistake is isolated, and then file system can be allow to continue offer service, while increasing reparation It is comprehensive.
A kind of file system prosthetic device 800 provided in an embodiment of the present invention refering to Fig. 8, described device it is executable or Person is for executing the method provided in preceding method embodiment.Therefore description same or similar in previous embodiment is combined, It repeats no more in the present embodiment.Described device can be the computer under general computer architecture or integrate in a computer Module perhaps equipment is readily applicable to apply other processing equipments or intelligence that file system principle carries out data management It can equipment or integrated module or equipment in the apparatus.It is a kind of file system member number in the present embodiment in conjunction with Fig. 2 According to the possible system architecture diagram of isolating device, it is aforementioned in the system architecture of the computer equipment is illustrated, Details are not described herein again.
The file system maintenance device includes:
File system freezes module 801, for receive user determine metadata occur mistake after send freeze file The instruction of system, and file system is freezed according to the instruction for freezing file system, and receive the defrosting text that user sends The instruction of part system, and according to the instruction of the defrosting file system defrosting file system;
Metadata repair module 802, the metadata reparation instruction for being occurred according to user is to the metadata that mistake occurs It is repaired.
Optionally, described device can also include information reporting module, for reporting of user error message list so as to The metadata that mistake occurs is determined in user, the error message list includes that the error message of the metadata of mistake occurs.
The file system, which freezes module, can be used for executing method described in aforementioned S503, S505;The metadata reparation Module can execute method described in aforementioned S502, S504.Therefore it can refer to the aforementioned description in embodiment of the method to this dress It sets and is understood.
As it can be seen that in the present embodiment, the metadata for the generation mistake that user can be reported according to kernel be isolated List, state by freezing file system, to occur mistake metadata repair.Due to having been obtained for that mistake occurs The list of metadata carries out error scanning to file system in the prior art without picture, therefore can shorten repair time, reduces The time that file system is hung up, improve the efficiency of system
It is a kind of structural schematic diagram of computer system 900 provided in an embodiment of the present invention with reference to Fig. 9.The computer System can execute the method in preceding method embodiment, specifically, the computer system includes:
Processor, and the memory being connected with the processor;
Wherein, the processor calls the instruction stored in the memory to be used for:
The instruction for freezing file system that user sends after determining metadata generation mistake is received, and is freezed according to described File system is freezed in the instruction of file system;
The metadata that mistake occurs is repaired in the metadata reparation instruction sent according to user;
The instruction for the defrosting file system that user sends is received, and according to the instruction of defrosting file system defrosting File system.
Optionally, the processor is also used to:
The metadata of mistake, the error message list occurs in order to which user determines to reporting of user error message list Error message comprising the metadata of mistake occurs.
Computer system described in the present embodiment is same or similar with the structure of computer system described in Fig. 7, therefore, can To understand the framework of the computer system in the present embodiment in reference Fig. 7 the associated description of the computer system.
The computer system can be used for executing method described in aforementioned S502, S503, S504, S505, therefore can refer to The aforementioned description in embodiment of the method understands the present apparatus.
As it can be seen that in the present embodiment, the metadata for the generation mistake that user can be reported according to kernel be isolated List, state by freezing file system, to occur mistake metadata repair.Due to having been obtained for that mistake occurs The list of metadata carries out error scanning to file system in the prior art without picture, therefore can shorten repair time, reduces The time that file system is hung up, improve the efficiency of system
The apparatus embodiments described above are merely exemplary, wherein described, unit can as illustrated by the separation member It is physically separated with being or may not be, component shown as a unit may or may not be physics list Member, it can it is in one place, or may be distributed over multiple network units.It can be selected according to the actual needs In some or all of the modules achieve the purpose of the solution of this embodiment.In addition, Installation practice attached drawing provided by the invention In, the connection relationship between module indicates there is communication connection between them, and it is total specifically to can be implemented as one or more communication Line or signal wire.Those of ordinary skill in the art can understand and implement without creative efforts.
Through the above description of the embodiments, it is apparent to those skilled in the art that the present invention is implemented Plotting unit described in example can add the mode of required common hardware to realize by software, naturally it is also possible to pass through specialized hardware It is realized including specific integrated circuit, dedicated cpu, private memory, special components and parts etc..Under normal circumstances, all by computer The function that program is completed can be realized easily with corresponding hardware, moreover, being used to realize the specific hard of same function Part structure is also possible to diversified, such as analog circuit, digital circuit or special circuit etc..
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain Lid is within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.

Claims (20)

1. a kind of file system maintenance method, which is characterized in that the described method includes:
When detecting that mistake occurs for metadata in the file system, determining whether the metadata of the mistake belongs to can be every From metadata, the isolable metadata is after mistake occurs, and file system still can continue to provide partial service Metadata;
When determining that the metadata that mistake occurs belongs to isolable metadata, the metadata that mistake occurs is arranged It is read-only or inaccessible.
2. method according to claim 1, which is characterized in that whether the determination metadata that mistake occurs belongs to can The metadata of isolation includes:
According to it is described occur mistake metadata and the metadata data type and whether isolable corresponding relationship, Determine whether the metadata that mistake occurs belongs to isolable metadata.
3. method according to claim 2, which is characterized in that described according to the metadata that mistake occurs and described The data type of metadata and whether isolable corresponding relationship, determine it is described occur mistake metadata whether belong to and can be isolated Metadata include:
Obtain the data type of the metadata that mistake occurs;
The generation mistake is determined according to the data type of the metadata that mistake occurs and preset meta data category table Whether metadata can be isolated, the meta data category table include metadata data type and whether isolable corresponding relationship.
4. method according to claim 1 to 3, which is characterized in that described by first number that mistake occurs After being set as read-only or inaccessible, further includes:
Whether the type of error for determining the metadata that mistake occurs is relevance mistake, the relevance misrepresentation mistake After generation, mistake is also had occurred in metadata relevant to the metadata that mistake occurs;
When determining that the type of error is relevance mistake, then by the metadata relevant to the metadata that mistake occurs Also it is set as read-only or inaccessible.
5. method according to claim 4, which is characterized in that whether judge the type of error that wrong metadata occurs For relevance mistake include: according to type of error and type of error with whether be that the corresponding relationship of relevance mistake determines institute State whether type of error is relevance mistake.
6. method according to claim 4, which is characterized in that the metadata relevant to the metadata that mistake occurs Including the metadata dependent on the metadata that mistake occurs.
7. method according to claim 1, which is characterized in that the method also includes:
The error message of the mistake is added in error message list, the error message list is used to occur mistake Metadata is reported to user.
8. a kind of file system maintenance device, which is characterized in that the file system maintenance device includes:
Metadata detection module, for judging the generation when detecting that mistake occurs for the metadata in the file system Whether the metadata of mistake belongs to isolable metadata, and the isolable metadata is after mistake occurs, and file system is still It can so continue to provide the metadata of partial service;
Metadata isolation module will be described for when determining that the metadata that mistake occurs belongs to isolable metadata The metadata that mistake occurs is set as read-only or inaccessible.
9. device according to claim 8, which is characterized in that the metadata detection module is specifically used for:
When detecting that mistake occurs for the metadata in the file system, according to the metadata that mistake occurs and first number According to data type and whether isolable corresponding relationship, determine it is described occur mistake metadata whether belong to isolable member Data.
10. device according to claim 8, which is characterized in that
The metadata detection module is also used to: whether the type of error for determining the metadata that mistake occurs is relevance mistake Accidentally, after the relevance misrepresentation mistake occurs, mistake is also had occurred in metadata relevant to the metadata that mistake occurs Accidentally;
The metadata isolation module is also used to:, then will the described and hair when determining that the type of error is relevance mistake The relevant metadata of metadata of raw mistake is also set as read-only or inaccessible.
11. device according to claim 10, which is characterized in that the metadata detection module is specifically used for: for judging When whether the type of error of metadata that mistake occurs is relevance mistake, according to type of error and type of error with It whether is that the corresponding relationship of relevance mistake determines whether the type of error is relevance mistake.
12. 0 or 11 described device according to claim 1, which is characterized in that the metadata isolation module is specifically used for, by institute When stating metadata relevant to the metadata of the mistake and being also set as read-only or inaccessible, first number with the mistake It include the metadata of the metadata dependent on the mistake according to relevant metadata.
13. the device according to claim 8, which is characterized in that described device further include:
Module is collected in error message, and the error message of the mistake is added in error message list, the error message column Table is used to the metadata that mistake occurs being reported to user.
14. a kind of computer system, which is characterized in that the computer system includes:
Processor, and the memory being connected with the processor;
Wherein, the processor calls the instruction stored in the memory to be used for:
When detecting that mistake occurs for the metadata in file system, it is isolable to determine whether the metadata of the mistake belongs to Metadata, the isolable metadata are after mistake occurs, and file system still can continue to provide first number of partial service According to;
If the metadata that mistake occurs belongs to isolable metadata, set the metadata that mistake occurs to It is read-only or inaccessible.
15. 4 computer system according to claim 1, which is characterized in that whether determining the metadata that mistake occurs When belonging to isolable metadata, the processor is specifically used for:
According to it is described occur mistake metadata and metadata data type and whether isolable corresponding relationship, determine institute It states and occurs whether wrong metadata belongs to isolable metadata.
16. computer system according to claim 15, which is characterized in that the metadata according to the mistake, described The data type of metadata and whether isolable corresponding relationship, determine it is described occur mistake metadata whether belong to and can be isolated Metadata when, the computer system is used for:
Obtain the data type of the metadata that mistake occurs;
The generation mistake is determined according to the data type of the metadata that mistake occurs and preset meta data category table Whether metadata can be isolated, the meta data category table include metadata data type and whether isolable corresponding relationship.
17. computer system described in 4-16 any one according to claim 1, which is characterized in that described by the generation After the metadata of mistake is set as read-only or inaccessible, the processor is also used to:
Whether the type of error for determining the metadata that mistake occurs is relevance mistake, the relevance misrepresentation mistake After generation, mistake is also had occurred in metadata relevant to the metadata of the mistake;
If the type of error is relevance mistake, the metadata relevant to the metadata of the mistake is also set as It is read-only or inaccessible.
18. 7 computer system according to claim 1, which is characterized in that in the determination metadata that mistake occurs Type of error when whether being relevance mistake, the processor is specifically used for: according to type of error and type of error with whether Determine whether the type of error is relevance mistake for the corresponding relationship of relevance mistake.
19. 7 computer system according to claim 1, which is characterized in that will be described related to the metadata of the mistake Metadata when being also set as read-only or inaccessible, the processor is specifically used for:
The metadata relevant to the metadata of the mistake includes the metadata of the metadata dependent on the mistake.
20. 4 computer system according to claim 1, which is characterized in that the processor is also used to:
The error message of the mistake is added in error message list, the error message list is used to occur mistake Metadata is reported to user.
CN201510662628.2A 2015-10-14 2015-10-14 A kind of method and apparatus of file system maintenance and reparation Active CN105354102B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510662628.2A CN105354102B (en) 2015-10-14 2015-10-14 A kind of method and apparatus of file system maintenance and reparation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510662628.2A CN105354102B (en) 2015-10-14 2015-10-14 A kind of method and apparatus of file system maintenance and reparation

Publications (2)

Publication Number Publication Date
CN105354102A CN105354102A (en) 2016-02-24
CN105354102B true CN105354102B (en) 2019-03-01

Family

ID=55330076

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510662628.2A Active CN105354102B (en) 2015-10-14 2015-10-14 A kind of method and apparatus of file system maintenance and reparation

Country Status (1)

Country Link
CN (1) CN105354102B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109426586B (en) * 2017-08-25 2023-05-12 中兴通讯股份有限公司 Data file repairing method, device and computer readable storage medium
CN107861842B (en) * 2017-11-08 2021-10-15 郑州云海信息技术有限公司 Metadata damage detection method, system, equipment and storage medium
CN111209138A (en) * 2018-11-22 2020-05-29 浙江宇视科技有限公司 Operation and maintenance method and device of data storage system
CN110532032B (en) * 2019-07-31 2021-01-05 华为技术有限公司 Startup file system detection method and related equipment
CN114327662A (en) * 2021-12-30 2022-04-12 山石网科通信技术股份有限公司 Operating system processing method and device, storage medium and processor

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7698597B2 (en) * 2006-02-28 2010-04-13 International Business Machines Corporation Method of isolating erroneous software program components
US8782361B2 (en) * 2010-08-31 2014-07-15 Hitachi, Ltd. Management server and data migration method with improved duplicate data removal efficiency and shortened backup time

Also Published As

Publication number Publication date
CN105354102A (en) 2016-02-24

Similar Documents

Publication Publication Date Title
CN105354102B (en) A kind of method and apparatus of file system maintenance and reparation
US7191198B2 (en) Storage operation management program and method and a storage management computer
US8910172B2 (en) Application resource switchover systems and methods
CN111031096B (en) Distributed storage system construction method based on mimicry defense
CN102981931B (en) Backup method and device for virtual machine
US9652326B1 (en) Instance migration for rapid recovery from correlated failures
CN109582443A (en) Virtual machine standby system based on distributed storage technology
CN102355368B (en) Fault processing method of network equipment and system
CN105550229A (en) Method and device for repairing data of distributed storage system
CN104583968A (en) Management system and management program
CN113360579A (en) Database high-availability processing method and device, electronic equipment and storage medium
CN114816820A (en) Method, device, equipment and storage medium for repairing chproxy cluster fault
WO2017220013A1 (en) Service processing method and apparatus, and storage medium
CN105550230B (en) The method for detecting and device of distributed memory system node failure
CN111342986B (en) Distributed node management method and device, distributed system and storage medium
CN104517067A (en) Method, device and system for data access
US9880776B1 (en) Content-driven data protection method for multiple storage devices
CN113268206B (en) Network target range resource hot plug implementation method and system
CN107943615B (en) Data processing method and system based on distributed cluster
CN115080309A (en) Data backup system, method, storage medium, and electronic device
CN109582497A (en) One kind being based on the quick emergency starting method of dynamic data increment
CN115686368A (en) Method, system, apparatus and medium for storage capacity expansion of nodes of block chain network
CN111209138A (en) Operation and maintenance method and device of data storage system
CN114996955A (en) Target range environment construction method and device for cloud-originated chaotic engineering experiment
CN110968456A (en) Method and device for processing fault disk in distributed storage system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant