Skip to content

Commit 5afbafc

Browse files
committed
Fix sb_read cache not be freed
1 parent 403e1b8 commit 5afbafc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

dir.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ static int simplefs_iterate(struct file *dir, struct dir_context *ctx)
6060
goto release_bh;
6161
}
6262
dblock = (struct simplefs_dir_block *) bh2->b_data;
63-
if (dblock->files[0].inode == 0)
63+
if (dblock->files[0].inode == 0) {
64+
brelse(bh2);
65+
bh2 = NULL;
6466
break;
65-
67+
}
6668
/* Iterate every file in one block */
6769
for (; fi < SIMPLEFS_FILES_PER_BLOCK; fi++) {
6870
f = &dblock->files[fi];

inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,8 @@ static int simplefs_rename(struct inode *old_dir,
749749
break;
750750
}
751751
}
752-
if (new_pos < 0)
753-
brelse(bh2);
752+
753+
brelse(bh2);
754754
}
755755
}
756756

0 commit comments

Comments
 (0)