Skip to content

Commit

Permalink
Fix sb_read cache not be freed
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyWFHuang committed Jun 27, 2024
1 parent e76e0cc commit f15ea0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ static int simplefs_iterate(struct file *dir, struct dir_context *ctx)
goto release_bh;
}
dblock = (struct simplefs_dir_block *) bh2->b_data;
if (dblock->files[0].inode == 0)
if (dblock->files[0].inode == 0) {
brelse(bh2);
bh2 = NULL;
break;

}
/* Iterate every file in one block */
for (; fi < SIMPLEFS_FILES_PER_BLOCK; fi++) {
f = &dblock->files[fi];
Expand Down
4 changes: 2 additions & 2 deletions inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ static int simplefs_rename(struct inode *old_dir,
break;
}
}
if (new_pos < 0)
brelse(bh2);

brelse(bh2);
}
}

Expand Down

0 comments on commit f15ea0c

Please sign in to comment.