Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfs:add nxsched_foreach to sched_lock avoid crash #10295

Merged
merged 1 commit into from
Aug 29, 2023

Conversation

anjiahao1
Copy link
Contributor

@anjiahao1 anjiahao1 commented Aug 18, 2023

Summary

vfs:add sched_lock to sync avoid crash
If scheduling occurs in file_fsync,
fl_lock may be released, and an error may
occur when calling nxmutex_unlock

Impact

call nxsched_foreach

Testing

sim:nsh

If scheduling occurs in file_fsync,
fl_lock may be released, and an error may
occur when calling nxmutex_unlock

Signed-off-by: anjiahao <[email protected]>
@pkarashchenko
Copy link
Contributor

I'm missing detailed description of the issue that this change is intended to fix. This is needed to justify why locking scheduler is needed inside the nxsched_foreach interface compared to case when nxsched_foreach caller should lock scheduler.

@patacongo
Copy link
Contributor

patacongo commented Aug 18, 2023

This is a special case of the more general Issue: #1138. I don't think we would want such a specific solution if a more general solution is possible.

But there are also may be places where we want to be suspended while we are in a critical section. Perhaps some logic depends on this current behavior. Perhaps this should still be in enter/leave_critical_section with an parameter to permit suspension or not.

@anjiahao1
Copy link
Contributor Author

If scheduling occurs in the handle, then some system resources are likely to be corrupted

@xiaoxiang781216
Copy link
Contributor

I'm missing detailed description of the issue that this change is intended to fix. This is needed to justify why locking scheduler is needed inside the nxsched_foreach interface compared to case when nxsched_foreach caller should lock scheduler.

@pkarashchenko as the discussion in #1138, the thread holds the critical section will be scheduled out if it wakes up other high priority thread, sched lock could prevent this happen.

@xiaoxiang781216
Copy link
Contributor

@pkarashchenko do you have more queston about this patch?

@pkarashchenko
Copy link
Contributor

I do not see @patacongo 's comment is answered. Currently I'm fine with this if it does not bring any regression.

@xiaoxiang781216 xiaoxiang781216 merged commit 48c153d into apache:master Aug 29, 2023
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants