Source-Changes-HG archive

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

[src/fvdl-softdep]: src/sys Give ufs_ihashget an extra argument: the flags pa...



details:   https://anonhg.NetBSD.org/src/rev/e0ec86ccd887
branches:  fvdl-softdep
changeset: 477515:e0ec86ccd887
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Wed Nov 03 23:40:30 1999 +0000

description:
Give ufs_ihashget an extra argument: the flags passed to vget() for
locking. This way we can avoid locking against ourselves when
ufs_ihashget is called during the flushing of metadata. XXX

Also, comment out a VOP_FSYNC call that I think is now unneeded, and
put a diagnostic printf there to check if this still happens.

diffstat:

 sys/kern/vfs_subr.c            |  13 +++++--------
 sys/ufs/ext2fs/ext2fs_vfsops.c |   4 ++--
 sys/ufs/ffs/ffs_softdep.c      |   5 +++--
 sys/ufs/ffs/ffs_vfsops.c       |   4 ++--
 sys/ufs/lfs/lfs_vfsops.c       |   4 ++--
 sys/ufs/ufs/ufs_extern.h       |   4 ++--
 sys/ufs/ufs/ufs_ihash.c        |   7 ++++---
 7 files changed, 20 insertions(+), 21 deletions(-)

diffs (151 lines):

diff -r 734705c3691d -r e0ec86ccd887 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Wed Oct 27 12:38:52 1999 +0000
+++ b/sys/kern/vfs_subr.c       Wed Nov 03 23:40:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.112.4.4 1999/10/26 19:15:16 fvdl Exp $  */
+/*     $NetBSD: vfs_subr.c,v 1.112.4.5 1999/11/03 23:40:30 fvdl Exp $  */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -657,16 +657,13 @@
                         * XXX Since there are no node locks for NFS, I believe
                         * there is a slight chance that a delayed write will
                         * occur while sleeping just above, so check for it.
-                        *
-                        * XXX If a buffer shows up as DELWRI, also call
-                        * VOP_FSYNC to sync the metadata softdeps, or we
-                        * might get stuck with a dependency that we can't
-                        * get rid of (VOP_FSYNC will call
-                        * softdep_sync_meta which will do the trick).
                         */
                        if ((bp->b_flags & B_DELWRI) && (flags & V_SAVE)) {
                                VOP_BWRITE(bp);
-                               VOP_FSYNC(vp, cred, FSYNC_WAIT, p);
+#ifdef DEBUG
+                               printf("buffer still DELWRI\n");
+#endif
+                               /* VOP_FSYNC(vp, cred, FSYNC_WAIT, p); */
                                continue;
                        }
                        bp->b_flags |= B_INVAL;
diff -r 734705c3691d -r e0ec86ccd887 sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c    Wed Oct 27 12:38:52 1999 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c    Wed Nov 03 23:40:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_vfsops.c,v 1.28.4.1 1999/10/19 12:50:32 fvdl Exp $      */
+/*     $NetBSD: ext2fs_vfsops.c,v 1.28.4.2 1999/11/03 23:40:31 fvdl Exp $      */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -838,7 +838,7 @@
        ump = VFSTOUFS(mp);
        dev = ump->um_dev;
        do {
-               if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
+               if ((*vpp = ufs_ihashget(dev, ino, LK_EXCLUSIVE)) != NULL)
                        return (0);
        } while (lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0));
 
diff -r 734705c3691d -r e0ec86ccd887 sys/ufs/ffs/ffs_softdep.c
--- a/sys/ufs/ffs/ffs_softdep.c Wed Oct 27 12:38:52 1999 +0000
+++ b/sys/ufs/ffs/ffs_softdep.c Wed Nov 03 23:40:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_softdep.c,v 1.1.2.5 1999/10/26 19:15:19 fvdl Exp $ */
+/*     $NetBSD: ffs_softdep.c,v 1.1.2.6 1999/11/03 23:40:31 fvdl Exp $ */
 
 /*
  * Copyright 1998 Marshall Kirk McKusick. All Rights Reserved.
@@ -4155,7 +4155,8 @@
                 */
                inum = dap->da_newinum;
                FREE_LOCK(&lk);
