diff options
author | Long Li <leo.lilong@huawei.com> | 2025-07-16 09:54:07 +0800 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-07-16 23:38:59 +0200 |
commit | 5105080b6bdc45a2a0ed9f2bccc9b511c572d1b6 (patch) | |
tree | 4c9193157316f23f2416055038d3ddf527edbb59 | |
parent | 53607e073d075ad1984f7015187d203a3ae83297 (diff) | |
download | libfuse-5105080b6bdc45a2a0ed9f2bccc9b511c572d1b6.tar.gz |
memfs_ll: fix deadlock in truncate operation
Remove redundant mutex lock acquisition in the truncate() method to
prevent deadlock. The issue occurs when memfs_setattr() already holds
the mutex lock and then calls truncate(), which attempts to acquire
the same lock again.
Signed-off-by: Long Li <leo.lilong@huawei.com>
(cherry picked from commit b96c738b10e9a308725c62b9392ba7d553eec254)
-rw-r--r-- | example/memfs_ll.cc | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/example/memfs_ll.cc b/example/memfs_ll.cc index 6038850..e587756 100644 --- a/example/memfs_ll.cc +++ b/example/memfs_ll.cc @@ -197,7 +197,6 @@ class Inode { void truncate(off_t size) { - std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> attr_lock(attr_mutex); if (size < content.size()) { content.resize(size); |