Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/miscfs Add missing operation VOP_GETPAGES() returning EF...



details:   https://anonhg.NetBSD.org/src/rev/c6a92844b097
branches:  trunk
changeset: 965028:c6a92844b097
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Aug 29 06:43:13 2019 +0000

description:
Add missing operation VOP_GETPAGES() returning EFAULT.

Without this operation posix_fadvise(..., POSIX_FADV_WILLNEED)
would leave the v_interlock held.

Observed by maxv@

diffstat:

 sys/miscfs/kernfs/kernfs_vnops.c |  26 ++++++++++++++++++++++++--
 sys/miscfs/procfs/procfs_vnops.c |  26 ++++++++++++++++++++++++--
 2 files changed, 48 insertions(+), 4 deletions(-)

diffs (119 lines):

diff -r 7a8d2d31fae6 -r c6a92844b097 sys/miscfs/kernfs/kernfs_vnops.c
--- a/sys/miscfs/kernfs/kernfs_vnops.c  Thu Aug 29 05:55:18 2019 +0000
+++ b/sys/miscfs/kernfs/kernfs_vnops.c  Thu Aug 29 06:43:13 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernfs_vnops.c,v 1.160 2018/09/03 16:29:35 riastradh Exp $     */
+/*     $NetBSD: kernfs_vnops.c,v 1.161 2019/08/29 06:43:13 hannken Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.160 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.161 2019/08/29 06:43:13 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -172,6 +172,7 @@
 int    kernfs_pathconf(void *);
 #define        kernfs_advlock  genfs_einval
 #define        kernfs_bwrite   genfs_eopnotsupp
+int    kernfs_getpages(void *);
 #define        kernfs_putpages genfs_putpages
 
 static int     kernfs_xread(struct kernfs_node *, int, char **,
@@ -219,6 +220,7 @@
        { &vop_pathconf_desc, kernfs_pathconf },        /* pathconf */
        { &vop_advlock_desc, kernfs_advlock },          /* advlock */
        { &vop_bwrite_desc, kernfs_bwrite },            /* bwrite */
+       { &vop_getpages_desc, kernfs_getpages },        /* getpages */
        { &vop_putpages_desc, kernfs_putpages },        /* putpages */
        { NULL, NULL }
 };
@@ -1169,3 +1171,23 @@
        VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
        return (EROFS);
 }
+ 
+int
+kernfs_getpages(void *v)
+{
+       struct vop_getpages_args /* {
+               struct vnode *a_vp;
+               voff_t a_offset;
+               struct vm_page **a_m;
+               int *a_count;
+               int a_centeridx;
+               vm_prot_t a_access_type;
+               int a_advice;
+               int a_flags;
+       } */ *ap = v;
+
+       if ((ap->a_flags & PGO_LOCKED) == 0)
+               mutex_exit(ap->a_vp->v_interlock);
+
+       return (EFAULT);
+}
diff -r 7a8d2d31fae6 -r c6a92844b097 sys/miscfs/procfs/procfs_vnops.c
--- a/sys/miscfs/procfs/procfs_vnops.c  Thu Aug 29 05:55:18 2019 +0000
+++ b/sys/miscfs/procfs/procfs_vnops.c  Thu Aug 29 06:43:13 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_vnops.c,v 1.206 2019/03/30 23:28:30 christos Exp $      */
+/*     $NetBSD: procfs_vnops.c,v 1.207 2019/08/29 06:43:13 hannken Exp $       */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.206 2019/03/30 23:28:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.207 2019/08/29 06:43:13 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -243,6 +243,7 @@
 #define        procfs_islocked genfs_islocked
 #define        procfs_advlock  genfs_einval
 #define        procfs_bwrite   genfs_eopnotsupp
+int    procfs_getpages(void *);
 #define procfs_putpages        genfs_null_putpages
 
 static int atoi(const char *, size_t);
@@ -291,6 +292,7 @@
        { &vop_islocked_desc, procfs_islocked },        /* islocked */
        { &vop_pathconf_desc, procfs_pathconf },        /* pathconf */
        { &vop_advlock_desc, procfs_advlock },          /* advlock */
+       { &vop_getpages_desc, procfs_getpages },        /* getpages */
        { &vop_putpages_desc, procfs_putpages },        /* putpages */
        { NULL, NULL }
 };
@@ -1719,6 +1721,26 @@
        return error;
 }
 
+int
+procfs_getpages(void *v)
+{
+       struct vop_getpages_args /* {
+               struct vnode *a_vp;
+               voff_t a_offset;
+               struct vm_page **a_m;
+               int *a_count;
+               int a_centeridx;
+               vm_prot_t a_access_type;
+               int a_advice;
+               int a_flags;
+       } */ *ap = v;
+
+       if ((ap->a_flags & PGO_LOCKED) == 0)
+               mutex_exit(ap->a_vp->v_interlock);
+
+       return (EFAULT);
+}
+
 /*
  * convert decimal ascii to int
  */



Home | Main Index | Thread Index | Old Index