[PR #1146] [CLOSED] fix deadlock due to fdmanager_lock and fdent_data_lock #1851

Closed
opened 2026-03-04 02:02:28 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/1146
Author: @liuyongqing
Created: 9/7/2019
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • b5bf745 fix deadlock due to fdmanager_lock and fdent_data_lock

📊 Changes

2 files changed (+11 additions, -4 deletions)

View changed files

📝 src/fdcache.cpp (+9 -3)
📝 src/fdcache.h (+2 -1)

📄 Description

Details

Deadlocks will appear in the following situations:

  1. thread A call s3fs_read, already get the fdent_data_lock and cache_cleanup_lock(for clean up cache dir), trying to get fd_manager_lock
  2. thread B call s3fs_open, already get fd_manager_lock and fdent_lock, trying to get fdent_data_lock
  3. the deadlock occured between thread A and thread B, because each thread wants to get the lock of another thread
    so we should use pthread_mutex_trylock for fdmanager when clean up cache

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/s3fs-fuse/s3fs-fuse/pull/1146 **Author:** [@liuyongqing](https://github.com/liuyongqing) **Created:** 9/7/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`b5bf745`](https://github.com/s3fs-fuse/s3fs-fuse/commit/b5bf745a720b786a82f55b27b7e28ceb37976fb6) fix deadlock due to fdmanager_lock and fdent_data_lock ### 📊 Changes **2 files changed** (+11 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/fdcache.cpp` (+9 -3) 📝 `src/fdcache.h` (+2 -1) </details> ### 📄 Description ### Details Deadlocks will appear in the following situations: 1. thread A call s3fs_read, already get the fdent_data_lock and cache_cleanup_lock(for clean up cache dir), trying to get fd_manager_lock 2. thread B call s3fs_open, already get fd_manager_lock and fdent_lock, trying to get fdent_data_lock 3. the deadlock occured between thread A and thread B, because each thread wants to get the lock of another thread so we should use pthread_mutex_trylock for fdmanager when clean up cache --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:02:28 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#1851
No description provided.