| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: puffs_vnops.c,v 1.162 2011/11/18 21:18:50 christos Exp $ */ | | 1 | /* $NetBSD: puffs_vnops.c,v 1.163 2012/01/17 09:30:16 martin Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Development of this software was supported by the | | 6 | * Development of this software was supported by the |
7 | * Google Summer of Code program and the Ulla Tuominen Foundation. | | 7 | * Google Summer of Code program and the Ulla Tuominen Foundation. |
8 | * The Google SoC project was mentored by Bill Studenmund. | | 8 | * The Google SoC project was mentored by Bill Studenmund. |
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. |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 20 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
22 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 22 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | | 29 | * SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.162 2011/11/18 21:18:50 christos Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.163 2012/01/17 09:30:16 martin Exp $"); |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/buf.h> | | 36 | #include <sys/buf.h> |
37 | #include <sys/lockf.h> | | 37 | #include <sys/lockf.h> |
38 | #include <sys/malloc.h> | | 38 | #include <sys/malloc.h> |
39 | #include <sys/mount.h> | | 39 | #include <sys/mount.h> |
40 | #include <sys/namei.h> | | 40 | #include <sys/namei.h> |
41 | #include <sys/vnode.h> | | 41 | #include <sys/vnode.h> |
42 | #include <sys/proc.h> | | 42 | #include <sys/proc.h> |
43 | | | 43 | |
44 | #include <uvm/uvm.h> | | 44 | #include <uvm/uvm.h> |
45 | | | 45 | |
46 | #include <fs/puffs/puffs_msgif.h> | | 46 | #include <fs/puffs/puffs_msgif.h> |
| @@ -1346,31 +1346,36 @@ flushvncache(struct vnode *vp, off_t off | | | @@ -1346,31 +1346,36 @@ flushvncache(struct vnode *vp, off_t off |
1346 | | | 1346 | |
1347 | int | | 1347 | int |
1348 | puffs_vnop_fsync(void *v) | | 1348 | puffs_vnop_fsync(void *v) |
1349 | { | | 1349 | { |
1350 | struct vop_fsync_args /* { | | 1350 | struct vop_fsync_args /* { |
1351 | const struct vnodeop_desc *a_desc; | | 1351 | const struct vnodeop_desc *a_desc; |
1352 | struct vnode *a_vp; | | 1352 | struct vnode *a_vp; |
1353 | kauth_cred_t a_cred; | | 1353 | kauth_cred_t a_cred; |
1354 | int a_flags; | | 1354 | int a_flags; |
1355 | off_t a_offlo; | | 1355 | off_t a_offlo; |
1356 | off_t a_offhi; | | 1356 | off_t a_offhi; |
1357 | } */ *ap = v; | | 1357 | } */ *ap = v; |
1358 | PUFFS_MSG_VARS(vn, fsync); | | 1358 | PUFFS_MSG_VARS(vn, fsync); |
1359 | struct vnode *vp = ap->a_vp; | | 1359 | struct vnode *vp; |
1360 | struct puffs_node *pn = VPTOPP(vp); | | 1360 | struct puffs_node *pn; |
1361 | struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount); | | 1361 | struct puffs_mount *pmp; |
1362 | int error, dofaf; | | 1362 | int error, dofaf; |
1363 | | | 1363 | |
| | | 1364 | vp = ap->a_vp; |
| | | 1365 | KASSERT(vp != NULL); |
| | | 1366 | pn = VPTOPP(vp); |
| | | 1367 | KASSERT(pn != NULL); |
| | | 1368 | pmp = MPTOPUFFSMP(vp->v_mount); |
1364 | if (ap->a_flags & FSYNC_WAIT) { | | 1369 | if (ap->a_flags & FSYNC_WAIT) { |
1365 | mutex_enter(&pn->pn_sizemtx); | | 1370 | mutex_enter(&pn->pn_sizemtx); |
1366 | } else { | | 1371 | } else { |
1367 | if (mutex_tryenter(&pn->pn_sizemtx) == 0) | | 1372 | if (mutex_tryenter(&pn->pn_sizemtx) == 0) |
1368 | return EDEADLK; | | 1373 | return EDEADLK; |
1369 | } | | 1374 | } |
1370 | | | 1375 | |
1371 | error = flushvncache(vp, ap->a_offlo, ap->a_offhi, | | 1376 | error = flushvncache(vp, ap->a_offlo, ap->a_offhi, |
1372 | (ap->a_flags & FSYNC_WAIT) == FSYNC_WAIT); | | 1377 | (ap->a_flags & FSYNC_WAIT) == FSYNC_WAIT); |
1373 | if (error) | | 1378 | if (error) |
1374 | goto out; | | 1379 | goto out; |
1375 | | | 1380 | |
1376 | /* | | 1381 | /* |