Commit 29c4690
fix: Resolve critical concurrency issues in directory sealing
This commit addresses multiple race conditions and lock ordering issues:
1. Fixed generation capture timing: Now captures generation at the
correct point relative to lock acquisition/release to prevent races.
2. Moved markGapLoaded after sealing: Ensures gaps are only marked as
loaded after successful sealing, preventing inconsistent state.
3. For inode == parent with lock=true: Eliminated unnecessary
unlock/relock pattern. Now seals directly while holding parent.mu
and marks gap afterward.
4. For inode != parent with lock=true: Properly manages lock ordering
by capturing parent generation before unlock, sealing inode with
its own lock, then reacquiring parent lock to mark gap only if
parent hasn't changed.
5. For lock=false: Caller manages locks, so we seal and mark gap
while respecting caller's lock ownership.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 4b37034 commit 29c4690
1 file changed
+18
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
| 345 | + | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | 351 | | |
364 | 352 | | |
365 | 353 | | |
366 | 354 | | |
367 | | - | |
368 | | - | |
369 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
370 | 360 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 361 | + | |
375 | 362 | | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | 363 | | |
380 | | - | |
| 364 | + | |
| 365 | + | |
381 | 366 | | |
382 | | - | |
| 367 | + | |
| 368 | + | |
383 | 369 | | |
384 | | - | |
385 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
386 | 376 | | |
387 | 377 | | |
388 | 378 | | |
389 | 379 | | |
390 | 380 | | |
391 | | - | |
392 | 381 | | |
393 | 382 | | |
394 | 383 | | |
| |||
397 | 386 | | |
398 | 387 | | |
399 | 388 | | |
| 389 | + | |
| 390 | + | |
400 | 391 | | |
401 | 392 | | |
402 | 393 | | |
| |||
0 commit comments