ext4: recheck buffer uptodate bit under buffer lock

Commit 8e33fadf945a ("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: 8e33fadf945a ("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

authored by Zhang Yi and committed by Theodore Ts'o f2c77973 42cb4474

Changed files
+6
fs
ext4
+6
fs/ext4/inode.c
··· 4277 4277 goto has_buffer; 4278 4278 4279 4279 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 + 4280 4286 /* 4281 4287 * If we have all information of the inode in memory and this 4282 4288 * is the only valid inode in the block, we need not read the