From f79d9cc971a2fff4b0de7e1fa3a36d29332ab890 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 14 Feb 2011 13:20:57 -0800 Subject: [PATCH] kernel - Remove the last MP locks from tmpfs (2). * The tmpfs interlock is the per-mount token now, not the MP lock Reported-by: Venkatesh Srinivas --- sys/vfs/tmpfs/tmpfs_vnops.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/vfs/tmpfs/tmpfs_vnops.c b/sys/vfs/tmpfs/tmpfs_vnops.c index eec0f34..39a44cf 100644 --- a/sys/vfs/tmpfs/tmpfs_vnops.c +++ b/sys/vfs/tmpfs/tmpfs_vnops.c @@ -1559,17 +1559,22 @@ filt_tmpfsread(struct knote *kn, long hint) kn->kn_flags |= (EV_EOF | EV_ONESHOT); return(1); } + + /* + * Interlock against MP races when performing this function. + */ + lwkt_gettoken(&vp->v_mount->mnt_token); off = node->tn_size - kn->kn_fp->f_offset; kn->kn_data = (off < INTPTR_MAX) ? off : INTPTR_MAX; - if (kn->kn_sfflags & NOTE_OLDAPI) + if (kn->kn_sfflags & NOTE_OLDAPI) { + lwkt_reltoken(&vp->v_mount->mnt_token); return(1); + } - /* - * Handle possible MP race interlock on filter check/write - */ if (kn->kn_data == 0) { kn->kn_data = (off < INTPTR_MAX) ? off : INTPTR_MAX; } + lwkt_reltoken(&vp->v_mount->mnt_token); return (kn->kn_data != 0); } -- 1.7.7.2