• Theodore Ts'o's avatar
    jbd2: fix race when writing superblock · 34cbc429
    Theodore Ts'o authored
    [ Upstream commit 538bcaa6 ]
    The jbd2 superblock is lockless now, so there is probably a race
    condition between writing it so disk and modifing contents of it, which
    may lead to checksum error. The following race is the one case that we
    have captured.
    jbd2                                fsstress
       jbd2_superblock_csum_set         jbd2_journal_revoke
                                         modify superblock
       submit_bh(checksum incorrect)
    Fix this by locking the buffer head before modifing it.  We always
    write the jbd2 superblock after we modify it, so this just means
    calling the lock_buffer() a little earlier.
    This checksum corruption problem can be reproduced by xfstests
    Reported-by: 's avatarzhangyi (F) <yi.zhang@huawei.com>
    Suggested-by: 's avatarJan Kara <jack@suse.cz>
    Signed-off-by: Theodore Ts'o's avatarTheodore Ts'o <tytso@mit.edu>
    Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
Last commit
Last update
Kconfig Loading commit data...
Makefile Loading commit data...
checkpoint.c Loading commit data...
commit.c Loading commit data...
journal.c Loading commit data...
recovery.c Loading commit data...
revoke.c Loading commit data...
transaction.c Loading commit data...