summaryrefslogtreecommitdiffstats
path: root/sys/sys
diff options
context:
space:
mode:
authorstas <stas@FreeBSD.org>2009-06-28 21:49:43 +0000
committerstas <stas@FreeBSD.org>2009-06-28 21:49:43 +0000
commitc61e1d6988484a6875f72fcc81e34d5a1c2dccfa (patch)
tree022e59bcdde11f99bd112a6b3f3fb767e6be937c /sys/sys
parent66973f6d466a972e501c27cd4da24634b5f87f3e (diff)
downloadFreeBSD-src-c61e1d6988484a6875f72fcc81e34d5a1c2dccfa.zip
FreeBSD-src-c61e1d6988484a6875f72fcc81e34d5a1c2dccfa.tar.gz
- Turn the third (islocked) argument of the knote call into flags parameter.
Introduce the new flag KNF_NOKQLOCK to allow event callers to be called without KQ_LOCK mtx held. - Modify VFS knote calls to always use KNF_NOKQLOCK flag. This is required for ZFS as its getattr implementation may sleep. Approved by: re (rwatson) Reviewed by: kib MFC after: 2 weeks
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/event.h12
-rw-r--r--sys/sys/mount.h2
-rw-r--r--sys/sys/vnode.h5
3 files changed, 13 insertions, 6 deletions
diff --git a/sys/sys/event.h b/sys/sys/event.h
index 824f084..6824152 100644
--- a/sys/sys/event.h
+++ b/sys/sys/event.h
@@ -136,8 +136,14 @@ struct knlist {
MALLOC_DECLARE(M_KQUEUE);
#endif
-#define KNOTE(list, hist, lock) knote(list, hist, lock)
-#define KNOTE_LOCKED(list, hint) knote(list, hint, 1)
+/*
+ * Flags for knote call
+ */
+#define KNF_LISTLOCKED 0x0001 /* knlist is locked */
+#define KNF_NOKQLOCK 0x0002 /* do not keep KQ_LOCK */
+
+#define KNOTE(list, hist, flags) knote(list, hist, flags)
+#define KNOTE_LOCKED(list, hint) knote(list, hint, KNF_LISTLOCKED)
#define KNOTE_UNLOCKED(list, hint) knote(list, hint, 0)
#define KNLIST_EMPTY(list) SLIST_EMPTY(&(list)->kl_list)
@@ -206,7 +212,7 @@ struct proc;
struct knlist;
struct mtx;
-extern void knote(struct knlist *list, long hint, int islocked);
+extern void knote(struct knlist *list, long hint, int lockflags);
extern void knote_fork(struct knlist *list, int pid);
extern void knlist_add(struct knlist *knl, struct knote *kn, int islocked);
extern void knlist_remove(struct knlist *knl, struct knote *kn, int islocked);
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 781d2b7..dbf8c20 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -657,7 +657,7 @@ vfs_statfs_t __vfs_statfs;
#define VFS_KNOTE_LOCKED(vp, hint) do \
{ \
if (((vp)->v_vflag & VV_NOKNOTE) == 0) \
- VN_KNOTE((vp), (hint), 1); \
+ VN_KNOTE((vp), (hint), KNF_LISTLOCKED); \
} while (0)
#define VFS_KNOTE_UNLOCKED(vp, hint) do \
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 2bb0688..2f2d90a 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -219,9 +219,10 @@ struct xvnode {
#define VN_KNOTE(vp, b, a) \
do { \
if (!VN_KNLIST_EMPTY(vp)) \
- KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b), (a)); \
+ KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b), \
+ (a) | KNF_NOKQLOCK); \
} while (0)
-#define VN_KNOTE_LOCKED(vp, b) VN_KNOTE(vp, b, 1)
+#define VN_KNOTE_LOCKED(vp, b) VN_KNOTE(vp, b, KNF_LISTLOCKED)
#define VN_KNOTE_UNLOCKED(vp, b) VN_KNOTE(vp, b, 0)
/*
OpenPOWER on IntegriCloud