Ye Bin
39fbef4b0f
PM: hibernate: Get block device exclusively in swsusp_check()
...
The following kernel crash can be triggered:
[ 89.266592] ------------[ cut here ]------------
[ 89.267427] kernel BUG at fs/buffer.c:3020!
[ 89.268264] invalid opcode: 0000 [#1 ] SMP KASAN PTI
[ 89.269116] CPU: 7 PID: 1750 Comm: kmmpd-loop0 Not tainted 5.10.0-862.14.0.6.x86_64-08610-gc932cda3cef4-dirty #20
[ 89.273169] RIP: 0010:submit_bh_wbc.isra.0+0x538/0x6d0
[ 89.277157] RSP: 0018:ffff888105ddfd08 EFLAGS: 00010246
[ 89.278093] RAX: 0000000000000005 RBX: ffff888124231498 RCX: ffffffffb2772612
[ 89.279332] RDX: 1ffff11024846293 RSI: 0000000000000008 RDI: ffff888124231498
[ 89.280591] RBP: ffff8881248cc000 R08: 0000000000000001 R09: ffffed1024846294
[ 89.281851] R10: ffff88812423149f R11: ffffed1024846293 R12: 0000000000003800
[ 89.283095] R13: 0000000000000001 R14: 0000000000000000 R15: ffff8881161f7000
[ 89.284342] FS: 0000000000000000(0000) GS:ffff88839b5c0000(0000) knlGS:0000000000000000
[ 89.285711] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 89.286701] CR2: 00007f166ebc01a0 CR3: 0000000435c0e000 CR4: 00000000000006e0
[ 89.287919] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 89.289138] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 89.290368] Call Trace:
[ 89.290842] write_mmp_block+0x2ca/0x510
[ 89.292218] kmmpd+0x433/0x9a0
[ 89.294902] kthread+0x2dd/0x3e0
[ 89.296268] ret_from_fork+0x22/0x30
[ 89.296906] Modules linked in:
by running the following commands:
1. mkfs.ext4 -O mmp /dev/sda -b 1024
2. mount /dev/sda /home/test
3. echo "/dev/sda" > /sys/power/resume
That happens because swsusp_check() calls set_blocksize() on the
target partition which confuses the file system:
Thread1 Thread2
mount /dev/sda /home/test
get s_mmp_bh --> has mapped flag
start kmmpd thread
echo "/dev/sda" > /sys/power/resume
resume_store
software_resume
swsusp_check
set_blocksize
truncate_inode_pages_range
truncate_cleanup_page
block_invalidatepage
discard_buffer --> clean mapped flag
write_mmp_block
submit_bh
submit_bh_wbc
BUG_ON(!buffer_mapped(bh))
To address this issue, modify swsusp_check() to open the target block
device with exclusive access.
Signed-off-by: Ye Bin <yebin10@huawei.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2021-10-21 19:38:32 +02:00
..
2021-08-30 16:42:47 -07:00
2021-09-03 10:08:28 -07:00
2021-05-07 00:26:34 -07:00
2021-09-07 12:08:04 -07:00
2021-09-03 10:34:44 -07:00
2021-05-31 10:14:49 +02:00
2021-09-04 11:35:47 -07:00
2021-06-22 11:07:18 -07:00
2021-09-03 11:22:50 -07:00
2021-09-02 13:00:15 -07:00
2021-08-19 12:00:24 +02:00
2021-09-09 10:31:22 +02:00
2021-10-21 19:38:32 +02:00
2021-08-30 16:36:10 +02:00
2021-08-30 14:26:36 -07:00
2021-09-12 11:37:41 -07:00
2021-09-03 10:08:28 -07:00
2021-09-11 10:16:30 -07:00
2021-05-02 00:43:35 +09:00
2021-09-08 11:50:26 -07:00
2021-05-07 00:26:33 -07:00
2021-02-23 10:25:27 -05:00
2021-08-24 18:52:36 -04:00
2020-12-03 14:58:35 +01:00
2021-03-22 15:23:32 -04:00
2021-07-19 22:38:24 -04:00
2021-03-22 15:23:32 -04:00
2021-06-10 20:59:05 -04:00
2021-01-24 14:27:16 +01:00
2021-08-11 13:11:12 -07:00
2021-09-08 15:32:35 -07:00
2021-08-16 18:55:32 +02:00
2021-08-10 18:31:32 +02:00
2021-07-08 11:48:22 -07:00
2021-08-23 16:13:04 -05:00
2021-05-12 11:43:25 +02:00
2021-08-23 13:10:37 -06:00
2020-12-15 22:46:19 -08:00
2021-09-08 18:45:53 -07:00
2021-06-18 11:43:08 +02:00
2021-09-03 23:00:22 +02:00
2021-05-27 04:01:50 +09:00
2021-02-26 09:41:03 -08:00
2021-07-02 12:08:10 -07:00
2021-06-10 10:00:08 +02:00
2021-07-05 10:46:20 +02:00
2021-07-08 11:48:22 -07:00
2020-12-15 19:36:48 -08:00
2021-08-17 17:50:51 +02:00
2021-06-28 22:43:05 +02:00
2021-08-30 16:36:10 +02:00
2021-05-07 00:26:32 -07:00
2021-02-22 12:33:26 +00:00
2021-09-08 15:32:34 -07:00
2021-05-07 00:26:33 -07:00
2021-07-11 11:06:09 -07:00
2021-06-29 17:29:11 -07:00
2021-05-02 00:43:35 +09:00
2021-01-19 10:24:45 +01:00
2021-01-19 10:24:45 +01:00
2021-07-19 11:57:48 +02:00
2021-08-16 18:55:32 +02:00
2021-09-03 09:58:12 -07:00
2021-08-27 16:30:18 +08:00
2021-08-30 16:36:10 +02:00
2021-08-16 14:42:22 +02:00
2021-09-03 09:58:12 -07:00
2021-08-10 12:53:07 +02:00
2021-09-08 11:50:26 -07:00
2021-06-18 11:43:09 +02:00
2021-06-21 13:08:36 +01:00
2020-12-15 22:46:18 -08:00
2020-11-25 18:52:35 +01:00
2021-05-14 19:41:32 -07:00
2021-04-14 18:04:09 +02:00
2021-07-27 11:39:30 -07:00
2020-12-01 10:30:28 +00:00
2021-09-01 14:52:05 -07:00
2021-09-03 10:08:28 -07:00
2021-08-11 14:47:16 +02:00
2021-08-10 14:57:42 +02:00
2021-08-10 22:50:07 +02:00
2021-07-05 10:46:33 +02:00
2021-03-23 16:01:58 +01:00
2021-09-08 15:32:35 -07:00
2021-09-08 12:55:35 -07:00
2021-06-23 16:41:24 -06:00
2021-09-03 10:08:28 -07:00
2021-04-30 11:20:42 -07:00
2021-08-10 10:48:07 -07:00
2021-08-16 11:39:51 -04:00
2021-08-09 15:45:02 -05:00
2021-05-07 00:26:34 -07:00
2021-05-09 13:07:03 -07:00
2021-09-03 09:58:12 -07:00
2021-09-08 11:50:27 -07:00
2021-07-03 11:41:14 -07:00
2021-01-26 11:16:34 +00:00
2021-06-29 10:53:46 -07:00
2021-08-17 07:49:10 -10:00
2021-08-17 07:49:10 -10:00