summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2018-05-08 08:58:50 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2018-05-08 08:58:50 +0000
commit7a3f425a437bf72f0ce1279c83be4acd0c57d50a (patch)
treed391174a91483eab04fa24538682cc1545e39c63
parentb1791167b5ee74c8d0c677267cc654141043b98e (diff)
Move the vfs stall "barrier" logic to a function. FREF() will soon
change and this has nothing to do with it. ok visa@, bluhm@
-rw-r--r--sys/kern/vfs_subr.c9
-rw-r--r--sys/sys/file.h7
-rw-r--r--sys/sys/mount.h3
3 files changed, 13 insertions, 6 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index f600bcff117..149819a0664 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.270 2018/05/07 15:24:05 bluhm Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.271 2018/05/08 08:58:49 mpi Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -1627,6 +1627,13 @@ vfs_stall(struct proc *p, int stall)
return (allerror);
}
+void
+vfs_stall_barrier(void)
+{
+ rw_enter_read(&vfs_stall_lock);
+ rw_exit_read(&vfs_stall_lock);
+}
+
/*
* Unmount all file systems.
* We traverse the list in reverse order under the assumption that doing so
diff --git a/sys/sys/file.h b/sys/sys/file.h
index 15438d4c4ee..fd5dd6c3d5c 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.h,v 1.42 2018/05/08 08:53:41 mpi Exp $ */
+/* $OpenBSD: file.h,v 1.43 2018/05/08 08:58:49 mpi Exp $ */
/* $NetBSD: file.h,v 1.11 1995/03/26 20:24:13 jtc Exp $ */
/*
@@ -38,6 +38,7 @@
#else /* _KERNEL */
#include <sys/queue.h>
#include <sys/mutex.h>
+#include <sys/mount.h> /* vfs_stall_barrier() */
struct proc;
struct uio;
@@ -98,9 +99,7 @@ struct file {
#define FREF(fp) \
do { \
- extern struct rwlock vfs_stall_lock; \
- rw_enter_read(&vfs_stall_lock); \
- rw_exit_read(&vfs_stall_lock); \
+ vfs_stall_barrier(); \
(fp)->f_count++; \
} while (0)
#define FRELE(fp,p) (--(fp)->f_count == 0 ? fdrop(fp, p) : 0)
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 9ec04f6e729..942cb8c8924 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.h,v 1.135 2018/02/10 05:24:23 deraadt Exp $ */
+/* $OpenBSD: mount.h,v 1.136 2018/05/08 08:58:49 mpi Exp $ */
/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */
/*
@@ -575,6 +575,7 @@ int vfs_rootmountalloc(char *, char *, struct mount **);
void vfs_unbusy(struct mount *);
extern TAILQ_HEAD(mntlist, mount) mountlist;
int vfs_stall(struct proc *, int);
+void vfs_stall_barrier(void);
struct mount *getvfs(fsid_t *); /* return vfs given fsid */
/* process mount export info */