From 2c56547272e43b483d560a61692f1e24926a82fb Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Mon, 4 Aug 2014 13:06:48 -0400 Subject: every iput() and namei() must be inside a transaction --- exec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'exec.c') 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; } -- cgit v1.2.3