Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ext2fs ext2fs_gro_genealogy: use vcache_get() to loo...



details:   https://anonhg.NetBSD.org/src/rev/348cc649dd10
branches:  trunk
changeset: 329456:348cc649dd10
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun May 25 13:46:58 2014 +0000

description:
ext2fs_gro_genealogy: use vcache_get() to lookup DOTDOT.

diffstat:

 sys/ufs/ext2fs/ext2fs_rename.c |  25 ++++++++++---------------
 1 files changed, 10 insertions(+), 15 deletions(-)

diffs (47 lines):

diff -r 07e4b8d0a2da -r 348cc649dd10 sys/ufs/ext2fs/ext2fs_rename.c
--- a/sys/ufs/ext2fs/ext2fs_rename.c    Sun May 25 13:46:16 2014 +0000
+++ b/sys/ufs/ext2fs/ext2fs_rename.c    Sun May 25 13:46:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_rename.c,v 1.6 2014/01/28 13:02:56 martin Exp $ */
+/*     $NetBSD: ext2fs_rename.c,v 1.7 2014/05/25 13:46:58 hannken Exp $        */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.6 2014/01/28 13:02:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.7 2014/05/25 13:46:58 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -846,20 +846,15 @@
                }
 
                /* Neither -- keep ascending the family tree.  */
-
-               /*
-                * Unlock vp so that we can lock the parent, but keep
-                * vp referenced until after we have found the parent,
-                * so that dotdot_ino will not be recycled.
-                *
-                * XXX This guarantees that vp's inode number will not
-                * be recycled, but why can't dotdot_ino be recycled?
-                */
-               VOP_UNLOCK(vp);
-               error = VFS_VGET(mp, dotdot_ino, &dvp);
-               vrele(vp);
-               if (error)
+               error = vcache_get(mp, &dotdot_ino, sizeof(dotdot_ino), &dvp);
+               vput(vp);
+               if (error)  
                        return error;
+               error = vn_lock(dvp, LK_EXCLUSIVE);
+               if (error) {
+                       vrele(dvp);
+                       return error;
+               }
 
                KASSERT(dvp != NULL);
                KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE);



Home | Main Index | Thread Index | Old Index