[PATCH] fs: run emergency remount on dedicated workqueue

From: Tejun Heo
Date: Thu May 27 2010 - 05:57:52 EST


Commit fa4b9074cd8428958c2adf9dc0c831f46e27c193 made s_umount depend
on keventd; however, emergency remount schedules works to keventd
which grabs s_umount creating a circular dependency. Run emergency
remount on a separate workqueue to break it.

Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
Reported-by: David Howells <dhowells@xxxxxxxxxx>
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: Jens Axboe <jens.axboe@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---
Unless someone objects, Andrew, can you please take this patch?

Thanks.

fs/super.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 69688b1..1ada607 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -575,6 +575,11 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
return 0;
}

+/*
+ * For emergency remount
+ */
+static struct workqueue_struct *emergency_remount_wq;
+
static void do_emergency_remount(struct work_struct *work)
{
struct super_block *sb, *n;
@@ -605,13 +610,25 @@ void emergency_remount(void)
{
struct work_struct *work;

+ if (!emergency_remount_wq)
+ return;
+
work = kmalloc(sizeof(*work), GFP_ATOMIC);
if (work) {
INIT_WORK(work, do_emergency_remount);
- schedule_work(work);
+ queue_work(emergency_remount_wq, work);
}
}

+static int __init emergency_remount_init(void)
+{
+ emergency_remount_wq = create_singlethread_workqueue("emerg-remount");
+ if (!emergency_remount_wq)
+ pr_warn("failed to create emergency remount workqueue\n");
+ return 0;
+}
+subsys_initcall(emergency_remount_init);
+
/*
* Unnamed block devices are dummy devices used by virtual
* filesystems which don't use real block-devices. -- jrs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/