Dne 17. 07. 24 v 21:52 Khazhy Kumykov napsal(a):
On Wed, Jul 17, 2024 at 12:45 PM Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote:
Hi
I am wondering why does do_resume need to call dm_suspend at all. Does
anyone here remember why is this code path needed?
In our case, we have a sequence with load_table followed by a resume,
with no suspend first. The resume path suspends if needed, swaps
tables, then resumes. Removing the suspend here would break existing
userspace, I'd imagine. It seems like minimizing the suspended time
would also be a nice benefit.
lvm2 maintainer POV
Automatic 'suspend' for resume is a kernel 'feature' that should not be
normally used from the userspace. Userspace is supposed to call 'suspend'
- handle error cases - eventually drop preloaded table and resume existing
table that should work.
If userspace is using ONLY 'resume' without calling suspend upfront - there
are some unsolvable error cases.
So no - 'minimizing' suspend time is NOT the main reason here. The only
valid reason to use it is basically if you are admin and you need to reload
table for a device you are running from - in this case calling 'dmsetup
suspend' might leave your system in 'blocked' state since your rootfs will be
'frozen/suspend' and you would have no chance to call 'dmsetup resume'.
lvm2 app is locking itself in the RAM in this critical section so it can
proceed with regular sequence: 'write metadata - preload DM - suspend DM -
commit metadata - resume DM' which basicall all userland apps should be using.
Regards
Zdenek