qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 105/104] virtiofsd: Unref old/new inodes with the same mutex lock


From: Philippe Mathieu-Daudé
Subject: [PATCH 105/104] virtiofsd: Unref old/new inodes with the same mutex lock in lo_rename()
Date: Fri, 17 Jan 2020 14:32:57 +0100

We can unref both old/new inodes with the same mutex lock.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
Based-on: <address@hidden>
"virtiofs daemon"
https://www.mail-archive.com/address@hidden/msg664652.html

 tools/virtiofsd/passthrough_ll.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index 57f58aef26..5c717cb5a1 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -1461,8 +1461,10 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, 
const char *name,
     }
 
 out:
-    unref_inode_lolocked(lo, oldinode, 1);
-    unref_inode_lolocked(lo, newinode, 1);
+    pthread_mutex_lock(&lo->mutex);
+    unref_inode(lo, oldinode, 1);
+    unref_inode(lo, newinode, 1);
+    pthread_mutex_unlock(&lo->mutex);
     lo_inode_put(lo, &oldinode);
     lo_inode_put(lo, &newinode);
     lo_inode_put(lo, &parent_inode);
-- 
2.21.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]