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 12:24:52 +0200 |
commit | b96c738b10e9a308725c62b9392ba7d553eec254 (patch) | |
tree | 2a1df8fbd808806dd3f274b7ebec0e57ae6785e4 /example/memfs_ll.cc | |
parent | d8253770ac2cf4b8769e8cf41eb3c629f30ee80f (diff) | |
download | libfuse-b96c738b10e9a308725c62b9392ba7d553eec254.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>
Diffstat (limited to 'example/memfs_ll.cc')
-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 0da7c25..17d7d03 100644 --- a/example/memfs_ll.cc +++ b/example/memfs_ll.cc @@ -199,7 +199,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); |