Skip to content
Snippets Groups Projects
Commit 41af4459 authored by Sebastian Hasler's avatar Sebastian Hasler Committed by Dr. David Alan Gilbert
Browse files

virtiofsd: Do not support blocking flock


With the current implementation, blocking flock can lead to
deadlock. Thus, it's better to return EOPNOTSUPP if a user attempts
to perform a blocking flock request.

Signed-off-by: default avatarSebastian Hasler <sebastian.hasler@stuvus.uni-stuttgart.de>
Message-Id: <20220113153249.710216-1-sebastian.hasler@stuvus.uni-stuttgart.de>
Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: default avatarVivek Goyal <vgoyal@redhat.com>
Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
parent c13b8e99
No related branches found
No related tags found
No related merge requests found
......@@ -2467,6 +2467,15 @@ static void lo_flock(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
int res;
(void)ino;
if (!(op & LOCK_NB)) {
/*
* Blocking flock can deadlock as there is only one thread
* serving the queue.
*/
fuse_reply_err(req, EOPNOTSUPP);
return;
}
res = flock(lo_fi_fd(req, fi), op);
fuse_reply_err(req, res == -1 ? errno : 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment