Assign the right linkcount when renaming a directory.

This commit is contained in:
fvdl 2003-04-25 23:12:33 +00:00
parent 4b293b5851
commit 94e92b1bb3

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vnops.c,v 1.96 2003/04/11 14:13:28 fvdl Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.97 2003/04/25 23:12:33 fvdl Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1993, 1995 * Copyright (c) 1982, 1986, 1989, 1993, 1995
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.96 2003/04/11 14:13:28 fvdl Exp $"); __KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.97 2003/04/25 23:12:33 fvdl Exp $");
#ifndef _LKM #ifndef _LKM
#include "opt_quota.h" #include "opt_quota.h"
@ -1027,7 +1027,7 @@ ufs_rename(void *v)
} }
dp->i_ffs_effnlink++; dp->i_ffs_effnlink++;
dp->i_nlink++; dp->i_nlink++;
DIP(dp, nlink) = ip->i_nlink; DIP(dp, nlink) = dp->i_nlink;
dp->i_flag |= IN_CHANGE; dp->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(tdvp)) if (DOINGSOFTDEP(tdvp))
softdep_change_linkcnt(dp); softdep_change_linkcnt(dp);
@ -1035,7 +1035,7 @@ ufs_rename(void *v)
UPDATE_DIROP)) != 0) { UPDATE_DIROP)) != 0) {
dp->i_ffs_effnlink--; dp->i_ffs_effnlink--;
dp->i_nlink--; dp->i_nlink--;
DIP(dp, nlink) = ip->i_nlink; DIP(dp, nlink) = dp->i_nlink;
dp->i_flag |= IN_CHANGE; dp->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(tdvp)) if (DOINGSOFTDEP(tdvp))
softdep_change_linkcnt(dp); softdep_change_linkcnt(dp);
@ -1048,7 +1048,7 @@ ufs_rename(void *v)
if (doingdirectory && newparent) { if (doingdirectory && newparent) {
dp->i_ffs_effnlink--; dp->i_ffs_effnlink--;
dp->i_nlink--; dp->i_nlink--;
DIP(dp, nlink) = ip->i_nlink; DIP(dp, nlink) = dp->i_nlink;
dp->i_flag |= IN_CHANGE; dp->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(tdvp)) if (DOINGSOFTDEP(tdvp))
softdep_change_linkcnt(dp); softdep_change_linkcnt(dp);