Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/puffs Add missing mutex pn->pn_sizemtx lock in puffs_...



details:   https://anonhg.NetBSD.org/src/rev/16ee1afc2155
branches:  trunk
changeset: 445595:16ee1afc2155
user:      manu <manu%NetBSD.org@localhost>
date:      Mon Nov 05 02:28:32 2018 +0000

description:
Add missing mutex pn->pn_sizemtx lock in puffs_vnop_open()

puffs_vnop_open() calls flushvncache(), which calls dosetattr()
if pn->pn_stat has PNODE_METACACHE_MASK. In that case, the lock
on pn->pn_sizemtx is mandatory and asserted.

diffstat:

 sys/fs/puffs/puffs_vnops.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 498f78dbcc68 -r 16ee1afc2155 sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c        Mon Nov 05 00:43:30 2018 +0000
+++ b/sys/fs/puffs/puffs_vnops.c        Mon Nov 05 02:28:32 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_vnops.c,v 1.211 2017/05/26 14:21:01 riastradh Exp $      */
+/*     $NetBSD: puffs_vnops.c,v 1.212 2018/11/05 02:28:32 manu Exp $   */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.211 2017/05/26 14:21:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.212 2018/11/05 02:28:32 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -913,7 +913,10 @@
                 * - we do not want to discard cached write by direct write
                 * - read cache is now useless and should be freed
                 */
+               mutex_enter(&pn->pn_sizemtx);
                flushvncache(vp, 0, 0, true);
+               mutex_exit(&pn->pn_sizemtx);
+
                if (mode & FREAD)
                        pn->pn_stat |= PNODE_RDIRECT;
                if (mode & FWRITE)



Home | Main Index | Thread Index | Old Index