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>
Gbp-Pq: Name memfs_ll-fix-deadlock.patch
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);