https://github.com/torvalds/linux
Revision bb9464e08309f6befe80866f5be51778ca355ee9 authored by yangerkun on 24 September 2021, 09:39:17 UTC, committed by Theodore Ts'o on 01 October 2021, 04:04:01 UTC
The error path in ext4_fill_super forget to flush s_error_work before journal destroy, and it may trigger the follow bug since flush_stashed_error_work can run concurrently with journal destroy without any protection for sbi->s_journal. [32031.740193] EXT4-fs (loop66): get root inode failed [32031.740484] EXT4-fs (loop66): mount failed [32031.759805] ------------[ cut here ]------------ [32031.759807] kernel BUG at fs/jbd2/transaction.c:373! [32031.760075] invalid opcode: 0000 [#1] SMP PTI [32031.760336] CPU: 5 PID: 1029268 Comm: kworker/5:1 Kdump: loaded 4.18.0 [32031.765112] Call Trace: [32031.765375] ? __switch_to_asm+0x35/0x70 [32031.765635] ? __switch_to_asm+0x41/0x70 [32031.765893] ? __switch_to_asm+0x35/0x70 [32031.766148] ? __switch_to_asm+0x41/0x70 [32031.766405] ? _cond_resched+0x15/0x40 [32031.766665] jbd2__journal_start+0xf1/0x1f0 [jbd2] [32031.766934] jbd2_journal_start+0x19/0x20 [jbd2] [32031.767218] flush_stashed_error_work+0x30/0x90 [ext4] [32031.767487] process_one_work+0x195/0x390 [32031.767747] worker_thread+0x30/0x390 [32031.768007] ? process_one_work+0x390/0x390 [32031.768265] kthread+0x10d/0x130 [32031.768521] ? kthread_flush_work_fn+0x10/0x10 [32031.768778] ret_from_fork+0x35/0x40 static int start_this_handle(...) BUG_ON(journal->j_flags & JBD2_UNMOUNT); <---- Trigger this Besides, after we enable fast commit, ext4_fc_replay can add work to s_error_work but return success, so the latter journal destroy in ext4_load_journal can trigger this problem too. Fix this problem with two steps: 1. Call ext4_commit_super directly in ext4_handle_error for the case that called from ext4_fc_replay 2. Since it's hard to pair the init and flush for s_error_work, we'd better add a extras flush_work before journal destroy in ext4_fill_super Besides, this patch will call ext4_commit_super in ext4_handle_error for any nojournal case too. But it seems safe since the reason we call schedule_work was that we should save error info to sb through journal if available. Conversely, for the nojournal case, it seems useless delay commit superblock to s_error_work. Fixes: c92dc856848f ("ext4: defer saving error info from atomic context") Fixes: 2d01ddc86606 ("ext4: save error info to sb through journal if available") Cc: stable@kernel.org Signed-off-by: yangerkun <yangerkun@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Link: https://lore.kernel.org/r/20210924093917.1953239-1-yangerkun@huawei.com
1 parent 75ca6ad
Tip revision: bb9464e08309f6befe80866f5be51778ca355ee9 authored by yangerkun on 24 September 2021, 09:39:17 UTC
ext4: flush s_error_work before journal destroy in ext4_fill_super
ext4: flush s_error_work before journal destroy in ext4_fill_super
Tip revision: bb9464e
File | Mode | Size |
---|---|---|
asymmetric_keys | ||
async_tx | ||
842.c | -rw-r--r-- | 3.7 KB |
Kconfig | -rw-r--r-- | 54.1 KB |
Makefile | -rw-r--r-- | 7.7 KB |
acompress.c | -rw-r--r-- | 4.7 KB |
adiantum.c | -rw-r--r-- | 19.5 KB |
aead.c | -rw-r--r-- | 7.2 KB |
aegis.h | -rw-r--r-- | 2.5 KB |
aegis128-core.c | -rw-r--r-- | 15.6 KB |
aegis128-neon-inner.c | -rw-r--r-- | 8.4 KB |
aegis128-neon.c | -rw-r--r-- | 2.0 KB |
aes_generic.c | -rw-r--r-- | 57.6 KB |
aes_ti.c | -rw-r--r-- | 2.0 KB |
af_alg.c | -rw-r--r-- | 26.8 KB |
ahash.c | -rw-r--r-- | 15.7 KB |
akcipher.c | -rw-r--r-- | 4.0 KB |
algapi.c | -rw-r--r-- | 29.2 KB |
algboss.c | -rw-r--r-- | 5.4 KB |
algif_aead.c | -rw-r--r-- | 15.6 KB |
algif_hash.c | -rw-r--r-- | 9.5 KB |
algif_rng.c | -rw-r--r-- | 8.4 KB |
algif_skcipher.c | -rw-r--r-- | 9.6 KB |
ansi_cprng.c | -rw-r--r-- | 10.8 KB |
anubis.c | -rw-r--r-- | 27.8 KB |
api.c | -rw-r--r-- | 13.8 KB |
arc4.c | -rw-r--r-- | 2.1 KB |
authenc.c | -rw-r--r-- | 13.1 KB |
authencesn.c | -rw-r--r-- | 14.2 KB |
blake2b_generic.c | -rw-r--r-- | 5.9 KB |
blake2s_generic.c | -rw-r--r-- | 2.3 KB |
blowfish_common.c | -rw-r--r-- | 15.5 KB |
blowfish_generic.c | -rw-r--r-- | 3.1 KB |
camellia_generic.c | -rw-r--r-- | 34.0 KB |
cast5_generic.c | -rw-r--r-- | 20.4 KB |
cast6_generic.c | -rw-r--r-- | 9.1 KB |
cast_common.c | -rw-r--r-- | 12.9 KB |
cbc.c | -rw-r--r-- | 5.2 KB |
ccm.c | -rw-r--r-- | 23.5 KB |
cfb.c | -rw-r--r-- | 6.2 KB |
chacha20poly1305.c | -rw-r--r-- | 17.7 KB |
chacha_generic.c | -rw-r--r-- | 3.9 KB |
cipher.c | -rw-r--r-- | 2.6 KB |
cmac.c | -rw-r--r-- | 7.6 KB |
compress.c | -rw-r--r-- | 921 bytes |
crc32_generic.c | -rw-r--r-- | 2.8 KB |
crc32c_generic.c | -rw-r--r-- | 4.1 KB |
crct10dif_common.c | -rw-r--r-- | 3.6 KB |
crct10dif_generic.c | -rw-r--r-- | 3.1 KB |
cryptd.c | -rw-r--r-- | 28.6 KB |
crypto_engine.c | -rw-r--r-- | 15.3 KB |
crypto_null.c | -rw-r--r-- | 5.3 KB |
crypto_user_base.c | -rw-r--r-- | 12.0 KB |
crypto_user_stat.c | -rw-r--r-- | 9.6 KB |
ctr.c | -rw-r--r-- | 9.6 KB |
cts.c | -rw-r--r-- | 11.5 KB |
curve25519-generic.c | -rw-r--r-- | 2.2 KB |
deflate.c | -rw-r--r-- | 7.7 KB |
des_generic.c | -rw-r--r-- | 3.3 KB |
dh.c | -rw-r--r-- | 5.4 KB |
dh_helper.c | -rw-r--r-- | 3.4 KB |
drbg.c | -rw-r--r-- | 59.8 KB |
ecb.c | -rw-r--r-- | 2.4 KB |
ecc.c | -rw-r--r-- | 42.0 KB |
ecc.h | -rw-r--r-- | 7.8 KB |
ecc_curve_defs.h | -rw-r--r-- | 3.7 KB |
ecdh.c | -rw-r--r-- | 5.7 KB |
ecdh_helper.c | -rw-r--r-- | 2.0 KB |
ecdsa.c | -rw-r--r-- | 9.2 KB |
ecdsasignature.asn1 | -rw-r--r-- | 111 bytes |
echainiv.c | -rw-r--r-- | 4.1 KB |
ecrdsa.c | -rw-r--r-- | 8.4 KB |
ecrdsa_defs.h | -rw-r--r-- | 7.2 KB |
ecrdsa_params.asn1 | -rw-r--r-- | 142 bytes |
ecrdsa_pub_key.asn1 | -rw-r--r-- | 57 bytes |
essiv.c | -rw-r--r-- | 17.9 KB |
fcrypt.c | -rw-r--r-- | 18.0 KB |
fips.c | -rw-r--r-- | 1.7 KB |
gcm.c | -rw-r--r-- | 30.0 KB |
geniv.c | -rw-r--r-- | 3.8 KB |
gf128mul.c | -rw-r--r-- | 12.5 KB |
ghash-generic.c | -rw-r--r-- | 4.8 KB |
hash_info.c | -rw-r--r-- | 1.9 KB |
hmac.c | -rw-r--r-- | 6.4 KB |
internal.h | -rw-r--r-- | 4.0 KB |
jitterentropy-kcapi.c | -rw-r--r-- | 6.2 KB |
jitterentropy.c | -rw-r--r-- | 25.2 KB |
jitterentropy.h | -rw-r--r-- | 643 bytes |
keywrap.c | -rw-r--r-- | 9.5 KB |
khazad.c | -rw-r--r-- | 51.8 KB |
kpp.c | -rw-r--r-- | 2.7 KB |
lrw.c | -rw-r--r-- | 10.6 KB |
lz4.c | -rw-r--r-- | 3.3 KB |
lz4hc.c | -rw-r--r-- | 3.4 KB |
lzo-rle.c | -rw-r--r-- | 3.4 KB |
lzo.c | -rw-r--r-- | 3.3 KB |
md4.c | -rw-r--r-- | 5.9 KB |
md5.c | -rw-r--r-- | 7.4 KB |
memneq.c | -rw-r--r-- | 6.1 KB |
michael_mic.c | -rw-r--r-- | 3.4 KB |
nhpoly1305.c | -rw-r--r-- | 7.8 KB |
ofb.c | -rw-r--r-- | 2.5 KB |
pcbc.c | -rw-r--r-- | 4.7 KB |
pcrypt.c | -rw-r--r-- | 9.2 KB |
poly1305_generic.c | -rw-r--r-- | 3.7 KB |
proc.c | -rw-r--r-- | 2.5 KB |
ripemd.h | -rw-r--r-- | 655 bytes |
rmd160.c | -rw-r--r-- | 12.4 KB |
rng.c | -rw-r--r-- | 4.7 KB |
rsa-pkcs1pad.c | -rw-r--r-- | 17.3 KB |
rsa.c | -rw-r--r-- | 5.3 KB |
rsa_helper.c | -rw-r--r-- | 4.0 KB |
rsaprivkey.asn1 | -rw-r--r-- | 316 bytes |
rsapubkey.asn1 | -rw-r--r-- | 82 bytes |
scatterwalk.c | -rw-r--r-- | 2.0 KB |
scompress.c | -rw-r--r-- | 6.8 KB |
seed.c | -rw-r--r-- | 17.2 KB |
seqiv.c | -rw-r--r-- | 4.5 KB |
serpent_generic.c | -rw-r--r-- | 19.6 KB |
sha1_generic.c | -rw-r--r-- | 2.3 KB |
sha256_generic.c | -rw-r--r-- | 3.3 KB |
sha3_generic.c | -rw-r--r-- | 8.0 KB |
sha512_generic.c | -rw-r--r-- | 7.8 KB |
shash.c | -rw-r--r-- | 15.5 KB |
simd.c | -rw-r--r-- | 13.5 KB |
skcipher.c | -rw-r--r-- | 24.7 KB |
sm2.c | -rw-r--r-- | 9.8 KB |
sm2signature.asn1 | -rw-r--r-- | 113 bytes |
sm3_generic.c | -rw-r--r-- | 4.1 KB |
sm4_generic.c | -rw-r--r-- | 6.2 KB |
streebog_generic.c | -rw-r--r-- | 57.6 KB |
tcrypt.c | -rw-r--r-- | 77.4 KB |
tcrypt.h | -rw-r--r-- | 3.0 KB |
tea.c | -rw-r--r-- | 6.5 KB |
testmgr.c | -rw-r--r-- | 144.8 KB |
testmgr.h | -rw-r--r-- | 1.2 MB |
twofish_common.c | -rw-r--r-- | 37.1 KB |
twofish_generic.c | -rw-r--r-- | 5.5 KB |
vmac.c | -rw-r--r-- | 18.9 KB |
wp512.c | -rw-r--r-- | 59.7 KB |
xcbc.c | -rw-r--r-- | 6.7 KB |
xor.c | -rw-r--r-- | 3.8 KB |
xts.c | -rw-r--r-- | 11.8 KB |
xxhash_generic.c | -rw-r--r-- | 2.4 KB |
zstd.c | -rw-r--r-- | 5.0 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...