-               if ((vp = ufs_ihashget(ump->um_dev, inum)) == NULL) {
+               if ((vp = ufs_ihashget(ump->um_dev, inum,
+                                      LK_CANRECURSE|LK_EXCLUSIVE)) == NULL) {
                        ACQUIRE_LOCK(&lk);
                        if (inodedep_lookup(ump->um_fs, inum, 0, &inodedep) == 0
                            && dap == LIST_FIRST(diraddhdp))
diff -r 734705c3691d -r e0ec86ccd887 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Wed Oct 27 12:38:52 1999 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Wed Nov 03 23:40:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.53.4.1 1999/10/19 12:50:37 fvdl Exp $ */
+/*     $NetBSD: ffs_vfsops.c,v 1.53.4.2 1999/11/03 23:40:32 fvdl Exp $ */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -954,7 +954,7 @@
        ump = VFSTOUFS(mp);
        dev = ump->um_dev;
        do {
-               if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
+               if ((*vpp = ufs_ihashget(dev, ino, LK_EXCLUSIVE)) != NULL)
                        return (0);
        } while (lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0));
 
diff -r 734705c3691d -r e0ec86ccd887 sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c  Wed Oct 27 12:38:52 1999 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c  Wed Nov 03 23:40:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vfsops.c,v 1.39.4.1 1999/10/19 12:50:44 fvdl Exp $ */
+/*     $NetBSD: lfs_vfsops.c,v 1.39.4.2 1999/11/03 23:40:32 fvdl Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -660,7 +660,7 @@
 #ifdef USE_UFS_HASHLOCK
        do {
 #endif
-               if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
+               if ((*vpp = ufs_ihashget(dev, ino, LK_EXCLUSIVE)) != NULL)
                        return (0);
 #ifdef USE_UFS_HASHLOCK
        } while (lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0));
diff -r 734705c3691d -r e0ec86ccd887 sys/ufs/ufs/ufs_extern.h
--- a/sys/ufs/ufs/ufs_extern.h  Wed Oct 27 12:38:52 1999 +0000
+++ b/sys/ufs/ufs/ufs_extern.h  Wed Nov 03 23:40:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_extern.h,v 1.20.4.1 1999/10/19 12:50:49 fvdl Exp $ */
+/*     $NetBSD: ufs_extern.h,v 1.20.4.2 1999/11/03 23:40:32 fvdl Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -106,7 +106,7 @@
 /* ufs_ihash.c */
 void ufs_ihashinit __P((void));
 struct vnode *ufs_ihashlookup __P((dev_t, ino_t));
-struct vnode *ufs_ihashget __P((dev_t, ino_t));
+struct vnode *ufs_ihashget __P((dev_t, ino_t, int));
 void ufs_ihashins __P((struct inode *));
 void ufs_ihashrem __P((struct inode *));
 
diff -r 734705c3691d -r e0ec86ccd887 sys/ufs/ufs/ufs_ihash.c
--- a/sys/ufs/ufs/ufs_ihash.c   Wed Oct 27 12:38:52 1999 +0000
+++ b/sys/ufs/ufs/ufs_ihash.c   Wed Nov 03 23:40:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_ihash.c,v 1.8 1999/07/08 01:06:07 wrstuden Exp $   */
+/*     $NetBSD: ufs_ihash.c,v 1.8.4.1 1999/11/03 23:40:32 fvdl Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -94,9 +94,10 @@
  * to it. If it is in core, but locked, wait for it.
  */
 struct vnode *
-ufs_ihashget(dev, inum)
+ufs_ihashget(dev, inum, flags)
        dev_t dev;
        ino_t inum;
+       int flags;
 {
        struct inode *ip;
        struct vnode *vp;
@@ -108,7 +109,7 @@
                        vp = ITOV(ip);
                        simple_lock(&vp->v_interlock);
                        simple_unlock(&ufs_ihash_slock);
-                       if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK))
+                       if (vget(vp, flags | LK_INTERLOCK))
                                goto loop;
                        return (vp);
                }



Home | Main Index | Thread Index | Old Index