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>
This commit is contained in:
Long Li
2025-07-16 09:54:07 +08:00
committed by Bernd Schubert
parent d8253770ac
commit b96c738b10
-1
View File
@@ -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);