The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/266

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Adds mutex to do_release_file_info to avoid lxcfs crash when stopping multiple containers concurrently.

Fixes https://github.com/lxc/lxcfs/issues/252
From d249048b51f4c406a1fd0317c903ac27fe87dbfc Mon Sep 17 00:00:00 2001
From: tomponline <t...@tomp.uk>
Date: Fri, 18 Jan 2019 13:05:09 +0000
Subject: [PATCH] Adds mutex to do_release_file_info to avoid lxcfs crash when
 stopping multiple containers concurrently

Signed-off-by: tomponline <t...@tomp.uk>
---
 bindings.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bindings.c b/bindings.c
index 097ca81..29855d5 100644
--- a/bindings.c
+++ b/bindings.c
@@ -2169,11 +2169,16 @@ int cg_readdir(const char *path, void *buf, 
fuse_fill_dir_t filler, off_t offset
        return ret;
 }
 
+static pthread_mutex_t do_release_file_info_lock = PTHREAD_MUTEX_INITIALIZER;
+
 static void do_release_file_info(struct fuse_file_info *fi)
 {
+       lock_mutex(&do_release_file_info_lock);
+
        struct file_info *f = (struct file_info *)fi->fh;
 
        if (!f)
+               unlock_mutex(&do_release_file_info_lock);
                return;
 
        fi->fh = 0;
@@ -2188,6 +2193,8 @@ static void do_release_file_info(struct fuse_file_info 
*fi)
        f->buf = NULL;
        free(f);
        f = NULL;
+
+       unlock_mutex(&do_release_file_info_lock);
 }
 
 int cg_releasedir(const char *path, struct fuse_file_info *fi)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to