Skip to content

Commit f2c7797

Browse files
zhangyi089tytso
authored andcommitted
ext4: recheck buffer uptodate bit under buffer lock
Commit 8e33fad ("ext4: remove an unnecessary if statement in __ext4_get_inode_loc()") forget to recheck buffer's uptodate bit again under buffer lock, which may overwrite the buffer if someone else have already brought it uptodate and changed it. Fixes: 8e33fad ("ext4: remove an unnecessary if statement in __ext4_get_inode_loc()") Cc: [email protected] Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 42cb447 commit f2c7797

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/ext4/inode.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4277,6 +4277,12 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
42774277
goto has_buffer;
42784278

42794279
lock_buffer(bh);
4280+
if (ext4_buffer_uptodate(bh)) {
4281+
/* Someone brought it uptodate while we waited */
4282+
unlock_buffer(bh);
4283+
goto has_buffer;
4284+
}
4285+
42804286
/*
42814287
* If we have all information of the inode in memory and this
42824288
* is the only valid inode in the block, we need not read the

0 commit comments

Comments
 (0)