every iput() and namei() must be inside a transaction
This commit is contained in:
parent
020c8e2384
commit
2c56547272
6 changed files with 145 additions and 17 deletions
10
exec.c
10
exec.c
|
|
@ -18,8 +18,11 @@ exec(char *path, char **argv)
|
|||
struct proghdr ph;
|
||||
pde_t *pgdir, *oldpgdir;
|
||||
|
||||
if((ip = namei(path)) == 0)
|
||||
begin_trans();
|
||||
if((ip = namei(path)) == 0){
|
||||
commit_trans();
|
||||
return -1;
|
||||
}
|
||||
ilock(ip);
|
||||
pgdir = 0;
|
||||
|
||||
|
|
@ -47,6 +50,7 @@ exec(char *path, char **argv)
|
|||
goto bad;
|
||||
}
|
||||
iunlockput(ip);
|
||||
commit_trans();
|
||||
ip = 0;
|
||||
|
||||
// Allocate two pages at the next page boundary.
|
||||
|
|
@ -95,7 +99,9 @@ exec(char *path, char **argv)
|
|||
bad:
|
||||
if(pgdir)
|
||||
freevm(pgdir);
|
||||
if(ip)
|
||||
if(ip){
|
||||
iunlockput(ip);
|
||||
commit_trans();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue