summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2014-08-04 13:06:48 -0400
committerRobert Morris <[email protected]>2014-08-04 13:06:48 -0400
commit2c56547272e43b483d560a61692f1e24926a82fb (patch)
tree514014c69ff9cfe2a67159b9a3f514a3a619aea6 /exec.c
parent020c8e2384877ffc13579f633ac3c723f80baf8c (diff)
downloadxv6-labs-2c56547272e43b483d560a61692f1e24926a82fb.tar.gz
xv6-labs-2c56547272e43b483d560a61692f1e24926a82fb.tar.bz2
xv6-labs-2c56547272e43b483d560a61692f1e24926a82fb.zip
every iput() and namei() must be inside a transaction
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/exec.c b/exec.c
index a85e203..7eaef5b 100644
--- a/exec.c
+++ b/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;
}