From f2fe4ddf0b22cea7dfeb189a589b6992fbab87ea Mon Sep 17 00:00:00 2001
From: Miklos Szeredi <miklos@szeredi.hu>
Date: Sun, 28 Jan 2007 17:50:40 +0000
Subject: [PATCH] fix BUG in control filesystem

---
 ChangeLog        | 6 ++++++
 kernel/control.c | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 11fd4bb..b3727fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-28  Miklos Szeredi <miklos@szeredi.hu>
+
+	* kernel: fix BUG in control filesystem if it is umounted and
+	mounted again, while some fuse filesystems are present.
+	Bugreport from Florent Mertens
+
 2007-01-22  Miklos Szeredi <miklos@szeredi.hu>
 
 	* lib/Makefile.am: actually link libfuse against libfuse_libs
diff --git a/kernel/control.c b/kernel/control.c
index 24e8fa4..494deb9 100644
--- a/kernel/control.c
+++ b/kernel/control.c
@@ -221,8 +221,12 @@ static struct super_block *fuse_ctl_get_sb(struct file_system_type *fs_type,
 
 static void fuse_ctl_kill_sb(struct super_block *sb)
 {
+	struct fuse_conn *fc;
+
 	mutex_lock(&fuse_mutex);
 	fuse_control_sb = NULL;
+	list_for_each_entry(fc, &fuse_conn_list, entry)
+		fc->ctl_ndents = 0;
 	mutex_unlock(&fuse_mutex);
 
 	kill_litter_super(sb);
-- 
2.30.2