xv6

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 15a269363777c0cd95e2a56e7def0a4dc3122e21
parent f3e87bc838a09163f91ab79696a34f8c19386c55
Author: kolya <kolya>
Date:   Fri, 17 Oct 2008 12:42:13 +0000

try harder to get directory refcounts right

Diffstat:
Msysfile.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sysfile.c b/sysfile.c @@ -199,6 +199,10 @@ sys_unlink(void) memset(&de, 0, sizeof(de)); if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("unlink: writei"); + if(ip->type == T_DIR){ + dp->nlink--; + iupdate(dp); + } iunlockput(dp); ip->nlink--; @@ -247,8 +251,10 @@ create(char *path, int canexist, short type, short major, short minor) } if(dirlink(dp, name, ip->inum) < 0){ - dp->nlink--; - iupdate(dp); + if(type == T_DIR){ + dp->nlink--; + iupdate(dp); + } iunlockput(dp); ip->nlink = 0;