From b43ed1b391a4faf352b2672ef6a299eda5be0ee3 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 3 Jun 2019 15:10:29 +0200 Subject: [PATCH] main: drop code to handle flock the implementation of flock(2) was wrong and it caused a deadlock when multiple processes tried to lock the same file. Drop it and let FUSE handle locking for us. Closes: https://github.com/containers/fuse-overlayfs/issues/80 Signed-off-by: Giuseppe Scrivano --- main.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/main.c b/main.c index 2d82570..4093b23 100644 --- a/main.c +++ b/main.c @@ -3091,22 +3091,6 @@ ovl_symlink (fuse_req_t req, const char *link, fuse_ino_t parent, const char *na fuse_reply_entry (req, &e); } -static void -ovl_flock (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi, int op) -{ - int ret, fd; - - if (ovl_debug (req)) - fprintf (stderr, "ovl_flock(ino=%" PRIu64 "s, op=%d)\n", ino, op); - - fd = fi->fh; - - ret = flock (fd, op); - - fuse_reply_err (req, ret == 0 ? 0 : errno); -} - static void ovl_rename_exchange (fuse_req_t req, fuse_ino_t parent, const char *name, fuse_ino_t newparent, const char *newname, @@ -3866,7 +3850,6 @@ static struct fuse_lowlevel_ops ovl_oper = .mknod = ovl_mknod, .link = ovl_link, .fsync = ovl_fsync, - .flock = ovl_flock, .ioctl = ovl_ioctl, };