lkml.org 
[lkml]   [2004]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 3/8] autofs4-2.6 - to support autofs 4.1.x

Patch:

3-autofs4-2.6.0-test9-waitq1.patch

interruptible_sleep_on open to race. Includes workaround to what appears
to be a scheduling problem (a nice(-1) in the daemon makes the problem go
away). Don't think anyone agrees with this view though. It was suggested
this code needed to be rewritten to fix the problem but after several days
I couldn't come up with anything that worked for me. The work around
remains for older versions of the daemon.

diff -Nur linux-2.6.0-0.test9.fill_super/fs/autofs4/autofs_i.h linux-2.6.0-0.test9.waitq1/fs/autofs4/autofs_i.h
--- linux-2.6.0-0.test9.fill_super/fs/autofs4/autofs_i.h 2003-11-15 09:26:07.000000000 +0800
+++ linux-2.6.0-0.test9.waitq1/fs/autofs4/autofs_i.h 2003-11-30 08:54:03.000000000 +0800
@@ -77,6 +77,7 @@
struct autofs_wait_queue {
wait_queue_head_t queue;
struct autofs_wait_queue *next;
+ struct task_struct *owner;
autofs_wqt_t wait_queue_token;
/* We use the following to see what we are waiting for */
int hash;
diff -Nur linux-2.6.0-0.test9.fill_super/fs/autofs4/waitq.c linux-2.6.0-0.test9.waitq1/fs/autofs4/waitq.c
--- linux-2.6.0-0.test9.fill_super/fs/autofs4/waitq.c 2003-11-15 09:26:07.000000000 +0800
+++ linux-2.6.0-0.test9.waitq1/fs/autofs4/waitq.c 2003-11-30 08:58:47.000000000 +0800
@@ -37,7 +37,7 @@
wq->status = -ENOENT; /* Magic is gone - report failure */
kfree(wq->name);
wq->name = NULL;
- wake_up(&wq->queue);
+ wake_up_interruptible(&wq->queue);
wq = nwq;
}
if (sbi->pipe) {
@@ -204,7 +204,18 @@
recalc_sigpending();
spin_unlock_irqrestore(&current->sighand->siglock, irqflags);

- interruptible_sleep_on(&wq->queue);
+ wait_event_interruptible(wq->queue, wq->name == NULL);
+
+ /*
+ * FIXME: Call never returns if wait owner is not first out.
+ * A nice(-1) in the daemon makes the problem go away.
+ * The workaround is left for people running old versions
+ * of the daemon.
+ */
+ if (waitqueue_active(&wq->queue) && current != wq->owner) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ/10);
+ }

spin_lock_irqsave(&current->sighand->siglock, irqflags);
current->blocked = oldset;
@@ -243,7 +254,7 @@
if (--wq->wait_ctr == 0) /* Is anyone still waiting for this guy? */
kfree(wq);
else
- wake_up(&wq->queue);
+ wake_up_interruptible(&wq->queue);

return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:00    [W:0.403 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site