| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: vnd.c,v 1.240 2015/01/28 15:08:12 bouyer Exp $ */ | | 1 | /* $NetBSD: vnd.c,v 1.241 2015/01/28 16:27:43 bouyer Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe. | | 8 | * by Jason R. Thorpe. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -81,27 +81,27 @@ | | | @@ -81,27 +81,27 @@ |
81 | * systems where the block-level operations are not implemented for | | 81 | * systems where the block-level operations are not implemented for |
82 | * whatever reason. | | 82 | * whatever reason. |
83 | * | | 83 | * |
84 | * NOTE 2: There is a security issue involved with this driver. | | 84 | * NOTE 2: There is a security issue involved with this driver. |
85 | * Once mounted all access to the contents of the "mapped" file via | | 85 | * Once mounted all access to the contents of the "mapped" file via |
86 | * the special file is controlled by the permissions on the special | | 86 | * the special file is controlled by the permissions on the special |
87 | * file, the protection of the mapped file is ignored (effectively, | | 87 | * file, the protection of the mapped file is ignored (effectively, |
88 | * by using root credentials in all transactions). | | 88 | * by using root credentials in all transactions). |
89 | * | | 89 | * |
90 | * NOTE 3: Doesn't interact with leases, should it? | | 90 | * NOTE 3: Doesn't interact with leases, should it? |
91 | */ | | 91 | */ |
92 | | | 92 | |
93 | #include <sys/cdefs.h> | | 93 | #include <sys/cdefs.h> |
94 | __KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.240 2015/01/28 15:08:12 bouyer Exp $"); | | 94 | __KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.241 2015/01/28 16:27:43 bouyer Exp $"); |
95 | | | 95 | |
96 | #if defined(_KERNEL_OPT) | | 96 | #if defined(_KERNEL_OPT) |
97 | #include "opt_vnd.h" | | 97 | #include "opt_vnd.h" |
98 | #include "opt_compat_netbsd.h" | | 98 | #include "opt_compat_netbsd.h" |
99 | #endif | | 99 | #endif |
100 | | | 100 | |
101 | #include <sys/param.h> | | 101 | #include <sys/param.h> |
102 | #include <sys/systm.h> | | 102 | #include <sys/systm.h> |
103 | #include <sys/namei.h> | | 103 | #include <sys/namei.h> |
104 | #include <sys/proc.h> | | 104 | #include <sys/proc.h> |
105 | #include <sys/kthread.h> | | 105 | #include <sys/kthread.h> |
106 | #include <sys/errno.h> | | 106 | #include <sys/errno.h> |
107 | #include <sys/buf.h> | | 107 | #include <sys/buf.h> |
| @@ -872,27 +872,27 @@ handle_with_strategy(struct vnd_softc *v | | | @@ -872,27 +872,27 @@ handle_with_strategy(struct vnd_softc *v |
872 | if (resid == sz) { | | 872 | if (resid == sz) { |
873 | break; | | 873 | break; |
874 | } | | 874 | } |
875 | VOP_STRATEGY(vp, nbp); | | 875 | VOP_STRATEGY(vp, nbp); |
876 | bn += sz; | | 876 | bn += sz; |
877 | } | | 877 | } |
878 | if (!(flags & B_READ)) { | | 878 | if (!(flags & B_READ)) { |
879 | struct vnode *w_vp; | | 879 | struct vnode *w_vp; |
880 | /* | | 880 | /* |
881 | * this is the last nested buf, account for | | 881 | * this is the last nested buf, account for |
882 | * the parent buf write too. | | 882 | * the parent buf write too. |
883 | * This has to be done last, so that | | 883 | * This has to be done last, so that |
884 | * fsync won't wait for this write which | | 884 | * fsync won't wait for this write which |
885 | * has to chance to complete before all nested bufs | | 885 | * has no chance to complete before all nested bufs |
886 | * have been queued. But it has to be done | | 886 | * have been queued. But it has to be done |
887 | * before the last VOP_STRATEGY() | | 887 | * before the last VOP_STRATEGY() |
888 | * or the call to nestiobuf_done(). | | 888 | * or the call to nestiobuf_done(). |
889 | */ | | 889 | */ |
890 | w_vp = bp->b_vp; | | 890 | w_vp = bp->b_vp; |
891 | mutex_enter(w_vp->v_interlock); | | 891 | mutex_enter(w_vp->v_interlock); |
892 | w_vp->v_numoutput++; | | 892 | w_vp->v_numoutput++; |
893 | mutex_exit(w_vp->v_interlock); | | 893 | mutex_exit(w_vp->v_interlock); |
894 | } | | 894 | } |
895 | KASSERT(skipped != 0 || nbp != NULL); | | 895 | KASSERT(skipped != 0 || nbp != NULL); |
896 | if (skipped) | | 896 | if (skipped) |
897 | nestiobuf_done(bp, skipped, error); | | 897 | nestiobuf_done(bp, skipped, error); |
898 | else | | 898 | else |