svn commit: r274232 - stable/10/sys/fs/autofs
Edward Tomasz Napierala
trasz at FreeBSD.org
Fri Nov 7 15:40:36 UTC 2014
Author: trasz
Date: Fri Nov 7 15:40:34 2014
New Revision: 274232
URL: https://svnweb.freebsd.org/changeset/base/274232
Log:
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
Modified:
stable/10/sys/fs/autofs/autofs.c
stable/10/sys/fs/autofs/autofs.h
stable/10/sys/fs/autofs/autofs_vfsops.c
stable/10/sys/fs/autofs/autofs_vnops.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/fs/autofs/autofs.c
==============================================================================
--- stable/10/sys/fs/autofs/autofs.c Fri Nov 7 15:14:10 2014 (r274231)
+++ stable/10/sys/fs/autofs/autofs.c Fri Nov 7 15:40:34 2014 (r274232)
@@ -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 *a
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 *a
* 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);
}
Modified: stable/10/sys/fs/autofs/autofs.h
==============================================================================
--- stable/10/sys/fs/autofs/autofs.h Fri Nov 7 15:14:10 2014 (r274231)
+++ stable/10/sys/fs/autofs/autofs.h Fri Nov 7 15:40:34 2014 (r274232)
@@ -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;
};
Modified: stable/10/sys/fs/autofs/autofs_vfsops.c
==============================================================================
--- stable/10/sys/fs/autofs/autofs_vfsops.c Fri Nov 7 15:14:10 2014 (r274231)
+++ stable/10/sys/fs/autofs/autofs_vfsops.c Fri Nov 7 15:40:34 2014 (r274232)
@@ -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>
Modified: stable/10/sys/fs/autofs/autofs_vnops.c
==============================================================================
--- stable/10/sys/fs/autofs/autofs_vnops.c Fri Nov 7 15:14:10 2014 (r274231)
+++ stable/10/sys/fs/autofs/autofs_vnops.c Fri Nov 7 15:40:34 2014 (r274232)
@@ -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>
More information about the svn-src-stable
mailing list