Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/nilfs VOP_GETATTR() needs a shared lock at least.



details:   https://anonhg.NetBSD.org/src/rev/97b749a0055d
branches:  trunk
changeset: 770425:97b749a0055d
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun Oct 16 12:41:45 2011 +0000

description:
VOP_GETATTR() needs a shared lock at least.

While here fix a typo (fvp -> tvp).

diffstat:

 sys/fs/nilfs/nilfs_vnops.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 4ef0064d1061 -r 97b749a0055d sys/fs/nilfs/nilfs_vnops.c
--- a/sys/fs/nilfs/nilfs_vnops.c        Sun Oct 16 12:26:16 2011 +0000
+++ b/sys/fs/nilfs/nilfs_vnops.c        Sun Oct 16 12:41:45 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nilfs_vnops.c,v 1.14 2011/09/27 01:34:41 christos Exp $ */
+/* $NetBSD: nilfs_vnops.c,v 1.15 2011/10/16 12:41:45 hannken Exp $ */
 
 /*
  * Copyright (c) 2008, 2009 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.14 2011/09/27 01:34:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.15 2011/10/16 12:41:45 hannken Exp $");
 #endif /* not lint */
 
 
@@ -1330,13 +1330,15 @@
        }
 
        /* get info about the node to be moved */
+       vn_lock(fvp, LK_SHARED | LK_RETRY);
        error = VOP_GETATTR(fvp, &fvap, FSCRED);
+       VOP_UNLOCK(fvp);
        KASSERT(error == 0);
 
        /* check when to delete the old already existing entry */
        if (tvp) {
                /* get info about the node to be moved to */
-               error = VOP_GETATTR(fvp, &tvap, FSCRED);
+               error = VOP_GETATTR(tvp, &tvap, FSCRED);
                KASSERT(error == 0);
 
                /* if both dirs, make sure the destination is empty */



Home | Main Index | Thread Index | Old Index