kernel_samsung_a53x/drivers/md
Mikulas Patocka 145f6f5efa dm: call the resume method on internal suspend
[ Upstream commit 65e8fbde64520001abf1c8d0e573561b4746ef38 ]

There is this reported crash when experimenting with the lvm2 testsuite.
The list corruption is caused by the fact that the postsuspend and resume
methods were not paired correctly; there were two consecutive calls to the
origin_postsuspend function. The second call attempts to remove the
"hash_list" entry from a list, while it was already removed by the first
call.

Fix __dm_internal_resume so that it calls the preresume and resume
methods of the table's targets.

If a preresume method of some target fails, we are in a tricky situation.
We can't return an error because dm_internal_resume isn't supposed to
return errors. We can't return success, because then the "resume" and
"postsuspend" methods would not be paired correctly. So, we set the
DMF_SUSPENDED flag and we fake normal suspend - it may confuse userspace
tools, but it won't cause a kernel crash.

------------[ cut here ]------------
kernel BUG at lib/list_debug.c:56!
invalid opcode: 0000 [#1] PREEMPT SMP
CPU: 1 PID: 8343 Comm: dmsetup Not tainted 6.8.0-rc6 #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
RIP: 0010:__list_del_entry_valid_or_report+0x77/0xc0
<snip>
RSP: 0018:ffff8881b831bcc0 EFLAGS: 00010282
RAX: 000000000000004e RBX: ffff888143b6eb80 RCX: 0000000000000000
RDX: 0000000000000001 RSI: ffffffff819053d0 RDI: 00000000ffffffff
RBP: ffff8881b83a3400 R08: 00000000fffeffff R09: 0000000000000058
R10: 0000000000000000 R11: ffffffff81a24080 R12: 0000000000000001
R13: ffff88814538e000 R14: ffff888143bc6dc0 R15: ffffffffa02e4bb0
FS:  00000000f7c0f780(0000) GS:ffff8893f0a40000(0000) knlGS:0000000000000000
CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
CR2: 0000000057fb5000 CR3: 0000000143474000 CR4: 00000000000006b0
Call Trace:
 <TASK>
 ? die+0x2d/0x80
 ? do_trap+0xeb/0xf0
 ? __list_del_entry_valid_or_report+0x77/0xc0
 ? do_error_trap+0x60/0x80
 ? __list_del_entry_valid_or_report+0x77/0xc0
 ? exc_invalid_op+0x49/0x60
 ? __list_del_entry_valid_or_report+0x77/0xc0
 ? asm_exc_invalid_op+0x16/0x20
 ? table_deps+0x1b0/0x1b0 [dm_mod]
 ? __list_del_entry_valid_or_report+0x77/0xc0
 origin_postsuspend+0x1a/0x50 [dm_snapshot]
 dm_table_postsuspend_targets+0x34/0x50 [dm_mod]
 dm_suspend+0xd8/0xf0 [dm_mod]
 dev_suspend+0x1f2/0x2f0 [dm_mod]
 ? table_deps+0x1b0/0x1b0 [dm_mod]
 ctl_ioctl+0x300/0x5f0 [dm_mod]
 dm_compat_ctl_ioctl+0x7/0x10 [dm_mod]
 __x64_compat_sys_ioctl+0x104/0x170
 do_syscall_64+0x184/0x1b0
 entry_SYSCALL_64_after_hwframe+0x46/0x4e
RIP: 0033:0xf7e6aead
<snip>
---[ end trace 0000000000000000 ]---

Fixes: ffcc39364160 ("dm: enhance internal suspend and resume interface")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 08:44:50 +01:00
..
bcache bcache: avoid NULL checking to c->root in run_cache_set() 2024-11-18 12:11:56 +01:00
persistent-data Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
alta_bigdata.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-bio-prison-v1.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-bio-prison-v1.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-bio-prison-v2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-bio-prison-v2.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-bio-record.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-bow.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-bufio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-builtin.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-background-tracker.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-background-tracker.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-block-types.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-metadata.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-metadata.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-policy-internal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-policy-smq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-policy.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-policy.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-cache-target.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-clone-metadata.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-clone-metadata.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-clone-target.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-core.h dm: limit the number of targets and parameter size area 2024-11-18 12:13:40 +01:00
dm-crypt.c dm-verity, dm-crypt: align "struct bvec_iter" correctly 2024-11-19 08:44:36 +01:00
dm-default-key.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-delay.c dm-delay: fix a race between delay_presuspend and delay_bio 2024-11-18 12:10:57 +01:00
dm-dust.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-ebs-target.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-era-target.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-exception-store.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-exception-store.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-flakey.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-historical-service-time.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-init.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-integrity.c dm-integrity: don't modify bio's immutable bio_vec in integrity_metadata() 2024-11-18 12:12:03 +01:00
dm-io.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-ioctl.c dm: limit the number of targets and parameter size area 2024-11-18 12:13:40 +01:00
dm-kcopyd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-linear.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-log-userspace-base.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-log-userspace-transfer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-log-userspace-transfer.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-log-writes.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-log.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-mpath.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-mpath.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-path-selector.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-path-selector.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-queue-length.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-raid.c dm raid: fix false positive for requeue needed during reshape 2024-11-19 08:44:50 +01:00
dm-raid1.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-region-hash.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-round-robin.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-rq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-rq.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-service-time.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-snap-persistent.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-snap-transient.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-snap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-stats.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-stats.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-stripe.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-switch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-sysfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-table.c dm: limit the number of targets and parameter size area 2024-11-18 12:13:40 +01:00
dm-target.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-thin-metadata.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-thin-metadata.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-thin.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-uevent.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-uevent.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-unstripe.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-user.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-verity-debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-verity-debug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-verity-fec.c dm-verity: align struct dm_verity_fec_io properly 2024-11-18 12:11:08 +01:00
dm-verity-fec.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-verity-target.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-verity-verify-sig.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-verity-verify-sig.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-verity.h dm-verity, dm-crypt: align "struct bvec_iter" correctly 2024-11-19 08:44:36 +01:00
dm-writecache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-zero.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-zoned-metadata.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-zoned-reclaim.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-zoned-target.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm-zoned.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dm.c dm: call the resume method on internal suspend 2024-11-19 08:44:50 +01:00
dm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-autodetect.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-bitmap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-bitmap.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-cluster.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-cluster.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-faulty.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-linear.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-linear.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-multipath.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md-multipath.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
md.c md: Don't clear MD_CLOSING when the raid is about to stop 2024-11-19 08:44:37 +01:00
md.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid0.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid0.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid1-10.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid1.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid1.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid5-cache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid5-log.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid5-ppl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid5.c Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d" 2024-11-18 12:13:33 +01:00
raid5.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid10.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid10.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00