From 2083e28d1f3c4fa7d7fde6407f9f553c4b8dee59 Mon Sep 17 00:00:00 2001 From: hannken Date: Sun, 16 Oct 2011 12:41:45 +0000 Subject: [PATCH] VOP_GETATTR() needs a shared lock at least. While here fix a typo (fvp -> tvp). --- sys/fs/nilfs/nilfs_vnops.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/fs/nilfs/nilfs_vnops.c b/sys/fs/nilfs/nilfs_vnops.c index 2696ffb38621..9aa4043e6ddc 100644 --- a/sys/fs/nilfs/nilfs_vnops.c +++ b/sys/fs/nilfs/nilfs_vnops.c @@ -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 #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 @@ nilfs_rename(void *v) } /* 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 */