Blame 0076-virtiofsd-passthrough_ll-add-renameat2-support.patch

1d442b
From: Miklos Szeredi <mszeredi@redhat.com>
1d442b
Date: Mon, 27 Jan 2020 19:01:45 +0000
1d442b
Subject: [PATCH] virtiofsd: passthrough_ll: add renameat2 support
1d442b
1d442b
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
(cherry picked from commit f0ab7d6f78a7d3c1c19fd81a91c9b1199f56c4f6)
1d442b
---
1d442b
 tools/virtiofsd/passthrough_ll.c | 10 ++++++++++
1d442b
 1 file changed, 10 insertions(+)
1d442b
1d442b
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
1d442b
index 98114a3f4a..18d69abcbc 100644
1d442b
--- a/tools/virtiofsd/passthrough_ll.c
1d442b
+++ b/tools/virtiofsd/passthrough_ll.c
1d442b
@@ -1099,7 +1099,17 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
1d442b
     }
1d442b
 
1d442b
     if (flags) {
1d442b
+#ifndef SYS_renameat2
1d442b
         fuse_reply_err(req, EINVAL);
1d442b
+#else
1d442b
+        res = syscall(SYS_renameat2, lo_fd(req, parent), name,
1d442b
+                       lo_fd(req, newparent), newname, flags);
1d442b
+        if (res == -1 && errno == ENOSYS) {
1d442b
+            fuse_reply_err(req, EINVAL);
1d442b
+        } else {
1d442b
+            fuse_reply_err(req, res == -1 ? errno : 0);
1d442b
+        }
1d442b
+#endif
1d442b
         return;
1d442b
     }
1d442b