Online File System Consistency Check via Dynamic Locking
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing file system consistency check processes, such as FSCK, take a long time to run and make databases inaccessible for extended periods, causing inconvenience in global file systems like SANs and cluster file systems, even when attempting to perform checks online.
Innovation Solution
Acquire a lock on the data structure, read and validate its content, then release the lock to allow concurrent checking of file system components, reacquiring the lock only when necessary to verify changes, thus minimizing the time the database is inaccessible.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If an exclusive lock is acquired on the database to perform consistency check, then the reliability of the check is improved, but the productivity of the system deteriorates due to extended inaccessibility
Solution Approach 1:
The consistency check process is segmented into two distinct phases: a lock-based phase for validating the data structure content, and a lock-free phase for checking file system components. This segmentation allows different parts of the check to use different locking strategies, improving overall system accessibility while maintaining check reliability.
Solution Approach 2:
The data structure content is read and validated preliminarily while holding the lock, before releasing the lock for the majority of the check process. This preliminary action ensures data integrity is captured at a consistent point in time, allowing subsequent checks to proceed without requiring the lock to be held.
2Measurement precision
If the lock is held for the entire consistency check process, then the measurement accuracy of the check is improved, but the loss of time increases due to prolonged database unavailability
Solution Approach 1:
The locking strategy is made dynamic rather than static. The lock is acquired temporarily only when needed to read and validate data structure content, then released to allow concurrent file system component checks. This dynamic approach adapts the locking duration to the actual needs of the check process, minimizing time loss while preserving measurement accuracy.
Solution Approach 2:
The consistency check employs periodic re-acquisition of the lock to verify version numbers and detect changes. Instead of holding the lock continuously, the system periodically reacquires it at strategic points (before and after file system component checks) to ensure data consistency, thereby reducing overall lock duration while maintaining check accuracy.
3Productivity
If the lock is released early to allow concurrent access, then the productivity is improved, but the reliability of the consistency check deteriorates due to potential data changes
Solution Approach 1:
The system implements feedback mechanisms by checking version numbers associated with the data structure. After releasing the lock and completing file system component checks, the system reacquires the lock and verifies whether the version number has changed. This feedback loop detects any data changes that occurred during the lock-free period, allowing the system to respond appropriately (repeating the check or detecting inconsistencies) thereby maintaining reliability while enabling concurrent access.
Data Source
AI summary
A lock is acquired on a data structure. Content in the data structure is read and verified while the lock is held. The lock is then released, and then the file system components that are referred to by the data structure are verified. In essence, a file system consistency check of the file system components is performed offline in the background while the data structure remains accessible.


