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

第9章之后easy-fs仍然使用自旋锁而非关中断锁 #104

Open
wyfcyx opened this issue Feb 9, 2023 · 1 comment
Open

第9章之后easy-fs仍然使用自旋锁而非关中断锁 #104

wyfcyx opened this issue Feb 9, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@wyfcyx
Copy link
Collaborator

wyfcyx commented Feb 9, 2023

问题:第9章开始,内核在执行系统调用的时候打开中断,因此内核自身的同步设施需要从单核独占访问UPSafeCell换成关中断版本的UPIntrFreeCell。然而,文件系统模块easy-fs仍然使用自旋锁spin::Mutex,就有可能在持有锁进行文件系统操作的时候,进入中断并再次尝试获取文件系统的锁而造成死锁。
触发方法:比如这种并发进行多个fork+exec的情况。
解决方案:将UPIntrFreeCell分离到一个独立的crate中,使得内核本体和easy-fs均依赖它。

@wyfcyx wyfcyx added the bug Something isn't working label Feb 9, 2023
@wyfcyx wyfcyx self-assigned this Feb 9, 2023
@wyfcyx
Copy link
Collaborator Author

wyfcyx commented Feb 16, 2023

一些相关思考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant