summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-11-07 15:40:34 +0000
committertrasz <trasz@FreeBSD.org>2014-11-07 15:40:34 +0000
commitaba7b57a359d5908c47c366fe4127ade7658215c (patch)
tree03f11a72547f2a9d3516ef4efb38175808ab38f1 /sys/fs
parent2eebc771d395a0aeb416e31265408ed6508575f8 (diff)
downloadFreeBSD-src-aba7b57a359d5908c47c366fe4127ade7658215c.zip
FreeBSD-src-aba7b57a359d5908c47c366fe4127ade7658215c.tar.gz
MFC r272403:
Make autofs timeout handling use timeout task instead of callout; that's because the handler can sleep on sx lock. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/autofs/autofs.c17
-rw-r--r--sys/fs/autofs/autofs.h2
-rw-r--r--sys/fs/autofs/autofs_vfsops.c1
-rw-r--r--sys/fs/autofs/autofs_vnops.c1
4 files changed, 15 insertions, 6 deletions
diff --git a/sys/fs/autofs/autofs.c b/sys/fs/autofs/autofs.c
index eeaf705..ddf8372 100644
--- a/sys/fs/autofs/autofs.c
+++ b/sys/fs/autofs/autofs.c
@@ -76,6 +76,7 @@
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/syscallsubr.h>
+#include <sys/taskqueue.h>
#include <sys/vnode.h>
#include <machine/atomic.h>
#include <vm/uma.h>
@@ -260,7 +261,7 @@ autofs_path(struct autofs_node *anp)
}
static void
-autofs_callout(void *context)
+autofs_task(void *context, int pending)
{
struct autofs_request *ar;
@@ -414,9 +415,14 @@ autofs_trigger_one(struct autofs_node *anp,
strlcpy(ar->ar_options,
amp->am_options, sizeof(ar->ar_options));
- callout_init(&ar->ar_callout, 1);
- callout_reset(&ar->ar_callout,
- autofs_timeout * hz, autofs_callout, ar);
+ TIMEOUT_TASK_INIT(taskqueue_thread, &ar->ar_task, 0,
+ autofs_task, ar);
+ error = taskqueue_enqueue_timeout(taskqueue_thread,
+ &ar->ar_task, autofs_timeout * hz);
+ if (error != 0) {
+ AUTOFS_WARN("taskqueue_enqueue_timeout() failed "
+ "with error %d", error);
+ }
refcount_init(&ar->ar_refcount, 1);
TAILQ_INSERT_TAIL(&autofs_softc->sc_requests, ar, ar_next);
}
@@ -456,7 +462,8 @@ autofs_trigger_one(struct autofs_node *anp,
* XXX: Is it safe?
*/
sx_xunlock(&autofs_softc->sc_lock);
- callout_drain(&ar->ar_callout);
+ taskqueue_cancel_timeout(taskqueue_thread, &ar->ar_task, NULL);
+ taskqueue_drain_timeout(taskqueue_thread, &ar->ar_task);
sx_xlock(&autofs_softc->sc_lock);
uma_zfree(autofs_request_zone, ar);
}
diff --git a/sys/fs/autofs/autofs.h b/sys/fs/autofs/autofs.h
index 2c72645..89789fd 100644
--- a/sys/fs/autofs/autofs.h
+++ b/sys/fs/autofs/autofs.h
@@ -97,7 +97,7 @@ struct autofs_request {
char ar_prefix[MAXPATHLEN];
char ar_key[MAXPATHLEN];
char ar_options[MAXPATHLEN];
- struct callout ar_callout;
+ struct timeout_task ar_task;
volatile u_int ar_refcount;
};
diff --git a/sys/fs/autofs/autofs_vfsops.c b/sys/fs/autofs/autofs_vfsops.c
index b289cad..fc2abc6 100644
--- a/sys/fs/autofs/autofs_vfsops.c
+++ b/sys/fs/autofs/autofs_vfsops.c
@@ -40,6 +40,7 @@
#include <sys/module.h>
#include <sys/mount.h>
#include <sys/sx.h>
+#include <sys/taskqueue.h>
#include <sys/vnode.h>
#include <fs/autofs/autofs.h>
diff --git a/sys/fs/autofs/autofs_vnops.c b/sys/fs/autofs/autofs_vnops.c
index 392c253..a37fca3 100644
--- a/sys/fs/autofs/autofs_vnops.c
+++ b/sys/fs/autofs/autofs_vnops.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/namei.h>
#include <sys/signalvar.h>
#include <sys/systm.h>
+#include <sys/taskqueue.h>
#include <sys/vnode.h>
#include <machine/atomic.h>
#include <vm/uma.h>
OpenPOWER on IntegriCloud