mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
ext4: recheck buffer uptodate bit under buffer lock
Commit8e33fadf94
("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:8e33fadf94
("ext4: remove an unnecessary if statement in __ext4_get_inode_loc()") Cc: stable@kernel.org Signed-off-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Link: https://lore.kernel.org/r/20210910080316.70421-1-yi.zhang@huawei.com
This commit is contained in:
parent
42cb447410
commit
f2c7797350
@ -4277,6 +4277,12 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
|
||||
goto has_buffer;
|
||||
|
||||
lock_buffer(bh);
|
||||
if (ext4_buffer_uptodate(bh)) {
|
||||
/* Someone brought it uptodate while we waited */
|
||||
unlock_buffer(bh);
|
||||
goto has_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have all information of the inode in memory and this
|
||||
* is the only valid inode in the block, we need not read the
|
||||
|
Loading…
Reference in New Issue
Block a user