Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs Assert ufs_strategy() always gets used while current...



details:   https://anonhg.NetBSD.org/src/rev/4d86b7fe9da6
branches:  trunk
changeset: 932934:4d86b7fe9da6
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon May 18 08:28:44 2020 +0000

description:
Assert ufs_strategy() always gets used while current thread
holds a fstrans lock.

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  10 ++++++++--
 sys/ufs/ufs/ufs_vnops.c  |   6 ++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (73 lines):

diff -r 21d3ab72c7b6 -r 4d86b7fe9da6 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Mon May 18 08:27:54 2020 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Mon May 18 08:28:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.369 2020/05/16 18:31:53 christos Exp $        */
+/*     $NetBSD: ffs_vfsops.c,v 1.370 2020/05/18 08:28:44 hannken Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.369 2020/05/16 18:31:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.370 2020/05/18 08:28:44 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -75,6 +75,7 @@
 #include <sys/proc.h>
 #include <sys/kernel.h>
 #include <sys/vnode.h>
+#include <sys/fstrans.h>
 #include <sys/socket.h>
 #include <sys/mount.h>
 #include <sys/buf.h>
@@ -581,7 +582,12 @@
                        DPRINTF("VOP_OPEN returned %d", error);
                        goto fail;
                }
+               /* Need fstrans_start() for assertion in ufs_strategy(). */
+               if ((mp->mnt_flag & MNT_RDONLY) == 0)
+                       fstrans_start(mp);
                error = ffs_mountfs(devvp, mp, l);
+               if ((mp->mnt_flag & MNT_RDONLY) == 0)
+                       fstrans_done(mp);
                if (error) {
                        DPRINTF("ffs_mountfs returned %d", error);
                        vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
diff -r 21d3ab72c7b6 -r 4d86b7fe9da6 sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c   Mon May 18 08:27:54 2020 +0000
+++ b/sys/ufs/ufs/ufs_vnops.c   Mon May 18 08:28:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_vnops.c,v 1.254 2020/05/16 18:31:54 christos Exp $ */
+/*     $NetBSD: ufs_vnops.c,v 1.255 2020/05/18 08:28:44 hannken Exp $  */
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.254 2020/05/16 18:31:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.255 2020/05/18 08:28:44 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -84,6 +84,7 @@
 #include <sys/proc.h>
 #include <sys/mount.h>
 #include <sys/vnode.h>
+#include <sys/fstrans.h>
 #include <sys/kmem.h>
 #include <sys/malloc.h>
 #include <sys/dirent.h>
@@ -1869,6 +1870,7 @@
        ip = VTOI(vp);
        if (vp->v_type == VBLK || vp->v_type == VCHR)
                panic("ufs_strategy: spec");
+       KASSERT(fstrans_held(vp->v_mount));
        KASSERT(bp->b_bcount != 0);
        if (bp->b_blkno == bp->b_lblkno) {
                error = VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno,



Home | Main Index | Thread Index | Old Index