|
Neal Gompa |
fdc9eb |
From 41af4459ac47e107093c3f54b6875d54723aa613 Mon Sep 17 00:00:00 2001
|
|
Neal Gompa |
fdc9eb |
From: Sebastian Hasler <sebastian.hasler@stuvus.uni-stuttgart.de>
|
|
Neal Gompa |
fdc9eb |
Date: Thu, 13 Jan 2022 16:32:49 +0100
|
|
Neal Gompa |
fdc9eb |
Subject: [PATCH 2/2] virtiofsd: Do not support blocking flock
|
|
Neal Gompa |
fdc9eb |
|
|
Neal Gompa |
fdc9eb |
With the current implementation, blocking flock can lead to
|
|
Neal Gompa |
fdc9eb |
deadlock. Thus, it's better to return EOPNOTSUPP if a user attempts
|
|
Neal Gompa |
fdc9eb |
to perform a blocking flock request.
|
|
Neal Gompa |
fdc9eb |
|
|
Neal Gompa |
fdc9eb |
Signed-off-by: Sebastian Hasler <sebastian.hasler@stuvus.uni-stuttgart.de>
|
|
Neal Gompa |
fdc9eb |
Message-Id: <20220113153249.710216-1-sebastian.hasler@stuvus.uni-stuttgart.de>
|
|
Neal Gompa |
fdc9eb |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
Neal Gompa |
fdc9eb |
Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
|
|
Neal Gompa |
fdc9eb |
Reviewed-by: Greg Kurz <groug@kaod.org>
|
|
Neal Gompa |
fdc9eb |
---
|
|
Neal Gompa |
fdc9eb |
tools/virtiofsd/passthrough_ll.c | 9 +++++++++
|
|
Neal Gompa |
fdc9eb |
1 file changed, 9 insertions(+)
|
|
Neal Gompa |
fdc9eb |
|
|
Neal Gompa |
fdc9eb |
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
|
|
Neal Gompa |
fdc9eb |
index b3d0674f6d..3e56d1cd95 100644
|
|
Neal Gompa |
fdc9eb |
--- a/tools/virtiofsd/passthrough_ll.c
|
|
Neal Gompa |
fdc9eb |
+++ b/tools/virtiofsd/passthrough_ll.c
|
|
Neal Gompa |
fdc9eb |
@@ -2467,6 +2467,15 @@ static void lo_flock(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
|
|
Neal Gompa |
fdc9eb |
int res;
|
|
Neal Gompa |
fdc9eb |
(void)ino;
|
|
Neal Gompa |
fdc9eb |
|
|
Neal Gompa |
fdc9eb |
+ if (!(op & LOCK_NB)) {
|
|
Neal Gompa |
fdc9eb |
+ /*
|
|
Neal Gompa |
fdc9eb |
+ * Blocking flock can deadlock as there is only one thread
|
|
Neal Gompa |
fdc9eb |
+ * serving the queue.
|
|
Neal Gompa |
fdc9eb |
+ */
|
|
Neal Gompa |
fdc9eb |
+ fuse_reply_err(req, EOPNOTSUPP);
|
|
Neal Gompa |
fdc9eb |
+ return;
|
|
Neal Gompa |
fdc9eb |
+ }
|
|
Neal Gompa |
fdc9eb |
+
|
|
Neal Gompa |
fdc9eb |
res = flock(lo_fi_fd(req, fi), op);
|
|
Neal Gompa |
fdc9eb |
|
|
Neal Gompa |
fdc9eb |
fuse_reply_err(req, res == -1 ? errno : 0);
|
|
Neal Gompa |
fdc9eb |
--
|
|
Neal Gompa |
fdc9eb |
2.35.1
|
|
Neal Gompa |
fdc9eb |
|