ext4: protect superblock modifications with a buffer lock
authorJan Kara <jack@suse.cz>
Wed, 16 Dec 2020 10:18:39 +0000 (11:18 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 22 Dec 2020 18:08:46 +0000 (13:08 -0500)
commit05c2c00f3769abb9e323fcaca70d2de0b48af7ba
tree503246bd2db7415e5552acbca2126f4a7e2a8c07
parent4392fbc4bab57db3760f0fb61258cb7089b37665
ext4: protect superblock modifications with a buffer lock

Protect all superblock modifications (including checksum computation)
with a superblock buffer lock. That way we are sure computed checksum
matches current superblock contents (a mismatch could cause checksum
failures in nojournal mode or if an unjournalled superblock update races
with a journalled one). Also we avoid modifying superblock contents
while it is being written out (which can cause DIF/DIX failures if we
are running in nojournal mode).

Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20201216101844.22917-4-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ext4_jbd2.c
fs/ext4/file.c
fs/ext4/inode.c
fs/ext4/namei.c
fs/ext4/resize.c
fs/ext4/super.c
fs/ext4/xattr.c