diff options
author | rtm <rtm> | 2006-08-13 12:22:44 +0000 |
---|---|---|
committer | rtm <rtm> | 2006-08-13 12:22:44 +0000 |
commit | 211ff0c67ea6737853cf932313cf4e27cc15f55c (patch) | |
tree | e28f2e9f39ddc226203c16e955337216bbdab7f5 /syscall.c | |
parent | c372e8dc348e4bb30aae7642db92ecbeedbc83ab (diff) | |
download | xv6-labs-211ff0c67ea6737853cf932313cf4e27cc15f55c.tar.gz xv6-labs-211ff0c67ea6737853cf932313cf4e27cc15f55c.tar.bz2 xv6-labs-211ff0c67ea6737853cf932313cf4e27cc15f55c.zip |
namei returns locked parent dir inode for create / unlink
don't hold fd table lock across idecref() (latter does block i/o)
idecref calls iput() in case last ref -> freeing inode
dir size is 512 * # blocks, so readi/writei &c work
unlink deletes dirent even if ip->nlink > 0
Diffstat (limited to 'syscall.c')
-rw-r--r-- | syscall.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -228,7 +228,7 @@ sys_open(void) return -1; if((l = checkstring(arg0)) < 0) return -1; - if((ip = namei(cp->mem + arg0, 0)) == 0) { + if((ip = namei(cp->mem + arg0, NAMEI_LOOKUP, 0)) == 0) { if (arg1 & O_CREATE) { if (l >= DIRSIZ) return -1; @@ -356,7 +356,7 @@ sys_exec(void) return -1; if(checkstring(arg0) < 0) return -1; - ip = namei(cp->mem + arg0, 0); + ip = namei(cp->mem + arg0, NAMEI_LOOKUP, 0); if(ip == 0) return -1; @@ -494,7 +494,7 @@ sys_block(void) ip->type, ip->nlink, ip->size, ip->addrs[0]); iput(ip); - ip = namei(".././//./../usertests", 0); + ip = namei(".././//./../usertests", NAMEI_LOOKUP, 0); if(ip){ cprintf("namei(usertests): %d %d %d %d %d %d %d %d\n", ip->dev, ip->inum, ip->count, ip->busy, |