Deadlock-Free Inode Lock Ordering for Concurrent File Copy
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Distributed file systems face challenges in maintaining consistency and avoiding deadlocks due to concurrent access from multiple clients, which can lead to data corruption and loss.
Innovation Solution
Implementing a deadlock-free locking mechanism that acquires multiple inode locks in a specific order, using inode numbers to ensure consistent and concurrent server-side file operations, and maintaining rename locks until the server-side copy operation is complete to prevent interference with other file system operations.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If concurrent access from multiple clients is allowed, then productivity and ease of operation are improved, but the risk of deadlocks and data inconsistency increases
Solution Approach 1:
The patent segments the file system operations into distinct phases (copy initiation, copy execution, copy completion) with separate locking requirements. Different lock types (source lock, destination lock, completion lock) are applied to different operational phases, allowing concurrent non-conflicting operations while preventing deadlocks through structured lock acquisition and release sequences.
Solution Approach 2:
The patent introduces an intermediary completion record data structure that mediates between the copy operation and the file system state. This intermediary tracks copy progress and coordinates lock release timing, enabling the system to maintain consistency without requiring prolonged exclusive locks that would block other clients.
2Reliability
If locking mechanisms are implemented to maintain consistency, then file system integrity is improved, but concurrency and productivity are degraded
Solution Approach 1:
The patent implements dynamic locking where the type and duration of locks adapt based on the operational phase. Read locks are used during copy initiation, exclusive locks during copy execution, and completion locks during finalization. This dynamic approach minimizes lock duration and allows maximum concurrency while maintaining integrity.
Solution Approach 2:
The patent performs preliminary actions by acquiring source and destination locks before initiating the copy operation, and by setting up completion records in advance. This preliminary locking prevents deadlocks by ensuring locks are acquired in a consistent order before conflicts can occur, while allowing the actual copy to proceed without additional blocking.
3Reliability
If multiple locks are acquired to prevent deadlocks, then reliability is improved, but device complexity increases
Solution Approach 1:
The patent applies different locking strategies to different components: source inode locks, destination inode locks, and completion record locks. Each lock type has specific acquisition and release rules tailored to its function. This localized approach manages complexity by treating each lock independently with well-defined semantics rather than using a monolithic locking mechanism.
Data Source
AI summary
A request is received to copy a file from a source to a target in a file system. The source is associated with a source inode, and the target is associated with a target inode. A list is generated of the one of the source or target inodes followed by another of the source or target inodes according to inode numbers identifying the source and target inodes. A first determination includes determining that the one inode is the source inode and the other inode is the target inode. When the first determination is made, a read rename lock is acquired for the source inode, followed by a write rename lock for the target inode, followed by a read inode lock for the source inode, followed by a write inode lock for the target inode. After the locks have been acquired, a chunk map of the source inode is copied to the target inode.


